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_VENDOR(0x1043, "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),
3645 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3646 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3647 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3652 * ALC880 codec presets
3654 static struct alc_config_preset alc880_presets[] = {
3656 .mixers = { alc880_three_stack_mixer },
3657 .init_verbs = { alc880_volume_init_verbs,
3658 alc880_pin_3stack_init_verbs },
3659 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3660 .dac_nids = alc880_dac_nids,
3661 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3662 .channel_mode = alc880_threestack_modes,
3664 .input_mux = &alc880_capture_source,
3666 [ALC880_3ST_DIG] = {
3667 .mixers = { alc880_three_stack_mixer },
3668 .init_verbs = { alc880_volume_init_verbs,
3669 alc880_pin_3stack_init_verbs },
3670 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3671 .dac_nids = alc880_dac_nids,
3672 .dig_out_nid = ALC880_DIGOUT_NID,
3673 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3674 .channel_mode = alc880_threestack_modes,
3676 .input_mux = &alc880_capture_source,
3678 [ALC880_TCL_S700] = {
3679 .mixers = { alc880_tcl_s700_mixer },
3680 .init_verbs = { alc880_volume_init_verbs,
3681 alc880_pin_tcl_S700_init_verbs,
3682 alc880_gpio2_init_verbs },
3683 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3684 .dac_nids = alc880_dac_nids,
3685 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3686 .num_adc_nids = 1, /* single ADC */
3688 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3689 .channel_mode = alc880_2_jack_modes,
3690 .input_mux = &alc880_capture_source,
3693 .mixers = { alc880_three_stack_mixer,
3694 alc880_five_stack_mixer},
3695 .init_verbs = { alc880_volume_init_verbs,
3696 alc880_pin_5stack_init_verbs },
3697 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3698 .dac_nids = alc880_dac_nids,
3699 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3700 .channel_mode = alc880_fivestack_modes,
3701 .input_mux = &alc880_capture_source,
3703 [ALC880_5ST_DIG] = {
3704 .mixers = { alc880_three_stack_mixer,
3705 alc880_five_stack_mixer },
3706 .init_verbs = { alc880_volume_init_verbs,
3707 alc880_pin_5stack_init_verbs },
3708 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3709 .dac_nids = alc880_dac_nids,
3710 .dig_out_nid = ALC880_DIGOUT_NID,
3711 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3712 .channel_mode = alc880_fivestack_modes,
3713 .input_mux = &alc880_capture_source,
3716 .mixers = { alc880_six_stack_mixer },
3717 .init_verbs = { alc880_volume_init_verbs,
3718 alc880_pin_6stack_init_verbs },
3719 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3720 .dac_nids = alc880_6st_dac_nids,
3721 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3722 .channel_mode = alc880_sixstack_modes,
3723 .input_mux = &alc880_6stack_capture_source,
3725 [ALC880_6ST_DIG] = {
3726 .mixers = { alc880_six_stack_mixer },
3727 .init_verbs = { alc880_volume_init_verbs,
3728 alc880_pin_6stack_init_verbs },
3729 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3730 .dac_nids = alc880_6st_dac_nids,
3731 .dig_out_nid = ALC880_DIGOUT_NID,
3732 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3733 .channel_mode = alc880_sixstack_modes,
3734 .input_mux = &alc880_6stack_capture_source,
3737 .mixers = { alc880_w810_base_mixer },
3738 .init_verbs = { alc880_volume_init_verbs,
3739 alc880_pin_w810_init_verbs,
3740 alc880_gpio2_init_verbs },
3741 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3742 .dac_nids = alc880_w810_dac_nids,
3743 .dig_out_nid = ALC880_DIGOUT_NID,
3744 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3745 .channel_mode = alc880_w810_modes,
3746 .input_mux = &alc880_capture_source,
3749 .mixers = { alc880_z71v_mixer },
3750 .init_verbs = { alc880_volume_init_verbs,
3751 alc880_pin_z71v_init_verbs },
3752 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3753 .dac_nids = alc880_z71v_dac_nids,
3754 .dig_out_nid = ALC880_DIGOUT_NID,
3756 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3757 .channel_mode = alc880_2_jack_modes,
3758 .input_mux = &alc880_capture_source,
3761 .mixers = { alc880_f1734_mixer },
3762 .init_verbs = { alc880_volume_init_verbs,
3763 alc880_pin_f1734_init_verbs },
3764 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3765 .dac_nids = alc880_f1734_dac_nids,
3767 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3768 .channel_mode = alc880_2_jack_modes,
3769 .input_mux = &alc880_f1734_capture_source,
3770 .unsol_event = alc880_uniwill_p53_unsol_event,
3771 .init_hook = alc880_uniwill_p53_hp_automute,
3774 .mixers = { alc880_asus_mixer },
3775 .init_verbs = { alc880_volume_init_verbs,
3776 alc880_pin_asus_init_verbs,
3777 alc880_gpio1_init_verbs },
3778 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3779 .dac_nids = alc880_asus_dac_nids,
3780 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3781 .channel_mode = alc880_asus_modes,
3783 .input_mux = &alc880_capture_source,
3785 [ALC880_ASUS_DIG] = {
3786 .mixers = { alc880_asus_mixer },
3787 .init_verbs = { alc880_volume_init_verbs,
3788 alc880_pin_asus_init_verbs,
3789 alc880_gpio1_init_verbs },
3790 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3791 .dac_nids = alc880_asus_dac_nids,
3792 .dig_out_nid = ALC880_DIGOUT_NID,
3793 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3794 .channel_mode = alc880_asus_modes,
3796 .input_mux = &alc880_capture_source,
3798 [ALC880_ASUS_DIG2] = {
3799 .mixers = { alc880_asus_mixer },
3800 .init_verbs = { alc880_volume_init_verbs,
3801 alc880_pin_asus_init_verbs,
3802 alc880_gpio2_init_verbs }, /* use GPIO2 */
3803 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3804 .dac_nids = alc880_asus_dac_nids,
3805 .dig_out_nid = ALC880_DIGOUT_NID,
3806 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3807 .channel_mode = alc880_asus_modes,
3809 .input_mux = &alc880_capture_source,
3811 [ALC880_ASUS_W1V] = {
3812 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3813 .init_verbs = { alc880_volume_init_verbs,
3814 alc880_pin_asus_init_verbs,
3815 alc880_gpio1_init_verbs },
3816 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3817 .dac_nids = alc880_asus_dac_nids,
3818 .dig_out_nid = ALC880_DIGOUT_NID,
3819 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3820 .channel_mode = alc880_asus_modes,
3822 .input_mux = &alc880_capture_source,
3824 [ALC880_UNIWILL_DIG] = {
3825 .mixers = { alc880_asus_mixer },
3826 .init_verbs = { alc880_volume_init_verbs,
3827 alc880_pin_asus_init_verbs },
3828 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3829 .dac_nids = alc880_asus_dac_nids,
3830 .dig_out_nid = ALC880_DIGOUT_NID,
3831 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3832 .channel_mode = alc880_asus_modes,
3834 .input_mux = &alc880_capture_source,
3836 [ALC880_UNIWILL] = {
3837 .mixers = { alc880_uniwill_mixer },
3838 .init_verbs = { alc880_volume_init_verbs,
3839 alc880_uniwill_init_verbs },
3840 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3841 .dac_nids = alc880_asus_dac_nids,
3842 .dig_out_nid = ALC880_DIGOUT_NID,
3843 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3844 .channel_mode = alc880_threestack_modes,
3846 .input_mux = &alc880_capture_source,
3847 .unsol_event = alc880_uniwill_unsol_event,
3848 .init_hook = alc880_uniwill_automute,
3850 [ALC880_UNIWILL_P53] = {
3851 .mixers = { alc880_uniwill_p53_mixer },
3852 .init_verbs = { alc880_volume_init_verbs,
3853 alc880_uniwill_p53_init_verbs },
3854 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3855 .dac_nids = alc880_asus_dac_nids,
3856 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3857 .channel_mode = alc880_threestack_modes,
3858 .input_mux = &alc880_capture_source,
3859 .unsol_event = alc880_uniwill_p53_unsol_event,
3860 .init_hook = alc880_uniwill_p53_hp_automute,
3862 [ALC880_FUJITSU] = {
3863 .mixers = { alc880_fujitsu_mixer },
3864 .init_verbs = { alc880_volume_init_verbs,
3865 alc880_uniwill_p53_init_verbs,
3866 alc880_beep_init_verbs },
3867 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3868 .dac_nids = alc880_dac_nids,
3869 .dig_out_nid = ALC880_DIGOUT_NID,
3870 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3871 .channel_mode = alc880_2_jack_modes,
3872 .input_mux = &alc880_capture_source,
3873 .unsol_event = alc880_uniwill_p53_unsol_event,
3874 .init_hook = alc880_uniwill_p53_hp_automute,
3877 .mixers = { alc880_three_stack_mixer },
3878 .init_verbs = { alc880_volume_init_verbs,
3879 alc880_pin_clevo_init_verbs },
3880 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3881 .dac_nids = alc880_dac_nids,
3883 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3884 .channel_mode = alc880_threestack_modes,
3886 .input_mux = &alc880_capture_source,
3889 .mixers = { alc880_lg_mixer },
3890 .init_verbs = { alc880_volume_init_verbs,
3891 alc880_lg_init_verbs },
3892 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3893 .dac_nids = alc880_lg_dac_nids,
3894 .dig_out_nid = ALC880_DIGOUT_NID,
3895 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3896 .channel_mode = alc880_lg_ch_modes,
3898 .input_mux = &alc880_lg_capture_source,
3899 .unsol_event = alc880_lg_unsol_event,
3900 .init_hook = alc880_lg_automute,
3901 #ifdef CONFIG_SND_HDA_POWER_SAVE
3902 .loopbacks = alc880_lg_loopbacks,
3906 .mixers = { alc880_lg_lw_mixer },
3907 .init_verbs = { alc880_volume_init_verbs,
3908 alc880_lg_lw_init_verbs },
3909 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3910 .dac_nids = alc880_dac_nids,
3911 .dig_out_nid = ALC880_DIGOUT_NID,
3912 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3913 .channel_mode = alc880_lg_lw_modes,
3914 .input_mux = &alc880_lg_lw_capture_source,
3915 .unsol_event = alc880_lg_lw_unsol_event,
3916 .init_hook = alc880_lg_lw_automute,
3918 [ALC880_MEDION_RIM] = {
3919 .mixers = { alc880_medion_rim_mixer },
3920 .init_verbs = { alc880_volume_init_verbs,
3921 alc880_medion_rim_init_verbs,
3922 alc_gpio2_init_verbs },
3923 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3924 .dac_nids = alc880_dac_nids,
3925 .dig_out_nid = ALC880_DIGOUT_NID,
3926 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3927 .channel_mode = alc880_2_jack_modes,
3928 .input_mux = &alc880_medion_rim_capture_source,
3929 .unsol_event = alc880_medion_rim_unsol_event,
3930 .init_hook = alc880_medion_rim_automute,
3932 #ifdef CONFIG_SND_DEBUG
3934 .mixers = { alc880_test_mixer },
3935 .init_verbs = { alc880_test_init_verbs },
3936 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3937 .dac_nids = alc880_test_dac_nids,
3938 .dig_out_nid = ALC880_DIGOUT_NID,
3939 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3940 .channel_mode = alc880_test_modes,
3941 .input_mux = &alc880_test_capture_source,
3947 * Automatic parse of I/O pins from the BIOS configuration
3952 ALC_CTL_WIDGET_MUTE,
3955 static struct snd_kcontrol_new alc880_control_templates[] = {
3956 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3957 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3958 HDA_BIND_MUTE(NULL, 0, 0, 0),
3961 /* add dynamic controls */
3962 static int add_control(struct alc_spec *spec, int type, const char *name,
3965 struct snd_kcontrol_new *knew;
3967 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3968 knew = snd_array_new(&spec->kctls);
3971 *knew = alc880_control_templates[type];
3972 knew->name = kstrdup(name, GFP_KERNEL);
3975 knew->private_value = val;
3979 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3980 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3981 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3982 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3983 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3984 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3985 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3986 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3987 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3988 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3989 #define ALC880_PIN_CD_NID 0x1c
3991 /* fill in the dac_nids table from the parsed pin configuration */
3992 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3993 const struct auto_pin_cfg *cfg)
3999 memset(assigned, 0, sizeof(assigned));
4000 spec->multiout.dac_nids = spec->private_dac_nids;
4002 /* check the pins hardwired to audio widget */
4003 for (i = 0; i < cfg->line_outs; i++) {
4004 nid = cfg->line_out_pins[i];
4005 if (alc880_is_fixed_pin(nid)) {
4006 int idx = alc880_fixed_pin_idx(nid);
4007 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4011 /* left pins can be connect to any audio widget */
4012 for (i = 0; i < cfg->line_outs; i++) {
4013 nid = cfg->line_out_pins[i];
4014 if (alc880_is_fixed_pin(nid))
4016 /* search for an empty channel */
4017 for (j = 0; j < cfg->line_outs; j++) {
4019 spec->multiout.dac_nids[i] =
4020 alc880_idx_to_dac(j);
4026 spec->multiout.num_dacs = cfg->line_outs;
4030 /* add playback controls from the parsed DAC table */
4031 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4032 const struct auto_pin_cfg *cfg)
4035 static const char *chname[4] = {
4036 "Front", "Surround", NULL /*CLFE*/, "Side"
4041 for (i = 0; i < cfg->line_outs; i++) {
4042 if (!spec->multiout.dac_nids[i])
4044 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4047 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4048 "Center Playback Volume",
4049 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4053 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4054 "LFE Playback Volume",
4055 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4059 err = add_control(spec, ALC_CTL_BIND_MUTE,
4060 "Center Playback Switch",
4061 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4065 err = add_control(spec, ALC_CTL_BIND_MUTE,
4066 "LFE Playback Switch",
4067 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4072 sprintf(name, "%s Playback Volume", chname[i]);
4073 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4074 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4078 sprintf(name, "%s Playback Switch", chname[i]);
4079 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4080 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4089 /* add playback controls for speaker and HP outputs */
4090 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4100 if (alc880_is_fixed_pin(pin)) {
4101 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4102 /* specify the DAC as the extra output */
4103 if (!spec->multiout.hp_nid)
4104 spec->multiout.hp_nid = nid;
4106 spec->multiout.extra_out_nid[0] = nid;
4107 /* control HP volume/switch on the output mixer amp */
4108 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4109 sprintf(name, "%s Playback Volume", pfx);
4110 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4111 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4114 sprintf(name, "%s Playback Switch", pfx);
4115 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4116 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4119 } else if (alc880_is_multi_pin(pin)) {
4120 /* set manual connection */
4121 /* we have only a switch on HP-out PIN */
4122 sprintf(name, "%s Playback Switch", pfx);
4123 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4124 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4131 /* create input playback/capture controls for the given pin */
4132 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4133 const char *ctlname,
4134 int idx, hda_nid_t mix_nid)
4139 sprintf(name, "%s Playback Volume", ctlname);
4140 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4141 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4144 sprintf(name, "%s Playback Switch", ctlname);
4145 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4146 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4152 /* create playback/capture controls for input pins */
4153 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4154 const struct auto_pin_cfg *cfg)
4156 struct hda_input_mux *imux = &spec->private_imux[0];
4159 for (i = 0; i < AUTO_PIN_LAST; i++) {
4160 if (alc880_is_input_pin(cfg->input_pins[i])) {
4161 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4162 err = new_analog_input(spec, cfg->input_pins[i],
4163 auto_pin_cfg_labels[i],
4167 imux->items[imux->num_items].label =
4168 auto_pin_cfg_labels[i];
4169 imux->items[imux->num_items].index =
4170 alc880_input_pin_idx(cfg->input_pins[i]);
4177 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4178 unsigned int pin_type)
4180 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4183 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4187 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4188 hda_nid_t nid, int pin_type,
4191 alc_set_pin_output(codec, nid, pin_type);
4192 /* need the manual connection? */
4193 if (alc880_is_multi_pin(nid)) {
4194 struct alc_spec *spec = codec->spec;
4195 int idx = alc880_multi_pin_idx(nid);
4196 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4197 AC_VERB_SET_CONNECT_SEL,
4198 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4202 static int get_pin_type(int line_out_type)
4204 if (line_out_type == AUTO_PIN_HP_OUT)
4210 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4212 struct alc_spec *spec = codec->spec;
4215 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4216 for (i = 0; i < spec->autocfg.line_outs; i++) {
4217 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4218 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4219 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4223 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4225 struct alc_spec *spec = codec->spec;
4228 pin = spec->autocfg.speaker_pins[0];
4229 if (pin) /* connect to front */
4230 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4231 pin = spec->autocfg.hp_pins[0];
4232 if (pin) /* connect to front */
4233 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4236 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4238 struct alc_spec *spec = codec->spec;
4241 for (i = 0; i < AUTO_PIN_LAST; i++) {
4242 hda_nid_t nid = spec->autocfg.input_pins[i];
4243 if (alc880_is_input_pin(nid)) {
4244 snd_hda_codec_write(codec, nid, 0,
4245 AC_VERB_SET_PIN_WIDGET_CONTROL,
4246 i <= AUTO_PIN_FRONT_MIC ?
4247 PIN_VREF80 : PIN_IN);
4248 if (nid != ALC880_PIN_CD_NID)
4249 snd_hda_codec_write(codec, nid, 0,
4250 AC_VERB_SET_AMP_GAIN_MUTE,
4256 /* parse the BIOS configuration and set up the alc_spec */
4257 /* return 1 if successful, 0 if the proper config is not found,
4258 * or a negative error code
4260 static int alc880_parse_auto_config(struct hda_codec *codec)
4262 struct alc_spec *spec = codec->spec;
4264 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4266 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4270 if (!spec->autocfg.line_outs)
4271 return 0; /* can't find valid BIOS pin config */
4273 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4276 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4279 err = alc880_auto_create_extra_out(spec,
4280 spec->autocfg.speaker_pins[0],
4284 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4288 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4292 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4294 if (spec->autocfg.dig_out_pin)
4295 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4296 if (spec->autocfg.dig_in_pin)
4297 spec->dig_in_nid = ALC880_DIGIN_NID;
4299 if (spec->kctls.list)
4300 add_mixer(spec, spec->kctls.list);
4302 add_verb(spec, alc880_volume_init_verbs);
4304 spec->num_mux_defs = 1;
4305 spec->input_mux = &spec->private_imux[0];
4307 store_pin_configs(codec);
4311 /* additional initialization for auto-configuration model */
4312 static void alc880_auto_init(struct hda_codec *codec)
4314 struct alc_spec *spec = codec->spec;
4315 alc880_auto_init_multi_out(codec);
4316 alc880_auto_init_extra_out(codec);
4317 alc880_auto_init_analog_input(codec);
4318 if (spec->unsol_event)
4319 alc_inithook(codec);
4322 static void set_capture_mixer(struct alc_spec *spec)
4324 static struct snd_kcontrol_new *caps[3] = {
4329 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4330 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4333 #define set_beep_amp(spec, nid, idx, dir) \
4334 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4337 * OK, here we have finally the patch for ALC880
4340 static int patch_alc880(struct hda_codec *codec)
4342 struct alc_spec *spec;
4346 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4352 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4355 if (board_config < 0) {
4356 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4357 "trying auto-probe from BIOS...\n");
4358 board_config = ALC880_AUTO;
4361 if (board_config == ALC880_AUTO) {
4362 /* automatic parse from the BIOS config */
4363 err = alc880_parse_auto_config(codec);
4369 "hda_codec: Cannot set up configuration "
4370 "from BIOS. Using 3-stack mode...\n");
4371 board_config = ALC880_3ST;
4375 err = snd_hda_attach_beep_device(codec, 0x1);
4381 if (board_config != ALC880_AUTO)
4382 setup_preset(spec, &alc880_presets[board_config]);
4384 spec->stream_name_analog = "ALC880 Analog";
4385 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4386 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4387 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4389 spec->stream_name_digital = "ALC880 Digital";
4390 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4391 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4393 if (!spec->adc_nids && spec->input_mux) {
4394 /* check whether NID 0x07 is valid */
4395 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4397 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4398 if (wcap != AC_WID_AUD_IN) {
4399 spec->adc_nids = alc880_adc_nids_alt;
4400 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4402 spec->adc_nids = alc880_adc_nids;
4403 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4406 set_capture_mixer(spec);
4407 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4409 spec->vmaster_nid = 0x0c;
4411 codec->patch_ops = alc_patch_ops;
4412 if (board_config == ALC880_AUTO)
4413 spec->init_hook = alc880_auto_init;
4414 #ifdef CONFIG_SND_HDA_POWER_SAVE
4415 if (!spec->loopback.amplist)
4416 spec->loopback.amplist = alc880_loopbacks;
4418 codec->proc_widget_hook = print_realtek_coef;
4428 static hda_nid_t alc260_dac_nids[1] = {
4433 static hda_nid_t alc260_adc_nids[1] = {
4438 static hda_nid_t alc260_adc_nids_alt[1] = {
4443 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4444 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4446 static hda_nid_t alc260_dual_adc_nids[2] = {
4451 #define ALC260_DIGOUT_NID 0x03
4452 #define ALC260_DIGIN_NID 0x06
4454 static struct hda_input_mux alc260_capture_source = {
4458 { "Front Mic", 0x1 },
4464 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4465 * headphone jack and the internal CD lines since these are the only pins at
4466 * which audio can appear. For flexibility, also allow the option of
4467 * recording the mixer output on the second ADC (ADC0 doesn't have a
4468 * connection to the mixer output).
4470 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4474 { "Mic/Line", 0x0 },
4476 { "Headphone", 0x2 },
4482 { "Mic/Line", 0x0 },
4484 { "Headphone", 0x2 },
4491 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4492 * the Fujitsu S702x, but jacks are marked differently.
4494 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4501 { "Headphone", 0x5 },
4510 { "Headphone", 0x6 },
4516 * This is just place-holder, so there's something for alc_build_pcms to look
4517 * at when it calculates the maximum number of channels. ALC260 has no mixer
4518 * element which allows changing the channel mode, so the verb list is
4521 static struct hda_channel_mode alc260_modes[1] = {
4526 /* Mixer combinations
4528 * basic: base_output + input + pc_beep + capture
4529 * HP: base_output + input + capture_alt
4530 * HP_3013: hp_3013 + input + capture
4531 * fujitsu: fujitsu + capture
4532 * acer: acer + capture
4535 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4536 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4537 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4538 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4539 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4540 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4541 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4545 static struct snd_kcontrol_new alc260_input_mixer[] = {
4546 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4547 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4548 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4549 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4551 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4552 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4553 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4557 /* update HP, line and mono out pins according to the master switch */
4558 static void alc260_hp_master_update(struct hda_codec *codec,
4559 hda_nid_t hp, hda_nid_t line,
4562 struct alc_spec *spec = codec->spec;
4563 unsigned int val = spec->master_sw ? PIN_HP : 0;
4564 /* change HP and line-out pins */
4565 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4567 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4569 /* mono (speaker) depending on the HP jack sense */
4570 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4571 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4575 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4576 struct snd_ctl_elem_value *ucontrol)
4578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4579 struct alc_spec *spec = codec->spec;
4580 *ucontrol->value.integer.value = spec->master_sw;
4584 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4585 struct snd_ctl_elem_value *ucontrol)
4587 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4588 struct alc_spec *spec = codec->spec;
4589 int val = !!*ucontrol->value.integer.value;
4590 hda_nid_t hp, line, mono;
4592 if (val == spec->master_sw)
4594 spec->master_sw = val;
4595 hp = (kcontrol->private_value >> 16) & 0xff;
4596 line = (kcontrol->private_value >> 8) & 0xff;
4597 mono = kcontrol->private_value & 0xff;
4598 alc260_hp_master_update(codec, hp, line, mono);
4602 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4604 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4605 .name = "Master Playback Switch",
4606 .info = snd_ctl_boolean_mono_info,
4607 .get = alc260_hp_master_sw_get,
4608 .put = alc260_hp_master_sw_put,
4609 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4611 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4612 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4613 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4614 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4615 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4617 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4621 static struct hda_verb alc260_hp_unsol_verbs[] = {
4622 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4626 static void alc260_hp_automute(struct hda_codec *codec)
4628 struct alc_spec *spec = codec->spec;
4629 unsigned int present;
4631 present = snd_hda_codec_read(codec, 0x10, 0,
4632 AC_VERB_GET_PIN_SENSE, 0);
4633 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4634 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4637 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4639 if ((res >> 26) == ALC880_HP_EVENT)
4640 alc260_hp_automute(codec);
4643 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4645 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4646 .name = "Master Playback Switch",
4647 .info = snd_ctl_boolean_mono_info,
4648 .get = alc260_hp_master_sw_get,
4649 .put = alc260_hp_master_sw_put,
4650 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4652 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4653 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4654 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4655 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4656 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4658 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4659 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4663 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4664 .ops = &snd_hda_bind_vol,
4666 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4667 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4668 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4673 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4674 .ops = &snd_hda_bind_sw,
4676 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4677 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4682 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4683 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4684 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4685 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4686 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4690 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4691 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4695 static void alc260_hp_3013_automute(struct hda_codec *codec)
4697 struct alc_spec *spec = codec->spec;
4698 unsigned int present;
4700 present = snd_hda_codec_read(codec, 0x15, 0,
4701 AC_VERB_GET_PIN_SENSE, 0);
4702 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4703 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4706 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4709 if ((res >> 26) == ALC880_HP_EVENT)
4710 alc260_hp_3013_automute(codec);
4713 static void alc260_hp_3012_automute(struct hda_codec *codec)
4715 unsigned int present, bits;
4717 present = snd_hda_codec_read(codec, 0x10, 0,
4718 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4720 bits = present ? 0 : PIN_OUT;
4721 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4723 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4725 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4729 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4732 if ((res >> 26) == ALC880_HP_EVENT)
4733 alc260_hp_3012_automute(codec);
4736 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4737 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4739 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4740 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4741 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4742 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4743 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4744 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4745 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4746 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4747 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4748 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4749 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4753 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4754 * versions of the ALC260 don't act on requests to enable mic bias from NID
4755 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4756 * datasheet doesn't mention this restriction. At this stage it's not clear
4757 * whether this behaviour is intentional or is a hardware bug in chip
4758 * revisions available in early 2006. Therefore for now allow the
4759 * "Headphone Jack Mode" control to span all choices, but if it turns out
4760 * that the lack of mic bias for this NID is intentional we could change the
4761 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4763 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4764 * don't appear to make the mic bias available from the "line" jack, even
4765 * though the NID used for this jack (0x14) can supply it. The theory is
4766 * that perhaps Acer have included blocking capacitors between the ALC260
4767 * and the output jack. If this turns out to be the case for all such
4768 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4769 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4771 * The C20x Tablet series have a mono internal speaker which is controlled
4772 * via the chip's Mono sum widget and pin complex, so include the necessary
4773 * controls for such models. On models without a "mono speaker" the control
4774 * won't do anything.
4776 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4777 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4778 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4779 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4780 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4782 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4784 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4785 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4786 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4787 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4788 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4789 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4790 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4791 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4795 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4796 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4798 static struct snd_kcontrol_new alc260_will_mixer[] = {
4799 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4800 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4802 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4803 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4804 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4805 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4806 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4807 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4808 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4812 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4813 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4815 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4816 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4817 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4819 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4820 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4821 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4822 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4823 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4824 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4825 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4830 * initialization verbs
4832 static struct hda_verb alc260_init_verbs[] = {
4833 /* Line In pin widget for input */
4834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4835 /* CD pin widget for input */
4836 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4837 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4838 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4839 /* Mic2 (front panel) pin widget for input and vref at 80% */
4840 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4841 /* LINE-2 is used for line-out in rear */
4842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4843 /* select line-out */
4844 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4846 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4848 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4850 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4851 /* mute capture amp left and right */
4852 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4853 /* set connection select to line in (default select for this ADC) */
4854 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4855 /* mute capture amp left and right */
4856 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4857 /* set connection select to line in (default select for this ADC) */
4858 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4859 /* set vol=0 Line-Out mixer amp left and right */
4860 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4861 /* unmute pin widget amp left and right (no gain on this amp) */
4862 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4863 /* set vol=0 HP mixer amp left and right */
4864 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4865 /* unmute pin widget amp left and right (no gain on this amp) */
4866 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4867 /* set vol=0 Mono mixer amp left and right */
4868 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4869 /* unmute pin widget amp left and right (no gain on this amp) */
4870 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4871 /* unmute LINE-2 out pin */
4872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4873 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4876 /* mute analog inputs */
4877 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4878 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4879 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4880 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4881 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4882 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4883 /* mute Front out path */
4884 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4885 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4886 /* mute Headphone out path */
4887 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4888 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4889 /* mute Mono out path */
4890 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4891 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4895 #if 0 /* should be identical with alc260_init_verbs? */
4896 static struct hda_verb alc260_hp_init_verbs[] = {
4897 /* Headphone and output */
4898 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4900 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4901 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4902 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4903 /* Mic2 (front panel) pin widget for input and vref at 80% */
4904 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4905 /* Line In pin widget for input */
4906 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4907 /* Line-2 pin widget for output */
4908 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4909 /* CD pin widget for input */
4910 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4911 /* unmute amp left and right */
4912 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4913 /* set connection select to line in (default select for this ADC) */
4914 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4915 /* unmute Line-Out mixer amp left and right (volume = 0) */
4916 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4917 /* mute pin widget amp left and right (no gain on this amp) */
4918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4919 /* unmute HP mixer amp left and right (volume = 0) */
4920 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4921 /* mute pin widget amp left and right (no gain on this amp) */
4922 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4923 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4926 /* mute analog inputs */
4927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4931 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4932 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4933 /* Unmute Front out path */
4934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4935 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4936 /* Unmute Headphone out path */
4937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4938 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4939 /* Unmute Mono out path */
4940 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4941 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4946 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4947 /* Line out and output */
4948 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4950 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4951 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4952 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4953 /* Mic2 (front panel) pin widget for input and vref at 80% */
4954 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4955 /* Line In pin widget for input */
4956 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4957 /* Headphone pin widget for output */
4958 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4959 /* CD pin widget for input */
4960 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4961 /* unmute amp left and right */
4962 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4963 /* set connection select to line in (default select for this ADC) */
4964 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4965 /* unmute Line-Out mixer amp left and right (volume = 0) */
4966 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4967 /* mute pin widget amp left and right (no gain on this amp) */
4968 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4969 /* unmute HP mixer amp left and right (volume = 0) */
4970 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4971 /* mute pin widget amp left and right (no gain on this amp) */
4972 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4973 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4976 /* mute analog inputs */
4977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4980 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4982 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4983 /* Unmute Front out path */
4984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4986 /* Unmute Headphone out path */
4987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4988 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4989 /* Unmute Mono out path */
4990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4991 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4995 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4996 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4997 * audio = 0x16, internal speaker = 0x10.
4999 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5000 /* Disable all GPIOs */
5001 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5002 /* Internal speaker is connected to headphone pin */
5003 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5004 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5006 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5007 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5008 /* Ensure all other unused pins are disabled and muted. */
5009 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5010 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5011 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5012 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5013 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5014 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5015 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5016 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5018 /* Disable digital (SPDIF) pins */
5019 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5020 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5022 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5023 * when acting as an output.
5025 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5027 /* Start with output sum widgets muted and their output gains at min */
5028 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5029 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5030 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5031 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5032 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5033 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5034 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5035 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5036 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5038 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5039 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5040 /* Unmute Line1 pin widget output buffer since it starts as an output.
5041 * If the pin mode is changed by the user the pin mode control will
5042 * take care of enabling the pin's input/output buffers as needed.
5043 * Therefore there's no need to enable the input buffer at this
5046 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5047 /* Unmute input buffer of pin widget used for Line-in (no equiv
5050 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5052 /* Mute capture amp left and right */
5053 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5054 /* Set ADC connection select to match default mixer setting - line
5057 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5059 /* Do the same for the second ADC: mute capture input amp and
5060 * set ADC connection to line in (on mic1 pin)
5062 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5063 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5065 /* Mute all inputs to mixer widget (even unconnected ones) */
5066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5069 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5070 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5071 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5072 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5073 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5078 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5079 * similar laptops (adapted from Fujitsu init verbs).
5081 static struct hda_verb alc260_acer_init_verbs[] = {
5082 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5083 * the headphone jack. Turn this on and rely on the standard mute
5084 * methods whenever the user wants to turn these outputs off.
5086 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5087 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5088 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5089 /* Internal speaker/Headphone jack is connected to Line-out pin */
5090 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5091 /* Internal microphone/Mic jack is connected to Mic1 pin */
5092 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5093 /* Line In jack is connected to Line1 pin */
5094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5095 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5096 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5097 /* Ensure all other unused pins are disabled and muted. */
5098 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5099 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5100 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5101 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5102 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5103 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5104 /* Disable digital (SPDIF) pins */
5105 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5106 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5108 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5109 * bus when acting as outputs.
5111 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5112 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5114 /* Start with output sum widgets muted and their output gains at min */
5115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5116 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5118 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5120 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5121 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5122 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5123 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5125 /* Unmute Line-out pin widget amp left and right
5126 * (no equiv mixer ctrl)
5128 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5129 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5130 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5131 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5132 * inputs. If the pin mode is changed by the user the pin mode control
5133 * will take care of enabling the pin's input/output buffers as needed.
5134 * Therefore there's no need to enable the input buffer at this
5137 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5138 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5140 /* Mute capture amp left and right */
5141 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5142 /* Set ADC connection select to match default mixer setting - mic
5145 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5147 /* Do similar with the second ADC: mute capture input amp and
5148 * set ADC connection to mic to match ALSA's default state.
5150 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5151 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5153 /* Mute all inputs to mixer widget (even unconnected ones) */
5154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5155 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5166 static struct hda_verb alc260_will_verbs[] = {
5167 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5168 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5169 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5170 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5171 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5172 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5176 static struct hda_verb alc260_replacer_672v_verbs[] = {
5177 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5178 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5179 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5181 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5182 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5183 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5185 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5189 /* toggle speaker-output according to the hp-jack state */
5190 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5192 unsigned int present;
5194 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5195 present = snd_hda_codec_read(codec, 0x0f, 0,
5196 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5198 snd_hda_codec_write_cache(codec, 0x01, 0,
5199 AC_VERB_SET_GPIO_DATA, 1);
5200 snd_hda_codec_write_cache(codec, 0x0f, 0,
5201 AC_VERB_SET_PIN_WIDGET_CONTROL,
5204 snd_hda_codec_write_cache(codec, 0x01, 0,
5205 AC_VERB_SET_GPIO_DATA, 0);
5206 snd_hda_codec_write_cache(codec, 0x0f, 0,
5207 AC_VERB_SET_PIN_WIDGET_CONTROL,
5212 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5215 if ((res >> 26) == ALC880_HP_EVENT)
5216 alc260_replacer_672v_automute(codec);
5219 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5220 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5221 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5222 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5223 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5224 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5225 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5226 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5227 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5228 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5229 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5233 /* Test configuration for debugging, modelled after the ALC880 test
5236 #ifdef CONFIG_SND_DEBUG
5237 static hda_nid_t alc260_test_dac_nids[1] = {
5240 static hda_nid_t alc260_test_adc_nids[2] = {
5243 /* For testing the ALC260, each input MUX needs its own definition since
5244 * the signal assignments are different. This assumes that the first ADC
5247 static struct hda_input_mux alc260_test_capture_sources[2] = {
5251 { "MIC1 pin", 0x0 },
5252 { "MIC2 pin", 0x1 },
5253 { "LINE1 pin", 0x2 },
5254 { "LINE2 pin", 0x3 },
5256 { "LINE-OUT pin", 0x5 },
5257 { "HP-OUT pin", 0x6 },
5263 { "MIC1 pin", 0x0 },
5264 { "MIC2 pin", 0x1 },
5265 { "LINE1 pin", 0x2 },
5266 { "LINE2 pin", 0x3 },
5269 { "LINE-OUT pin", 0x6 },
5270 { "HP-OUT pin", 0x7 },
5274 static struct snd_kcontrol_new alc260_test_mixer[] = {
5275 /* Output driver widgets */
5276 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5277 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5278 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5279 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5280 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5281 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5283 /* Modes for retasking pin widgets
5284 * Note: the ALC260 doesn't seem to act on requests to enable mic
5285 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5286 * mention this restriction. At this stage it's not clear whether
5287 * this behaviour is intentional or is a hardware bug in chip
5288 * revisions available at least up until early 2006. Therefore for
5289 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5290 * choices, but if it turns out that the lack of mic bias for these
5291 * NIDs is intentional we could change their modes from
5292 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5294 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5295 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5296 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5297 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5298 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5299 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5301 /* Loopback mixer controls */
5302 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5303 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5304 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5305 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5306 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5307 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5308 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5309 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5310 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5311 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5312 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5313 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5314 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5315 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5317 /* Controls for GPIO pins, assuming they are configured as outputs */
5318 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5319 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5320 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5321 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5323 /* Switches to allow the digital IO pins to be enabled. The datasheet
5324 * is ambigious as to which NID is which; testing on laptops which
5325 * make this output available should provide clarification.
5327 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5328 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5330 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5331 * this output to turn on an external amplifier.
5333 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5334 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5338 static struct hda_verb alc260_test_init_verbs[] = {
5339 /* Enable all GPIOs as outputs with an initial value of 0 */
5340 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5341 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5342 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5344 /* Enable retasking pins as output, initially without power amp */
5345 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5346 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5347 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5349 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5350 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5352 /* Disable digital (SPDIF) pins initially, but users can enable
5353 * them via a mixer switch. In the case of SPDIF-out, this initverb
5354 * payload also sets the generation to 0, output to be in "consumer"
5355 * PCM format, copyright asserted, no pre-emphasis and no validity
5358 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5359 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5361 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5362 * OUT1 sum bus when acting as an output.
5364 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5365 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5366 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5367 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5369 /* Start with output sum widgets muted and their output gains at min */
5370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5372 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5376 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5377 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5378 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5380 /* Unmute retasking pin widget output buffers since the default
5381 * state appears to be output. As the pin mode is changed by the
5382 * user the pin mode control will take care of enabling the pin's
5383 * input/output buffers as needed.
5385 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5386 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5388 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5389 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5390 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5391 /* Also unmute the mono-out pin widget */
5392 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5394 /* Mute capture amp left and right */
5395 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5396 /* Set ADC connection select to match default mixer setting (mic1
5399 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5401 /* Do the same for the second ADC: mute capture input amp and
5402 * set ADC connection to mic1 pin
5404 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5405 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5407 /* Mute all inputs to mixer widget (even unconnected ones) */
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5421 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5422 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5424 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5425 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5428 * for BIOS auto-configuration
5431 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5432 const char *pfx, int *vol_bits)
5435 unsigned long vol_val, sw_val;
5439 if (nid >= 0x0f && nid < 0x11) {
5440 nid_vol = nid - 0x7;
5441 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5442 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5443 } else if (nid == 0x11) {
5444 nid_vol = nid - 0x7;
5445 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5446 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5447 } else if (nid >= 0x12 && nid <= 0x15) {
5449 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5450 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5454 if (!(*vol_bits & (1 << nid_vol))) {
5455 /* first control for the volume widget */
5456 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5457 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5460 *vol_bits |= (1 << nid_vol);
5462 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5463 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5469 /* add playback controls from the parsed DAC table */
5470 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5471 const struct auto_pin_cfg *cfg)
5477 spec->multiout.num_dacs = 1;
5478 spec->multiout.dac_nids = spec->private_dac_nids;
5479 spec->multiout.dac_nids[0] = 0x02;
5481 nid = cfg->line_out_pins[0];
5483 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5488 nid = cfg->speaker_pins[0];
5490 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5495 nid = cfg->hp_pins[0];
5497 err = alc260_add_playback_controls(spec, nid, "Headphone",
5505 /* create playback/capture controls for input pins */
5506 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5507 const struct auto_pin_cfg *cfg)
5509 struct hda_input_mux *imux = &spec->private_imux[0];
5512 for (i = 0; i < AUTO_PIN_LAST; i++) {
5513 if (cfg->input_pins[i] >= 0x12) {
5514 idx = cfg->input_pins[i] - 0x12;
5515 err = new_analog_input(spec, cfg->input_pins[i],
5516 auto_pin_cfg_labels[i], idx,
5520 imux->items[imux->num_items].label =
5521 auto_pin_cfg_labels[i];
5522 imux->items[imux->num_items].index = idx;
5525 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5526 idx = cfg->input_pins[i] - 0x09;
5527 err = new_analog_input(spec, cfg->input_pins[i],
5528 auto_pin_cfg_labels[i], idx,
5532 imux->items[imux->num_items].label =
5533 auto_pin_cfg_labels[i];
5534 imux->items[imux->num_items].index = idx;
5541 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5542 hda_nid_t nid, int pin_type,
5545 alc_set_pin_output(codec, nid, pin_type);
5546 /* need the manual connection? */
5548 int idx = nid - 0x12;
5549 snd_hda_codec_write(codec, idx + 0x0b, 0,
5550 AC_VERB_SET_CONNECT_SEL, sel_idx);
5554 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5556 struct alc_spec *spec = codec->spec;
5559 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5560 nid = spec->autocfg.line_out_pins[0];
5562 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5563 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5566 nid = spec->autocfg.speaker_pins[0];
5568 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5570 nid = spec->autocfg.hp_pins[0];
5572 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5575 #define ALC260_PIN_CD_NID 0x16
5576 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5578 struct alc_spec *spec = codec->spec;
5581 for (i = 0; i < AUTO_PIN_LAST; i++) {
5582 hda_nid_t nid = spec->autocfg.input_pins[i];
5584 snd_hda_codec_write(codec, nid, 0,
5585 AC_VERB_SET_PIN_WIDGET_CONTROL,
5586 i <= AUTO_PIN_FRONT_MIC ?
5587 PIN_VREF80 : PIN_IN);
5588 if (nid != ALC260_PIN_CD_NID)
5589 snd_hda_codec_write(codec, nid, 0,
5590 AC_VERB_SET_AMP_GAIN_MUTE,
5597 * generic initialization of ADC, input mixers and output mixers
5599 static struct hda_verb alc260_volume_init_verbs[] = {
5601 * Unmute ADC0-1 and set the default input to mic-in
5603 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5604 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5605 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5606 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5608 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5610 * Note: PASD motherboards uses the Line In 2 as the input for
5611 * front panel mic (mic 2)
5613 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5614 /* mute analog inputs */
5615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5622 * Set up output mixers (0x08 - 0x0a)
5624 /* set vol=0 to output mixers */
5625 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5626 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5627 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5628 /* set up input amps for analog loopback */
5629 /* Amp Indices: DAC = 0, mixer = 1 */
5630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5634 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5635 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5640 static int alc260_parse_auto_config(struct hda_codec *codec)
5642 struct alc_spec *spec = codec->spec;
5644 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5646 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5650 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5653 if (!spec->kctls.list)
5654 return 0; /* can't find valid BIOS pin config */
5655 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5659 spec->multiout.max_channels = 2;
5661 if (spec->autocfg.dig_out_pin)
5662 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5663 if (spec->kctls.list)
5664 add_mixer(spec, spec->kctls.list);
5666 add_verb(spec, alc260_volume_init_verbs);
5668 spec->num_mux_defs = 1;
5669 spec->input_mux = &spec->private_imux[0];
5671 store_pin_configs(codec);
5675 /* additional initialization for auto-configuration model */
5676 static void alc260_auto_init(struct hda_codec *codec)
5678 struct alc_spec *spec = codec->spec;
5679 alc260_auto_init_multi_out(codec);
5680 alc260_auto_init_analog_input(codec);
5681 if (spec->unsol_event)
5682 alc_inithook(codec);
5685 #ifdef CONFIG_SND_HDA_POWER_SAVE
5686 static struct hda_amp_list alc260_loopbacks[] = {
5687 { 0x07, HDA_INPUT, 0 },
5688 { 0x07, HDA_INPUT, 1 },
5689 { 0x07, HDA_INPUT, 2 },
5690 { 0x07, HDA_INPUT, 3 },
5691 { 0x07, HDA_INPUT, 4 },
5697 * ALC260 configurations
5699 static const char *alc260_models[ALC260_MODEL_LAST] = {
5700 [ALC260_BASIC] = "basic",
5702 [ALC260_HP_3013] = "hp-3013",
5703 [ALC260_HP_DC7600] = "hp-dc7600",
5704 [ALC260_FUJITSU_S702X] = "fujitsu",
5705 [ALC260_ACER] = "acer",
5706 [ALC260_WILL] = "will",
5707 [ALC260_REPLACER_672V] = "replacer",
5708 #ifdef CONFIG_SND_DEBUG
5709 [ALC260_TEST] = "test",
5711 [ALC260_AUTO] = "auto",
5714 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5715 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5716 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5717 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5718 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5719 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5720 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5721 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5722 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5723 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5724 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5725 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5726 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5727 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5728 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5729 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5730 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5731 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5732 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5736 static struct alc_config_preset alc260_presets[] = {
5738 .mixers = { alc260_base_output_mixer,
5739 alc260_input_mixer },
5740 .init_verbs = { alc260_init_verbs },
5741 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5742 .dac_nids = alc260_dac_nids,
5743 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5744 .adc_nids = alc260_adc_nids,
5745 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5746 .channel_mode = alc260_modes,
5747 .input_mux = &alc260_capture_source,
5750 .mixers = { alc260_hp_output_mixer,
5751 alc260_input_mixer },
5752 .init_verbs = { alc260_init_verbs,
5753 alc260_hp_unsol_verbs },
5754 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5755 .dac_nids = alc260_dac_nids,
5756 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5757 .adc_nids = alc260_adc_nids_alt,
5758 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5759 .channel_mode = alc260_modes,
5760 .input_mux = &alc260_capture_source,
5761 .unsol_event = alc260_hp_unsol_event,
5762 .init_hook = alc260_hp_automute,
5764 [ALC260_HP_DC7600] = {
5765 .mixers = { alc260_hp_dc7600_mixer,
5766 alc260_input_mixer },
5767 .init_verbs = { alc260_init_verbs,
5768 alc260_hp_dc7600_verbs },
5769 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5770 .dac_nids = alc260_dac_nids,
5771 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5772 .adc_nids = alc260_adc_nids_alt,
5773 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5774 .channel_mode = alc260_modes,
5775 .input_mux = &alc260_capture_source,
5776 .unsol_event = alc260_hp_3012_unsol_event,
5777 .init_hook = alc260_hp_3012_automute,
5779 [ALC260_HP_3013] = {
5780 .mixers = { alc260_hp_3013_mixer,
5781 alc260_input_mixer },
5782 .init_verbs = { alc260_hp_3013_init_verbs,
5783 alc260_hp_3013_unsol_verbs },
5784 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5785 .dac_nids = alc260_dac_nids,
5786 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5787 .adc_nids = alc260_adc_nids_alt,
5788 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5789 .channel_mode = alc260_modes,
5790 .input_mux = &alc260_capture_source,
5791 .unsol_event = alc260_hp_3013_unsol_event,
5792 .init_hook = alc260_hp_3013_automute,
5794 [ALC260_FUJITSU_S702X] = {
5795 .mixers = { alc260_fujitsu_mixer },
5796 .init_verbs = { alc260_fujitsu_init_verbs },
5797 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5798 .dac_nids = alc260_dac_nids,
5799 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5800 .adc_nids = alc260_dual_adc_nids,
5801 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5802 .channel_mode = alc260_modes,
5803 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5804 .input_mux = alc260_fujitsu_capture_sources,
5807 .mixers = { alc260_acer_mixer },
5808 .init_verbs = { alc260_acer_init_verbs },
5809 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5810 .dac_nids = alc260_dac_nids,
5811 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5812 .adc_nids = alc260_dual_adc_nids,
5813 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5814 .channel_mode = alc260_modes,
5815 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5816 .input_mux = alc260_acer_capture_sources,
5819 .mixers = { alc260_will_mixer },
5820 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5821 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5822 .dac_nids = alc260_dac_nids,
5823 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5824 .adc_nids = alc260_adc_nids,
5825 .dig_out_nid = ALC260_DIGOUT_NID,
5826 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5827 .channel_mode = alc260_modes,
5828 .input_mux = &alc260_capture_source,
5830 [ALC260_REPLACER_672V] = {
5831 .mixers = { alc260_replacer_672v_mixer },
5832 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5833 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5834 .dac_nids = alc260_dac_nids,
5835 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5836 .adc_nids = alc260_adc_nids,
5837 .dig_out_nid = ALC260_DIGOUT_NID,
5838 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5839 .channel_mode = alc260_modes,
5840 .input_mux = &alc260_capture_source,
5841 .unsol_event = alc260_replacer_672v_unsol_event,
5842 .init_hook = alc260_replacer_672v_automute,
5844 #ifdef CONFIG_SND_DEBUG
5846 .mixers = { alc260_test_mixer },
5847 .init_verbs = { alc260_test_init_verbs },
5848 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5849 .dac_nids = alc260_test_dac_nids,
5850 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5851 .adc_nids = alc260_test_adc_nids,
5852 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5853 .channel_mode = alc260_modes,
5854 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5855 .input_mux = alc260_test_capture_sources,
5860 static int patch_alc260(struct hda_codec *codec)
5862 struct alc_spec *spec;
5863 int err, board_config;
5865 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5871 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5874 if (board_config < 0) {
5875 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5876 "trying auto-probe from BIOS...\n");
5877 board_config = ALC260_AUTO;
5880 if (board_config == ALC260_AUTO) {
5881 /* automatic parse from the BIOS config */
5882 err = alc260_parse_auto_config(codec);
5888 "hda_codec: Cannot set up configuration "
5889 "from BIOS. Using base mode...\n");
5890 board_config = ALC260_BASIC;
5894 err = snd_hda_attach_beep_device(codec, 0x1);
5900 if (board_config != ALC260_AUTO)
5901 setup_preset(spec, &alc260_presets[board_config]);
5903 spec->stream_name_analog = "ALC260 Analog";
5904 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5905 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5907 spec->stream_name_digital = "ALC260 Digital";
5908 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5909 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5911 if (!spec->adc_nids && spec->input_mux) {
5912 /* check whether NID 0x04 is valid */
5913 unsigned int wcap = get_wcaps(codec, 0x04);
5914 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5916 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5917 spec->adc_nids = alc260_adc_nids_alt;
5918 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5920 spec->adc_nids = alc260_adc_nids;
5921 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5924 set_capture_mixer(spec);
5925 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
5927 spec->vmaster_nid = 0x08;
5929 codec->patch_ops = alc_patch_ops;
5930 if (board_config == ALC260_AUTO)
5931 spec->init_hook = alc260_auto_init;
5932 #ifdef CONFIG_SND_HDA_POWER_SAVE
5933 if (!spec->loopback.amplist)
5934 spec->loopback.amplist = alc260_loopbacks;
5936 codec->proc_widget_hook = print_realtek_coef;
5945 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5946 * configuration. Each pin widget can choose any input DACs and a mixer.
5947 * Each ADC is connected from a mixer of all inputs. This makes possible
5948 * 6-channel independent captures.
5950 * In addition, an independent DAC for the multi-playback (not used in this
5953 #define ALC882_DIGOUT_NID 0x06
5954 #define ALC882_DIGIN_NID 0x0a
5956 static struct hda_channel_mode alc882_ch_modes[1] = {
5960 static hda_nid_t alc882_dac_nids[4] = {
5961 /* front, rear, clfe, rear_surr */
5962 0x02, 0x03, 0x04, 0x05
5965 /* identical with ALC880 */
5966 #define alc882_adc_nids alc880_adc_nids
5967 #define alc882_adc_nids_alt alc880_adc_nids_alt
5969 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5970 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5973 /* FIXME: should be a matrix-type input source selection */
5975 static struct hda_input_mux alc882_capture_source = {
5979 { "Front Mic", 0x1 },
5987 static struct hda_verb alc882_3ST_ch2_init[] = {
5988 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5989 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5990 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5991 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5998 static struct hda_verb alc882_3ST_ch6_init[] = {
5999 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6000 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6001 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6002 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6003 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6004 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6008 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6009 { 2, alc882_3ST_ch2_init },
6010 { 6, alc882_3ST_ch6_init },
6016 static struct hda_verb alc882_sixstack_ch6_init[] = {
6017 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6018 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6019 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6020 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6027 static struct hda_verb alc882_sixstack_ch8_init[] = {
6028 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6029 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6030 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6031 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6035 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6036 { 6, alc882_sixstack_ch6_init },
6037 { 8, alc882_sixstack_ch8_init },
6041 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6047 static struct hda_verb alc885_mbp_ch2_init[] = {
6048 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6049 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6050 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6057 static struct hda_verb alc885_mbp_ch6_init[] = {
6058 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6059 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6060 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6061 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6062 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6066 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6067 { 2, alc885_mbp_ch2_init },
6068 { 6, alc885_mbp_ch6_init },
6072 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6073 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6075 static struct snd_kcontrol_new alc882_base_mixer[] = {
6076 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6077 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6078 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6079 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6080 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6081 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6082 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6083 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6084 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6085 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6088 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6092 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6094 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6095 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6096 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6100 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6101 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6102 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6103 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6104 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6105 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6106 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6108 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6109 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6110 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6113 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6116 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6117 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6118 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6119 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6122 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6126 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6128 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6136 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6137 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6138 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6139 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6143 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6144 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6146 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6147 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6148 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6150 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6151 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6152 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6155 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6156 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6157 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6158 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6159 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6163 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6164 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6165 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6167 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6168 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6169 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6170 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6172 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6177 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6179 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6180 .name = "Channel Mode",
6181 .info = alc_ch_mode_info,
6182 .get = alc_ch_mode_get,
6183 .put = alc_ch_mode_put,
6188 static struct hda_verb alc882_init_verbs[] = {
6189 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6192 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6194 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6195 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6196 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6198 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6200 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6202 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6203 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6204 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6206 /* Front Pin: output 0 (0x0c) */
6207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6208 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6209 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6210 /* Rear Pin: output 1 (0x0d) */
6211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6212 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6213 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6214 /* CLFE Pin: output 2 (0x0e) */
6215 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6216 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6217 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6218 /* Side Pin: output 3 (0x0f) */
6219 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6220 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6221 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6222 /* Mic (rear) pin: input vref at 80% */
6223 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6224 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6225 /* Front Mic pin: input vref at 80% */
6226 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6227 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6228 /* Line In pin: input */
6229 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6230 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6231 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6232 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6233 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6234 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6235 /* CD pin widget for input */
6236 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6238 /* FIXME: use matrix-type input source selection */
6239 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6240 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6242 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6249 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6255 /* ADC1: mute amp left and right */
6256 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6257 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6258 /* ADC2: mute amp left and right */
6259 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6260 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6261 /* ADC3: mute amp left and right */
6262 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6263 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6268 static struct hda_verb alc882_eapd_verbs[] = {
6269 /* change to EAPD mode */
6270 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6271 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6276 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6277 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6278 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6279 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6280 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6281 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6282 /* FIXME: this looks suspicious...
6283 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6284 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6289 static struct hda_verb alc882_macpro_init_verbs[] = {
6290 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6294 /* Front Pin: output 0 (0x0c) */
6295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6296 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6297 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6298 /* Front Mic pin: input vref at 80% */
6299 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6300 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6301 /* Speaker: output */
6302 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6303 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6304 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6305 /* Headphone output (output 0 - 0x0c) */
6306 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6307 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6308 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6310 /* FIXME: use matrix-type input source selection */
6311 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6312 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6320 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6321 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6325 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6326 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6327 /* ADC1: mute amp left and right */
6328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6329 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6330 /* ADC2: mute amp left and right */
6331 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6332 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6333 /* ADC3: mute amp left and right */
6334 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6335 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6340 /* Macbook Pro rev3 */
6341 static struct hda_verb alc885_mbp3_init_verbs[] = {
6342 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6350 /* Front Pin: output 0 (0x0c) */
6351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6353 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6354 /* HP Pin: output 0 (0x0d) */
6355 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6358 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6359 /* Mic (rear) pin: input vref at 80% */
6360 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6361 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6362 /* Front Mic pin: input vref at 80% */
6363 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6364 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6365 /* Line In pin: use output 1 when in LineOut mode */
6366 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6367 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6368 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6370 /* FIXME: use matrix-type input source selection */
6371 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6372 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6376 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6387 /* ADC1: mute amp left and right */
6388 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6389 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6390 /* ADC2: mute amp left and right */
6391 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6392 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6393 /* ADC3: mute amp left and right */
6394 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6395 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6400 /* iMac 24 mixer. */
6401 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6402 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6403 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6407 /* iMac 24 init verbs. */
6408 static struct hda_verb alc885_imac24_init_verbs[] = {
6409 /* Internal speakers: output 0 (0x0c) */
6410 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6411 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6412 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6413 /* Internal speakers: output 0 (0x0c) */
6414 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6415 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6416 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6417 /* Headphone: output 0 (0x0c) */
6418 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6419 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6420 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6421 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6422 /* Front Mic: input vref at 80% */
6423 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6424 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6428 /* Toggle speaker-output according to the hp-jack state */
6429 static void alc885_imac24_automute(struct hda_codec *codec)
6431 unsigned int present;
6433 present = snd_hda_codec_read(codec, 0x14, 0,
6434 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6435 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6436 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6437 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6438 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6441 /* Processes unsolicited events. */
6442 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6445 /* Headphone insertion or removal. */
6446 if ((res >> 26) == ALC880_HP_EVENT)
6447 alc885_imac24_automute(codec);
6450 static void alc885_mbp3_automute(struct hda_codec *codec)
6452 unsigned int present;
6454 present = snd_hda_codec_read(codec, 0x15, 0,
6455 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6456 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6457 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6458 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6459 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6462 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6465 /* Headphone insertion or removal. */
6466 if ((res >> 26) == ALC880_HP_EVENT)
6467 alc885_mbp3_automute(codec);
6471 static struct hda_verb alc882_targa_verbs[] = {
6472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6475 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6476 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6478 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6479 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6480 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6482 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6483 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6484 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6485 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6489 /* toggle speaker-output according to the hp-jack state */
6490 static void alc882_targa_automute(struct hda_codec *codec)
6492 unsigned int present;
6494 present = snd_hda_codec_read(codec, 0x14, 0,
6495 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6496 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6497 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6498 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6502 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6504 /* Looks like the unsol event is incompatible with the standard
6505 * definition. 4bit tag is placed at 26 bit!
6507 if (((res >> 26) == ALC880_HP_EVENT)) {
6508 alc882_targa_automute(codec);
6512 static struct hda_verb alc882_asus_a7j_verbs[] = {
6513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6517 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6518 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6520 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6521 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6522 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6524 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6525 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6526 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6530 static struct hda_verb alc882_asus_a7m_verbs[] = {
6531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6536 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6538 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6539 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6540 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6542 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6543 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6544 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6548 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6550 unsigned int gpiostate, gpiomask, gpiodir;
6552 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6553 AC_VERB_GET_GPIO_DATA, 0);
6556 gpiostate |= (1 << pin);
6558 gpiostate &= ~(1 << pin);
6560 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6561 AC_VERB_GET_GPIO_MASK, 0);
6562 gpiomask |= (1 << pin);
6564 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6565 AC_VERB_GET_GPIO_DIRECTION, 0);
6566 gpiodir |= (1 << pin);
6569 snd_hda_codec_write(codec, codec->afg, 0,
6570 AC_VERB_SET_GPIO_MASK, gpiomask);
6571 snd_hda_codec_write(codec, codec->afg, 0,
6572 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6576 snd_hda_codec_write(codec, codec->afg, 0,
6577 AC_VERB_SET_GPIO_DATA, gpiostate);
6580 /* set up GPIO at initialization */
6581 static void alc885_macpro_init_hook(struct hda_codec *codec)
6583 alc882_gpio_mute(codec, 0, 0);
6584 alc882_gpio_mute(codec, 1, 0);
6587 /* set up GPIO and update auto-muting at initialization */
6588 static void alc885_imac24_init_hook(struct hda_codec *codec)
6590 alc885_macpro_init_hook(codec);
6591 alc885_imac24_automute(codec);
6595 * generic initialization of ADC, input mixers and output mixers
6597 static struct hda_verb alc882_auto_init_verbs[] = {
6599 * Unmute ADC0-2 and set the default input to mic-in
6601 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6603 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6604 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6605 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6606 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6608 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6610 * Note: PASD motherboards uses the Line In 2 as the input for
6611 * front panel mic (mic 2)
6613 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6616 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6617 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6618 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6621 * Set up output mixers (0x0c - 0x0f)
6623 /* set vol=0 to output mixers */
6624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6627 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6628 /* set up input amps for analog loopback */
6629 /* Amp Indices: DAC = 0, mixer = 1 */
6630 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6631 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6632 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6633 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6634 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6635 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6636 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6637 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6638 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6639 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6641 /* FIXME: use matrix-type input source selection */
6642 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6643 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6662 #ifdef CONFIG_SND_HDA_POWER_SAVE
6663 #define alc882_loopbacks alc880_loopbacks
6666 /* pcm configuration: identiacal with ALC880 */
6667 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6668 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6669 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6670 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6673 * configuration and preset
6675 static const char *alc882_models[ALC882_MODEL_LAST] = {
6676 [ALC882_3ST_DIG] = "3stack-dig",
6677 [ALC882_6ST_DIG] = "6stack-dig",
6678 [ALC882_ARIMA] = "arima",
6679 [ALC882_W2JC] = "w2jc",
6680 [ALC882_TARGA] = "targa",
6681 [ALC882_ASUS_A7J] = "asus-a7j",
6682 [ALC882_ASUS_A7M] = "asus-a7m",
6683 [ALC885_MACPRO] = "macpro",
6684 [ALC885_MBP3] = "mbp3",
6685 [ALC885_IMAC24] = "imac24",
6686 [ALC882_AUTO] = "auto",
6689 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6690 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6691 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6692 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6693 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6694 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6695 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6696 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6697 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6698 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6699 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6700 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6701 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6705 static struct alc_config_preset alc882_presets[] = {
6706 [ALC882_3ST_DIG] = {
6707 .mixers = { alc882_base_mixer },
6708 .init_verbs = { alc882_init_verbs },
6709 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6710 .dac_nids = alc882_dac_nids,
6711 .dig_out_nid = ALC882_DIGOUT_NID,
6712 .dig_in_nid = ALC882_DIGIN_NID,
6713 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6714 .channel_mode = alc882_ch_modes,
6716 .input_mux = &alc882_capture_source,
6718 [ALC882_6ST_DIG] = {
6719 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6720 .init_verbs = { alc882_init_verbs },
6721 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6722 .dac_nids = alc882_dac_nids,
6723 .dig_out_nid = ALC882_DIGOUT_NID,
6724 .dig_in_nid = ALC882_DIGIN_NID,
6725 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6726 .channel_mode = alc882_sixstack_modes,
6727 .input_mux = &alc882_capture_source,
6730 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6731 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6732 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6733 .dac_nids = alc882_dac_nids,
6734 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6735 .channel_mode = alc882_sixstack_modes,
6736 .input_mux = &alc882_capture_source,
6739 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6740 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6741 alc880_gpio1_init_verbs },
6742 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6743 .dac_nids = alc882_dac_nids,
6744 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6745 .channel_mode = alc880_threestack_modes,
6747 .input_mux = &alc882_capture_source,
6748 .dig_out_nid = ALC882_DIGOUT_NID,
6751 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6752 .init_verbs = { alc885_mbp3_init_verbs,
6753 alc880_gpio1_init_verbs },
6754 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6755 .dac_nids = alc882_dac_nids,
6756 .channel_mode = alc885_mbp_6ch_modes,
6757 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6758 .input_mux = &alc882_capture_source,
6759 .dig_out_nid = ALC882_DIGOUT_NID,
6760 .dig_in_nid = ALC882_DIGIN_NID,
6761 .unsol_event = alc885_mbp3_unsol_event,
6762 .init_hook = alc885_mbp3_automute,
6765 .mixers = { alc882_macpro_mixer },
6766 .init_verbs = { alc882_macpro_init_verbs },
6767 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6768 .dac_nids = alc882_dac_nids,
6769 .dig_out_nid = ALC882_DIGOUT_NID,
6770 .dig_in_nid = ALC882_DIGIN_NID,
6771 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6772 .channel_mode = alc882_ch_modes,
6773 .input_mux = &alc882_capture_source,
6774 .init_hook = alc885_macpro_init_hook,
6777 .mixers = { alc885_imac24_mixer },
6778 .init_verbs = { alc885_imac24_init_verbs },
6779 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6780 .dac_nids = alc882_dac_nids,
6781 .dig_out_nid = ALC882_DIGOUT_NID,
6782 .dig_in_nid = ALC882_DIGIN_NID,
6783 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6784 .channel_mode = alc882_ch_modes,
6785 .input_mux = &alc882_capture_source,
6786 .unsol_event = alc885_imac24_unsol_event,
6787 .init_hook = alc885_imac24_init_hook,
6790 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6791 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6792 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6793 .dac_nids = alc882_dac_nids,
6794 .dig_out_nid = ALC882_DIGOUT_NID,
6795 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6796 .adc_nids = alc882_adc_nids,
6797 .capsrc_nids = alc882_capsrc_nids,
6798 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6799 .channel_mode = alc882_3ST_6ch_modes,
6801 .input_mux = &alc882_capture_source,
6802 .unsol_event = alc882_targa_unsol_event,
6803 .init_hook = alc882_targa_automute,
6805 [ALC882_ASUS_A7J] = {
6806 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6807 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6808 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6809 .dac_nids = alc882_dac_nids,
6810 .dig_out_nid = ALC882_DIGOUT_NID,
6811 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6812 .adc_nids = alc882_adc_nids,
6813 .capsrc_nids = alc882_capsrc_nids,
6814 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6815 .channel_mode = alc882_3ST_6ch_modes,
6817 .input_mux = &alc882_capture_source,
6819 [ALC882_ASUS_A7M] = {
6820 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6821 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6822 alc880_gpio1_init_verbs,
6823 alc882_asus_a7m_verbs },
6824 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6825 .dac_nids = alc882_dac_nids,
6826 .dig_out_nid = ALC882_DIGOUT_NID,
6827 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6828 .channel_mode = alc880_threestack_modes,
6830 .input_mux = &alc882_capture_source,
6839 PINFIX_ABIT_AW9D_MAX
6842 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6843 { 0x15, 0x01080104 }, /* side */
6844 { 0x16, 0x01011012 }, /* rear */
6845 { 0x17, 0x01016011 }, /* clfe */
6849 static const struct alc_pincfg *alc882_pin_fixes[] = {
6850 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6853 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6854 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6859 * BIOS auto configuration
6861 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6862 hda_nid_t nid, int pin_type,
6866 struct alc_spec *spec = codec->spec;
6869 alc_set_pin_output(codec, nid, pin_type);
6870 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6873 idx = spec->multiout.dac_nids[dac_idx] - 2;
6874 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6878 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6880 struct alc_spec *spec = codec->spec;
6883 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6884 for (i = 0; i <= HDA_SIDE; i++) {
6885 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6886 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6888 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6893 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6895 struct alc_spec *spec = codec->spec;
6898 pin = spec->autocfg.hp_pins[0];
6899 if (pin) /* connect to front */
6901 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6902 pin = spec->autocfg.speaker_pins[0];
6904 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6907 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6908 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6910 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6912 struct alc_spec *spec = codec->spec;
6915 for (i = 0; i < AUTO_PIN_LAST; i++) {
6916 hda_nid_t nid = spec->autocfg.input_pins[i];
6921 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6922 unsigned int pincap;
6923 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6924 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6928 snd_hda_codec_write(codec, nid, 0,
6929 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6930 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6931 snd_hda_codec_write(codec, nid, 0,
6932 AC_VERB_SET_AMP_GAIN_MUTE,
6937 static void alc882_auto_init_input_src(struct hda_codec *codec)
6939 struct alc_spec *spec = codec->spec;
6942 for (c = 0; c < spec->num_adc_nids; c++) {
6943 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6944 hda_nid_t nid = spec->capsrc_nids[c];
6945 unsigned int mux_idx;
6946 const struct hda_input_mux *imux;
6947 int conns, mute, idx, item;
6949 conns = snd_hda_get_connections(codec, nid, conn_list,
6950 ARRAY_SIZE(conn_list));
6953 mux_idx = c >= spec->num_mux_defs ? 0 : c;
6954 imux = &spec->input_mux[mux_idx];
6955 for (idx = 0; idx < conns; idx++) {
6956 /* if the current connection is the selected one,
6957 * unmute it as default - otherwise mute it
6959 mute = AMP_IN_MUTE(idx);
6960 for (item = 0; item < imux->num_items; item++) {
6961 if (imux->items[item].index == idx) {
6962 if (spec->cur_mux[c] == item)
6963 mute = AMP_IN_UNMUTE(idx);
6967 /* check if we have a selector or mixer
6968 * we could check for the widget type instead, but
6969 * just check for Amp-In presence (in case of mixer
6970 * without amp-in there is something wrong, this
6971 * function shouldn't be used or capsrc nid is wrong)
6973 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
6974 snd_hda_codec_write(codec, nid, 0,
6975 AC_VERB_SET_AMP_GAIN_MUTE,
6977 else if (mute != AMP_IN_MUTE(idx))
6978 snd_hda_codec_write(codec, nid, 0,
6979 AC_VERB_SET_CONNECT_SEL,
6985 /* add mic boosts if needed */
6986 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6988 struct alc_spec *spec = codec->spec;
6992 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6993 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6994 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6996 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7000 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7001 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7002 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7004 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7011 /* almost identical with ALC880 parser... */
7012 static int alc882_parse_auto_config(struct hda_codec *codec)
7014 struct alc_spec *spec = codec->spec;
7015 int err = alc880_parse_auto_config(codec);
7020 return 0; /* no config found */
7022 err = alc_auto_add_mic_boost(codec);
7026 /* hack - override the init verbs */
7027 spec->init_verbs[0] = alc882_auto_init_verbs;
7029 return 1; /* config found */
7032 /* additional initialization for auto-configuration model */
7033 static void alc882_auto_init(struct hda_codec *codec)
7035 struct alc_spec *spec = codec->spec;
7036 alc882_auto_init_multi_out(codec);
7037 alc882_auto_init_hp_out(codec);
7038 alc882_auto_init_analog_input(codec);
7039 alc882_auto_init_input_src(codec);
7040 if (spec->unsol_event)
7041 alc_inithook(codec);
7044 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7046 static int patch_alc882(struct hda_codec *codec)
7048 struct alc_spec *spec;
7049 int err, board_config;
7051 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7057 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7061 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7062 /* Pick up systems that don't supply PCI SSID */
7063 switch (codec->subsystem_id) {
7064 case 0x106b0c00: /* Mac Pro */
7065 board_config = ALC885_MACPRO;
7067 case 0x106b1000: /* iMac 24 */
7068 case 0x106b2800: /* AppleTV */
7069 case 0x106b3e00: /* iMac 24 Aluminium */
7070 board_config = ALC885_IMAC24;
7072 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7073 case 0x106b00a4: /* MacbookPro4,1 */
7074 case 0x106b2c00: /* Macbook Pro rev3 */
7075 case 0x106b3600: /* Macbook 3.1 */
7076 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7077 board_config = ALC885_MBP3;
7080 /* ALC889A is handled better as ALC888-compatible */
7081 if (codec->revision_id == 0x100101 ||
7082 codec->revision_id == 0x100103) {
7084 return patch_alc883(codec);
7086 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7087 "trying auto-probe from BIOS...\n");
7088 board_config = ALC882_AUTO;
7092 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7094 if (board_config == ALC882_AUTO) {
7095 /* automatic parse from the BIOS config */
7096 err = alc882_parse_auto_config(codec);
7102 "hda_codec: Cannot set up configuration "
7103 "from BIOS. Using base mode...\n");
7104 board_config = ALC882_3ST_DIG;
7108 err = snd_hda_attach_beep_device(codec, 0x1);
7114 if (board_config != ALC882_AUTO)
7115 setup_preset(spec, &alc882_presets[board_config]);
7117 if (codec->vendor_id == 0x10ec0885) {
7118 spec->stream_name_analog = "ALC885 Analog";
7119 spec->stream_name_digital = "ALC885 Digital";
7121 spec->stream_name_analog = "ALC882 Analog";
7122 spec->stream_name_digital = "ALC882 Digital";
7125 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7126 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7127 /* FIXME: setup DAC5 */
7128 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7129 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7131 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7132 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7134 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7135 if (!spec->adc_nids && spec->input_mux) {
7136 /* check whether NID 0x07 is valid */
7137 unsigned int wcap = get_wcaps(codec, 0x07);
7139 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7140 if (wcap != AC_WID_AUD_IN) {
7141 spec->adc_nids = alc882_adc_nids_alt;
7142 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7143 spec->capsrc_nids = alc882_capsrc_nids_alt;
7145 spec->adc_nids = alc882_adc_nids;
7146 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7147 spec->capsrc_nids = alc882_capsrc_nids;
7150 set_capture_mixer(spec);
7151 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7153 spec->vmaster_nid = 0x0c;
7155 codec->patch_ops = alc_patch_ops;
7156 if (board_config == ALC882_AUTO)
7157 spec->init_hook = alc882_auto_init;
7158 #ifdef CONFIG_SND_HDA_POWER_SAVE
7159 if (!spec->loopback.amplist)
7160 spec->loopback.amplist = alc882_loopbacks;
7162 codec->proc_widget_hook = print_realtek_coef;
7170 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7171 * configuration. Each pin widget can choose any input DACs and a mixer.
7172 * Each ADC is connected from a mixer of all inputs. This makes possible
7173 * 6-channel independent captures.
7175 * In addition, an independent DAC for the multi-playback (not used in this
7178 #define ALC883_DIGOUT_NID 0x06
7179 #define ALC883_DIGIN_NID 0x0a
7181 #define ALC1200_DIGOUT_NID 0x10
7183 static hda_nid_t alc883_dac_nids[4] = {
7184 /* front, rear, clfe, rear_surr */
7185 0x02, 0x03, 0x04, 0x05
7188 static hda_nid_t alc883_adc_nids[2] = {
7193 static hda_nid_t alc883_adc_nids_alt[1] = {
7198 static hda_nid_t alc883_adc_nids_rev[2] = {
7203 #define alc889_adc_nids alc880_adc_nids
7205 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7207 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7209 #define alc889_capsrc_nids alc882_capsrc_nids
7212 /* FIXME: should be a matrix-type input source selection */
7214 static struct hda_input_mux alc883_capture_source = {
7218 { "Front Mic", 0x1 },
7224 static struct hda_input_mux alc883_3stack_6ch_intel = {
7228 { "Front Mic", 0x0 },
7234 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7242 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7252 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7260 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7264 { "Front Mic", 0x1 },
7269 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7280 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7287 static struct hda_verb alc883_3ST_ch2_init[] = {
7288 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7289 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7290 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7291 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7298 static struct hda_verb alc883_3ST_ch4_init[] = {
7299 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7300 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7301 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7302 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7303 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7310 static struct hda_verb alc883_3ST_ch6_init[] = {
7311 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7312 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7313 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7314 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7315 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7316 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7320 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7321 { 2, alc883_3ST_ch2_init },
7322 { 4, alc883_3ST_ch4_init },
7323 { 6, alc883_3ST_ch6_init },
7329 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7330 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7331 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7332 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7333 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7340 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7341 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7342 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7343 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7344 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7345 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7352 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7353 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7354 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7355 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7356 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7357 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7358 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7362 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7363 { 2, alc883_3ST_ch2_intel_init },
7364 { 4, alc883_3ST_ch4_intel_init },
7365 { 6, alc883_3ST_ch6_intel_init },
7371 static struct hda_verb alc883_sixstack_ch6_init[] = {
7372 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7373 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7374 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7375 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7382 static struct hda_verb alc883_sixstack_ch8_init[] = {
7383 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7384 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7385 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7386 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7390 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7391 { 6, alc883_sixstack_ch6_init },
7392 { 8, alc883_sixstack_ch8_init },
7395 static struct hda_verb alc883_medion_eapd_verbs[] = {
7396 /* eanable EAPD on medion laptop */
7397 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7398 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7402 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7403 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7406 static struct snd_kcontrol_new alc883_base_mixer[] = {
7407 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7408 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7409 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7410 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7411 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7412 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7413 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7414 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7415 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7416 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7417 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7418 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7419 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7421 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7425 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7426 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7427 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7431 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7433 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7434 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7435 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7436 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7437 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7438 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7440 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7443 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7444 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7448 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7449 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7450 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7452 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7454 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7456 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7457 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7458 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7462 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7463 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7464 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7465 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7466 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7468 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7471 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7472 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7476 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7477 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7478 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7479 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7480 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7481 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7482 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7483 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7485 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7487 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7488 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7489 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7493 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7495 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7496 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7497 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7498 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7499 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7500 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7501 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7503 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7504 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7505 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7506 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7507 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7508 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7509 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7510 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7511 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7512 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7516 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7517 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7518 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7519 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7520 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7521 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7523 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7524 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7525 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7526 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7527 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7528 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7529 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7530 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7532 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7533 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7534 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7535 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7536 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7540 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7541 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7542 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7543 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7544 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7545 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7546 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7547 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7548 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7549 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7550 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7551 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7552 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7553 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7555 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7556 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7557 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7558 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7559 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7563 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7564 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7565 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7566 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7567 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7568 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7569 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7570 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7571 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7572 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7573 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7574 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7575 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7576 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7579 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7583 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7584 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7585 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7586 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7587 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7588 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7591 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7592 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7593 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7594 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7598 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7599 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7600 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7601 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7602 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7603 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7606 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7610 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7611 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7612 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7614 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7615 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7618 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7619 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7623 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7626 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7627 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7628 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7630 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7631 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7632 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7636 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7637 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7638 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7640 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7648 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7649 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7651 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7652 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7653 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7654 0x0d, 1, 0x0, HDA_OUTPUT),
7655 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7656 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7657 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7658 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7659 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7660 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7661 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7662 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7663 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7665 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7667 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7669 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7670 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7671 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7675 static struct hda_bind_ctls alc883_bind_cap_vol = {
7676 .ops = &snd_hda_bind_vol,
7678 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7679 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7684 static struct hda_bind_ctls alc883_bind_cap_switch = {
7685 .ops = &snd_hda_bind_sw,
7687 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7688 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7693 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7694 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7695 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7697 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7698 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7699 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7700 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7701 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7705 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7706 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7707 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7709 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7710 /* .name = "Capture Source", */
7711 .name = "Input Source",
7713 .info = alc_mux_enum_info,
7714 .get = alc_mux_enum_get,
7715 .put = alc_mux_enum_put,
7720 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7722 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7723 .name = "Channel Mode",
7724 .info = alc_ch_mode_info,
7725 .get = alc_ch_mode_get,
7726 .put = alc_ch_mode_put,
7731 static struct hda_verb alc883_init_verbs[] = {
7732 /* ADC1: mute amp left and right */
7733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7734 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7735 /* ADC2: mute amp left and right */
7736 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7737 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7738 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7745 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7749 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7751 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7752 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7753 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7755 /* mute analog input loopbacks */
7756 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7757 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7762 /* Front Pin: output 0 (0x0c) */
7763 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7764 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7765 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7766 /* Rear Pin: output 1 (0x0d) */
7767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7769 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7770 /* CLFE Pin: output 2 (0x0e) */
7771 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7772 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7773 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7774 /* Side Pin: output 3 (0x0f) */
7775 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7776 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7777 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7778 /* Mic (rear) pin: input vref at 80% */
7779 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7780 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7781 /* Front Mic pin: input vref at 80% */
7782 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7783 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7784 /* Line In pin: input */
7785 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7786 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7787 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7789 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7790 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7791 /* CD pin widget for input */
7792 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7794 /* FIXME: use matrix-type input source selection */
7795 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7797 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7798 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7799 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7800 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7803 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7804 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7805 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7809 /* toggle speaker-output according to the hp-jack state */
7810 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7812 unsigned int present;
7814 present = snd_hda_codec_read(codec, 0x15, 0,
7815 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7816 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7817 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7818 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7819 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7822 /* auto-toggle front mic */
7824 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7826 unsigned int present;
7829 present = snd_hda_codec_read(codec, 0x18, 0,
7830 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7831 bits = present ? HDA_AMP_MUTE : 0;
7832 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7836 static void alc883_mitac_automute(struct hda_codec *codec)
7838 alc883_mitac_hp_automute(codec);
7839 /* alc883_mitac_mic_automute(codec); */
7842 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7845 switch (res >> 26) {
7846 case ALC880_HP_EVENT:
7847 alc883_mitac_hp_automute(codec);
7849 case ALC880_MIC_EVENT:
7850 /* alc883_mitac_mic_automute(codec); */
7855 static struct hda_verb alc883_mitac_verbs[] = {
7857 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7858 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7860 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7861 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7863 /* enable unsolicited event */
7864 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7865 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7870 static struct hda_verb alc883_clevo_m720_verbs[] = {
7872 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7873 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7875 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7876 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7878 /* enable unsolicited event */
7879 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7880 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7885 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7887 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7888 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7890 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7891 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7893 /* enable unsolicited event */
7894 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7899 static struct hda_verb alc883_tagra_verbs[] = {
7900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7903 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7904 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7906 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7907 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7908 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7910 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7911 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7912 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7913 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7918 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7919 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7920 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7921 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7925 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7926 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7928 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7933 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7936 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7937 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7938 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7942 static struct hda_verb alc883_haier_w66_verbs[] = {
7943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7946 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7948 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7949 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7950 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7951 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7955 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7959 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7960 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7961 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7962 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7963 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7967 static struct hda_verb alc888_3st_hp_verbs[] = {
7968 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7969 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7970 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7974 static struct hda_verb alc888_6st_dell_verbs[] = {
7975 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7979 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7980 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7981 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7982 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7983 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7987 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7988 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7989 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7990 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7991 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7995 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7996 { 2, alc888_3st_hp_2ch_init },
7997 { 6, alc888_3st_hp_6ch_init },
8000 /* toggle front-jack and RCA according to the hp-jack state */
8001 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8003 unsigned int present;
8005 present = snd_hda_codec_read(codec, 0x1b, 0,
8006 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8007 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8008 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8009 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8010 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8013 /* toggle RCA according to the front-jack state */
8014 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8016 unsigned int present;
8018 present = snd_hda_codec_read(codec, 0x14, 0,
8019 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8020 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8021 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8024 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8027 if ((res >> 26) == ALC880_HP_EVENT)
8028 alc888_lenovo_ms7195_front_automute(codec);
8029 if ((res >> 26) == ALC880_FRONT_EVENT)
8030 alc888_lenovo_ms7195_rca_automute(codec);
8033 static struct hda_verb alc883_medion_md2_verbs[] = {
8034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8035 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8037 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8039 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8043 /* toggle speaker-output according to the hp-jack state */
8044 static void alc883_medion_md2_automute(struct hda_codec *codec)
8046 unsigned int present;
8048 present = snd_hda_codec_read(codec, 0x14, 0,
8049 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8050 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8051 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8054 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8057 if ((res >> 26) == ALC880_HP_EVENT)
8058 alc883_medion_md2_automute(codec);
8061 /* toggle speaker-output according to the hp-jack state */
8062 static void alc883_tagra_automute(struct hda_codec *codec)
8064 unsigned int present;
8067 present = snd_hda_codec_read(codec, 0x14, 0,
8068 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8069 bits = present ? HDA_AMP_MUTE : 0;
8070 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8071 HDA_AMP_MUTE, bits);
8072 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8076 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8078 if ((res >> 26) == ALC880_HP_EVENT)
8079 alc883_tagra_automute(codec);
8082 /* toggle speaker-output according to the hp-jack state */
8083 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8085 unsigned int present;
8088 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8089 & AC_PINSENSE_PRESENCE;
8090 bits = present ? HDA_AMP_MUTE : 0;
8091 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8092 HDA_AMP_MUTE, bits);
8095 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8097 unsigned int present;
8099 present = snd_hda_codec_read(codec, 0x18, 0,
8100 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8101 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8102 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8105 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8107 alc883_clevo_m720_hp_automute(codec);
8108 alc883_clevo_m720_mic_automute(codec);
8111 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8114 switch (res >> 26) {
8115 case ALC880_HP_EVENT:
8116 alc883_clevo_m720_hp_automute(codec);
8118 case ALC880_MIC_EVENT:
8119 alc883_clevo_m720_mic_automute(codec);
8124 /* toggle speaker-output according to the hp-jack state */
8125 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8127 unsigned int present;
8130 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8131 & AC_PINSENSE_PRESENCE;
8132 bits = present ? HDA_AMP_MUTE : 0;
8133 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8134 HDA_AMP_MUTE, bits);
8137 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8140 if ((res >> 26) == ALC880_HP_EVENT)
8141 alc883_2ch_fujitsu_pi2515_automute(codec);
8144 static void alc883_haier_w66_automute(struct hda_codec *codec)
8146 unsigned int present;
8149 present = snd_hda_codec_read(codec, 0x1b, 0,
8150 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8151 bits = present ? 0x80 : 0;
8152 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8156 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8159 if ((res >> 26) == ALC880_HP_EVENT)
8160 alc883_haier_w66_automute(codec);
8163 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8165 unsigned int present;
8168 present = snd_hda_codec_read(codec, 0x14, 0,
8169 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8170 bits = present ? HDA_AMP_MUTE : 0;
8171 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8172 HDA_AMP_MUTE, bits);
8175 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8177 unsigned int present;
8180 present = snd_hda_codec_read(codec, 0x1b, 0,
8181 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8182 bits = present ? HDA_AMP_MUTE : 0;
8183 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8184 HDA_AMP_MUTE, bits);
8185 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8186 HDA_AMP_MUTE, bits);
8189 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8192 if ((res >> 26) == ALC880_HP_EVENT)
8193 alc883_lenovo_101e_all_automute(codec);
8194 if ((res >> 26) == ALC880_FRONT_EVENT)
8195 alc883_lenovo_101e_ispeaker_automute(codec);
8198 /* toggle speaker-output according to the hp-jack state */
8199 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8201 unsigned int present;
8203 present = snd_hda_codec_read(codec, 0x14, 0,
8204 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8205 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8206 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8207 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8208 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8211 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8214 if ((res >> 26) == ALC880_HP_EVENT)
8215 alc883_acer_aspire_automute(codec);
8218 static struct hda_verb alc883_acer_eapd_verbs[] = {
8219 /* HP Pin: output 0 (0x0c) */
8220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8222 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8223 /* Front Pin: output 0 (0x0c) */
8224 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8225 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8226 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8227 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8228 /* eanable EAPD on medion laptop */
8229 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8230 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8231 /* enable unsolicited event */
8232 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8236 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8238 unsigned int present;
8240 present = snd_hda_codec_read(codec, 0x1b, 0,
8241 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8242 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8243 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8244 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8245 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8246 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8247 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8248 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8249 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8252 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8255 switch (res >> 26) {
8256 case ALC880_HP_EVENT:
8257 /* printk(KERN_DEBUG "hp_event\n"); */
8258 alc888_6st_dell_front_automute(codec);
8263 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8266 unsigned int present;
8268 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8269 present = snd_hda_codec_read(codec, 0x1b, 0,
8270 AC_VERB_GET_PIN_SENSE, 0);
8271 present = (present & 0x80000000) != 0;
8273 /* mute internal speaker */
8274 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8275 HDA_AMP_MUTE, HDA_AMP_MUTE);
8276 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8277 HDA_AMP_MUTE, HDA_AMP_MUTE);
8278 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8279 HDA_AMP_MUTE, HDA_AMP_MUTE);
8280 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8281 HDA_AMP_MUTE, HDA_AMP_MUTE);
8282 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8283 HDA_AMP_MUTE, HDA_AMP_MUTE);
8285 /* unmute internal speaker if necessary */
8286 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8287 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8288 HDA_AMP_MUTE, mute);
8289 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8290 HDA_AMP_MUTE, mute);
8291 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8292 HDA_AMP_MUTE, mute);
8293 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8294 HDA_AMP_MUTE, mute);
8295 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8296 HDA_AMP_MUTE, mute);
8300 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8303 if ((res >> 26) == ALC880_HP_EVENT)
8304 alc888_lenovo_sky_front_automute(codec);
8308 * generic initialization of ADC, input mixers and output mixers
8310 static struct hda_verb alc883_auto_init_verbs[] = {
8312 * Unmute ADC0-2 and set the default input to mic-in
8314 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8316 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8319 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8321 * Note: PASD motherboards uses the Line In 2 as the input for
8322 * front panel mic (mic 2)
8324 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8332 * Set up output mixers (0x0c - 0x0f)
8334 /* set vol=0 to output mixers */
8335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8338 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8339 /* set up input amps for analog loopback */
8340 /* Amp Indices: DAC = 0, mixer = 1 */
8341 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8342 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8344 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8348 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8349 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8350 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8352 /* FIXME: use matrix-type input source selection */
8353 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8355 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8357 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8358 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8364 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8370 static struct hda_verb alc888_asus_m90v_verbs[] = {
8371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8374 /* enable unsolicited event */
8375 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8376 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8380 static void alc883_nb_mic_automute(struct hda_codec *codec)
8382 unsigned int present;
8384 present = snd_hda_codec_read(codec, 0x18, 0,
8385 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8386 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8387 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8388 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8389 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8392 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8394 unsigned int present;
8397 present = snd_hda_codec_read(codec, 0x1b, 0,
8398 AC_VERB_GET_PIN_SENSE, 0)
8399 & AC_PINSENSE_PRESENCE;
8400 bits = present ? 0 : PIN_OUT;
8401 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8403 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8405 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8409 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8412 switch (res >> 26) {
8413 case ALC880_HP_EVENT:
8414 alc883_M90V_speaker_automute(codec);
8416 case ALC880_MIC_EVENT:
8417 alc883_nb_mic_automute(codec);
8422 static void alc883_mode2_inithook(struct hda_codec *codec)
8424 alc883_M90V_speaker_automute(codec);
8425 alc883_nb_mic_automute(codec);
8428 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8429 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8430 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8432 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8433 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8434 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8435 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8436 /* enable unsolicited event */
8437 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8441 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8443 unsigned int present;
8446 present = snd_hda_codec_read(codec, 0x14, 0,
8447 AC_VERB_GET_PIN_SENSE, 0)
8448 & AC_PINSENSE_PRESENCE;
8449 bits = present ? 0 : PIN_OUT;
8450 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8454 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8457 switch (res >> 26) {
8458 case ALC880_HP_EVENT:
8459 alc883_eee1601_speaker_automute(codec);
8464 static void alc883_eee1601_inithook(struct hda_codec *codec)
8466 alc883_eee1601_speaker_automute(codec);
8469 #ifdef CONFIG_SND_HDA_POWER_SAVE
8470 #define alc883_loopbacks alc880_loopbacks
8473 /* pcm configuration: identiacal with ALC880 */
8474 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8475 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8476 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8477 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8478 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8481 * configuration and preset
8483 static const char *alc883_models[ALC883_MODEL_LAST] = {
8484 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8485 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8486 [ALC883_3ST_6ch] = "3stack-6ch",
8487 [ALC883_6ST_DIG] = "6stack-dig",
8488 [ALC883_TARGA_DIG] = "targa-dig",
8489 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8490 [ALC883_ACER] = "acer",
8491 [ALC883_ACER_ASPIRE] = "acer-aspire",
8492 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8493 [ALC883_MEDION] = "medion",
8494 [ALC883_MEDION_MD2] = "medion-md2",
8495 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8496 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8497 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8498 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8499 [ALC888_LENOVO_SKY] = "lenovo-sky",
8500 [ALC883_HAIER_W66] = "haier-w66",
8501 [ALC888_3ST_HP] = "3stack-hp",
8502 [ALC888_6ST_DELL] = "6stack-dell",
8503 [ALC883_MITAC] = "mitac",
8504 [ALC883_CLEVO_M720] = "clevo-m720",
8505 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8506 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8507 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8508 [ALC1200_ASUS_P5Q] = "asus-p5q",
8509 [ALC883_AUTO] = "auto",
8512 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8513 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8514 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8515 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8516 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8517 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8518 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8519 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8520 ALC888_ACER_ASPIRE_4930G),
8521 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8522 ALC888_ACER_ASPIRE_4930G),
8523 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8524 ALC888_ACER_ASPIRE_4930G),
8526 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8527 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8528 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8529 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8530 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8531 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8532 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8533 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8534 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8535 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8536 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8537 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8538 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8539 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8540 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8541 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8542 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8543 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8544 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8545 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8546 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8547 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8548 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8549 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8550 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8551 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8552 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8553 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8554 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8555 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8556 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8557 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8558 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8559 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8560 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8561 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8562 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8563 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8564 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8565 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8566 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8567 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8568 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8569 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8570 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8571 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8572 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8573 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8574 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
8575 ALC883_FUJITSU_PI2515),
8576 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8577 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8578 ALC888_FUJITSU_XA3530),
8579 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8580 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8581 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8582 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8583 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8584 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8585 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8586 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8587 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8588 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8589 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8590 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8591 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8592 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8596 static hda_nid_t alc1200_slave_dig_outs[] = {
8597 ALC883_DIGOUT_NID, 0,
8600 static struct alc_config_preset alc883_presets[] = {
8601 [ALC883_3ST_2ch_DIG] = {
8602 .mixers = { alc883_3ST_2ch_mixer },
8603 .init_verbs = { alc883_init_verbs },
8604 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8605 .dac_nids = alc883_dac_nids,
8606 .dig_out_nid = ALC883_DIGOUT_NID,
8607 .dig_in_nid = ALC883_DIGIN_NID,
8608 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8609 .channel_mode = alc883_3ST_2ch_modes,
8610 .input_mux = &alc883_capture_source,
8612 [ALC883_3ST_6ch_DIG] = {
8613 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8614 .init_verbs = { alc883_init_verbs },
8615 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8616 .dac_nids = alc883_dac_nids,
8617 .dig_out_nid = ALC883_DIGOUT_NID,
8618 .dig_in_nid = ALC883_DIGIN_NID,
8619 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8620 .channel_mode = alc883_3ST_6ch_modes,
8622 .input_mux = &alc883_capture_source,
8624 [ALC883_3ST_6ch] = {
8625 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8626 .init_verbs = { alc883_init_verbs },
8627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8628 .dac_nids = alc883_dac_nids,
8629 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8630 .channel_mode = alc883_3ST_6ch_modes,
8632 .input_mux = &alc883_capture_source,
8634 [ALC883_3ST_6ch_INTEL] = {
8635 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8636 .init_verbs = { alc883_init_verbs },
8637 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8638 .dac_nids = alc883_dac_nids,
8639 .dig_out_nid = ALC883_DIGOUT_NID,
8640 .dig_in_nid = ALC883_DIGIN_NID,
8641 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8642 .channel_mode = alc883_3ST_6ch_intel_modes,
8644 .input_mux = &alc883_3stack_6ch_intel,
8646 [ALC883_6ST_DIG] = {
8647 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8648 .init_verbs = { alc883_init_verbs },
8649 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8650 .dac_nids = alc883_dac_nids,
8651 .dig_out_nid = ALC883_DIGOUT_NID,
8652 .dig_in_nid = ALC883_DIGIN_NID,
8653 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8654 .channel_mode = alc883_sixstack_modes,
8655 .input_mux = &alc883_capture_source,
8657 [ALC883_TARGA_DIG] = {
8658 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8659 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8660 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8661 .dac_nids = alc883_dac_nids,
8662 .dig_out_nid = ALC883_DIGOUT_NID,
8663 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8664 .channel_mode = alc883_3ST_6ch_modes,
8666 .input_mux = &alc883_capture_source,
8667 .unsol_event = alc883_tagra_unsol_event,
8668 .init_hook = alc883_tagra_automute,
8670 [ALC883_TARGA_2ch_DIG] = {
8671 .mixers = { alc883_tagra_2ch_mixer},
8672 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8673 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8674 .dac_nids = alc883_dac_nids,
8675 .adc_nids = alc883_adc_nids_alt,
8676 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8677 .dig_out_nid = ALC883_DIGOUT_NID,
8678 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8679 .channel_mode = alc883_3ST_2ch_modes,
8680 .input_mux = &alc883_capture_source,
8681 .unsol_event = alc883_tagra_unsol_event,
8682 .init_hook = alc883_tagra_automute,
8685 .mixers = { alc883_base_mixer },
8686 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8687 * and the headphone jack. Turn this on and rely on the
8688 * standard mute methods whenever the user wants to turn
8689 * these outputs off.
8691 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8692 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8693 .dac_nids = alc883_dac_nids,
8694 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8695 .channel_mode = alc883_3ST_2ch_modes,
8696 .input_mux = &alc883_capture_source,
8698 [ALC883_ACER_ASPIRE] = {
8699 .mixers = { alc883_acer_aspire_mixer },
8700 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8701 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8702 .dac_nids = alc883_dac_nids,
8703 .dig_out_nid = ALC883_DIGOUT_NID,
8704 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8705 .channel_mode = alc883_3ST_2ch_modes,
8706 .input_mux = &alc883_capture_source,
8707 .unsol_event = alc883_acer_aspire_unsol_event,
8708 .init_hook = alc883_acer_aspire_automute,
8710 [ALC888_ACER_ASPIRE_4930G] = {
8711 .mixers = { alc888_base_mixer,
8712 alc883_chmode_mixer },
8713 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8714 alc888_acer_aspire_4930g_verbs },
8715 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8716 .dac_nids = alc883_dac_nids,
8717 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8718 .adc_nids = alc883_adc_nids_rev,
8719 .capsrc_nids = alc883_capsrc_nids_rev,
8720 .dig_out_nid = ALC883_DIGOUT_NID,
8721 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8722 .channel_mode = alc883_3ST_6ch_modes,
8725 ARRAY_SIZE(alc888_2_capture_sources),
8726 .input_mux = alc888_2_capture_sources,
8727 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8728 .init_hook = alc888_acer_aspire_4930g_automute,
8731 .mixers = { alc883_fivestack_mixer,
8732 alc883_chmode_mixer },
8733 .init_verbs = { alc883_init_verbs,
8734 alc883_medion_eapd_verbs },
8735 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8736 .dac_nids = alc883_dac_nids,
8737 .adc_nids = alc883_adc_nids_alt,
8738 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8739 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8740 .channel_mode = alc883_sixstack_modes,
8741 .input_mux = &alc883_capture_source,
8743 [ALC883_MEDION_MD2] = {
8744 .mixers = { alc883_medion_md2_mixer},
8745 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8746 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8747 .dac_nids = alc883_dac_nids,
8748 .dig_out_nid = ALC883_DIGOUT_NID,
8749 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8750 .channel_mode = alc883_3ST_2ch_modes,
8751 .input_mux = &alc883_capture_source,
8752 .unsol_event = alc883_medion_md2_unsol_event,
8753 .init_hook = alc883_medion_md2_automute,
8755 [ALC883_LAPTOP_EAPD] = {
8756 .mixers = { alc883_base_mixer },
8757 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8759 .dac_nids = alc883_dac_nids,
8760 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8761 .channel_mode = alc883_3ST_2ch_modes,
8762 .input_mux = &alc883_capture_source,
8764 [ALC883_CLEVO_M720] = {
8765 .mixers = { alc883_clevo_m720_mixer },
8766 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8767 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8768 .dac_nids = alc883_dac_nids,
8769 .dig_out_nid = ALC883_DIGOUT_NID,
8770 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8771 .channel_mode = alc883_3ST_2ch_modes,
8772 .input_mux = &alc883_capture_source,
8773 .unsol_event = alc883_clevo_m720_unsol_event,
8774 .init_hook = alc883_clevo_m720_automute,
8776 [ALC883_LENOVO_101E_2ch] = {
8777 .mixers = { alc883_lenovo_101e_2ch_mixer},
8778 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8780 .dac_nids = alc883_dac_nids,
8781 .adc_nids = alc883_adc_nids_alt,
8782 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8783 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8784 .channel_mode = alc883_3ST_2ch_modes,
8785 .input_mux = &alc883_lenovo_101e_capture_source,
8786 .unsol_event = alc883_lenovo_101e_unsol_event,
8787 .init_hook = alc883_lenovo_101e_all_automute,
8789 [ALC883_LENOVO_NB0763] = {
8790 .mixers = { alc883_lenovo_nb0763_mixer },
8791 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8792 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8793 .dac_nids = alc883_dac_nids,
8794 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8795 .channel_mode = alc883_3ST_2ch_modes,
8797 .input_mux = &alc883_lenovo_nb0763_capture_source,
8798 .unsol_event = alc883_medion_md2_unsol_event,
8799 .init_hook = alc883_medion_md2_automute,
8801 [ALC888_LENOVO_MS7195_DIG] = {
8802 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8803 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8804 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8805 .dac_nids = alc883_dac_nids,
8806 .dig_out_nid = ALC883_DIGOUT_NID,
8807 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8808 .channel_mode = alc883_3ST_6ch_modes,
8810 .input_mux = &alc883_capture_source,
8811 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8812 .init_hook = alc888_lenovo_ms7195_front_automute,
8814 [ALC883_HAIER_W66] = {
8815 .mixers = { alc883_tagra_2ch_mixer},
8816 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8817 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8818 .dac_nids = alc883_dac_nids,
8819 .dig_out_nid = ALC883_DIGOUT_NID,
8820 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8821 .channel_mode = alc883_3ST_2ch_modes,
8822 .input_mux = &alc883_capture_source,
8823 .unsol_event = alc883_haier_w66_unsol_event,
8824 .init_hook = alc883_haier_w66_automute,
8827 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8828 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8829 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8830 .dac_nids = alc883_dac_nids,
8831 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8832 .channel_mode = alc888_3st_hp_modes,
8834 .input_mux = &alc883_capture_source,
8836 [ALC888_6ST_DELL] = {
8837 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8838 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8839 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8840 .dac_nids = alc883_dac_nids,
8841 .dig_out_nid = ALC883_DIGOUT_NID,
8842 .dig_in_nid = ALC883_DIGIN_NID,
8843 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8844 .channel_mode = alc883_sixstack_modes,
8845 .input_mux = &alc883_capture_source,
8846 .unsol_event = alc888_6st_dell_unsol_event,
8847 .init_hook = alc888_6st_dell_front_automute,
8850 .mixers = { alc883_mitac_mixer },
8851 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8852 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8853 .dac_nids = alc883_dac_nids,
8854 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8855 .channel_mode = alc883_3ST_2ch_modes,
8856 .input_mux = &alc883_capture_source,
8857 .unsol_event = alc883_mitac_unsol_event,
8858 .init_hook = alc883_mitac_automute,
8860 [ALC883_FUJITSU_PI2515] = {
8861 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8862 .init_verbs = { alc883_init_verbs,
8863 alc883_2ch_fujitsu_pi2515_verbs},
8864 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8865 .dac_nids = alc883_dac_nids,
8866 .dig_out_nid = ALC883_DIGOUT_NID,
8867 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8868 .channel_mode = alc883_3ST_2ch_modes,
8869 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8870 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8871 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8873 [ALC888_FUJITSU_XA3530] = {
8874 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8875 .init_verbs = { alc883_init_verbs,
8876 alc888_fujitsu_xa3530_verbs },
8877 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8878 .dac_nids = alc883_dac_nids,
8879 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8880 .adc_nids = alc883_adc_nids_rev,
8881 .capsrc_nids = alc883_capsrc_nids_rev,
8882 .dig_out_nid = ALC883_DIGOUT_NID,
8883 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8884 .channel_mode = alc888_4ST_8ch_intel_modes,
8886 ARRAY_SIZE(alc888_2_capture_sources),
8887 .input_mux = alc888_2_capture_sources,
8888 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8889 .init_hook = alc888_fujitsu_xa3530_automute,
8891 [ALC888_LENOVO_SKY] = {
8892 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8893 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8894 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8895 .dac_nids = alc883_dac_nids,
8896 .dig_out_nid = ALC883_DIGOUT_NID,
8897 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8898 .channel_mode = alc883_sixstack_modes,
8900 .input_mux = &alc883_lenovo_sky_capture_source,
8901 .unsol_event = alc883_lenovo_sky_unsol_event,
8902 .init_hook = alc888_lenovo_sky_front_automute,
8904 [ALC888_ASUS_M90V] = {
8905 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8906 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8907 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8908 .dac_nids = alc883_dac_nids,
8909 .dig_out_nid = ALC883_DIGOUT_NID,
8910 .dig_in_nid = ALC883_DIGIN_NID,
8911 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8912 .channel_mode = alc883_3ST_6ch_modes,
8914 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8915 .unsol_event = alc883_mode2_unsol_event,
8916 .init_hook = alc883_mode2_inithook,
8918 [ALC888_ASUS_EEE1601] = {
8919 .mixers = { alc883_asus_eee1601_mixer },
8920 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8921 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8922 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8923 .dac_nids = alc883_dac_nids,
8924 .dig_out_nid = ALC883_DIGOUT_NID,
8925 .dig_in_nid = ALC883_DIGIN_NID,
8926 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8927 .channel_mode = alc883_3ST_2ch_modes,
8929 .input_mux = &alc883_asus_eee1601_capture_source,
8930 .unsol_event = alc883_eee1601_unsol_event,
8931 .init_hook = alc883_eee1601_inithook,
8933 [ALC1200_ASUS_P5Q] = {
8934 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8935 .init_verbs = { alc883_init_verbs },
8936 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8937 .dac_nids = alc883_dac_nids,
8938 .dig_out_nid = ALC1200_DIGOUT_NID,
8939 .dig_in_nid = ALC883_DIGIN_NID,
8940 .slave_dig_outs = alc1200_slave_dig_outs,
8941 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8942 .channel_mode = alc883_sixstack_modes,
8943 .input_mux = &alc883_capture_source,
8949 * BIOS auto configuration
8951 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8952 hda_nid_t nid, int pin_type,
8956 struct alc_spec *spec = codec->spec;
8959 alc_set_pin_output(codec, nid, pin_type);
8960 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8963 idx = spec->multiout.dac_nids[dac_idx] - 2;
8964 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8968 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8970 struct alc_spec *spec = codec->spec;
8973 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8974 for (i = 0; i <= HDA_SIDE; i++) {
8975 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8976 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8978 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8983 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8985 struct alc_spec *spec = codec->spec;
8988 pin = spec->autocfg.hp_pins[0];
8989 if (pin) /* connect to front */
8991 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8992 pin = spec->autocfg.speaker_pins[0];
8994 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8997 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8998 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9000 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9002 struct alc_spec *spec = codec->spec;
9005 for (i = 0; i < AUTO_PIN_LAST; i++) {
9006 hda_nid_t nid = spec->autocfg.input_pins[i];
9007 if (alc883_is_input_pin(nid)) {
9008 snd_hda_codec_write(codec, nid, 0,
9009 AC_VERB_SET_PIN_WIDGET_CONTROL,
9010 (i <= AUTO_PIN_FRONT_MIC ?
9011 PIN_VREF80 : PIN_IN));
9012 if (nid != ALC883_PIN_CD_NID)
9013 snd_hda_codec_write(codec, nid, 0,
9014 AC_VERB_SET_AMP_GAIN_MUTE,
9020 #define alc883_auto_init_input_src alc882_auto_init_input_src
9022 /* almost identical with ALC880 parser... */
9023 static int alc883_parse_auto_config(struct hda_codec *codec)
9025 struct alc_spec *spec = codec->spec;
9026 int err = alc880_parse_auto_config(codec);
9027 struct auto_pin_cfg *cfg = &spec->autocfg;
9033 return 0; /* no config found */
9035 err = alc_auto_add_mic_boost(codec);
9039 /* hack - override the init verbs */
9040 spec->init_verbs[0] = alc883_auto_init_verbs;
9042 /* setup input_mux for ALC889 */
9043 if (codec->vendor_id == 0x10ec0889) {
9044 /* digital-mic input pin is excluded in alc880_auto_create..()
9045 * because it's under 0x18
9047 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9048 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9049 struct hda_input_mux *imux = &spec->private_imux[0];
9050 for (i = 1; i < 3; i++)
9051 memcpy(&spec->private_imux[i],
9052 &spec->private_imux[0],
9053 sizeof(spec->private_imux[0]));
9054 imux->items[imux->num_items].label = "Int DMic";
9055 imux->items[imux->num_items].index = 0x0b;
9057 spec->num_mux_defs = 3;
9058 spec->input_mux = spec->private_imux;
9062 return 1; /* config found */
9065 /* additional initialization for auto-configuration model */
9066 static void alc883_auto_init(struct hda_codec *codec)
9068 struct alc_spec *spec = codec->spec;
9069 alc883_auto_init_multi_out(codec);
9070 alc883_auto_init_hp_out(codec);
9071 alc883_auto_init_analog_input(codec);
9072 alc883_auto_init_input_src(codec);
9073 if (spec->unsol_event)
9074 alc_inithook(codec);
9077 static int patch_alc883(struct hda_codec *codec)
9079 struct alc_spec *spec;
9080 int err, board_config;
9082 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9088 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9090 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9093 if (board_config < 0) {
9094 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9095 "trying auto-probe from BIOS...\n");
9096 board_config = ALC883_AUTO;
9099 if (board_config == ALC883_AUTO) {
9100 /* automatic parse from the BIOS config */
9101 err = alc883_parse_auto_config(codec);
9107 "hda_codec: Cannot set up configuration "
9108 "from BIOS. Using base mode...\n");
9109 board_config = ALC883_3ST_2ch_DIG;
9113 err = snd_hda_attach_beep_device(codec, 0x1);
9119 if (board_config != ALC883_AUTO)
9120 setup_preset(spec, &alc883_presets[board_config]);
9122 switch (codec->vendor_id) {
9124 if (codec->revision_id == 0x100101) {
9125 spec->stream_name_analog = "ALC1200 Analog";
9126 spec->stream_name_digital = "ALC1200 Digital";
9128 spec->stream_name_analog = "ALC888 Analog";
9129 spec->stream_name_digital = "ALC888 Digital";
9131 if (!spec->num_adc_nids) {
9132 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9133 spec->adc_nids = alc883_adc_nids;
9135 if (!spec->capsrc_nids)
9136 spec->capsrc_nids = alc883_capsrc_nids;
9137 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9140 spec->stream_name_analog = "ALC889 Analog";
9141 spec->stream_name_digital = "ALC889 Digital";
9142 if (!spec->num_adc_nids) {
9143 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9144 spec->adc_nids = alc889_adc_nids;
9146 if (!spec->capsrc_nids)
9147 spec->capsrc_nids = alc889_capsrc_nids;
9148 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9152 spec->stream_name_analog = "ALC883 Analog";
9153 spec->stream_name_digital = "ALC883 Digital";
9154 if (!spec->num_adc_nids) {
9155 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9156 spec->adc_nids = alc883_adc_nids;
9158 if (!spec->capsrc_nids)
9159 spec->capsrc_nids = alc883_capsrc_nids;
9160 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9164 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9165 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9166 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9168 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9169 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9171 if (!spec->cap_mixer)
9172 set_capture_mixer(spec);
9173 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9175 spec->vmaster_nid = 0x0c;
9177 codec->patch_ops = alc_patch_ops;
9178 if (board_config == ALC883_AUTO)
9179 spec->init_hook = alc883_auto_init;
9181 #ifdef CONFIG_SND_HDA_POWER_SAVE
9182 if (!spec->loopback.amplist)
9183 spec->loopback.amplist = alc883_loopbacks;
9185 codec->proc_widget_hook = print_realtek_coef;
9194 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9195 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9197 #define alc262_dac_nids alc260_dac_nids
9198 #define alc262_adc_nids alc882_adc_nids
9199 #define alc262_adc_nids_alt alc882_adc_nids_alt
9200 #define alc262_capsrc_nids alc882_capsrc_nids
9201 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9203 #define alc262_modes alc260_modes
9204 #define alc262_capture_source alc882_capture_source
9206 static hda_nid_t alc262_dmic_adc_nids[1] = {
9211 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9213 static struct snd_kcontrol_new alc262_base_mixer[] = {
9214 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9215 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9222 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9223 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9225 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9228 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9229 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9233 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9234 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9235 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9236 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9237 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9238 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9239 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9241 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9242 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9243 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9244 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9245 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9246 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9251 /* update HP, line and mono-out pins according to the master switch */
9252 static void alc262_hp_master_update(struct hda_codec *codec)
9254 struct alc_spec *spec = codec->spec;
9255 int val = spec->master_sw;
9258 snd_hda_codec_write_cache(codec, 0x1b, 0,
9259 AC_VERB_SET_PIN_WIDGET_CONTROL,
9261 snd_hda_codec_write_cache(codec, 0x15, 0,
9262 AC_VERB_SET_PIN_WIDGET_CONTROL,
9264 /* mono (speaker) depending on the HP jack sense */
9265 val = val && !spec->jack_present;
9266 snd_hda_codec_write_cache(codec, 0x16, 0,
9267 AC_VERB_SET_PIN_WIDGET_CONTROL,
9271 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9273 struct alc_spec *spec = codec->spec;
9274 unsigned int presence;
9275 presence = snd_hda_codec_read(codec, 0x1b, 0,
9276 AC_VERB_GET_PIN_SENSE, 0);
9277 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9278 alc262_hp_master_update(codec);
9281 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9283 if ((res >> 26) != ALC880_HP_EVENT)
9285 alc262_hp_bpc_automute(codec);
9288 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9290 struct alc_spec *spec = codec->spec;
9291 unsigned int presence;
9292 presence = snd_hda_codec_read(codec, 0x15, 0,
9293 AC_VERB_GET_PIN_SENSE, 0);
9294 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9295 alc262_hp_master_update(codec);
9298 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9301 if ((res >> 26) != ALC880_HP_EVENT)
9303 alc262_hp_wildwest_automute(codec);
9306 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9307 struct snd_ctl_elem_value *ucontrol)
9309 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9310 struct alc_spec *spec = codec->spec;
9311 *ucontrol->value.integer.value = spec->master_sw;
9315 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9316 struct snd_ctl_elem_value *ucontrol)
9318 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9319 struct alc_spec *spec = codec->spec;
9320 int val = !!*ucontrol->value.integer.value;
9322 if (val == spec->master_sw)
9324 spec->master_sw = val;
9325 alc262_hp_master_update(codec);
9329 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9331 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9332 .name = "Master Playback Switch",
9333 .info = snd_ctl_boolean_mono_info,
9334 .get = alc262_hp_master_sw_get,
9335 .put = alc262_hp_master_sw_put,
9337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9338 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9340 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9342 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9345 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9346 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9347 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9348 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9349 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9353 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9354 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9355 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9359 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9361 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9362 .name = "Master Playback Switch",
9363 .info = snd_ctl_boolean_mono_info,
9364 .get = alc262_hp_master_sw_get,
9365 .put = alc262_hp_master_sw_put,
9367 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9368 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9369 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9371 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9373 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9375 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9376 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9377 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9378 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9379 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9380 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9381 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9385 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9386 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9387 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9388 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9392 /* mute/unmute internal speaker according to the hp jack and mute state */
9393 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9395 struct alc_spec *spec = codec->spec;
9397 if (force || !spec->sense_updated) {
9398 unsigned int present;
9399 present = snd_hda_codec_read(codec, 0x15, 0,
9400 AC_VERB_GET_PIN_SENSE, 0);
9401 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9402 spec->sense_updated = 1;
9404 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9405 spec->jack_present ? HDA_AMP_MUTE : 0);
9408 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9411 if ((res >> 26) != ALC880_HP_EVENT)
9413 alc262_hp_t5735_automute(codec, 1);
9416 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9418 alc262_hp_t5735_automute(codec, 1);
9421 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9422 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9423 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9424 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9427 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9428 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9432 static struct hda_verb alc262_hp_t5735_verbs[] = {
9433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9434 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9436 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9440 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9441 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9442 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9443 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9444 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9450 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9451 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9452 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9453 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9454 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9455 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9456 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9464 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9471 /* bind hp and internal speaker mute (with plug check) */
9472 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9473 struct snd_ctl_elem_value *ucontrol)
9475 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9476 long *valp = ucontrol->value.integer.value;
9479 /* change hp mute */
9480 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9482 valp[0] ? 0 : HDA_AMP_MUTE);
9483 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9485 valp[1] ? 0 : HDA_AMP_MUTE);
9487 /* change speaker according to HP jack state */
9488 struct alc_spec *spec = codec->spec;
9490 if (spec->jack_present)
9491 mute = HDA_AMP_MUTE;
9493 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9495 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9496 HDA_AMP_MUTE, mute);
9501 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9502 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9504 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9505 .name = "Master Playback Switch",
9506 .info = snd_hda_mixer_amp_switch_info,
9507 .get = snd_hda_mixer_amp_switch_get,
9508 .put = alc262_sony_master_sw_put,
9509 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9511 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9512 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9513 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9514 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9518 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9519 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9520 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9523 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9524 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9525 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9529 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9530 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9531 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9532 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9533 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9534 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9535 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9538 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9539 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9540 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9541 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9545 static struct hda_verb alc262_tyan_verbs[] = {
9546 /* Headphone automute */
9547 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9548 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9549 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9551 /* P11 AUX_IN, white 4-pin connector */
9552 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9553 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9554 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9555 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9560 /* unsolicited event for HP jack sensing */
9561 static void alc262_tyan_automute(struct hda_codec *codec)
9564 unsigned int present;
9566 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9567 present = snd_hda_codec_read(codec, 0x1b, 0,
9568 AC_VERB_GET_PIN_SENSE, 0);
9569 present = (present & 0x80000000) != 0;
9571 /* mute line output on ATX panel */
9572 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9573 HDA_AMP_MUTE, HDA_AMP_MUTE);
9575 /* unmute line output if necessary */
9576 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9577 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9578 HDA_AMP_MUTE, mute);
9582 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9585 if ((res >> 26) != ALC880_HP_EVENT)
9587 alc262_tyan_automute(codec);
9590 #define alc262_capture_mixer alc882_capture_mixer
9591 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9594 * generic initialization of ADC, input mixers and output mixers
9596 static struct hda_verb alc262_init_verbs[] = {
9598 * Unmute ADC0-2 and set the default input to mic-in
9600 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9602 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9604 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9605 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9607 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9609 * Note: PASD motherboards uses the Line In 2 as the input for
9610 * front panel mic (mic 2)
9612 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9616 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9617 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9620 * Set up output mixers (0x0c - 0x0e)
9622 /* set vol=0 to output mixers */
9623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9624 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9626 /* set up input amps for analog loopback */
9627 /* Amp Indices: DAC = 0, mixer = 1 */
9628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9630 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9631 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9633 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9637 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9638 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9639 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9640 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9642 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9644 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9646 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9648 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9649 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9651 /* FIXME: use matrix-type input source selection */
9652 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9653 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9659 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9672 static struct hda_verb alc262_eapd_verbs[] = {
9673 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9674 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9678 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9679 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9684 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9686 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9687 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9689 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9690 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9694 static struct hda_verb alc262_sony_unsol_verbs[] = {
9695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9696 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9697 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9699 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9704 static struct hda_input_mux alc262_dmic_capture_source = {
9707 { "Int DMic", 0x9 },
9712 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9713 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9714 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9715 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9717 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9721 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9722 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9725 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9726 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9727 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9728 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9729 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9733 static void alc262_dmic_automute(struct hda_codec *codec)
9735 unsigned int present;
9737 present = snd_hda_codec_read(codec, 0x18, 0,
9738 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9739 snd_hda_codec_write(codec, 0x22, 0,
9740 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9743 /* toggle speaker-output according to the hp-jack state */
9744 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9746 unsigned int present;
9749 present = snd_hda_codec_read(codec, 0x15, 0,
9750 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9751 bits = present ? 0 : PIN_OUT;
9752 snd_hda_codec_write(codec, 0x14, 0,
9753 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9758 /* unsolicited event for HP jack sensing */
9759 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9762 if ((res >> 26) == ALC880_HP_EVENT)
9763 alc262_toshiba_s06_speaker_automute(codec);
9764 if ((res >> 26) == ALC880_MIC_EVENT)
9765 alc262_dmic_automute(codec);
9769 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9771 alc262_toshiba_s06_speaker_automute(codec);
9772 alc262_dmic_automute(codec);
9775 /* mute/unmute internal speaker according to the hp jack and mute state */
9776 static void alc262_hippo_automute(struct hda_codec *codec)
9778 struct alc_spec *spec = codec->spec;
9780 unsigned int present;
9782 /* need to execute and sync at first */
9783 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9784 present = snd_hda_codec_read(codec, 0x15, 0,
9785 AC_VERB_GET_PIN_SENSE, 0);
9786 spec->jack_present = (present & 0x80000000) != 0;
9787 if (spec->jack_present) {
9788 /* mute internal speaker */
9789 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9790 HDA_AMP_MUTE, HDA_AMP_MUTE);
9792 /* unmute internal speaker if necessary */
9793 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9794 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9795 HDA_AMP_MUTE, mute);
9799 /* unsolicited event for HP jack sensing */
9800 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9803 if ((res >> 26) != ALC880_HP_EVENT)
9805 alc262_hippo_automute(codec);
9808 static void alc262_hippo1_automute(struct hda_codec *codec)
9811 unsigned int present;
9813 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9814 present = snd_hda_codec_read(codec, 0x1b, 0,
9815 AC_VERB_GET_PIN_SENSE, 0);
9816 present = (present & 0x80000000) != 0;
9818 /* mute internal speaker */
9819 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9820 HDA_AMP_MUTE, HDA_AMP_MUTE);
9822 /* unmute internal speaker if necessary */
9823 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9824 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9825 HDA_AMP_MUTE, mute);
9829 /* unsolicited event for HP jack sensing */
9830 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9833 if ((res >> 26) != ALC880_HP_EVENT)
9835 alc262_hippo1_automute(codec);
9841 * 0x16 = internal speaker
9842 * 0x18 = external mic
9845 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9846 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9847 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9850 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9851 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9853 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9858 static struct hda_verb alc262_nec_verbs[] = {
9859 /* Unmute Speaker */
9860 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9863 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9866 /* External mic to headphone */
9867 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9868 /* External mic to speaker */
9869 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9875 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9876 * 0x1b = port replicator headphone out
9879 #define ALC_HP_EVENT 0x37
9881 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9882 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9883 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9884 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9885 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9889 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9890 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9891 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9895 static struct hda_input_mux alc262_fujitsu_capture_source = {
9904 static struct hda_input_mux alc262_HP_capture_source = {
9908 { "Front Mic", 0x1 },
9915 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9919 { "Front Mic", 0x2 },
9925 /* mute/unmute internal speaker according to the hp jacks and mute state */
9926 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9928 struct alc_spec *spec = codec->spec;
9931 if (force || !spec->sense_updated) {
9932 unsigned int present;
9933 /* need to execute and sync at first */
9934 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9935 /* check laptop HP jack */
9936 present = snd_hda_codec_read(codec, 0x14, 0,
9937 AC_VERB_GET_PIN_SENSE, 0);
9938 /* need to execute and sync at first */
9939 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9940 /* check docking HP jack */
9941 present |= snd_hda_codec_read(codec, 0x1b, 0,
9942 AC_VERB_GET_PIN_SENSE, 0);
9943 if (present & AC_PINSENSE_PRESENCE)
9944 spec->jack_present = 1;
9946 spec->jack_present = 0;
9947 spec->sense_updated = 1;
9949 /* unmute internal speaker only if both HPs are unplugged and
9950 * master switch is on
9952 if (spec->jack_present)
9953 mute = HDA_AMP_MUTE;
9955 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9956 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9957 HDA_AMP_MUTE, mute);
9960 /* unsolicited event for HP jack sensing */
9961 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9964 if ((res >> 26) != ALC_HP_EVENT)
9966 alc262_fujitsu_automute(codec, 1);
9969 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9971 alc262_fujitsu_automute(codec, 1);
9974 /* bind volumes of both NID 0x0c and 0x0d */
9975 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9976 .ops = &snd_hda_bind_vol,
9978 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9979 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9984 /* mute/unmute internal speaker according to the hp jack and mute state */
9985 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9987 struct alc_spec *spec = codec->spec;
9990 if (force || !spec->sense_updated) {
9991 unsigned int present_int_hp;
9992 /* need to execute and sync at first */
9993 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9994 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9995 AC_VERB_GET_PIN_SENSE, 0);
9996 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9997 spec->sense_updated = 1;
9999 if (spec->jack_present) {
10000 /* mute internal speaker */
10001 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10002 HDA_AMP_MUTE, HDA_AMP_MUTE);
10003 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10004 HDA_AMP_MUTE, HDA_AMP_MUTE);
10006 /* unmute internal speaker if necessary */
10007 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10008 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10009 HDA_AMP_MUTE, mute);
10010 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10011 HDA_AMP_MUTE, mute);
10015 /* unsolicited event for HP jack sensing */
10016 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10019 if ((res >> 26) != ALC_HP_EVENT)
10021 alc262_lenovo_3000_automute(codec, 1);
10024 /* bind hp and internal speaker mute (with plug check) */
10025 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10026 struct snd_ctl_elem_value *ucontrol)
10028 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10029 long *valp = ucontrol->value.integer.value;
10032 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10034 valp ? 0 : HDA_AMP_MUTE);
10035 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10037 valp ? 0 : HDA_AMP_MUTE);
10040 alc262_fujitsu_automute(codec, 0);
10044 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10045 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10047 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10048 .name = "Master Playback Switch",
10049 .info = snd_hda_mixer_amp_switch_info,
10050 .get = snd_hda_mixer_amp_switch_get,
10051 .put = alc262_fujitsu_master_sw_put,
10052 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10054 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10055 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10056 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10059 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10060 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10061 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10065 /* bind hp and internal speaker mute (with plug check) */
10066 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10067 struct snd_ctl_elem_value *ucontrol)
10069 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10070 long *valp = ucontrol->value.integer.value;
10073 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10075 valp ? 0 : HDA_AMP_MUTE);
10078 alc262_lenovo_3000_automute(codec, 0);
10082 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10083 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10086 .name = "Master Playback Switch",
10087 .info = snd_hda_mixer_amp_switch_info,
10088 .get = snd_hda_mixer_amp_switch_get,
10089 .put = alc262_lenovo_3000_master_sw_put,
10090 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10094 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10095 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10096 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10097 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10098 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10099 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10103 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10104 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10106 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10107 .name = "Master Playback Switch",
10108 .info = snd_hda_mixer_amp_switch_info,
10109 .get = snd_hda_mixer_amp_switch_get,
10110 .put = alc262_sony_master_sw_put,
10111 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10115 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10116 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10117 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10118 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10122 /* additional init verbs for Benq laptops */
10123 static struct hda_verb alc262_EAPD_verbs[] = {
10124 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10125 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10129 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10130 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10131 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10133 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10134 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10138 /* Samsung Q1 Ultra Vista model setup */
10139 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10140 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10141 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10144 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10145 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10149 static struct hda_verb alc262_ultra_verbs[] = {
10151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10152 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10153 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10155 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10157 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10158 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10160 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10161 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10162 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10163 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10164 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10166 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10168 /* ADC, choose mic */
10169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10171 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10172 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10173 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10174 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10175 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10176 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10177 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10178 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10182 /* mute/unmute internal speaker according to the hp jack and mute state */
10183 static void alc262_ultra_automute(struct hda_codec *codec)
10185 struct alc_spec *spec = codec->spec;
10189 /* auto-mute only when HP is used as HP */
10190 if (!spec->cur_mux[0]) {
10191 unsigned int present;
10192 /* need to execute and sync at first */
10193 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10194 present = snd_hda_codec_read(codec, 0x15, 0,
10195 AC_VERB_GET_PIN_SENSE, 0);
10196 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10197 if (spec->jack_present)
10198 mute = HDA_AMP_MUTE;
10200 /* mute/unmute internal speaker */
10201 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10202 HDA_AMP_MUTE, mute);
10203 /* mute/unmute HP */
10204 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10205 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10208 /* unsolicited event for HP jack sensing */
10209 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10212 if ((res >> 26) != ALC880_HP_EVENT)
10214 alc262_ultra_automute(codec);
10217 static struct hda_input_mux alc262_ultra_capture_source = {
10221 { "Headphone", 0x7 },
10225 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10226 struct snd_ctl_elem_value *ucontrol)
10228 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10229 struct alc_spec *spec = codec->spec;
10232 ret = alc_mux_enum_put(kcontrol, ucontrol);
10235 /* reprogram the HP pin as mic or HP according to the input source */
10236 snd_hda_codec_write_cache(codec, 0x15, 0,
10237 AC_VERB_SET_PIN_WIDGET_CONTROL,
10238 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10239 alc262_ultra_automute(codec); /* mute/unmute HP */
10243 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10244 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10245 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10248 .name = "Capture Source",
10249 .info = alc_mux_enum_info,
10250 .get = alc_mux_enum_get,
10251 .put = alc262_ultra_mux_enum_put,
10256 /* add playback controls from the parsed DAC table */
10257 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10258 const struct auto_pin_cfg *cfg)
10263 spec->multiout.num_dacs = 1; /* only use one dac */
10264 spec->multiout.dac_nids = spec->private_dac_nids;
10265 spec->multiout.dac_nids[0] = 2;
10267 nid = cfg->line_out_pins[0];
10269 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10270 "Front Playback Volume",
10271 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10274 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10275 "Front Playback Switch",
10276 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10281 nid = cfg->speaker_pins[0];
10284 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10285 "Speaker Playback Volume",
10286 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10290 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10291 "Speaker Playback Switch",
10292 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10297 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10298 "Speaker Playback Switch",
10299 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10305 nid = cfg->hp_pins[0];
10307 /* spec->multiout.hp_nid = 2; */
10309 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10310 "Headphone Playback Volume",
10311 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10315 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10316 "Headphone Playback Switch",
10317 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10322 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10323 "Headphone Playback Switch",
10324 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10333 /* identical with ALC880 */
10334 #define alc262_auto_create_analog_input_ctls \
10335 alc880_auto_create_analog_input_ctls
10338 * generic initialization of ADC, input mixers and output mixers
10340 static struct hda_verb alc262_volume_init_verbs[] = {
10342 * Unmute ADC0-2 and set the default input to mic-in
10344 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10345 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10346 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10347 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10348 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10349 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10351 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10353 * Note: PASD motherboards uses the Line In 2 as the input for
10354 * front panel mic (mic 2)
10356 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10358 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10359 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10360 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10361 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10364 * Set up output mixers (0x0c - 0x0f)
10366 /* set vol=0 to output mixers */
10367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10371 /* set up input amps for analog loopback */
10372 /* Amp Indices: DAC = 0, mixer = 1 */
10373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10375 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10376 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10377 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10378 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10380 /* FIXME: use matrix-type input source selection */
10381 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10382 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10388 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10401 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10403 * Unmute ADC0-2 and set the default input to mic-in
10405 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10406 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10407 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10408 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10409 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10410 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10412 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10414 * Note: PASD motherboards uses the Line In 2 as the input for
10415 * front panel mic (mic 2)
10417 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10421 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10422 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10423 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10424 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10427 * Set up output mixers (0x0c - 0x0e)
10429 /* set vol=0 to output mixers */
10430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10432 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10434 /* set up input amps for analog loopback */
10435 /* Amp Indices: DAC = 0, mixer = 1 */
10436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10438 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10439 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10441 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10443 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10444 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10445 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10447 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10450 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10451 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10453 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10454 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10455 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10456 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10457 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10460 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10461 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10462 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10463 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10464 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10467 /* FIXME: use matrix-type input source selection */
10468 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10469 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10485 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10490 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10492 * Unmute ADC0-2 and set the default input to mic-in
10494 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10496 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10497 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10498 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10499 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10501 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10503 * Note: PASD motherboards uses the Line In 2 as the input for front
10504 * panel mic (mic 2)
10506 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10511 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10512 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10516 * Set up output mixers (0x0c - 0x0e)
10518 /* set vol=0 to output mixers */
10519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10523 /* set up input amps for analog loopback */
10524 /* Amp Indices: DAC = 0, mixer = 1 */
10525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10528 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10529 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10534 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10535 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10536 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10537 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10538 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10539 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10541 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10544 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10545 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10547 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10548 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10549 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10550 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10551 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10552 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10554 /* FIXME: use matrix-type input source selection */
10555 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10556 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10558 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10562 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10563 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10568 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10569 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10570 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10571 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10574 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10575 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10578 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10581 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10586 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10589 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10590 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10592 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10593 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10594 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10595 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10598 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10604 #ifdef CONFIG_SND_HDA_POWER_SAVE
10605 #define alc262_loopbacks alc880_loopbacks
10608 /* pcm configuration: identiacal with ALC880 */
10609 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10610 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10611 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10612 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10615 * BIOS auto configuration
10617 static int alc262_parse_auto_config(struct hda_codec *codec)
10619 struct alc_spec *spec = codec->spec;
10621 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10623 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10627 if (!spec->autocfg.line_outs) {
10628 if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) {
10629 spec->multiout.max_channels = 2;
10630 spec->no_analog = 1;
10633 return 0; /* can't find valid BIOS pin config */
10635 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10638 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10642 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10645 if (spec->autocfg.dig_out_pin) {
10646 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10647 spec->dig_out_type = spec->autocfg.dig_out_type;
10649 if (spec->autocfg.dig_in_pin)
10650 spec->dig_in_nid = ALC262_DIGIN_NID;
10652 if (spec->kctls.list)
10653 add_mixer(spec, spec->kctls.list);
10655 add_verb(spec, alc262_volume_init_verbs);
10656 spec->num_mux_defs = 1;
10657 spec->input_mux = &spec->private_imux[0];
10659 err = alc_auto_add_mic_boost(codec);
10663 store_pin_configs(codec);
10667 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10668 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10669 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10670 #define alc262_auto_init_input_src alc882_auto_init_input_src
10673 /* init callback for auto-configuration model -- overriding the default init */
10674 static void alc262_auto_init(struct hda_codec *codec)
10676 struct alc_spec *spec = codec->spec;
10677 alc262_auto_init_multi_out(codec);
10678 alc262_auto_init_hp_out(codec);
10679 alc262_auto_init_analog_input(codec);
10680 alc262_auto_init_input_src(codec);
10681 if (spec->unsol_event)
10682 alc_inithook(codec);
10686 * configuration and preset
10688 static const char *alc262_models[ALC262_MODEL_LAST] = {
10689 [ALC262_BASIC] = "basic",
10690 [ALC262_HIPPO] = "hippo",
10691 [ALC262_HIPPO_1] = "hippo_1",
10692 [ALC262_FUJITSU] = "fujitsu",
10693 [ALC262_HP_BPC] = "hp-bpc",
10694 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10695 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10696 [ALC262_HP_RP5700] = "hp-rp5700",
10697 [ALC262_BENQ_ED8] = "benq",
10698 [ALC262_BENQ_T31] = "benq-t31",
10699 [ALC262_SONY_ASSAMD] = "sony-assamd",
10700 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10701 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10702 [ALC262_ULTRA] = "ultra",
10703 [ALC262_LENOVO_3000] = "lenovo-3000",
10704 [ALC262_NEC] = "nec",
10705 [ALC262_TYAN] = "tyan",
10706 [ALC262_AUTO] = "auto",
10709 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10710 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10711 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10712 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10714 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10716 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10717 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10718 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10719 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10720 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10721 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10722 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10723 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10724 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10725 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10726 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10727 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10728 ALC262_HP_TC_T5735),
10729 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10730 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10731 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10732 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10733 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10734 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10735 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10736 ALC262_SONY_ASSAMD),
10737 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10738 ALC262_TOSHIBA_RX1),
10739 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10740 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10741 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10742 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10743 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10745 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10746 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10747 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10748 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10749 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10753 static struct alc_config_preset alc262_presets[] = {
10755 .mixers = { alc262_base_mixer },
10756 .init_verbs = { alc262_init_verbs },
10757 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10758 .dac_nids = alc262_dac_nids,
10760 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10761 .channel_mode = alc262_modes,
10762 .input_mux = &alc262_capture_source,
10765 .mixers = { alc262_base_mixer },
10766 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10767 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10768 .dac_nids = alc262_dac_nids,
10770 .dig_out_nid = ALC262_DIGOUT_NID,
10771 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10772 .channel_mode = alc262_modes,
10773 .input_mux = &alc262_capture_source,
10774 .unsol_event = alc262_hippo_unsol_event,
10775 .init_hook = alc262_hippo_automute,
10777 [ALC262_HIPPO_1] = {
10778 .mixers = { alc262_hippo1_mixer },
10779 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10780 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10781 .dac_nids = alc262_dac_nids,
10783 .dig_out_nid = ALC262_DIGOUT_NID,
10784 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10785 .channel_mode = alc262_modes,
10786 .input_mux = &alc262_capture_source,
10787 .unsol_event = alc262_hippo1_unsol_event,
10788 .init_hook = alc262_hippo1_automute,
10790 [ALC262_FUJITSU] = {
10791 .mixers = { alc262_fujitsu_mixer },
10792 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10793 alc262_fujitsu_unsol_verbs },
10794 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10795 .dac_nids = alc262_dac_nids,
10797 .dig_out_nid = ALC262_DIGOUT_NID,
10798 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10799 .channel_mode = alc262_modes,
10800 .input_mux = &alc262_fujitsu_capture_source,
10801 .unsol_event = alc262_fujitsu_unsol_event,
10802 .init_hook = alc262_fujitsu_init_hook,
10804 [ALC262_HP_BPC] = {
10805 .mixers = { alc262_HP_BPC_mixer },
10806 .init_verbs = { alc262_HP_BPC_init_verbs },
10807 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10808 .dac_nids = alc262_dac_nids,
10810 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10811 .channel_mode = alc262_modes,
10812 .input_mux = &alc262_HP_capture_source,
10813 .unsol_event = alc262_hp_bpc_unsol_event,
10814 .init_hook = alc262_hp_bpc_automute,
10816 [ALC262_HP_BPC_D7000_WF] = {
10817 .mixers = { alc262_HP_BPC_WildWest_mixer },
10818 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10819 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10820 .dac_nids = alc262_dac_nids,
10822 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10823 .channel_mode = alc262_modes,
10824 .input_mux = &alc262_HP_D7000_capture_source,
10825 .unsol_event = alc262_hp_wildwest_unsol_event,
10826 .init_hook = alc262_hp_wildwest_automute,
10828 [ALC262_HP_BPC_D7000_WL] = {
10829 .mixers = { alc262_HP_BPC_WildWest_mixer,
10830 alc262_HP_BPC_WildWest_option_mixer },
10831 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10832 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10833 .dac_nids = alc262_dac_nids,
10835 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10836 .channel_mode = alc262_modes,
10837 .input_mux = &alc262_HP_D7000_capture_source,
10838 .unsol_event = alc262_hp_wildwest_unsol_event,
10839 .init_hook = alc262_hp_wildwest_automute,
10841 [ALC262_HP_TC_T5735] = {
10842 .mixers = { alc262_hp_t5735_mixer },
10843 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10844 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10845 .dac_nids = alc262_dac_nids,
10847 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10848 .channel_mode = alc262_modes,
10849 .input_mux = &alc262_capture_source,
10850 .unsol_event = alc262_hp_t5735_unsol_event,
10851 .init_hook = alc262_hp_t5735_init_hook,
10853 [ALC262_HP_RP5700] = {
10854 .mixers = { alc262_hp_rp5700_mixer },
10855 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10856 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10857 .dac_nids = alc262_dac_nids,
10858 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10859 .channel_mode = alc262_modes,
10860 .input_mux = &alc262_hp_rp5700_capture_source,
10862 [ALC262_BENQ_ED8] = {
10863 .mixers = { alc262_base_mixer },
10864 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10865 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10866 .dac_nids = alc262_dac_nids,
10868 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10869 .channel_mode = alc262_modes,
10870 .input_mux = &alc262_capture_source,
10872 [ALC262_SONY_ASSAMD] = {
10873 .mixers = { alc262_sony_mixer },
10874 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10875 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10876 .dac_nids = alc262_dac_nids,
10878 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10879 .channel_mode = alc262_modes,
10880 .input_mux = &alc262_capture_source,
10881 .unsol_event = alc262_hippo_unsol_event,
10882 .init_hook = alc262_hippo_automute,
10884 [ALC262_BENQ_T31] = {
10885 .mixers = { alc262_benq_t31_mixer },
10886 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10887 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10888 .dac_nids = alc262_dac_nids,
10890 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10891 .channel_mode = alc262_modes,
10892 .input_mux = &alc262_capture_source,
10893 .unsol_event = alc262_hippo_unsol_event,
10894 .init_hook = alc262_hippo_automute,
10897 .mixers = { alc262_ultra_mixer },
10898 .cap_mixer = alc262_ultra_capture_mixer,
10899 .init_verbs = { alc262_ultra_verbs },
10900 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10901 .dac_nids = alc262_dac_nids,
10902 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10903 .channel_mode = alc262_modes,
10904 .input_mux = &alc262_ultra_capture_source,
10905 .adc_nids = alc262_adc_nids, /* ADC0 */
10906 .capsrc_nids = alc262_capsrc_nids,
10907 .num_adc_nids = 1, /* single ADC */
10908 .unsol_event = alc262_ultra_unsol_event,
10909 .init_hook = alc262_ultra_automute,
10911 [ALC262_LENOVO_3000] = {
10912 .mixers = { alc262_lenovo_3000_mixer },
10913 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10914 alc262_lenovo_3000_unsol_verbs },
10915 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10916 .dac_nids = alc262_dac_nids,
10918 .dig_out_nid = ALC262_DIGOUT_NID,
10919 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10920 .channel_mode = alc262_modes,
10921 .input_mux = &alc262_fujitsu_capture_source,
10922 .unsol_event = alc262_lenovo_3000_unsol_event,
10925 .mixers = { alc262_nec_mixer },
10926 .init_verbs = { alc262_nec_verbs },
10927 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10928 .dac_nids = alc262_dac_nids,
10930 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10931 .channel_mode = alc262_modes,
10932 .input_mux = &alc262_capture_source,
10934 [ALC262_TOSHIBA_S06] = {
10935 .mixers = { alc262_toshiba_s06_mixer },
10936 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10937 alc262_eapd_verbs },
10938 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10939 .capsrc_nids = alc262_dmic_capsrc_nids,
10940 .dac_nids = alc262_dac_nids,
10941 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10942 .dig_out_nid = ALC262_DIGOUT_NID,
10943 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10944 .channel_mode = alc262_modes,
10945 .input_mux = &alc262_dmic_capture_source,
10946 .unsol_event = alc262_toshiba_s06_unsol_event,
10947 .init_hook = alc262_toshiba_s06_init_hook,
10949 [ALC262_TOSHIBA_RX1] = {
10950 .mixers = { alc262_toshiba_rx1_mixer },
10951 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10952 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10953 .dac_nids = alc262_dac_nids,
10955 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10956 .channel_mode = alc262_modes,
10957 .input_mux = &alc262_capture_source,
10958 .unsol_event = alc262_hippo_unsol_event,
10959 .init_hook = alc262_hippo_automute,
10962 .mixers = { alc262_tyan_mixer },
10963 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
10964 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10965 .dac_nids = alc262_dac_nids,
10967 .dig_out_nid = ALC262_DIGOUT_NID,
10968 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10969 .channel_mode = alc262_modes,
10970 .input_mux = &alc262_capture_source,
10971 .unsol_event = alc262_tyan_unsol_event,
10972 .init_hook = alc262_tyan_automute,
10976 static int patch_alc262(struct hda_codec *codec)
10978 struct alc_spec *spec;
10982 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10986 codec->spec = spec;
10988 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10993 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10994 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10995 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10996 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11000 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11002 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11006 if (board_config < 0) {
11007 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11008 "trying auto-probe from BIOS...\n");
11009 board_config = ALC262_AUTO;
11012 if (board_config == ALC262_AUTO) {
11013 /* automatic parse from the BIOS config */
11014 err = alc262_parse_auto_config(codec);
11020 "hda_codec: Cannot set up configuration "
11021 "from BIOS. Using base mode...\n");
11022 board_config = ALC262_BASIC;
11026 err = snd_hda_attach_beep_device(codec, 0x1);
11032 if (board_config != ALC262_AUTO)
11033 setup_preset(spec, &alc262_presets[board_config]);
11035 spec->stream_name_analog = "ALC262 Analog";
11036 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11037 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11039 spec->stream_name_digital = "ALC262 Digital";
11040 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11041 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11043 spec->capture_style = CAPT_MIX;
11044 if (!spec->adc_nids && spec->input_mux) {
11045 /* check whether NID 0x07 is valid */
11046 unsigned int wcap = get_wcaps(codec, 0x07);
11049 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11050 if (wcap != AC_WID_AUD_IN) {
11051 spec->adc_nids = alc262_adc_nids_alt;
11052 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11053 spec->capsrc_nids = alc262_capsrc_nids_alt;
11055 spec->adc_nids = alc262_adc_nids;
11056 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11057 spec->capsrc_nids = alc262_capsrc_nids;
11060 if (!spec->cap_mixer && !spec->no_analog)
11061 set_capture_mixer(spec);
11062 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11064 spec->vmaster_nid = 0x0c;
11066 codec->patch_ops = alc_patch_ops;
11067 if (board_config == ALC262_AUTO)
11068 spec->init_hook = alc262_auto_init;
11069 #ifdef CONFIG_SND_HDA_POWER_SAVE
11070 if (!spec->loopback.amplist)
11071 spec->loopback.amplist = alc262_loopbacks;
11073 codec->proc_widget_hook = print_realtek_coef;
11079 * ALC268 channel source setting (2 channel)
11081 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11082 #define alc268_modes alc260_modes
11084 static hda_nid_t alc268_dac_nids[2] = {
11089 static hda_nid_t alc268_adc_nids[2] = {
11094 static hda_nid_t alc268_adc_nids_alt[1] = {
11099 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11101 static struct snd_kcontrol_new alc268_base_mixer[] = {
11102 /* output mixer control */
11103 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11104 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11105 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11106 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11107 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11108 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11109 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11113 /* bind Beep switches of both NID 0x0f and 0x10 */
11114 static struct hda_bind_ctls alc268_bind_beep_sw = {
11115 .ops = &snd_hda_bind_sw,
11117 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11118 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11123 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11124 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11125 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11129 static struct hda_verb alc268_eapd_verbs[] = {
11130 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11131 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11135 /* Toshiba specific */
11136 #define alc268_toshiba_automute alc262_hippo_automute
11138 static struct hda_verb alc268_toshiba_verbs[] = {
11139 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11143 static struct hda_input_mux alc268_acer_lc_capture_source = {
11151 /* Acer specific */
11152 /* bind volumes of both NID 0x02 and 0x03 */
11153 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11154 .ops = &snd_hda_bind_vol,
11156 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11157 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11162 /* mute/unmute internal speaker according to the hp jack and mute state */
11163 static void alc268_acer_automute(struct hda_codec *codec, int force)
11165 struct alc_spec *spec = codec->spec;
11168 if (force || !spec->sense_updated) {
11169 unsigned int present;
11170 present = snd_hda_codec_read(codec, 0x14, 0,
11171 AC_VERB_GET_PIN_SENSE, 0);
11172 spec->jack_present = (present & 0x80000000) != 0;
11173 spec->sense_updated = 1;
11175 if (spec->jack_present)
11176 mute = HDA_AMP_MUTE; /* mute internal speaker */
11177 else /* unmute internal speaker if necessary */
11178 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11179 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11180 HDA_AMP_MUTE, mute);
11184 /* bind hp and internal speaker mute (with plug check) */
11185 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11186 struct snd_ctl_elem_value *ucontrol)
11188 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11189 long *valp = ucontrol->value.integer.value;
11192 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11194 valp[0] ? 0 : HDA_AMP_MUTE);
11195 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11197 valp[1] ? 0 : HDA_AMP_MUTE);
11199 alc268_acer_automute(codec, 0);
11203 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11204 /* output mixer control */
11205 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11207 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11208 .name = "Master Playback Switch",
11209 .info = snd_hda_mixer_amp_switch_info,
11210 .get = snd_hda_mixer_amp_switch_get,
11211 .put = alc268_acer_master_sw_put,
11212 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11214 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11218 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11219 /* output mixer control */
11220 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11222 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11223 .name = "Master Playback Switch",
11224 .info = snd_hda_mixer_amp_switch_info,
11225 .get = snd_hda_mixer_amp_switch_get,
11226 .put = alc268_acer_master_sw_put,
11227 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11230 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11231 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11235 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11236 /* output mixer control */
11237 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11240 .name = "Master Playback Switch",
11241 .info = snd_hda_mixer_amp_switch_info,
11242 .get = snd_hda_mixer_amp_switch_get,
11243 .put = alc268_acer_master_sw_put,
11244 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11246 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11247 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11251 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11252 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11254 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11255 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11256 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11257 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11261 static struct hda_verb alc268_acer_verbs[] = {
11262 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11263 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11265 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11266 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11268 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11272 /* unsolicited event for HP jack sensing */
11273 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11276 if ((res >> 26) != ALC880_HP_EVENT)
11278 alc268_toshiba_automute(codec);
11281 static void alc268_acer_unsol_event(struct hda_codec *codec,
11284 if ((res >> 26) != ALC880_HP_EVENT)
11286 alc268_acer_automute(codec, 1);
11289 static void alc268_acer_init_hook(struct hda_codec *codec)
11291 alc268_acer_automute(codec, 1);
11294 /* toggle speaker-output according to the hp-jack state */
11295 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11297 unsigned int present;
11298 unsigned char bits;
11300 present = snd_hda_codec_read(codec, 0x15, 0,
11301 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11302 bits = present ? AMP_IN_MUTE(0) : 0;
11303 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11304 AMP_IN_MUTE(0), bits);
11305 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11306 AMP_IN_MUTE(0), bits);
11310 static void alc268_acer_mic_automute(struct hda_codec *codec)
11312 unsigned int present;
11314 present = snd_hda_codec_read(codec, 0x18, 0,
11315 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11316 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11317 present ? 0x0 : 0x6);
11320 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11323 if ((res >> 26) == ALC880_HP_EVENT)
11324 alc268_aspire_one_speaker_automute(codec);
11325 if ((res >> 26) == ALC880_MIC_EVENT)
11326 alc268_acer_mic_automute(codec);
11329 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11331 alc268_aspire_one_speaker_automute(codec);
11332 alc268_acer_mic_automute(codec);
11335 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11336 /* output mixer control */
11337 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11338 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11339 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11340 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11341 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11342 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11346 static struct hda_verb alc268_dell_verbs[] = {
11347 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11348 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11353 /* mute/unmute internal speaker according to the hp jack and mute state */
11354 static void alc268_dell_automute(struct hda_codec *codec)
11356 unsigned int present;
11359 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11360 if (present & 0x80000000)
11361 mute = HDA_AMP_MUTE;
11363 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11364 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11365 HDA_AMP_MUTE, mute);
11368 static void alc268_dell_unsol_event(struct hda_codec *codec,
11371 if ((res >> 26) != ALC880_HP_EVENT)
11373 alc268_dell_automute(codec);
11376 #define alc268_dell_init_hook alc268_dell_automute
11378 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11379 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11380 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11381 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11382 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11383 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11384 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11385 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11386 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11390 static struct hda_verb alc267_quanta_il1_verbs[] = {
11391 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11392 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11396 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11398 unsigned int present;
11400 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11401 & AC_PINSENSE_PRESENCE;
11402 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11403 present ? 0 : PIN_OUT);
11406 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11408 unsigned int present;
11410 present = snd_hda_codec_read(codec, 0x18, 0,
11411 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11412 snd_hda_codec_write(codec, 0x23, 0,
11413 AC_VERB_SET_CONNECT_SEL,
11414 present ? 0x00 : 0x01);
11417 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11419 alc267_quanta_il1_hp_automute(codec);
11420 alc267_quanta_il1_mic_automute(codec);
11423 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11426 switch (res >> 26) {
11427 case ALC880_HP_EVENT:
11428 alc267_quanta_il1_hp_automute(codec);
11430 case ALC880_MIC_EVENT:
11431 alc267_quanta_il1_mic_automute(codec);
11437 * generic initialization of ADC, input mixers and output mixers
11439 static struct hda_verb alc268_base_init_verbs[] = {
11440 /* Unmute DAC0-1 and set vol = 0 */
11441 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11442 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11445 * Set up output mixers (0x0c - 0x0e)
11447 /* set vol=0 to output mixers */
11448 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11449 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11451 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11452 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11454 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11456 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11457 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11458 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11459 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11460 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11461 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11464 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11465 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11466 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11467 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11469 /* set PCBEEP vol = 0, mute connections */
11470 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11471 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11472 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11474 /* Unmute Selector 23h,24h and set the default input to mic-in */
11476 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11478 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11485 * generic initialization of ADC, input mixers and output mixers
11487 static struct hda_verb alc268_volume_init_verbs[] = {
11488 /* set output DAC */
11489 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11490 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11492 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11493 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11494 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11495 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11496 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11498 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11499 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11500 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11502 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11503 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11505 /* set PCBEEP vol = 0, mute connections */
11506 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11507 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11508 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11513 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11514 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11515 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11517 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11518 /* The multiple "Capture Source" controls confuse alsamixer
11519 * So call somewhat different..
11521 /* .name = "Capture Source", */
11522 .name = "Input Source",
11524 .info = alc_mux_enum_info,
11525 .get = alc_mux_enum_get,
11526 .put = alc_mux_enum_put,
11531 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11532 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11533 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11534 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11535 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11538 /* The multiple "Capture Source" controls confuse alsamixer
11539 * So call somewhat different..
11541 /* .name = "Capture Source", */
11542 .name = "Input Source",
11544 .info = alc_mux_enum_info,
11545 .get = alc_mux_enum_get,
11546 .put = alc_mux_enum_put,
11551 static struct hda_input_mux alc268_capture_source = {
11555 { "Front Mic", 0x1 },
11561 static struct hda_input_mux alc268_acer_capture_source = {
11565 { "Internal Mic", 0x1 },
11570 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11574 { "Internal Mic", 0x6 },
11579 #ifdef CONFIG_SND_DEBUG
11580 static struct snd_kcontrol_new alc268_test_mixer[] = {
11581 /* Volume widgets */
11582 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11583 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11584 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11585 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11586 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11587 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11588 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11589 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11590 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11591 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11592 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11593 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11594 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11595 /* The below appears problematic on some hardwares */
11596 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11597 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11598 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11599 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11600 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11602 /* Modes for retasking pin widgets */
11603 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11604 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11605 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11606 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11608 /* Controls for GPIO pins, assuming they are configured as outputs */
11609 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11610 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11611 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11612 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11614 /* Switches to allow the digital SPDIF output pin to be enabled.
11615 * The ALC268 does not have an SPDIF input.
11617 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11619 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11620 * this output to turn on an external amplifier.
11622 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11623 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11629 /* create input playback/capture controls for the given pin */
11630 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11631 const char *ctlname, int idx)
11636 sprintf(name, "%s Playback Volume", ctlname);
11638 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11639 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11643 } else if (nid == 0x15) {
11644 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11645 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11651 sprintf(name, "%s Playback Switch", ctlname);
11652 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11653 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11659 /* add playback controls from the parsed DAC table */
11660 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11661 const struct auto_pin_cfg *cfg)
11666 spec->multiout.num_dacs = 2; /* only use one dac */
11667 spec->multiout.dac_nids = spec->private_dac_nids;
11668 spec->multiout.dac_nids[0] = 2;
11669 spec->multiout.dac_nids[1] = 3;
11671 nid = cfg->line_out_pins[0];
11673 alc268_new_analog_output(spec, nid, "Front", 0);
11675 nid = cfg->speaker_pins[0];
11677 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11678 "Speaker Playback Volume",
11679 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11683 nid = cfg->hp_pins[0];
11685 alc268_new_analog_output(spec, nid, "Headphone", 0);
11687 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11689 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11690 "Mono Playback Switch",
11691 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11698 /* create playback/capture controls for input pins */
11699 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11700 const struct auto_pin_cfg *cfg)
11702 struct hda_input_mux *imux = &spec->private_imux[0];
11705 for (i = 0; i < AUTO_PIN_LAST; i++) {
11706 switch(cfg->input_pins[i]) {
11708 idx1 = 0; /* Mic 1 */
11711 idx1 = 1; /* Mic 2 */
11714 idx1 = 2; /* Line In */
11721 idx1 = 6; /* digital mics */
11726 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11727 imux->items[imux->num_items].index = idx1;
11733 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11735 struct alc_spec *spec = codec->spec;
11736 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11737 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11738 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11739 unsigned int dac_vol1, dac_vol2;
11742 snd_hda_codec_write(codec, speaker_nid, 0,
11743 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11744 snd_hda_codec_write(codec, 0x0f, 0,
11745 AC_VERB_SET_AMP_GAIN_MUTE,
11747 snd_hda_codec_write(codec, 0x10, 0,
11748 AC_VERB_SET_AMP_GAIN_MUTE,
11751 snd_hda_codec_write(codec, 0x0f, 0,
11752 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11753 snd_hda_codec_write(codec, 0x10, 0,
11754 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11757 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11758 if (line_nid == 0x14)
11759 dac_vol2 = AMP_OUT_ZERO;
11760 else if (line_nid == 0x15)
11761 dac_vol1 = AMP_OUT_ZERO;
11762 if (hp_nid == 0x14)
11763 dac_vol2 = AMP_OUT_ZERO;
11764 else if (hp_nid == 0x15)
11765 dac_vol1 = AMP_OUT_ZERO;
11766 if (line_nid != 0x16 || hp_nid != 0x16 ||
11767 spec->autocfg.line_out_pins[1] != 0x16 ||
11768 spec->autocfg.line_out_pins[2] != 0x16)
11769 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11771 snd_hda_codec_write(codec, 0x02, 0,
11772 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11773 snd_hda_codec_write(codec, 0x03, 0,
11774 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11777 /* pcm configuration: identiacal with ALC880 */
11778 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11779 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11780 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11781 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11784 * BIOS auto configuration
11786 static int alc268_parse_auto_config(struct hda_codec *codec)
11788 struct alc_spec *spec = codec->spec;
11790 static hda_nid_t alc268_ignore[] = { 0 };
11792 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11796 if (!spec->autocfg.line_outs)
11797 return 0; /* can't find valid BIOS pin config */
11799 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11802 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11806 spec->multiout.max_channels = 2;
11808 /* digital only support output */
11809 if (spec->autocfg.dig_out_pin)
11810 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11812 if (spec->kctls.list)
11813 add_mixer(spec, spec->kctls.list);
11815 if (spec->autocfg.speaker_pins[0] != 0x1d)
11816 add_mixer(spec, alc268_beep_mixer);
11818 add_verb(spec, alc268_volume_init_verbs);
11819 spec->num_mux_defs = 1;
11820 spec->input_mux = &spec->private_imux[0];
11822 err = alc_auto_add_mic_boost(codec);
11826 store_pin_configs(codec);
11830 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11831 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11832 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11834 /* init callback for auto-configuration model -- overriding the default init */
11835 static void alc268_auto_init(struct hda_codec *codec)
11837 struct alc_spec *spec = codec->spec;
11838 alc268_auto_init_multi_out(codec);
11839 alc268_auto_init_hp_out(codec);
11840 alc268_auto_init_mono_speaker_out(codec);
11841 alc268_auto_init_analog_input(codec);
11842 if (spec->unsol_event)
11843 alc_inithook(codec);
11847 * configuration and preset
11849 static const char *alc268_models[ALC268_MODEL_LAST] = {
11850 [ALC267_QUANTA_IL1] = "quanta-il1",
11851 [ALC268_3ST] = "3stack",
11852 [ALC268_TOSHIBA] = "toshiba",
11853 [ALC268_ACER] = "acer",
11854 [ALC268_ACER_DMIC] = "acer-dmic",
11855 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11856 [ALC268_DELL] = "dell",
11857 [ALC268_ZEPTO] = "zepto",
11858 #ifdef CONFIG_SND_DEBUG
11859 [ALC268_TEST] = "test",
11861 [ALC268_AUTO] = "auto",
11864 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11865 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11866 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11867 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11868 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11869 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11870 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11871 ALC268_ACER_ASPIRE_ONE),
11872 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11873 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11874 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11875 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11876 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11877 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11878 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11879 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11880 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11881 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11882 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11886 static struct alc_config_preset alc268_presets[] = {
11887 [ALC267_QUANTA_IL1] = {
11888 .mixers = { alc267_quanta_il1_mixer },
11889 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11890 alc267_quanta_il1_verbs },
11891 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11892 .dac_nids = alc268_dac_nids,
11893 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11894 .adc_nids = alc268_adc_nids_alt,
11896 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11897 .channel_mode = alc268_modes,
11898 .input_mux = &alc268_capture_source,
11899 .unsol_event = alc267_quanta_il1_unsol_event,
11900 .init_hook = alc267_quanta_il1_automute,
11903 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11904 alc268_beep_mixer },
11905 .init_verbs = { alc268_base_init_verbs },
11906 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11907 .dac_nids = alc268_dac_nids,
11908 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11909 .adc_nids = alc268_adc_nids_alt,
11910 .capsrc_nids = alc268_capsrc_nids,
11912 .dig_out_nid = ALC268_DIGOUT_NID,
11913 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11914 .channel_mode = alc268_modes,
11915 .input_mux = &alc268_capture_source,
11917 [ALC268_TOSHIBA] = {
11918 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11919 alc268_beep_mixer },
11920 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11921 alc268_toshiba_verbs },
11922 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11923 .dac_nids = alc268_dac_nids,
11924 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11925 .adc_nids = alc268_adc_nids_alt,
11926 .capsrc_nids = alc268_capsrc_nids,
11928 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11929 .channel_mode = alc268_modes,
11930 .input_mux = &alc268_capture_source,
11931 .unsol_event = alc268_toshiba_unsol_event,
11932 .init_hook = alc268_toshiba_automute,
11935 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11936 alc268_beep_mixer },
11937 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11938 alc268_acer_verbs },
11939 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11940 .dac_nids = alc268_dac_nids,
11941 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11942 .adc_nids = alc268_adc_nids_alt,
11943 .capsrc_nids = alc268_capsrc_nids,
11945 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11946 .channel_mode = alc268_modes,
11947 .input_mux = &alc268_acer_capture_source,
11948 .unsol_event = alc268_acer_unsol_event,
11949 .init_hook = alc268_acer_init_hook,
11951 [ALC268_ACER_DMIC] = {
11952 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11953 alc268_beep_mixer },
11954 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11955 alc268_acer_verbs },
11956 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11957 .dac_nids = alc268_dac_nids,
11958 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11959 .adc_nids = alc268_adc_nids_alt,
11960 .capsrc_nids = alc268_capsrc_nids,
11962 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11963 .channel_mode = alc268_modes,
11964 .input_mux = &alc268_acer_dmic_capture_source,
11965 .unsol_event = alc268_acer_unsol_event,
11966 .init_hook = alc268_acer_init_hook,
11968 [ALC268_ACER_ASPIRE_ONE] = {
11969 .mixers = { alc268_acer_aspire_one_mixer,
11970 alc268_capture_alt_mixer },
11971 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11972 alc268_acer_aspire_one_verbs },
11973 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11974 .dac_nids = alc268_dac_nids,
11975 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11976 .adc_nids = alc268_adc_nids_alt,
11977 .capsrc_nids = alc268_capsrc_nids,
11979 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11980 .channel_mode = alc268_modes,
11981 .input_mux = &alc268_acer_lc_capture_source,
11982 .unsol_event = alc268_acer_lc_unsol_event,
11983 .init_hook = alc268_acer_lc_init_hook,
11986 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11987 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11988 alc268_dell_verbs },
11989 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11990 .dac_nids = alc268_dac_nids,
11992 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11993 .channel_mode = alc268_modes,
11994 .unsol_event = alc268_dell_unsol_event,
11995 .init_hook = alc268_dell_init_hook,
11996 .input_mux = &alc268_capture_source,
11999 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12000 alc268_beep_mixer },
12001 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12002 alc268_toshiba_verbs },
12003 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12004 .dac_nids = alc268_dac_nids,
12005 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12006 .adc_nids = alc268_adc_nids_alt,
12007 .capsrc_nids = alc268_capsrc_nids,
12009 .dig_out_nid = ALC268_DIGOUT_NID,
12010 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12011 .channel_mode = alc268_modes,
12012 .input_mux = &alc268_capture_source,
12013 .unsol_event = alc268_toshiba_unsol_event,
12014 .init_hook = alc268_toshiba_automute
12016 #ifdef CONFIG_SND_DEBUG
12018 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12019 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12020 alc268_volume_init_verbs },
12021 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12022 .dac_nids = alc268_dac_nids,
12023 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12024 .adc_nids = alc268_adc_nids_alt,
12025 .capsrc_nids = alc268_capsrc_nids,
12027 .dig_out_nid = ALC268_DIGOUT_NID,
12028 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12029 .channel_mode = alc268_modes,
12030 .input_mux = &alc268_capture_source,
12035 static int patch_alc268(struct hda_codec *codec)
12037 struct alc_spec *spec;
12041 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12045 codec->spec = spec;
12047 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12051 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12052 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12053 "trying auto-probe from BIOS...\n");
12054 board_config = ALC268_AUTO;
12057 if (board_config == ALC268_AUTO) {
12058 /* automatic parse from the BIOS config */
12059 err = alc268_parse_auto_config(codec);
12065 "hda_codec: Cannot set up configuration "
12066 "from BIOS. Using base mode...\n");
12067 board_config = ALC268_3ST;
12071 err = snd_hda_attach_beep_device(codec, 0x1);
12077 if (board_config != ALC268_AUTO)
12078 setup_preset(spec, &alc268_presets[board_config]);
12080 if (codec->vendor_id == 0x10ec0267) {
12081 spec->stream_name_analog = "ALC267 Analog";
12082 spec->stream_name_digital = "ALC267 Digital";
12084 spec->stream_name_analog = "ALC268 Analog";
12085 spec->stream_name_digital = "ALC268 Digital";
12088 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12089 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12090 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12092 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12094 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12095 /* override the amp caps for beep generator */
12096 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12097 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12098 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12099 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12100 (0 << AC_AMPCAP_MUTE_SHIFT));
12102 if (!spec->adc_nids && spec->input_mux) {
12103 /* check whether NID 0x07 is valid */
12104 unsigned int wcap = get_wcaps(codec, 0x07);
12108 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12109 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12110 spec->adc_nids = alc268_adc_nids_alt;
12111 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12112 add_mixer(spec, alc268_capture_alt_mixer);
12114 spec->adc_nids = alc268_adc_nids;
12115 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12116 add_mixer(spec, alc268_capture_mixer);
12118 spec->capsrc_nids = alc268_capsrc_nids;
12119 /* set default input source */
12120 for (i = 0; i < spec->num_adc_nids; i++)
12121 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12122 0, AC_VERB_SET_CONNECT_SEL,
12123 spec->input_mux->items[0].index);
12126 spec->vmaster_nid = 0x02;
12128 codec->patch_ops = alc_patch_ops;
12129 if (board_config == ALC268_AUTO)
12130 spec->init_hook = alc268_auto_init;
12132 codec->proc_widget_hook = print_realtek_coef;
12138 * ALC269 channel source setting (2 channel)
12140 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12142 #define alc269_dac_nids alc260_dac_nids
12144 static hda_nid_t alc269_adc_nids[1] = {
12149 static hda_nid_t alc269_capsrc_nids[1] = {
12153 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12157 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12165 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12173 #define alc269_modes alc260_modes
12174 #define alc269_capture_source alc880_lg_lw_capture_source
12176 static struct snd_kcontrol_new alc269_base_mixer[] = {
12177 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12178 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12179 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12180 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12183 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12184 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12185 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12186 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12188 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12192 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12193 /* output mixer control */
12194 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12196 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12197 .name = "Master Playback Switch",
12198 .info = snd_hda_mixer_amp_switch_info,
12199 .get = snd_hda_mixer_amp_switch_get,
12200 .put = alc268_acer_master_sw_put,
12201 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12205 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12206 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12207 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12208 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12212 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12213 /* output mixer control */
12214 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12216 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12217 .name = "Master Playback Switch",
12218 .info = snd_hda_mixer_amp_switch_info,
12219 .get = snd_hda_mixer_amp_switch_get,
12220 .put = alc268_acer_master_sw_put,
12221 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12225 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12226 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12227 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12228 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12229 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12230 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12231 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12235 /* bind volumes of both NID 0x0c and 0x0d */
12236 static struct hda_bind_ctls alc269_epc_bind_vol = {
12237 .ops = &snd_hda_bind_vol,
12239 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12240 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12245 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12246 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12247 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12248 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12252 /* capture mixer elements */
12253 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12254 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12255 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12256 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12261 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12262 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12263 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12264 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12268 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12269 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12270 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12272 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12273 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12274 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12278 static struct hda_verb alc269_lifebook_verbs[] = {
12279 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12280 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12281 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12283 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12284 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12286 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12287 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12288 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12292 /* toggle speaker-output according to the hp-jack state */
12293 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12295 unsigned int present;
12296 unsigned char bits;
12298 present = snd_hda_codec_read(codec, 0x15, 0,
12299 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12300 bits = present ? AMP_IN_MUTE(0) : 0;
12301 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12302 AMP_IN_MUTE(0), bits);
12303 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12304 AMP_IN_MUTE(0), bits);
12306 snd_hda_codec_write(codec, 0x20, 0,
12307 AC_VERB_SET_COEF_INDEX, 0x0c);
12308 snd_hda_codec_write(codec, 0x20, 0,
12309 AC_VERB_SET_PROC_COEF, 0x680);
12311 snd_hda_codec_write(codec, 0x20, 0,
12312 AC_VERB_SET_COEF_INDEX, 0x0c);
12313 snd_hda_codec_write(codec, 0x20, 0,
12314 AC_VERB_SET_PROC_COEF, 0x480);
12317 /* toggle speaker-output according to the hp-jacks state */
12318 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12320 unsigned int present;
12321 unsigned char bits;
12323 /* Check laptop headphone socket */
12324 present = snd_hda_codec_read(codec, 0x15, 0,
12325 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12327 /* Check port replicator headphone socket */
12328 present |= snd_hda_codec_read(codec, 0x1a, 0,
12329 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12331 bits = present ? AMP_IN_MUTE(0) : 0;
12332 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12333 AMP_IN_MUTE(0), bits);
12334 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12335 AMP_IN_MUTE(0), bits);
12337 snd_hda_codec_write(codec, 0x20, 0,
12338 AC_VERB_SET_COEF_INDEX, 0x0c);
12339 snd_hda_codec_write(codec, 0x20, 0,
12340 AC_VERB_SET_PROC_COEF, 0x680);
12342 snd_hda_codec_write(codec, 0x20, 0,
12343 AC_VERB_SET_COEF_INDEX, 0x0c);
12344 snd_hda_codec_write(codec, 0x20, 0,
12345 AC_VERB_SET_PROC_COEF, 0x480);
12348 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12350 unsigned int present;
12352 present = snd_hda_codec_read(codec, 0x18, 0,
12353 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12354 snd_hda_codec_write(codec, 0x23, 0,
12355 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12358 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12360 unsigned int present_laptop;
12361 unsigned int present_dock;
12363 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12364 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12366 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12367 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12369 /* Laptop mic port overrides dock mic port, design decision */
12371 snd_hda_codec_write(codec, 0x23, 0,
12372 AC_VERB_SET_CONNECT_SEL, 0x3);
12373 if (present_laptop)
12374 snd_hda_codec_write(codec, 0x23, 0,
12375 AC_VERB_SET_CONNECT_SEL, 0x0);
12376 if (!present_dock && !present_laptop)
12377 snd_hda_codec_write(codec, 0x23, 0,
12378 AC_VERB_SET_CONNECT_SEL, 0x1);
12381 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12384 if ((res >> 26) == ALC880_HP_EVENT)
12385 alc269_quanta_fl1_speaker_automute(codec);
12386 if ((res >> 26) == ALC880_MIC_EVENT)
12387 alc269_quanta_fl1_mic_automute(codec);
12390 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12393 if ((res >> 26) == ALC880_HP_EVENT)
12394 alc269_lifebook_speaker_automute(codec);
12395 if ((res >> 26) == ALC880_MIC_EVENT)
12396 alc269_lifebook_mic_autoswitch(codec);
12399 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12401 alc269_quanta_fl1_speaker_automute(codec);
12402 alc269_quanta_fl1_mic_automute(codec);
12405 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12407 alc269_lifebook_speaker_automute(codec);
12408 alc269_lifebook_mic_autoswitch(codec);
12411 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12412 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12413 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12414 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12415 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12416 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12417 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12418 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12422 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12423 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12424 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12425 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12426 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12427 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12428 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12432 /* toggle speaker-output according to the hp-jack state */
12433 static void alc269_speaker_automute(struct hda_codec *codec)
12435 unsigned int present;
12436 unsigned char bits;
12438 present = snd_hda_codec_read(codec, 0x15, 0,
12439 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12440 bits = present ? AMP_IN_MUTE(0) : 0;
12441 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12442 AMP_IN_MUTE(0), bits);
12443 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12444 AMP_IN_MUTE(0), bits);
12447 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12449 unsigned int present;
12451 present = snd_hda_codec_read(codec, 0x18, 0,
12452 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12453 snd_hda_codec_write(codec, 0x23, 0,
12454 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12457 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12459 unsigned int present;
12461 present = snd_hda_codec_read(codec, 0x18, 0,
12462 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12463 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12464 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12465 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12466 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12469 /* unsolicited event for HP jack sensing */
12470 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12473 if ((res >> 26) == ALC880_HP_EVENT)
12474 alc269_speaker_automute(codec);
12476 if ((res >> 26) == ALC880_MIC_EVENT)
12477 alc269_eeepc_dmic_automute(codec);
12480 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12482 alc269_speaker_automute(codec);
12483 alc269_eeepc_dmic_automute(codec);
12486 /* unsolicited event for HP jack sensing */
12487 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12490 if ((res >> 26) == ALC880_HP_EVENT)
12491 alc269_speaker_automute(codec);
12493 if ((res >> 26) == ALC880_MIC_EVENT)
12494 alc269_eeepc_amic_automute(codec);
12497 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12499 alc269_speaker_automute(codec);
12500 alc269_eeepc_amic_automute(codec);
12504 * generic initialization of ADC, input mixers and output mixers
12506 static struct hda_verb alc269_init_verbs[] = {
12508 * Unmute ADC0 and set the default input to mic-in
12510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12512 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12513 * analog-loopback mixer widget
12514 * Note: PASD motherboards uses the Line In 2 as the input for
12515 * front panel mic (mic 2)
12517 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12525 * Set up output mixers (0x0c - 0x0e)
12527 /* set vol=0 to output mixers */
12528 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12529 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12531 /* set up input amps for analog loopback */
12532 /* Amp Indices: DAC = 0, mixer = 1 */
12533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12535 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12537 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12541 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12542 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12544 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12545 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12550 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12551 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12552 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12553 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12554 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12556 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12557 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12559 /* FIXME: use matrix-type input source selection */
12560 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12561 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12563 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12564 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12565 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12568 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12569 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12573 /* add playback controls from the parsed DAC table */
12574 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12575 const struct auto_pin_cfg *cfg)
12580 spec->multiout.num_dacs = 1; /* only use one dac */
12581 spec->multiout.dac_nids = spec->private_dac_nids;
12582 spec->multiout.dac_nids[0] = 2;
12584 nid = cfg->line_out_pins[0];
12586 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12587 "Front Playback Volume",
12588 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12591 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12592 "Front Playback Switch",
12593 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12598 nid = cfg->speaker_pins[0];
12600 if (!cfg->line_out_pins[0]) {
12601 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12602 "Speaker Playback Volume",
12603 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12609 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12610 "Speaker Playback Switch",
12611 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12616 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12617 "Speaker Playback Switch",
12618 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12624 nid = cfg->hp_pins[0];
12626 /* spec->multiout.hp_nid = 2; */
12627 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12628 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12629 "Headphone Playback Volume",
12630 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12636 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12637 "Headphone Playback Switch",
12638 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12643 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12644 "Headphone Playback Switch",
12645 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12654 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12655 const struct auto_pin_cfg *cfg)
12659 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12662 /* digital-mic input pin is excluded in alc880_auto_create..()
12663 * because it's under 0x18
12665 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12666 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12667 struct hda_input_mux *imux = &spec->private_imux[0];
12668 imux->items[imux->num_items].label = "Int Mic";
12669 imux->items[imux->num_items].index = 0x05;
12675 #ifdef CONFIG_SND_HDA_POWER_SAVE
12676 #define alc269_loopbacks alc880_loopbacks
12679 /* pcm configuration: identiacal with ALC880 */
12680 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12681 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12682 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12683 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12686 * BIOS auto configuration
12688 static int alc269_parse_auto_config(struct hda_codec *codec)
12690 struct alc_spec *spec = codec->spec;
12692 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12694 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12699 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12702 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12706 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12708 if (spec->autocfg.dig_out_pin)
12709 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12711 if (spec->kctls.list)
12712 add_mixer(spec, spec->kctls.list);
12714 add_verb(spec, alc269_init_verbs);
12715 spec->num_mux_defs = 1;
12716 spec->input_mux = &spec->private_imux[0];
12717 /* set default input source */
12718 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12719 0, AC_VERB_SET_CONNECT_SEL,
12720 spec->input_mux->items[0].index);
12722 err = alc_auto_add_mic_boost(codec);
12726 if (!spec->cap_mixer)
12727 set_capture_mixer(spec);
12729 store_pin_configs(codec);
12733 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12734 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12735 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12738 /* init callback for auto-configuration model -- overriding the default init */
12739 static void alc269_auto_init(struct hda_codec *codec)
12741 struct alc_spec *spec = codec->spec;
12742 alc269_auto_init_multi_out(codec);
12743 alc269_auto_init_hp_out(codec);
12744 alc269_auto_init_analog_input(codec);
12745 if (spec->unsol_event)
12746 alc_inithook(codec);
12750 * configuration and preset
12752 static const char *alc269_models[ALC269_MODEL_LAST] = {
12753 [ALC269_BASIC] = "basic",
12754 [ALC269_QUANTA_FL1] = "quanta",
12755 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12756 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12757 [ALC269_FUJITSU] = "fujitsu",
12758 [ALC269_LIFEBOOK] = "lifebook"
12761 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12762 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12763 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12764 ALC269_ASUS_EEEPC_P703),
12765 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12766 ALC269_ASUS_EEEPC_P901),
12767 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12768 ALC269_ASUS_EEEPC_P901),
12769 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12770 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12774 static struct alc_config_preset alc269_presets[] = {
12776 .mixers = { alc269_base_mixer },
12777 .init_verbs = { alc269_init_verbs },
12778 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12779 .dac_nids = alc269_dac_nids,
12781 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12782 .channel_mode = alc269_modes,
12783 .input_mux = &alc269_capture_source,
12785 [ALC269_QUANTA_FL1] = {
12786 .mixers = { alc269_quanta_fl1_mixer },
12787 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12788 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12789 .dac_nids = alc269_dac_nids,
12791 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12792 .channel_mode = alc269_modes,
12793 .input_mux = &alc269_capture_source,
12794 .unsol_event = alc269_quanta_fl1_unsol_event,
12795 .init_hook = alc269_quanta_fl1_init_hook,
12797 [ALC269_ASUS_EEEPC_P703] = {
12798 .mixers = { alc269_eeepc_mixer },
12799 .cap_mixer = alc269_epc_capture_mixer,
12800 .init_verbs = { alc269_init_verbs,
12801 alc269_eeepc_amic_init_verbs },
12802 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12803 .dac_nids = alc269_dac_nids,
12805 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12806 .channel_mode = alc269_modes,
12807 .input_mux = &alc269_eeepc_amic_capture_source,
12808 .unsol_event = alc269_eeepc_amic_unsol_event,
12809 .init_hook = alc269_eeepc_amic_inithook,
12811 [ALC269_ASUS_EEEPC_P901] = {
12812 .mixers = { alc269_eeepc_mixer },
12813 .cap_mixer = alc269_epc_capture_mixer,
12814 .init_verbs = { alc269_init_verbs,
12815 alc269_eeepc_dmic_init_verbs },
12816 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12817 .dac_nids = alc269_dac_nids,
12819 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12820 .channel_mode = alc269_modes,
12821 .input_mux = &alc269_eeepc_dmic_capture_source,
12822 .unsol_event = alc269_eeepc_dmic_unsol_event,
12823 .init_hook = alc269_eeepc_dmic_inithook,
12825 [ALC269_FUJITSU] = {
12826 .mixers = { alc269_fujitsu_mixer },
12827 .cap_mixer = alc269_epc_capture_mixer,
12828 .init_verbs = { alc269_init_verbs,
12829 alc269_eeepc_dmic_init_verbs },
12830 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12831 .dac_nids = alc269_dac_nids,
12833 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12834 .channel_mode = alc269_modes,
12835 .input_mux = &alc269_eeepc_dmic_capture_source,
12836 .unsol_event = alc269_eeepc_dmic_unsol_event,
12837 .init_hook = alc269_eeepc_dmic_inithook,
12839 [ALC269_LIFEBOOK] = {
12840 .mixers = { alc269_lifebook_mixer },
12841 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12842 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12843 .dac_nids = alc269_dac_nids,
12845 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12846 .channel_mode = alc269_modes,
12847 .input_mux = &alc269_capture_source,
12848 .unsol_event = alc269_lifebook_unsol_event,
12849 .init_hook = alc269_lifebook_init_hook,
12853 static int patch_alc269(struct hda_codec *codec)
12855 struct alc_spec *spec;
12859 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12863 codec->spec = spec;
12865 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12867 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12871 if (board_config < 0) {
12872 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12873 "trying auto-probe from BIOS...\n");
12874 board_config = ALC269_AUTO;
12877 if (board_config == ALC269_AUTO) {
12878 /* automatic parse from the BIOS config */
12879 err = alc269_parse_auto_config(codec);
12885 "hda_codec: Cannot set up configuration "
12886 "from BIOS. Using base mode...\n");
12887 board_config = ALC269_BASIC;
12891 err = snd_hda_attach_beep_device(codec, 0x1);
12897 if (board_config != ALC269_AUTO)
12898 setup_preset(spec, &alc269_presets[board_config]);
12900 spec->stream_name_analog = "ALC269 Analog";
12901 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12902 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12904 spec->stream_name_digital = "ALC269 Digital";
12905 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12906 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12908 spec->adc_nids = alc269_adc_nids;
12909 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12910 spec->capsrc_nids = alc269_capsrc_nids;
12911 if (!spec->cap_mixer)
12912 set_capture_mixer(spec);
12913 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12915 codec->patch_ops = alc_patch_ops;
12916 if (board_config == ALC269_AUTO)
12917 spec->init_hook = alc269_auto_init;
12918 #ifdef CONFIG_SND_HDA_POWER_SAVE
12919 if (!spec->loopback.amplist)
12920 spec->loopback.amplist = alc269_loopbacks;
12922 codec->proc_widget_hook = print_realtek_coef;
12928 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12932 * set the path ways for 2 channel output
12933 * need to set the codec line out and mic 1 pin widgets to inputs
12935 static struct hda_verb alc861_threestack_ch2_init[] = {
12936 /* set pin widget 1Ah (line in) for input */
12937 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12938 /* set pin widget 18h (mic1/2) for input, for mic also enable
12941 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12943 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12945 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12946 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12952 * need to set the codec line out and mic 1 pin widgets to outputs
12954 static struct hda_verb alc861_threestack_ch6_init[] = {
12955 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12956 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12957 /* set pin widget 18h (mic1) for output (CLFE)*/
12958 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12960 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12961 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12963 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12965 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12966 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12971 static struct hda_channel_mode alc861_threestack_modes[2] = {
12972 { 2, alc861_threestack_ch2_init },
12973 { 6, alc861_threestack_ch6_init },
12975 /* Set mic1 as input and unmute the mixer */
12976 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12977 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12978 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12981 /* Set mic1 as output and mute mixer */
12982 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12983 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12984 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12988 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12989 { 2, alc861_uniwill_m31_ch2_init },
12990 { 4, alc861_uniwill_m31_ch4_init },
12993 /* Set mic1 and line-in as input and unmute the mixer */
12994 static struct hda_verb alc861_asus_ch2_init[] = {
12995 /* set pin widget 1Ah (line in) for input */
12996 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12997 /* set pin widget 18h (mic1/2) for input, for mic also enable
13000 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13002 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13004 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13005 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13009 /* Set mic1 nad line-in as output and mute mixer */
13010 static struct hda_verb alc861_asus_ch6_init[] = {
13011 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13012 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13013 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13014 /* set pin widget 18h (mic1) for output (CLFE)*/
13015 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13016 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13017 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13018 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13020 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13022 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13023 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13028 static struct hda_channel_mode alc861_asus_modes[2] = {
13029 { 2, alc861_asus_ch2_init },
13030 { 6, alc861_asus_ch6_init },
13035 static struct snd_kcontrol_new alc861_base_mixer[] = {
13036 /* output mixer control */
13037 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13038 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13039 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13040 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13041 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13043 /*Input mixer control */
13044 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13045 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13046 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13047 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13048 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13049 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13050 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13051 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13052 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13053 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13058 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13059 /* output mixer control */
13060 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13061 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13062 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13063 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13064 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13066 /* Input mixer control */
13067 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13068 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13069 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13070 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13071 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13072 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13073 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13074 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13075 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13076 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13079 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13080 .name = "Channel Mode",
13081 .info = alc_ch_mode_info,
13082 .get = alc_ch_mode_get,
13083 .put = alc_ch_mode_put,
13084 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13089 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13090 /* output mixer control */
13091 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13093 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13098 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13099 /* output mixer control */
13100 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13101 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13102 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13103 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13104 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13106 /* Input mixer control */
13107 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13108 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13109 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13110 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13111 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13112 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13114 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13120 .name = "Channel Mode",
13121 .info = alc_ch_mode_info,
13122 .get = alc_ch_mode_get,
13123 .put = alc_ch_mode_put,
13124 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13129 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13130 /* output mixer control */
13131 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13132 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13133 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13134 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13135 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13137 /* Input mixer control */
13138 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13139 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13140 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13141 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13142 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13143 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13145 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13150 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13151 .name = "Channel Mode",
13152 .info = alc_ch_mode_info,
13153 .get = alc_ch_mode_get,
13154 .put = alc_ch_mode_put,
13155 .private_value = ARRAY_SIZE(alc861_asus_modes),
13160 /* additional mixer */
13161 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13162 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13163 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13168 * generic initialization of ADC, input mixers and output mixers
13170 static struct hda_verb alc861_base_init_verbs[] = {
13172 * Unmute ADC0 and set the default input to mic-in
13174 /* port-A for surround (rear panel) */
13175 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13176 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13177 /* port-B for mic-in (rear panel) with vref */
13178 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13179 /* port-C for line-in (rear panel) */
13180 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13181 /* port-D for Front */
13182 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13183 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13184 /* port-E for HP out (front panel) */
13185 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13186 /* route front PCM to HP */
13187 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13188 /* port-F for mic-in (front panel) with vref */
13189 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13190 /* port-G for CLFE (rear panel) */
13191 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13192 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13193 /* port-H for side (rear panel) */
13194 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13195 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13197 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13198 /* route front mic to ADC1*/
13199 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13202 /* Unmute DAC0~3 & spdif out*/
13203 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13204 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13205 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13206 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13207 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13209 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13210 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13211 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13212 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13213 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13215 /* Unmute Stereo Mixer 15 */
13216 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13217 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13218 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13219 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13221 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13222 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13223 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13224 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13225 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13226 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13227 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13228 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13229 /* hp used DAC 3 (Front) */
13230 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13231 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13236 static struct hda_verb alc861_threestack_init_verbs[] = {
13238 * Unmute ADC0 and set the default input to mic-in
13240 /* port-A for surround (rear panel) */
13241 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13242 /* port-B for mic-in (rear panel) with vref */
13243 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13244 /* port-C for line-in (rear panel) */
13245 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13246 /* port-D for Front */
13247 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13248 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13249 /* port-E for HP out (front panel) */
13250 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13251 /* route front PCM to HP */
13252 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13253 /* port-F for mic-in (front panel) with vref */
13254 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13255 /* port-G for CLFE (rear panel) */
13256 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13257 /* port-H for side (rear panel) */
13258 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13260 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13261 /* route front mic to ADC1*/
13262 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13263 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13264 /* Unmute DAC0~3 & spdif out*/
13265 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13266 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13267 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13268 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13271 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13272 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13273 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13274 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13275 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13277 /* Unmute Stereo Mixer 15 */
13278 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13279 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13283 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13284 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13285 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13286 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13287 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13288 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13289 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13290 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13291 /* hp used DAC 3 (Front) */
13292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13293 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13297 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13299 * Unmute ADC0 and set the default input to mic-in
13301 /* port-A for surround (rear panel) */
13302 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13303 /* port-B for mic-in (rear panel) with vref */
13304 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13305 /* port-C for line-in (rear panel) */
13306 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13307 /* port-D for Front */
13308 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13309 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13310 /* port-E for HP out (front panel) */
13311 /* this has to be set to VREF80 */
13312 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13313 /* route front PCM to HP */
13314 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13315 /* port-F for mic-in (front panel) with vref */
13316 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13317 /* port-G for CLFE (rear panel) */
13318 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13319 /* port-H for side (rear panel) */
13320 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13322 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13323 /* route front mic to ADC1*/
13324 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13326 /* Unmute DAC0~3 & spdif out*/
13327 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13328 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13329 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13330 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13333 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13334 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13335 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13336 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13337 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13339 /* Unmute Stereo Mixer 15 */
13340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13341 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13342 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13345 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13346 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13347 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13348 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13349 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13351 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13352 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13353 /* hp used DAC 3 (Front) */
13354 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13355 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13359 static struct hda_verb alc861_asus_init_verbs[] = {
13361 * Unmute ADC0 and set the default input to mic-in
13363 /* port-A for surround (rear panel)
13364 * according to codec#0 this is the HP jack
13366 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13367 /* route front PCM to HP */
13368 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13369 /* port-B for mic-in (rear panel) with vref */
13370 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13371 /* port-C for line-in (rear panel) */
13372 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13373 /* port-D for Front */
13374 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13375 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13376 /* port-E for HP out (front panel) */
13377 /* this has to be set to VREF80 */
13378 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13379 /* route front PCM to HP */
13380 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13381 /* port-F for mic-in (front panel) with vref */
13382 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13383 /* port-G for CLFE (rear panel) */
13384 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13385 /* port-H for side (rear panel) */
13386 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13388 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13389 /* route front mic to ADC1*/
13390 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13391 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13392 /* Unmute DAC0~3 & spdif out*/
13393 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13394 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13395 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13396 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13398 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13399 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13400 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13401 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13402 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13404 /* Unmute Stereo Mixer 15 */
13405 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13406 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13407 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13408 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13410 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13411 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13412 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13413 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13414 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13415 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13416 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13417 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13418 /* hp used DAC 3 (Front) */
13419 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13420 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13424 /* additional init verbs for ASUS laptops */
13425 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13426 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13427 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13432 * generic initialization of ADC, input mixers and output mixers
13434 static struct hda_verb alc861_auto_init_verbs[] = {
13436 * Unmute ADC0 and set the default input to mic-in
13438 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13441 /* Unmute DAC0~3 & spdif out*/
13442 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13443 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13444 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13445 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13448 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13449 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13450 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13451 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13452 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13454 /* Unmute Stereo Mixer 15 */
13455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13456 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13457 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13458 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13460 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13461 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13462 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13463 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13464 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13465 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13466 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13467 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13469 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13470 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13471 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13472 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13473 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13474 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13475 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13476 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13478 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13483 static struct hda_verb alc861_toshiba_init_verbs[] = {
13484 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13489 /* toggle speaker-output according to the hp-jack state */
13490 static void alc861_toshiba_automute(struct hda_codec *codec)
13492 unsigned int present;
13494 present = snd_hda_codec_read(codec, 0x0f, 0,
13495 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13496 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13497 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13498 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13499 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13502 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13505 if ((res >> 26) == ALC880_HP_EVENT)
13506 alc861_toshiba_automute(codec);
13509 /* pcm configuration: identiacal with ALC880 */
13510 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13511 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13512 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13513 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13516 #define ALC861_DIGOUT_NID 0x07
13518 static struct hda_channel_mode alc861_8ch_modes[1] = {
13522 static hda_nid_t alc861_dac_nids[4] = {
13523 /* front, surround, clfe, side */
13524 0x03, 0x06, 0x05, 0x04
13527 static hda_nid_t alc660_dac_nids[3] = {
13528 /* front, clfe, surround */
13532 static hda_nid_t alc861_adc_nids[1] = {
13537 static struct hda_input_mux alc861_capture_source = {
13541 { "Front Mic", 0x3 },
13548 /* fill in the dac_nids table from the parsed pin configuration */
13549 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13550 const struct auto_pin_cfg *cfg)
13555 spec->multiout.dac_nids = spec->private_dac_nids;
13556 for (i = 0; i < cfg->line_outs; i++) {
13557 nid = cfg->line_out_pins[i];
13559 if (i >= ARRAY_SIZE(alc861_dac_nids))
13561 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13564 spec->multiout.num_dacs = cfg->line_outs;
13568 /* add playback controls from the parsed DAC table */
13569 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13570 const struct auto_pin_cfg *cfg)
13573 static const char *chname[4] = {
13574 "Front", "Surround", NULL /*CLFE*/, "Side"
13579 for (i = 0; i < cfg->line_outs; i++) {
13580 nid = spec->multiout.dac_nids[i];
13585 err = add_control(spec, ALC_CTL_BIND_MUTE,
13586 "Center Playback Switch",
13587 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13591 err = add_control(spec, ALC_CTL_BIND_MUTE,
13592 "LFE Playback Switch",
13593 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13598 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13600 if (nid == alc861_dac_nids[idx])
13602 sprintf(name, "%s Playback Switch", chname[idx]);
13603 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13604 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13613 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13621 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13623 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13624 "Headphone Playback Switch",
13625 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13628 spec->multiout.hp_nid = nid;
13633 /* create playback/capture controls for input pins */
13634 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13635 const struct auto_pin_cfg *cfg)
13637 struct hda_input_mux *imux = &spec->private_imux[0];
13638 int i, err, idx, idx1;
13640 for (i = 0; i < AUTO_PIN_LAST; i++) {
13641 switch (cfg->input_pins[i]) {
13644 idx = 2; /* Line In */
13648 idx = 2; /* Line In */
13652 idx = 1; /* Mic In */
13656 idx = 1; /* Mic In */
13666 err = new_analog_input(spec, cfg->input_pins[i],
13667 auto_pin_cfg_labels[i], idx, 0x15);
13671 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13672 imux->items[imux->num_items].index = idx1;
13678 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13680 int pin_type, int dac_idx)
13682 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13684 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13688 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13690 struct alc_spec *spec = codec->spec;
13693 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13694 for (i = 0; i < spec->autocfg.line_outs; i++) {
13695 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13696 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13698 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13699 spec->multiout.dac_nids[i]);
13703 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13705 struct alc_spec *spec = codec->spec;
13708 pin = spec->autocfg.hp_pins[0];
13709 if (pin) /* connect to front */
13710 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13711 spec->multiout.dac_nids[0]);
13712 pin = spec->autocfg.speaker_pins[0];
13714 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13717 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13719 struct alc_spec *spec = codec->spec;
13722 for (i = 0; i < AUTO_PIN_LAST; i++) {
13723 hda_nid_t nid = spec->autocfg.input_pins[i];
13724 if (nid >= 0x0c && nid <= 0x11) {
13725 snd_hda_codec_write(codec, nid, 0,
13726 AC_VERB_SET_PIN_WIDGET_CONTROL,
13727 i <= AUTO_PIN_FRONT_MIC ?
13728 PIN_VREF80 : PIN_IN);
13733 /* parse the BIOS configuration and set up the alc_spec */
13734 /* return 1 if successful, 0 if the proper config is not found,
13735 * or a negative error code
13737 static int alc861_parse_auto_config(struct hda_codec *codec)
13739 struct alc_spec *spec = codec->spec;
13741 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13743 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13747 if (!spec->autocfg.line_outs)
13748 return 0; /* can't find valid BIOS pin config */
13750 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13753 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13756 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13759 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13763 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13765 if (spec->autocfg.dig_out_pin)
13766 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13768 if (spec->kctls.list)
13769 add_mixer(spec, spec->kctls.list);
13771 add_verb(spec, alc861_auto_init_verbs);
13773 spec->num_mux_defs = 1;
13774 spec->input_mux = &spec->private_imux[0];
13776 spec->adc_nids = alc861_adc_nids;
13777 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13778 set_capture_mixer(spec);
13780 store_pin_configs(codec);
13784 /* additional initialization for auto-configuration model */
13785 static void alc861_auto_init(struct hda_codec *codec)
13787 struct alc_spec *spec = codec->spec;
13788 alc861_auto_init_multi_out(codec);
13789 alc861_auto_init_hp_out(codec);
13790 alc861_auto_init_analog_input(codec);
13791 if (spec->unsol_event)
13792 alc_inithook(codec);
13795 #ifdef CONFIG_SND_HDA_POWER_SAVE
13796 static struct hda_amp_list alc861_loopbacks[] = {
13797 { 0x15, HDA_INPUT, 0 },
13798 { 0x15, HDA_INPUT, 1 },
13799 { 0x15, HDA_INPUT, 2 },
13800 { 0x15, HDA_INPUT, 3 },
13807 * configuration and preset
13809 static const char *alc861_models[ALC861_MODEL_LAST] = {
13810 [ALC861_3ST] = "3stack",
13811 [ALC660_3ST] = "3stack-660",
13812 [ALC861_3ST_DIG] = "3stack-dig",
13813 [ALC861_6ST_DIG] = "6stack-dig",
13814 [ALC861_UNIWILL_M31] = "uniwill-m31",
13815 [ALC861_TOSHIBA] = "toshiba",
13816 [ALC861_ASUS] = "asus",
13817 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13818 [ALC861_AUTO] = "auto",
13821 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13822 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13823 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13824 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13825 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13826 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13827 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13828 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13829 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13830 * Any other models that need this preset?
13832 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13833 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13834 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13835 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13836 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13837 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13838 /* FIXME: the below seems conflict */
13839 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13840 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13841 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13845 static struct alc_config_preset alc861_presets[] = {
13847 .mixers = { alc861_3ST_mixer },
13848 .init_verbs = { alc861_threestack_init_verbs },
13849 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13850 .dac_nids = alc861_dac_nids,
13851 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13852 .channel_mode = alc861_threestack_modes,
13854 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13855 .adc_nids = alc861_adc_nids,
13856 .input_mux = &alc861_capture_source,
13858 [ALC861_3ST_DIG] = {
13859 .mixers = { alc861_base_mixer },
13860 .init_verbs = { alc861_threestack_init_verbs },
13861 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13862 .dac_nids = alc861_dac_nids,
13863 .dig_out_nid = ALC861_DIGOUT_NID,
13864 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13865 .channel_mode = alc861_threestack_modes,
13867 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13868 .adc_nids = alc861_adc_nids,
13869 .input_mux = &alc861_capture_source,
13871 [ALC861_6ST_DIG] = {
13872 .mixers = { alc861_base_mixer },
13873 .init_verbs = { alc861_base_init_verbs },
13874 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13875 .dac_nids = alc861_dac_nids,
13876 .dig_out_nid = ALC861_DIGOUT_NID,
13877 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13878 .channel_mode = alc861_8ch_modes,
13879 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13880 .adc_nids = alc861_adc_nids,
13881 .input_mux = &alc861_capture_source,
13884 .mixers = { alc861_3ST_mixer },
13885 .init_verbs = { alc861_threestack_init_verbs },
13886 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13887 .dac_nids = alc660_dac_nids,
13888 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13889 .channel_mode = alc861_threestack_modes,
13891 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13892 .adc_nids = alc861_adc_nids,
13893 .input_mux = &alc861_capture_source,
13895 [ALC861_UNIWILL_M31] = {
13896 .mixers = { alc861_uniwill_m31_mixer },
13897 .init_verbs = { alc861_uniwill_m31_init_verbs },
13898 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13899 .dac_nids = alc861_dac_nids,
13900 .dig_out_nid = ALC861_DIGOUT_NID,
13901 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13902 .channel_mode = alc861_uniwill_m31_modes,
13904 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13905 .adc_nids = alc861_adc_nids,
13906 .input_mux = &alc861_capture_source,
13908 [ALC861_TOSHIBA] = {
13909 .mixers = { alc861_toshiba_mixer },
13910 .init_verbs = { alc861_base_init_verbs,
13911 alc861_toshiba_init_verbs },
13912 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13913 .dac_nids = alc861_dac_nids,
13914 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13915 .channel_mode = alc883_3ST_2ch_modes,
13916 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13917 .adc_nids = alc861_adc_nids,
13918 .input_mux = &alc861_capture_source,
13919 .unsol_event = alc861_toshiba_unsol_event,
13920 .init_hook = alc861_toshiba_automute,
13923 .mixers = { alc861_asus_mixer },
13924 .init_verbs = { alc861_asus_init_verbs },
13925 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13926 .dac_nids = alc861_dac_nids,
13927 .dig_out_nid = ALC861_DIGOUT_NID,
13928 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13929 .channel_mode = alc861_asus_modes,
13932 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13933 .adc_nids = alc861_adc_nids,
13934 .input_mux = &alc861_capture_source,
13936 [ALC861_ASUS_LAPTOP] = {
13937 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13938 .init_verbs = { alc861_asus_init_verbs,
13939 alc861_asus_laptop_init_verbs },
13940 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13941 .dac_nids = alc861_dac_nids,
13942 .dig_out_nid = ALC861_DIGOUT_NID,
13943 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13944 .channel_mode = alc883_3ST_2ch_modes,
13946 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13947 .adc_nids = alc861_adc_nids,
13948 .input_mux = &alc861_capture_source,
13953 static int patch_alc861(struct hda_codec *codec)
13955 struct alc_spec *spec;
13959 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13963 codec->spec = spec;
13965 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13969 if (board_config < 0) {
13970 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13971 "trying auto-probe from BIOS...\n");
13972 board_config = ALC861_AUTO;
13975 if (board_config == ALC861_AUTO) {
13976 /* automatic parse from the BIOS config */
13977 err = alc861_parse_auto_config(codec);
13983 "hda_codec: Cannot set up configuration "
13984 "from BIOS. Using base mode...\n");
13985 board_config = ALC861_3ST_DIG;
13989 err = snd_hda_attach_beep_device(codec, 0x23);
13995 if (board_config != ALC861_AUTO)
13996 setup_preset(spec, &alc861_presets[board_config]);
13998 spec->stream_name_analog = "ALC861 Analog";
13999 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14000 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14002 spec->stream_name_digital = "ALC861 Digital";
14003 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14004 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14006 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14008 spec->vmaster_nid = 0x03;
14010 codec->patch_ops = alc_patch_ops;
14011 if (board_config == ALC861_AUTO)
14012 spec->init_hook = alc861_auto_init;
14013 #ifdef CONFIG_SND_HDA_POWER_SAVE
14014 if (!spec->loopback.amplist)
14015 spec->loopback.amplist = alc861_loopbacks;
14017 codec->proc_widget_hook = print_realtek_coef;
14023 * ALC861-VD support
14027 * In addition, an independent DAC
14029 #define ALC861VD_DIGOUT_NID 0x06
14031 static hda_nid_t alc861vd_dac_nids[4] = {
14032 /* front, surr, clfe, side surr */
14033 0x02, 0x03, 0x04, 0x05
14036 /* dac_nids for ALC660vd are in a different order - according to
14037 * Realtek's driver.
14038 * This should probably tesult in a different mixer for 6stack models
14039 * of ALC660vd codecs, but for now there is only 3stack mixer
14040 * - and it is the same as in 861vd.
14041 * adc_nids in ALC660vd are (is) the same as in 861vd
14043 static hda_nid_t alc660vd_dac_nids[3] = {
14044 /* front, rear, clfe, rear_surr */
14048 static hda_nid_t alc861vd_adc_nids[1] = {
14053 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14056 /* FIXME: should be a matrix-type input source selection */
14057 static struct hda_input_mux alc861vd_capture_source = {
14061 { "Front Mic", 0x1 },
14067 static struct hda_input_mux alc861vd_dallas_capture_source = {
14070 { "Ext Mic", 0x0 },
14071 { "Int Mic", 0x1 },
14075 static struct hda_input_mux alc861vd_hp_capture_source = {
14078 { "Front Mic", 0x0 },
14079 { "ATAPI Mic", 0x1 },
14086 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14093 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14094 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14095 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14096 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14097 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14104 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14105 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14106 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14107 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14108 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14112 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14113 { 6, alc861vd_6stack_ch6_init },
14114 { 8, alc861vd_6stack_ch8_init },
14117 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14120 .name = "Channel Mode",
14121 .info = alc_ch_mode_info,
14122 .get = alc_ch_mode_get,
14123 .put = alc_ch_mode_put,
14128 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14129 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14131 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14132 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14133 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14135 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14136 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14138 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14140 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14142 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14143 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14145 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14146 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14148 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14150 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14154 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14155 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14156 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14158 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14159 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14162 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14167 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14168 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14169 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14173 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14174 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14177 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14178 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14179 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14181 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14182 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14184 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14185 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14190 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14191 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14192 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14193 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14197 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14201 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14202 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14203 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14205 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14206 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14211 /* Pin assignment: Speaker=0x14, HP = 0x15,
14212 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14214 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14215 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14216 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14218 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14219 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14220 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14221 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14222 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14223 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14224 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14228 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14229 * Front Mic=0x18, ATAPI Mic = 0x19,
14231 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14232 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14233 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14234 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14235 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14237 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14238 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14239 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14245 * generic initialization of ADC, input mixers and output mixers
14247 static struct hda_verb alc861vd_volume_init_verbs[] = {
14249 * Unmute ADC0 and set the default input to mic-in
14251 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14254 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14255 * the analog-loopback mixer widget
14257 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14258 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14264 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14268 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14271 * Set up output mixers (0x02 - 0x05)
14273 /* set vol=0 to output mixers */
14274 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14275 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14276 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14277 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14279 /* set up input amps for analog loopback */
14280 /* Amp Indices: DAC = 0, mixer = 1 */
14281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14283 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14284 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14285 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14287 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14288 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14294 * 3-stack pin configuration:
14295 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14297 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14299 * Set pin mode and muting
14301 /* set front pin widgets 0x14 for output */
14302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14304 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14306 /* Mic (rear) pin: input vref at 80% */
14307 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14309 /* Front Mic pin: input vref at 80% */
14310 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14312 /* Line In pin: input */
14313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14314 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14315 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14316 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14317 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14318 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14319 /* CD pin widget for input */
14320 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14326 * 6-stack pin configuration:
14328 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14330 * Set pin mode and muting
14332 /* set front pin widgets 0x14 for output */
14333 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14334 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14335 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14337 /* Rear Pin: output 1 (0x0d) */
14338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14341 /* CLFE Pin: output 2 (0x0e) */
14342 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14343 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14344 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14345 /* Side Pin: output 3 (0x0f) */
14346 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14347 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14348 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14350 /* Mic (rear) pin: input vref at 80% */
14351 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14353 /* Front Mic pin: input vref at 80% */
14354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14355 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14356 /* Line In pin: input */
14357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14359 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14360 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14361 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14362 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14363 /* CD pin widget for input */
14364 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14369 static struct hda_verb alc861vd_eapd_verbs[] = {
14370 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14374 static struct hda_verb alc660vd_eapd_verbs[] = {
14375 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14376 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14380 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14384 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14385 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14389 /* toggle speaker-output according to the hp-jack state */
14390 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14392 unsigned int present;
14393 unsigned char bits;
14395 present = snd_hda_codec_read(codec, 0x1b, 0,
14396 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14397 bits = present ? HDA_AMP_MUTE : 0;
14398 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14399 HDA_AMP_MUTE, bits);
14402 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14404 unsigned int present;
14405 unsigned char bits;
14407 present = snd_hda_codec_read(codec, 0x18, 0,
14408 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14409 bits = present ? HDA_AMP_MUTE : 0;
14410 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14411 HDA_AMP_MUTE, bits);
14414 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14416 alc861vd_lenovo_hp_automute(codec);
14417 alc861vd_lenovo_mic_automute(codec);
14420 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14423 switch (res >> 26) {
14424 case ALC880_HP_EVENT:
14425 alc861vd_lenovo_hp_automute(codec);
14427 case ALC880_MIC_EVENT:
14428 alc861vd_lenovo_mic_automute(codec);
14433 static struct hda_verb alc861vd_dallas_verbs[] = {
14434 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14435 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14436 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14437 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14441 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14442 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14443 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14444 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14445 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14446 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14448 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14449 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14450 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14451 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14452 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14453 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14454 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14455 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14457 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14458 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14459 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14460 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14461 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14462 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14463 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14464 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14471 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14472 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14473 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14478 /* toggle speaker-output according to the hp-jack state */
14479 static void alc861vd_dallas_automute(struct hda_codec *codec)
14481 unsigned int present;
14483 present = snd_hda_codec_read(codec, 0x15, 0,
14484 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14485 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14486 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14489 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14491 if ((res >> 26) == ALC880_HP_EVENT)
14492 alc861vd_dallas_automute(codec);
14495 #ifdef CONFIG_SND_HDA_POWER_SAVE
14496 #define alc861vd_loopbacks alc880_loopbacks
14499 /* pcm configuration: identiacal with ALC880 */
14500 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14501 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14502 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14503 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14506 * configuration and preset
14508 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14509 [ALC660VD_3ST] = "3stack-660",
14510 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14511 [ALC660VD_ASUS_V1S] = "asus-v1s",
14512 [ALC861VD_3ST] = "3stack",
14513 [ALC861VD_3ST_DIG] = "3stack-digout",
14514 [ALC861VD_6ST_DIG] = "6stack-digout",
14515 [ALC861VD_LENOVO] = "lenovo",
14516 [ALC861VD_DALLAS] = "dallas",
14517 [ALC861VD_HP] = "hp",
14518 [ALC861VD_AUTO] = "auto",
14521 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14522 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14523 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14524 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14525 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14526 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14527 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14528 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14529 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14530 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14531 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14532 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14533 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14534 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14535 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14536 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14540 static struct alc_config_preset alc861vd_presets[] = {
14542 .mixers = { alc861vd_3st_mixer },
14543 .init_verbs = { alc861vd_volume_init_verbs,
14544 alc861vd_3stack_init_verbs },
14545 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14546 .dac_nids = alc660vd_dac_nids,
14547 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14548 .channel_mode = alc861vd_3stack_2ch_modes,
14549 .input_mux = &alc861vd_capture_source,
14551 [ALC660VD_3ST_DIG] = {
14552 .mixers = { alc861vd_3st_mixer },
14553 .init_verbs = { alc861vd_volume_init_verbs,
14554 alc861vd_3stack_init_verbs },
14555 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14556 .dac_nids = alc660vd_dac_nids,
14557 .dig_out_nid = ALC861VD_DIGOUT_NID,
14558 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14559 .channel_mode = alc861vd_3stack_2ch_modes,
14560 .input_mux = &alc861vd_capture_source,
14563 .mixers = { alc861vd_3st_mixer },
14564 .init_verbs = { alc861vd_volume_init_verbs,
14565 alc861vd_3stack_init_verbs },
14566 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14567 .dac_nids = alc861vd_dac_nids,
14568 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14569 .channel_mode = alc861vd_3stack_2ch_modes,
14570 .input_mux = &alc861vd_capture_source,
14572 [ALC861VD_3ST_DIG] = {
14573 .mixers = { alc861vd_3st_mixer },
14574 .init_verbs = { alc861vd_volume_init_verbs,
14575 alc861vd_3stack_init_verbs },
14576 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14577 .dac_nids = alc861vd_dac_nids,
14578 .dig_out_nid = ALC861VD_DIGOUT_NID,
14579 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14580 .channel_mode = alc861vd_3stack_2ch_modes,
14581 .input_mux = &alc861vd_capture_source,
14583 [ALC861VD_6ST_DIG] = {
14584 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14585 .init_verbs = { alc861vd_volume_init_verbs,
14586 alc861vd_6stack_init_verbs },
14587 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14588 .dac_nids = alc861vd_dac_nids,
14589 .dig_out_nid = ALC861VD_DIGOUT_NID,
14590 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14591 .channel_mode = alc861vd_6stack_modes,
14592 .input_mux = &alc861vd_capture_source,
14594 [ALC861VD_LENOVO] = {
14595 .mixers = { alc861vd_lenovo_mixer },
14596 .init_verbs = { alc861vd_volume_init_verbs,
14597 alc861vd_3stack_init_verbs,
14598 alc861vd_eapd_verbs,
14599 alc861vd_lenovo_unsol_verbs },
14600 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14601 .dac_nids = alc660vd_dac_nids,
14602 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14603 .channel_mode = alc861vd_3stack_2ch_modes,
14604 .input_mux = &alc861vd_capture_source,
14605 .unsol_event = alc861vd_lenovo_unsol_event,
14606 .init_hook = alc861vd_lenovo_automute,
14608 [ALC861VD_DALLAS] = {
14609 .mixers = { alc861vd_dallas_mixer },
14610 .init_verbs = { alc861vd_dallas_verbs },
14611 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14612 .dac_nids = alc861vd_dac_nids,
14613 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14614 .channel_mode = alc861vd_3stack_2ch_modes,
14615 .input_mux = &alc861vd_dallas_capture_source,
14616 .unsol_event = alc861vd_dallas_unsol_event,
14617 .init_hook = alc861vd_dallas_automute,
14620 .mixers = { alc861vd_hp_mixer },
14621 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14622 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14623 .dac_nids = alc861vd_dac_nids,
14624 .dig_out_nid = ALC861VD_DIGOUT_NID,
14625 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14626 .channel_mode = alc861vd_3stack_2ch_modes,
14627 .input_mux = &alc861vd_hp_capture_source,
14628 .unsol_event = alc861vd_dallas_unsol_event,
14629 .init_hook = alc861vd_dallas_automute,
14631 [ALC660VD_ASUS_V1S] = {
14632 .mixers = { alc861vd_lenovo_mixer },
14633 .init_verbs = { alc861vd_volume_init_verbs,
14634 alc861vd_3stack_init_verbs,
14635 alc861vd_eapd_verbs,
14636 alc861vd_lenovo_unsol_verbs },
14637 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14638 .dac_nids = alc660vd_dac_nids,
14639 .dig_out_nid = ALC861VD_DIGOUT_NID,
14640 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14641 .channel_mode = alc861vd_3stack_2ch_modes,
14642 .input_mux = &alc861vd_capture_source,
14643 .unsol_event = alc861vd_lenovo_unsol_event,
14644 .init_hook = alc861vd_lenovo_automute,
14649 * BIOS auto configuration
14651 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14652 hda_nid_t nid, int pin_type, int dac_idx)
14654 alc_set_pin_output(codec, nid, pin_type);
14657 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14659 struct alc_spec *spec = codec->spec;
14662 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14663 for (i = 0; i <= HDA_SIDE; i++) {
14664 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14665 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14667 alc861vd_auto_set_output_and_unmute(codec, nid,
14673 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14675 struct alc_spec *spec = codec->spec;
14678 pin = spec->autocfg.hp_pins[0];
14679 if (pin) /* connect to front and use dac 0 */
14680 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14681 pin = spec->autocfg.speaker_pins[0];
14683 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14686 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14687 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14689 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14691 struct alc_spec *spec = codec->spec;
14694 for (i = 0; i < AUTO_PIN_LAST; i++) {
14695 hda_nid_t nid = spec->autocfg.input_pins[i];
14696 if (alc861vd_is_input_pin(nid)) {
14697 snd_hda_codec_write(codec, nid, 0,
14698 AC_VERB_SET_PIN_WIDGET_CONTROL,
14699 i <= AUTO_PIN_FRONT_MIC ?
14700 PIN_VREF80 : PIN_IN);
14701 if (nid != ALC861VD_PIN_CD_NID)
14702 snd_hda_codec_write(codec, nid, 0,
14703 AC_VERB_SET_AMP_GAIN_MUTE,
14709 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14711 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14712 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14714 /* add playback controls from the parsed DAC table */
14715 /* Based on ALC880 version. But ALC861VD has separate,
14716 * different NIDs for mute/unmute switch and volume control */
14717 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14718 const struct auto_pin_cfg *cfg)
14721 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14722 hda_nid_t nid_v, nid_s;
14725 for (i = 0; i < cfg->line_outs; i++) {
14726 if (!spec->multiout.dac_nids[i])
14728 nid_v = alc861vd_idx_to_mixer_vol(
14730 spec->multiout.dac_nids[i]));
14731 nid_s = alc861vd_idx_to_mixer_switch(
14733 spec->multiout.dac_nids[i]));
14737 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14738 "Center Playback Volume",
14739 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14743 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14744 "LFE Playback Volume",
14745 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14749 err = add_control(spec, ALC_CTL_BIND_MUTE,
14750 "Center Playback Switch",
14751 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14755 err = add_control(spec, ALC_CTL_BIND_MUTE,
14756 "LFE Playback Switch",
14757 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14762 sprintf(name, "%s Playback Volume", chname[i]);
14763 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14764 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14768 sprintf(name, "%s Playback Switch", chname[i]);
14769 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14770 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14779 /* add playback controls for speaker and HP outputs */
14780 /* Based on ALC880 version. But ALC861VD has separate,
14781 * different NIDs for mute/unmute switch and volume control */
14782 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14783 hda_nid_t pin, const char *pfx)
14785 hda_nid_t nid_v, nid_s;
14792 if (alc880_is_fixed_pin(pin)) {
14793 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14794 /* specify the DAC as the extra output */
14795 if (!spec->multiout.hp_nid)
14796 spec->multiout.hp_nid = nid_v;
14798 spec->multiout.extra_out_nid[0] = nid_v;
14799 /* control HP volume/switch on the output mixer amp */
14800 nid_v = alc861vd_idx_to_mixer_vol(
14801 alc880_fixed_pin_idx(pin));
14802 nid_s = alc861vd_idx_to_mixer_switch(
14803 alc880_fixed_pin_idx(pin));
14805 sprintf(name, "%s Playback Volume", pfx);
14806 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14807 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14810 sprintf(name, "%s Playback Switch", pfx);
14811 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14812 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14815 } else if (alc880_is_multi_pin(pin)) {
14816 /* set manual connection */
14817 /* we have only a switch on HP-out PIN */
14818 sprintf(name, "%s Playback Switch", pfx);
14819 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14820 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14827 /* parse the BIOS configuration and set up the alc_spec
14828 * return 1 if successful, 0 if the proper config is not found,
14829 * or a negative error code
14830 * Based on ALC880 version - had to change it to override
14831 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14832 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14834 struct alc_spec *spec = codec->spec;
14836 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14838 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14842 if (!spec->autocfg.line_outs)
14843 return 0; /* can't find valid BIOS pin config */
14845 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14848 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14851 err = alc861vd_auto_create_extra_out(spec,
14852 spec->autocfg.speaker_pins[0],
14856 err = alc861vd_auto_create_extra_out(spec,
14857 spec->autocfg.hp_pins[0],
14861 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14865 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14867 if (spec->autocfg.dig_out_pin)
14868 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14870 if (spec->kctls.list)
14871 add_mixer(spec, spec->kctls.list);
14873 add_verb(spec, alc861vd_volume_init_verbs);
14875 spec->num_mux_defs = 1;
14876 spec->input_mux = &spec->private_imux[0];
14878 err = alc_auto_add_mic_boost(codec);
14882 store_pin_configs(codec);
14886 /* additional initialization for auto-configuration model */
14887 static void alc861vd_auto_init(struct hda_codec *codec)
14889 struct alc_spec *spec = codec->spec;
14890 alc861vd_auto_init_multi_out(codec);
14891 alc861vd_auto_init_hp_out(codec);
14892 alc861vd_auto_init_analog_input(codec);
14893 alc861vd_auto_init_input_src(codec);
14894 if (spec->unsol_event)
14895 alc_inithook(codec);
14898 static int patch_alc861vd(struct hda_codec *codec)
14900 struct alc_spec *spec;
14901 int err, board_config;
14903 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14907 codec->spec = spec;
14909 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14913 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14914 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14915 "ALC861VD, trying auto-probe from BIOS...\n");
14916 board_config = ALC861VD_AUTO;
14919 if (board_config == ALC861VD_AUTO) {
14920 /* automatic parse from the BIOS config */
14921 err = alc861vd_parse_auto_config(codec);
14927 "hda_codec: Cannot set up configuration "
14928 "from BIOS. Using base mode...\n");
14929 board_config = ALC861VD_3ST;
14933 err = snd_hda_attach_beep_device(codec, 0x23);
14939 if (board_config != ALC861VD_AUTO)
14940 setup_preset(spec, &alc861vd_presets[board_config]);
14942 if (codec->vendor_id == 0x10ec0660) {
14943 spec->stream_name_analog = "ALC660-VD Analog";
14944 spec->stream_name_digital = "ALC660-VD Digital";
14945 /* always turn on EAPD */
14946 add_verb(spec, alc660vd_eapd_verbs);
14948 spec->stream_name_analog = "ALC861VD Analog";
14949 spec->stream_name_digital = "ALC861VD Digital";
14952 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14953 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14955 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14956 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14958 spec->adc_nids = alc861vd_adc_nids;
14959 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14960 spec->capsrc_nids = alc861vd_capsrc_nids;
14961 spec->capture_style = CAPT_MIX;
14963 set_capture_mixer(spec);
14964 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
14966 spec->vmaster_nid = 0x02;
14968 codec->patch_ops = alc_patch_ops;
14970 if (board_config == ALC861VD_AUTO)
14971 spec->init_hook = alc861vd_auto_init;
14972 #ifdef CONFIG_SND_HDA_POWER_SAVE
14973 if (!spec->loopback.amplist)
14974 spec->loopback.amplist = alc861vd_loopbacks;
14976 codec->proc_widget_hook = print_realtek_coef;
14984 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14985 * configuration. Each pin widget can choose any input DACs and a mixer.
14986 * Each ADC is connected from a mixer of all inputs. This makes possible
14987 * 6-channel independent captures.
14989 * In addition, an independent DAC for the multi-playback (not used in this
14992 #define ALC662_DIGOUT_NID 0x06
14993 #define ALC662_DIGIN_NID 0x0a
14995 static hda_nid_t alc662_dac_nids[4] = {
14996 /* front, rear, clfe, rear_surr */
15000 static hda_nid_t alc662_adc_nids[1] = {
15005 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15008 /* FIXME: should be a matrix-type input source selection */
15009 static struct hda_input_mux alc662_capture_source = {
15013 { "Front Mic", 0x1 },
15019 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15027 static struct hda_input_mux alc662_eeepc_capture_source = {
15035 static struct hda_input_mux alc663_capture_source = {
15039 { "Front Mic", 0x1 },
15044 static struct hda_input_mux alc663_m51va_capture_source = {
15047 { "Ext-Mic", 0x0 },
15055 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15062 static struct hda_verb alc662_3ST_ch2_init[] = {
15063 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15064 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15065 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15066 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15073 static struct hda_verb alc662_3ST_ch6_init[] = {
15074 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15075 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15076 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15077 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15078 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15079 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15083 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15084 { 2, alc662_3ST_ch2_init },
15085 { 6, alc662_3ST_ch6_init },
15091 static struct hda_verb alc662_sixstack_ch6_init[] = {
15092 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15093 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15094 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15101 static struct hda_verb alc662_sixstack_ch8_init[] = {
15102 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15103 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15104 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15108 static struct hda_channel_mode alc662_5stack_modes[2] = {
15109 { 2, alc662_sixstack_ch6_init },
15110 { 6, alc662_sixstack_ch8_init },
15113 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15114 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15117 static struct snd_kcontrol_new alc662_base_mixer[] = {
15118 /* output mixer control */
15119 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15120 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15121 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15122 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15123 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15124 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15125 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15126 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15129 /*Input mixer control */
15130 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15131 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15132 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15133 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15134 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15135 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15136 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15137 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15141 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15142 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15143 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15144 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15145 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15146 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15147 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15148 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15151 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15152 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15156 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15157 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15158 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15159 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15160 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15161 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15162 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15163 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15164 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15166 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15167 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15168 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15169 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15172 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15177 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15178 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15179 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15180 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15181 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15183 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15184 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15185 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15186 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15190 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15191 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15193 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15194 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15196 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15197 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15198 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15200 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15201 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15202 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15206 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15207 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15208 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15209 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15210 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15211 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15212 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15213 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15214 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15215 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15216 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15224 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15225 .ops = &snd_hda_bind_vol,
15227 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15228 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15233 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15234 .ops = &snd_hda_bind_sw,
15236 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15237 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15242 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15243 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15244 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15250 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15251 .ops = &snd_hda_bind_sw,
15253 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15254 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15255 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15260 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15261 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15262 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15264 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15265 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15266 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15271 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15272 .ops = &snd_hda_bind_sw,
15274 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15275 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15276 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15281 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15282 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15283 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15286 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15287 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15291 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15292 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15293 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15294 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15297 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15298 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15302 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15303 .ops = &snd_hda_bind_vol,
15305 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15306 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15311 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15312 .ops = &snd_hda_bind_sw,
15314 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15315 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15320 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15321 HDA_BIND_VOL("Master Playback Volume",
15322 &alc663_asus_two_bind_master_vol),
15323 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15324 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15325 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15331 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15332 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15333 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15334 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15335 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15341 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15342 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15343 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15344 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15345 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15346 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15349 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15350 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15351 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15355 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15356 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15357 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15358 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15360 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15361 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15362 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15363 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15364 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15365 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15369 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15372 .name = "Channel Mode",
15373 .info = alc_ch_mode_info,
15374 .get = alc_ch_mode_get,
15375 .put = alc_ch_mode_put,
15380 static struct hda_verb alc662_init_verbs[] = {
15381 /* ADC: mute amp left and right */
15382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15383 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15384 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15395 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15396 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15399 /* Front Pin: output 0 (0x0c) */
15400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15401 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15403 /* Rear Pin: output 1 (0x0d) */
15404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15405 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15407 /* CLFE Pin: output 2 (0x0e) */
15408 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15409 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15411 /* Mic (rear) pin: input vref at 80% */
15412 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15413 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15414 /* Front Mic pin: input vref at 80% */
15415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15416 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15417 /* Line In pin: input */
15418 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15419 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15420 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15421 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15422 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15423 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15424 /* CD pin widget for input */
15425 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15427 /* FIXME: use matrix-type input source selection */
15428 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15432 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15433 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15435 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15436 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15437 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15438 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15440 /* always trun on EAPD */
15441 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15442 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15447 static struct hda_verb alc662_sue_init_verbs[] = {
15448 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15449 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15453 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15454 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15455 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15459 /* Set Unsolicited Event*/
15460 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15461 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15462 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15467 * generic initialization of ADC, input mixers and output mixers
15469 static struct hda_verb alc662_auto_init_verbs[] = {
15471 * Unmute ADC and set the default input to mic-in
15473 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15474 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15476 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15478 * Note: PASD motherboards uses the Line In 2 as the input for front
15479 * panel mic (mic 2)
15481 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15482 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15489 * Set up output mixers (0x0c - 0x0f)
15491 /* set vol=0 to output mixers */
15492 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15493 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15494 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15496 /* set up input amps for analog loopback */
15497 /* Amp Indices: DAC = 0, mixer = 1 */
15498 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15500 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15502 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15506 /* FIXME: use matrix-type input source selection */
15507 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15514 /* additional verbs for ALC663 */
15515 static struct hda_verb alc663_auto_init_verbs[] = {
15516 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15517 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15521 static struct hda_verb alc663_m51va_init_verbs[] = {
15522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15524 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15525 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15526 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15529 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15530 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15534 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15535 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15536 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15537 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15538 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15539 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15540 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15541 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15545 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15546 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15547 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15548 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15549 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15552 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15553 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15557 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15560 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15561 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15562 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15563 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15564 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15568 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15569 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15570 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15571 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15572 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15573 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15575 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15578 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15579 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15580 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15584 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15586 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15587 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15588 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15591 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15594 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15595 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15596 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15600 static struct hda_verb alc663_g71v_init_verbs[] = {
15601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15602 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15603 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15605 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15606 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15607 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15609 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15610 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15611 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15615 static struct hda_verb alc663_g50v_init_verbs[] = {
15616 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15617 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15618 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15620 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15621 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15625 static struct hda_verb alc662_ecs_init_verbs[] = {
15626 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15627 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15628 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15629 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15633 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15634 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15635 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15639 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15641 unsigned int present;
15642 unsigned char bits;
15644 present = snd_hda_codec_read(codec, 0x14, 0,
15645 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15646 bits = present ? HDA_AMP_MUTE : 0;
15647 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15648 HDA_AMP_MUTE, bits);
15651 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15653 unsigned int present;
15654 unsigned char bits;
15656 present = snd_hda_codec_read(codec, 0x1b, 0,
15657 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15658 bits = present ? HDA_AMP_MUTE : 0;
15659 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15660 HDA_AMP_MUTE, bits);
15661 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15662 HDA_AMP_MUTE, bits);
15665 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15668 if ((res >> 26) == ALC880_HP_EVENT)
15669 alc662_lenovo_101e_all_automute(codec);
15670 if ((res >> 26) == ALC880_FRONT_EVENT)
15671 alc662_lenovo_101e_ispeaker_automute(codec);
15674 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15676 unsigned int present;
15678 present = snd_hda_codec_read(codec, 0x18, 0,
15679 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15680 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15681 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15682 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15683 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15684 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15685 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15686 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15687 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15690 /* unsolicited event for HP jack sensing */
15691 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15694 if ((res >> 26) == ALC880_HP_EVENT)
15695 alc262_hippo1_automute( codec );
15697 if ((res >> 26) == ALC880_MIC_EVENT)
15698 alc662_eeepc_mic_automute(codec);
15701 static void alc662_eeepc_inithook(struct hda_codec *codec)
15703 alc262_hippo1_automute( codec );
15704 alc662_eeepc_mic_automute(codec);
15707 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15710 unsigned int present;
15712 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15713 present = snd_hda_codec_read(codec, 0x14, 0,
15714 AC_VERB_GET_PIN_SENSE, 0);
15715 present = (present & 0x80000000) != 0;
15717 /* mute internal speaker */
15718 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15719 HDA_AMP_MUTE, HDA_AMP_MUTE);
15721 /* unmute internal speaker if necessary */
15722 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15723 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15724 HDA_AMP_MUTE, mute);
15728 /* unsolicited event for HP jack sensing */
15729 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15732 if ((res >> 26) == ALC880_HP_EVENT)
15733 alc662_eeepc_ep20_automute(codec);
15736 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15738 alc662_eeepc_ep20_automute(codec);
15741 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15743 unsigned int present;
15744 unsigned char bits;
15746 present = snd_hda_codec_read(codec, 0x21, 0,
15747 AC_VERB_GET_PIN_SENSE, 0)
15748 & AC_PINSENSE_PRESENCE;
15749 bits = present ? HDA_AMP_MUTE : 0;
15750 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15751 AMP_IN_MUTE(0), bits);
15752 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15753 AMP_IN_MUTE(0), bits);
15756 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15758 unsigned int present;
15759 unsigned char bits;
15761 present = snd_hda_codec_read(codec, 0x21, 0,
15762 AC_VERB_GET_PIN_SENSE, 0)
15763 & AC_PINSENSE_PRESENCE;
15764 bits = present ? HDA_AMP_MUTE : 0;
15765 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15766 AMP_IN_MUTE(0), bits);
15767 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15768 AMP_IN_MUTE(0), bits);
15769 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15770 AMP_IN_MUTE(0), bits);
15771 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15772 AMP_IN_MUTE(0), bits);
15775 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15777 unsigned int present;
15778 unsigned char bits;
15780 present = snd_hda_codec_read(codec, 0x15, 0,
15781 AC_VERB_GET_PIN_SENSE, 0)
15782 & AC_PINSENSE_PRESENCE;
15783 bits = present ? HDA_AMP_MUTE : 0;
15784 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15785 AMP_IN_MUTE(0), bits);
15786 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15787 AMP_IN_MUTE(0), bits);
15788 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15789 AMP_IN_MUTE(0), bits);
15790 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15791 AMP_IN_MUTE(0), bits);
15794 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15796 unsigned int present;
15797 unsigned char bits;
15799 present = snd_hda_codec_read(codec, 0x1b, 0,
15800 AC_VERB_GET_PIN_SENSE, 0)
15801 & AC_PINSENSE_PRESENCE;
15802 bits = present ? 0 : PIN_OUT;
15803 snd_hda_codec_write(codec, 0x14, 0,
15804 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15807 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15809 unsigned int present1, present2;
15811 present1 = snd_hda_codec_read(codec, 0x21, 0,
15812 AC_VERB_GET_PIN_SENSE, 0)
15813 & AC_PINSENSE_PRESENCE;
15814 present2 = snd_hda_codec_read(codec, 0x15, 0,
15815 AC_VERB_GET_PIN_SENSE, 0)
15816 & AC_PINSENSE_PRESENCE;
15818 if (present1 || present2) {
15819 snd_hda_codec_write_cache(codec, 0x14, 0,
15820 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15822 snd_hda_codec_write_cache(codec, 0x14, 0,
15823 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15827 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15829 unsigned int present1, present2;
15831 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15832 AC_VERB_GET_PIN_SENSE, 0)
15833 & AC_PINSENSE_PRESENCE;
15834 present2 = snd_hda_codec_read(codec, 0x15, 0,
15835 AC_VERB_GET_PIN_SENSE, 0)
15836 & AC_PINSENSE_PRESENCE;
15838 if (present1 || present2) {
15839 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15840 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15841 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15842 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15844 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15845 AMP_IN_MUTE(0), 0);
15846 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15847 AMP_IN_MUTE(0), 0);
15851 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15853 unsigned int present;
15855 present = snd_hda_codec_read(codec, 0x18, 0,
15856 AC_VERB_GET_PIN_SENSE, 0)
15857 & AC_PINSENSE_PRESENCE;
15858 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15859 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15860 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15861 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15862 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15863 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15864 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15865 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15868 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15871 switch (res >> 26) {
15872 case ALC880_HP_EVENT:
15873 alc663_m51va_speaker_automute(codec);
15875 case ALC880_MIC_EVENT:
15876 alc663_m51va_mic_automute(codec);
15881 static void alc663_m51va_inithook(struct hda_codec *codec)
15883 alc663_m51va_speaker_automute(codec);
15884 alc663_m51va_mic_automute(codec);
15887 /* ***************** Mode1 ******************************/
15888 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15891 switch (res >> 26) {
15892 case ALC880_HP_EVENT:
15893 alc663_m51va_speaker_automute(codec);
15895 case ALC880_MIC_EVENT:
15896 alc662_eeepc_mic_automute(codec);
15901 static void alc663_mode1_inithook(struct hda_codec *codec)
15903 alc663_m51va_speaker_automute(codec);
15904 alc662_eeepc_mic_automute(codec);
15906 /* ***************** Mode2 ******************************/
15907 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15910 switch (res >> 26) {
15911 case ALC880_HP_EVENT:
15912 alc662_f5z_speaker_automute(codec);
15914 case ALC880_MIC_EVENT:
15915 alc662_eeepc_mic_automute(codec);
15920 static void alc662_mode2_inithook(struct hda_codec *codec)
15922 alc662_f5z_speaker_automute(codec);
15923 alc662_eeepc_mic_automute(codec);
15925 /* ***************** Mode3 ******************************/
15926 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15929 switch (res >> 26) {
15930 case ALC880_HP_EVENT:
15931 alc663_two_hp_m1_speaker_automute(codec);
15933 case ALC880_MIC_EVENT:
15934 alc662_eeepc_mic_automute(codec);
15939 static void alc663_mode3_inithook(struct hda_codec *codec)
15941 alc663_two_hp_m1_speaker_automute(codec);
15942 alc662_eeepc_mic_automute(codec);
15944 /* ***************** Mode4 ******************************/
15945 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15948 switch (res >> 26) {
15949 case ALC880_HP_EVENT:
15950 alc663_21jd_two_speaker_automute(codec);
15952 case ALC880_MIC_EVENT:
15953 alc662_eeepc_mic_automute(codec);
15958 static void alc663_mode4_inithook(struct hda_codec *codec)
15960 alc663_21jd_two_speaker_automute(codec);
15961 alc662_eeepc_mic_automute(codec);
15963 /* ***************** Mode5 ******************************/
15964 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15967 switch (res >> 26) {
15968 case ALC880_HP_EVENT:
15969 alc663_15jd_two_speaker_automute(codec);
15971 case ALC880_MIC_EVENT:
15972 alc662_eeepc_mic_automute(codec);
15977 static void alc663_mode5_inithook(struct hda_codec *codec)
15979 alc663_15jd_two_speaker_automute(codec);
15980 alc662_eeepc_mic_automute(codec);
15982 /* ***************** Mode6 ******************************/
15983 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15986 switch (res >> 26) {
15987 case ALC880_HP_EVENT:
15988 alc663_two_hp_m2_speaker_automute(codec);
15990 case ALC880_MIC_EVENT:
15991 alc662_eeepc_mic_automute(codec);
15996 static void alc663_mode6_inithook(struct hda_codec *codec)
15998 alc663_two_hp_m2_speaker_automute(codec);
15999 alc662_eeepc_mic_automute(codec);
16002 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16004 unsigned int present;
16005 unsigned char bits;
16007 present = snd_hda_codec_read(codec, 0x21, 0,
16008 AC_VERB_GET_PIN_SENSE, 0)
16009 & AC_PINSENSE_PRESENCE;
16010 bits = present ? HDA_AMP_MUTE : 0;
16011 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16012 HDA_AMP_MUTE, bits);
16013 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16014 HDA_AMP_MUTE, bits);
16017 static void alc663_g71v_front_automute(struct hda_codec *codec)
16019 unsigned int present;
16020 unsigned char bits;
16022 present = snd_hda_codec_read(codec, 0x15, 0,
16023 AC_VERB_GET_PIN_SENSE, 0)
16024 & AC_PINSENSE_PRESENCE;
16025 bits = present ? HDA_AMP_MUTE : 0;
16026 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16027 HDA_AMP_MUTE, bits);
16030 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16033 switch (res >> 26) {
16034 case ALC880_HP_EVENT:
16035 alc663_g71v_hp_automute(codec);
16037 case ALC880_FRONT_EVENT:
16038 alc663_g71v_front_automute(codec);
16040 case ALC880_MIC_EVENT:
16041 alc662_eeepc_mic_automute(codec);
16046 static void alc663_g71v_inithook(struct hda_codec *codec)
16048 alc663_g71v_front_automute(codec);
16049 alc663_g71v_hp_automute(codec);
16050 alc662_eeepc_mic_automute(codec);
16053 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16056 switch (res >> 26) {
16057 case ALC880_HP_EVENT:
16058 alc663_m51va_speaker_automute(codec);
16060 case ALC880_MIC_EVENT:
16061 alc662_eeepc_mic_automute(codec);
16066 static void alc663_g50v_inithook(struct hda_codec *codec)
16068 alc663_m51va_speaker_automute(codec);
16069 alc662_eeepc_mic_automute(codec);
16072 /* bind hp and internal speaker mute (with plug check) */
16073 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16074 struct snd_ctl_elem_value *ucontrol)
16076 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16077 long *valp = ucontrol->value.integer.value;
16080 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16082 valp[0] ? 0 : HDA_AMP_MUTE);
16083 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16085 valp[1] ? 0 : HDA_AMP_MUTE);
16087 alc262_hippo1_automute(codec);
16091 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16092 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16094 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16095 .name = "Master Playback Switch",
16096 .info = snd_hda_mixer_amp_switch_info,
16097 .get = snd_hda_mixer_amp_switch_get,
16098 .put = alc662_ecs_master_sw_put,
16099 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16102 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16103 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16104 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16106 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16107 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16108 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16112 #ifdef CONFIG_SND_HDA_POWER_SAVE
16113 #define alc662_loopbacks alc880_loopbacks
16117 /* pcm configuration: identiacal with ALC880 */
16118 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16119 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16120 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16121 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16124 * configuration and preset
16126 static const char *alc662_models[ALC662_MODEL_LAST] = {
16127 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16128 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16129 [ALC662_3ST_6ch] = "3stack-6ch",
16130 [ALC662_5ST_DIG] = "6stack-dig",
16131 [ALC662_LENOVO_101E] = "lenovo-101e",
16132 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16133 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16134 [ALC662_ECS] = "ecs",
16135 [ALC663_ASUS_M51VA] = "m51va",
16136 [ALC663_ASUS_G71V] = "g71v",
16137 [ALC663_ASUS_H13] = "h13",
16138 [ALC663_ASUS_G50V] = "g50v",
16139 [ALC663_ASUS_MODE1] = "asus-mode1",
16140 [ALC662_ASUS_MODE2] = "asus-mode2",
16141 [ALC663_ASUS_MODE3] = "asus-mode3",
16142 [ALC663_ASUS_MODE4] = "asus-mode4",
16143 [ALC663_ASUS_MODE5] = "asus-mode5",
16144 [ALC663_ASUS_MODE6] = "asus-mode6",
16145 [ALC662_AUTO] = "auto",
16148 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16149 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16150 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16151 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16152 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16153 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16154 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16155 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16156 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16157 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16158 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16159 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16160 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16161 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16162 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16163 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16164 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16165 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16166 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16167 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16168 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16169 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16170 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16171 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16172 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16173 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16174 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16175 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16176 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16177 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16178 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16179 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16180 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16181 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16182 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16183 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16184 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16185 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16186 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16187 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16188 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16189 ALC662_3ST_6ch_DIG),
16190 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16191 ALC662_3ST_6ch_DIG),
16192 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16193 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16194 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16195 ALC662_3ST_6ch_DIG),
16196 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16201 static struct alc_config_preset alc662_presets[] = {
16202 [ALC662_3ST_2ch_DIG] = {
16203 .mixers = { alc662_3ST_2ch_mixer },
16204 .init_verbs = { alc662_init_verbs },
16205 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16206 .dac_nids = alc662_dac_nids,
16207 .dig_out_nid = ALC662_DIGOUT_NID,
16208 .dig_in_nid = ALC662_DIGIN_NID,
16209 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16210 .channel_mode = alc662_3ST_2ch_modes,
16211 .input_mux = &alc662_capture_source,
16213 [ALC662_3ST_6ch_DIG] = {
16214 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16215 .init_verbs = { alc662_init_verbs },
16216 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16217 .dac_nids = alc662_dac_nids,
16218 .dig_out_nid = ALC662_DIGOUT_NID,
16219 .dig_in_nid = ALC662_DIGIN_NID,
16220 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16221 .channel_mode = alc662_3ST_6ch_modes,
16223 .input_mux = &alc662_capture_source,
16225 [ALC662_3ST_6ch] = {
16226 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16227 .init_verbs = { alc662_init_verbs },
16228 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16229 .dac_nids = alc662_dac_nids,
16230 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16231 .channel_mode = alc662_3ST_6ch_modes,
16233 .input_mux = &alc662_capture_source,
16235 [ALC662_5ST_DIG] = {
16236 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16237 .init_verbs = { alc662_init_verbs },
16238 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16239 .dac_nids = alc662_dac_nids,
16240 .dig_out_nid = ALC662_DIGOUT_NID,
16241 .dig_in_nid = ALC662_DIGIN_NID,
16242 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16243 .channel_mode = alc662_5stack_modes,
16244 .input_mux = &alc662_capture_source,
16246 [ALC662_LENOVO_101E] = {
16247 .mixers = { alc662_lenovo_101e_mixer },
16248 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16249 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16250 .dac_nids = alc662_dac_nids,
16251 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16252 .channel_mode = alc662_3ST_2ch_modes,
16253 .input_mux = &alc662_lenovo_101e_capture_source,
16254 .unsol_event = alc662_lenovo_101e_unsol_event,
16255 .init_hook = alc662_lenovo_101e_all_automute,
16257 [ALC662_ASUS_EEEPC_P701] = {
16258 .mixers = { alc662_eeepc_p701_mixer },
16259 .init_verbs = { alc662_init_verbs,
16260 alc662_eeepc_sue_init_verbs },
16261 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16262 .dac_nids = alc662_dac_nids,
16263 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16264 .channel_mode = alc662_3ST_2ch_modes,
16265 .input_mux = &alc662_eeepc_capture_source,
16266 .unsol_event = alc662_eeepc_unsol_event,
16267 .init_hook = alc662_eeepc_inithook,
16269 [ALC662_ASUS_EEEPC_EP20] = {
16270 .mixers = { alc662_eeepc_ep20_mixer,
16271 alc662_chmode_mixer },
16272 .init_verbs = { alc662_init_verbs,
16273 alc662_eeepc_ep20_sue_init_verbs },
16274 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16275 .dac_nids = alc662_dac_nids,
16276 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16277 .channel_mode = alc662_3ST_6ch_modes,
16278 .input_mux = &alc662_lenovo_101e_capture_source,
16279 .unsol_event = alc662_eeepc_ep20_unsol_event,
16280 .init_hook = alc662_eeepc_ep20_inithook,
16283 .mixers = { alc662_ecs_mixer },
16284 .init_verbs = { alc662_init_verbs,
16285 alc662_ecs_init_verbs },
16286 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16287 .dac_nids = alc662_dac_nids,
16288 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16289 .channel_mode = alc662_3ST_2ch_modes,
16290 .input_mux = &alc662_eeepc_capture_source,
16291 .unsol_event = alc662_eeepc_unsol_event,
16292 .init_hook = alc662_eeepc_inithook,
16294 [ALC663_ASUS_M51VA] = {
16295 .mixers = { alc663_m51va_mixer },
16296 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16297 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16298 .dac_nids = alc662_dac_nids,
16299 .dig_out_nid = ALC662_DIGOUT_NID,
16300 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16301 .channel_mode = alc662_3ST_2ch_modes,
16302 .input_mux = &alc663_m51va_capture_source,
16303 .unsol_event = alc663_m51va_unsol_event,
16304 .init_hook = alc663_m51va_inithook,
16306 [ALC663_ASUS_G71V] = {
16307 .mixers = { alc663_g71v_mixer },
16308 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16309 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16310 .dac_nids = alc662_dac_nids,
16311 .dig_out_nid = ALC662_DIGOUT_NID,
16312 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16313 .channel_mode = alc662_3ST_2ch_modes,
16314 .input_mux = &alc662_eeepc_capture_source,
16315 .unsol_event = alc663_g71v_unsol_event,
16316 .init_hook = alc663_g71v_inithook,
16318 [ALC663_ASUS_H13] = {
16319 .mixers = { alc663_m51va_mixer },
16320 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16321 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16322 .dac_nids = alc662_dac_nids,
16323 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16324 .channel_mode = alc662_3ST_2ch_modes,
16325 .input_mux = &alc663_m51va_capture_source,
16326 .unsol_event = alc663_m51va_unsol_event,
16327 .init_hook = alc663_m51va_inithook,
16329 [ALC663_ASUS_G50V] = {
16330 .mixers = { alc663_g50v_mixer },
16331 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16332 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16333 .dac_nids = alc662_dac_nids,
16334 .dig_out_nid = ALC662_DIGOUT_NID,
16335 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16336 .channel_mode = alc662_3ST_6ch_modes,
16337 .input_mux = &alc663_capture_source,
16338 .unsol_event = alc663_g50v_unsol_event,
16339 .init_hook = alc663_g50v_inithook,
16341 [ALC663_ASUS_MODE1] = {
16342 .mixers = { alc663_m51va_mixer },
16343 .cap_mixer = alc662_auto_capture_mixer,
16344 .init_verbs = { alc662_init_verbs,
16345 alc663_21jd_amic_init_verbs },
16346 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16348 .dac_nids = alc662_dac_nids,
16349 .dig_out_nid = ALC662_DIGOUT_NID,
16350 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16351 .channel_mode = alc662_3ST_2ch_modes,
16352 .input_mux = &alc662_eeepc_capture_source,
16353 .unsol_event = alc663_mode1_unsol_event,
16354 .init_hook = alc663_mode1_inithook,
16356 [ALC662_ASUS_MODE2] = {
16357 .mixers = { alc662_1bjd_mixer },
16358 .cap_mixer = alc662_auto_capture_mixer,
16359 .init_verbs = { alc662_init_verbs,
16360 alc662_1bjd_amic_init_verbs },
16361 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16362 .dac_nids = alc662_dac_nids,
16363 .dig_out_nid = ALC662_DIGOUT_NID,
16364 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16365 .channel_mode = alc662_3ST_2ch_modes,
16366 .input_mux = &alc662_eeepc_capture_source,
16367 .unsol_event = alc662_mode2_unsol_event,
16368 .init_hook = alc662_mode2_inithook,
16370 [ALC663_ASUS_MODE3] = {
16371 .mixers = { alc663_two_hp_m1_mixer },
16372 .cap_mixer = alc662_auto_capture_mixer,
16373 .init_verbs = { alc662_init_verbs,
16374 alc663_two_hp_amic_m1_init_verbs },
16375 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16377 .dac_nids = alc662_dac_nids,
16378 .dig_out_nid = ALC662_DIGOUT_NID,
16379 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16380 .channel_mode = alc662_3ST_2ch_modes,
16381 .input_mux = &alc662_eeepc_capture_source,
16382 .unsol_event = alc663_mode3_unsol_event,
16383 .init_hook = alc663_mode3_inithook,
16385 [ALC663_ASUS_MODE4] = {
16386 .mixers = { alc663_asus_21jd_clfe_mixer },
16387 .cap_mixer = alc662_auto_capture_mixer,
16388 .init_verbs = { alc662_init_verbs,
16389 alc663_21jd_amic_init_verbs},
16390 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16392 .dac_nids = alc662_dac_nids,
16393 .dig_out_nid = ALC662_DIGOUT_NID,
16394 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16395 .channel_mode = alc662_3ST_2ch_modes,
16396 .input_mux = &alc662_eeepc_capture_source,
16397 .unsol_event = alc663_mode4_unsol_event,
16398 .init_hook = alc663_mode4_inithook,
16400 [ALC663_ASUS_MODE5] = {
16401 .mixers = { alc663_asus_15jd_clfe_mixer },
16402 .cap_mixer = alc662_auto_capture_mixer,
16403 .init_verbs = { alc662_init_verbs,
16404 alc663_15jd_amic_init_verbs },
16405 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16407 .dac_nids = alc662_dac_nids,
16408 .dig_out_nid = ALC662_DIGOUT_NID,
16409 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16410 .channel_mode = alc662_3ST_2ch_modes,
16411 .input_mux = &alc662_eeepc_capture_source,
16412 .unsol_event = alc663_mode5_unsol_event,
16413 .init_hook = alc663_mode5_inithook,
16415 [ALC663_ASUS_MODE6] = {
16416 .mixers = { alc663_two_hp_m2_mixer },
16417 .cap_mixer = alc662_auto_capture_mixer,
16418 .init_verbs = { alc662_init_verbs,
16419 alc663_two_hp_amic_m2_init_verbs },
16420 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16422 .dac_nids = alc662_dac_nids,
16423 .dig_out_nid = ALC662_DIGOUT_NID,
16424 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16425 .channel_mode = alc662_3ST_2ch_modes,
16426 .input_mux = &alc662_eeepc_capture_source,
16427 .unsol_event = alc663_mode6_unsol_event,
16428 .init_hook = alc663_mode6_inithook,
16434 * BIOS auto configuration
16437 /* add playback controls from the parsed DAC table */
16438 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16439 const struct auto_pin_cfg *cfg)
16442 static const char *chname[4] = {
16443 "Front", "Surround", NULL /*CLFE*/, "Side"
16448 for (i = 0; i < cfg->line_outs; i++) {
16449 if (!spec->multiout.dac_nids[i])
16451 nid = alc880_idx_to_dac(i);
16454 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16455 "Center Playback Volume",
16456 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16460 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16461 "LFE Playback Volume",
16462 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16466 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16467 "Center Playback Switch",
16468 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16472 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16473 "LFE Playback Switch",
16474 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16479 sprintf(name, "%s Playback Volume", chname[i]);
16480 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16481 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16485 sprintf(name, "%s Playback Switch", chname[i]);
16486 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16487 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16496 /* add playback controls for speaker and HP outputs */
16497 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16508 /* ALC663 has a mono output pin on 0x17 */
16509 sprintf(name, "%s Playback Switch", pfx);
16510 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16511 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16515 if (alc880_is_fixed_pin(pin)) {
16516 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16517 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16518 /* specify the DAC as the extra output */
16519 if (!spec->multiout.hp_nid)
16520 spec->multiout.hp_nid = nid;
16522 spec->multiout.extra_out_nid[0] = nid;
16523 /* control HP volume/switch on the output mixer amp */
16524 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16525 sprintf(name, "%s Playback Volume", pfx);
16526 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16527 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16530 sprintf(name, "%s Playback Switch", pfx);
16531 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16532 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16535 } else if (alc880_is_multi_pin(pin)) {
16536 /* set manual connection */
16537 /* we have only a switch on HP-out PIN */
16538 sprintf(name, "%s Playback Switch", pfx);
16539 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16540 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16547 /* create playback/capture controls for input pins */
16548 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16549 const struct auto_pin_cfg *cfg)
16551 struct hda_input_mux *imux = &spec->private_imux[0];
16554 for (i = 0; i < AUTO_PIN_LAST; i++) {
16555 if (alc880_is_input_pin(cfg->input_pins[i])) {
16556 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16557 err = new_analog_input(spec, cfg->input_pins[i],
16558 auto_pin_cfg_labels[i],
16562 imux->items[imux->num_items].label =
16563 auto_pin_cfg_labels[i];
16564 imux->items[imux->num_items].index =
16565 alc880_input_pin_idx(cfg->input_pins[i]);
16572 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16573 hda_nid_t nid, int pin_type,
16576 alc_set_pin_output(codec, nid, pin_type);
16577 /* need the manual connection? */
16578 if (alc880_is_multi_pin(nid)) {
16579 struct alc_spec *spec = codec->spec;
16580 int idx = alc880_multi_pin_idx(nid);
16581 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16582 AC_VERB_SET_CONNECT_SEL,
16583 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16587 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16589 struct alc_spec *spec = codec->spec;
16592 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16593 for (i = 0; i <= HDA_SIDE; i++) {
16594 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16595 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16597 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16602 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16604 struct alc_spec *spec = codec->spec;
16607 pin = spec->autocfg.hp_pins[0];
16608 if (pin) /* connect to front */
16610 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16611 pin = spec->autocfg.speaker_pins[0];
16613 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16616 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16617 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16619 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16621 struct alc_spec *spec = codec->spec;
16624 for (i = 0; i < AUTO_PIN_LAST; i++) {
16625 hda_nid_t nid = spec->autocfg.input_pins[i];
16626 if (alc662_is_input_pin(nid)) {
16627 snd_hda_codec_write(codec, nid, 0,
16628 AC_VERB_SET_PIN_WIDGET_CONTROL,
16629 (i <= AUTO_PIN_FRONT_MIC ?
16630 PIN_VREF80 : PIN_IN));
16631 if (nid != ALC662_PIN_CD_NID)
16632 snd_hda_codec_write(codec, nid, 0,
16633 AC_VERB_SET_AMP_GAIN_MUTE,
16639 #define alc662_auto_init_input_src alc882_auto_init_input_src
16641 static int alc662_parse_auto_config(struct hda_codec *codec)
16643 struct alc_spec *spec = codec->spec;
16645 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16647 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16651 if (!spec->autocfg.line_outs)
16652 return 0; /* can't find valid BIOS pin config */
16654 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16657 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16660 err = alc662_auto_create_extra_out(spec,
16661 spec->autocfg.speaker_pins[0],
16665 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16669 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16673 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16675 if (spec->autocfg.dig_out_pin)
16676 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16678 if (spec->kctls.list)
16679 add_mixer(spec, spec->kctls.list);
16681 spec->num_mux_defs = 1;
16682 spec->input_mux = &spec->private_imux[0];
16684 add_verb(spec, alc662_auto_init_verbs);
16685 if (codec->vendor_id == 0x10ec0663)
16686 add_verb(spec, alc663_auto_init_verbs);
16688 err = alc_auto_add_mic_boost(codec);
16692 store_pin_configs(codec);
16696 /* additional initialization for auto-configuration model */
16697 static void alc662_auto_init(struct hda_codec *codec)
16699 struct alc_spec *spec = codec->spec;
16700 alc662_auto_init_multi_out(codec);
16701 alc662_auto_init_hp_out(codec);
16702 alc662_auto_init_analog_input(codec);
16703 alc662_auto_init_input_src(codec);
16704 if (spec->unsol_event)
16705 alc_inithook(codec);
16708 static int patch_alc662(struct hda_codec *codec)
16710 struct alc_spec *spec;
16711 int err, board_config;
16713 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16717 codec->spec = spec;
16719 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16721 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16724 if (board_config < 0) {
16725 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16726 "trying auto-probe from BIOS...\n");
16727 board_config = ALC662_AUTO;
16730 if (board_config == ALC662_AUTO) {
16731 /* automatic parse from the BIOS config */
16732 err = alc662_parse_auto_config(codec);
16738 "hda_codec: Cannot set up configuration "
16739 "from BIOS. Using base mode...\n");
16740 board_config = ALC662_3ST_2ch_DIG;
16744 err = snd_hda_attach_beep_device(codec, 0x1);
16750 if (board_config != ALC662_AUTO)
16751 setup_preset(spec, &alc662_presets[board_config]);
16753 if (codec->vendor_id == 0x10ec0663) {
16754 spec->stream_name_analog = "ALC663 Analog";
16755 spec->stream_name_digital = "ALC663 Digital";
16756 } else if (codec->vendor_id == 0x10ec0272) {
16757 spec->stream_name_analog = "ALC272 Analog";
16758 spec->stream_name_digital = "ALC272 Digital";
16760 spec->stream_name_analog = "ALC662 Analog";
16761 spec->stream_name_digital = "ALC662 Digital";
16764 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16765 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16767 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16768 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16770 spec->adc_nids = alc662_adc_nids;
16771 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16772 spec->capsrc_nids = alc662_capsrc_nids;
16773 spec->capture_style = CAPT_MIX;
16775 if (!spec->cap_mixer)
16776 set_capture_mixer(spec);
16777 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16779 spec->vmaster_nid = 0x02;
16781 codec->patch_ops = alc_patch_ops;
16782 if (board_config == ALC662_AUTO)
16783 spec->init_hook = alc662_auto_init;
16784 #ifdef CONFIG_SND_HDA_POWER_SAVE
16785 if (!spec->loopback.amplist)
16786 spec->loopback.amplist = alc662_loopbacks;
16788 codec->proc_widget_hook = print_realtek_coef;
16796 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16797 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16798 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16799 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16800 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16801 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16802 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16803 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16804 .patch = patch_alc861 },
16805 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16806 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16807 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16808 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16809 .patch = patch_alc883 },
16810 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16811 .patch = patch_alc662 },
16812 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16813 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16814 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16815 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16816 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16817 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16818 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16819 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16820 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16821 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16822 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16823 .patch = patch_alc883 },
16824 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16825 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16826 {} /* terminator */
16829 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16831 MODULE_LICENSE("GPL");
16832 MODULE_DESCRIPTION("Realtek HD-audio codec");
16834 static struct hda_codec_preset_list realtek_list = {
16835 .preset = snd_hda_preset_realtek,
16836 .owner = THIS_MODULE,
16839 static int __init patch_realtek_init(void)
16841 return snd_hda_add_codec_preset(&realtek_list);
16844 static void __exit patch_realtek_exit(void)
16846 snd_hda_delete_codec_preset(&realtek_list);
16849 module_init(patch_realtek_init)
16850 module_exit(patch_realtek_exit)