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, alc268_beep_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,
11971 alc268_capture_alt_mixer },
11972 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11973 alc268_acer_aspire_one_verbs },
11974 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11975 .dac_nids = alc268_dac_nids,
11976 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11977 .adc_nids = alc268_adc_nids_alt,
11978 .capsrc_nids = alc268_capsrc_nids,
11980 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11981 .channel_mode = alc268_modes,
11982 .input_mux = &alc268_acer_lc_capture_source,
11983 .unsol_event = alc268_acer_lc_unsol_event,
11984 .init_hook = alc268_acer_lc_init_hook,
11987 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11988 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11989 alc268_dell_verbs },
11990 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11991 .dac_nids = alc268_dac_nids,
11993 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11994 .channel_mode = alc268_modes,
11995 .unsol_event = alc268_dell_unsol_event,
11996 .init_hook = alc268_dell_init_hook,
11997 .input_mux = &alc268_capture_source,
12000 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12001 alc268_beep_mixer },
12002 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12003 alc268_toshiba_verbs },
12004 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12005 .dac_nids = alc268_dac_nids,
12006 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12007 .adc_nids = alc268_adc_nids_alt,
12008 .capsrc_nids = alc268_capsrc_nids,
12010 .dig_out_nid = ALC268_DIGOUT_NID,
12011 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12012 .channel_mode = alc268_modes,
12013 .input_mux = &alc268_capture_source,
12014 .unsol_event = alc268_toshiba_unsol_event,
12015 .init_hook = alc268_toshiba_automute
12017 #ifdef CONFIG_SND_DEBUG
12019 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12020 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12021 alc268_volume_init_verbs },
12022 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12023 .dac_nids = alc268_dac_nids,
12024 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12025 .adc_nids = alc268_adc_nids_alt,
12026 .capsrc_nids = alc268_capsrc_nids,
12028 .dig_out_nid = ALC268_DIGOUT_NID,
12029 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12030 .channel_mode = alc268_modes,
12031 .input_mux = &alc268_capture_source,
12036 static int patch_alc268(struct hda_codec *codec)
12038 struct alc_spec *spec;
12040 int i, has_beep, err;
12042 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12046 codec->spec = spec;
12048 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12052 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12053 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12054 "trying auto-probe from BIOS...\n");
12055 board_config = ALC268_AUTO;
12058 if (board_config == ALC268_AUTO) {
12059 /* automatic parse from the BIOS config */
12060 err = alc268_parse_auto_config(codec);
12066 "hda_codec: Cannot set up configuration "
12067 "from BIOS. Using base mode...\n");
12068 board_config = ALC268_3ST;
12072 err = snd_hda_attach_beep_device(codec, 0x1);
12078 if (board_config != ALC268_AUTO)
12079 setup_preset(spec, &alc268_presets[board_config]);
12081 if (codec->vendor_id == 0x10ec0267) {
12082 spec->stream_name_analog = "ALC267 Analog";
12083 spec->stream_name_digital = "ALC267 Digital";
12085 spec->stream_name_analog = "ALC268 Analog";
12086 spec->stream_name_digital = "ALC268 Digital";
12089 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12090 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12091 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12093 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12096 for (i = 0; i < spec->num_mixers; i++) {
12097 if (spec->mixers[i] == alc268_beep_mixer) {
12104 err = snd_hda_attach_beep_device(codec, 0x1);
12109 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12110 /* override the amp caps for beep generator */
12111 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12112 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12113 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12114 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12115 (0 << AC_AMPCAP_MUTE_SHIFT));
12118 if (!spec->adc_nids && spec->input_mux) {
12119 /* check whether NID 0x07 is valid */
12120 unsigned int wcap = get_wcaps(codec, 0x07);
12124 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12125 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12126 spec->adc_nids = alc268_adc_nids_alt;
12127 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12128 add_mixer(spec, alc268_capture_alt_mixer);
12130 spec->adc_nids = alc268_adc_nids;
12131 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12132 add_mixer(spec, alc268_capture_mixer);
12134 spec->capsrc_nids = alc268_capsrc_nids;
12135 /* set default input source */
12136 for (i = 0; i < spec->num_adc_nids; i++)
12137 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12138 0, AC_VERB_SET_CONNECT_SEL,
12139 spec->input_mux->items[0].index);
12142 spec->vmaster_nid = 0x02;
12144 codec->patch_ops = alc_patch_ops;
12145 if (board_config == ALC268_AUTO)
12146 spec->init_hook = alc268_auto_init;
12148 codec->proc_widget_hook = print_realtek_coef;
12154 * ALC269 channel source setting (2 channel)
12156 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12158 #define alc269_dac_nids alc260_dac_nids
12160 static hda_nid_t alc269_adc_nids[1] = {
12165 static hda_nid_t alc269_capsrc_nids[1] = {
12169 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12173 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12181 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12189 #define alc269_modes alc260_modes
12190 #define alc269_capture_source alc880_lg_lw_capture_source
12192 static struct snd_kcontrol_new alc269_base_mixer[] = {
12193 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12194 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12199 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12200 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12201 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12202 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12204 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12208 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12209 /* output mixer control */
12210 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12213 .name = "Master Playback Switch",
12214 .info = snd_hda_mixer_amp_switch_info,
12215 .get = snd_hda_mixer_amp_switch_get,
12216 .put = alc268_acer_master_sw_put,
12217 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12221 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12222 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12223 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12224 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12228 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12229 /* output mixer control */
12230 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12232 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12233 .name = "Master Playback Switch",
12234 .info = snd_hda_mixer_amp_switch_info,
12235 .get = snd_hda_mixer_amp_switch_get,
12236 .put = alc268_acer_master_sw_put,
12237 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12239 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12240 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12241 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12242 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12243 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12244 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12245 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12246 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12247 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12251 /* bind volumes of both NID 0x0c and 0x0d */
12252 static struct hda_bind_ctls alc269_epc_bind_vol = {
12253 .ops = &snd_hda_bind_vol,
12255 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12256 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12261 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12262 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12263 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12264 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12268 /* capture mixer elements */
12269 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12270 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12271 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12272 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12277 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12278 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12279 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12280 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12284 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12285 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12286 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12288 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12289 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12290 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12294 static struct hda_verb alc269_lifebook_verbs[] = {
12295 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12296 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12297 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12298 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12299 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12300 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12301 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12302 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12303 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12304 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12308 /* toggle speaker-output according to the hp-jack state */
12309 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12311 unsigned int present;
12312 unsigned char bits;
12314 present = snd_hda_codec_read(codec, 0x15, 0,
12315 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12316 bits = present ? AMP_IN_MUTE(0) : 0;
12317 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12318 AMP_IN_MUTE(0), bits);
12319 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12320 AMP_IN_MUTE(0), bits);
12322 snd_hda_codec_write(codec, 0x20, 0,
12323 AC_VERB_SET_COEF_INDEX, 0x0c);
12324 snd_hda_codec_write(codec, 0x20, 0,
12325 AC_VERB_SET_PROC_COEF, 0x680);
12327 snd_hda_codec_write(codec, 0x20, 0,
12328 AC_VERB_SET_COEF_INDEX, 0x0c);
12329 snd_hda_codec_write(codec, 0x20, 0,
12330 AC_VERB_SET_PROC_COEF, 0x480);
12333 /* toggle speaker-output according to the hp-jacks state */
12334 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12336 unsigned int present;
12337 unsigned char bits;
12339 /* Check laptop headphone socket */
12340 present = snd_hda_codec_read(codec, 0x15, 0,
12341 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12343 /* Check port replicator headphone socket */
12344 present |= snd_hda_codec_read(codec, 0x1a, 0,
12345 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12347 bits = present ? AMP_IN_MUTE(0) : 0;
12348 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12349 AMP_IN_MUTE(0), bits);
12350 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12351 AMP_IN_MUTE(0), bits);
12353 snd_hda_codec_write(codec, 0x20, 0,
12354 AC_VERB_SET_COEF_INDEX, 0x0c);
12355 snd_hda_codec_write(codec, 0x20, 0,
12356 AC_VERB_SET_PROC_COEF, 0x680);
12358 snd_hda_codec_write(codec, 0x20, 0,
12359 AC_VERB_SET_COEF_INDEX, 0x0c);
12360 snd_hda_codec_write(codec, 0x20, 0,
12361 AC_VERB_SET_PROC_COEF, 0x480);
12364 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12366 unsigned int present;
12368 present = snd_hda_codec_read(codec, 0x18, 0,
12369 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12370 snd_hda_codec_write(codec, 0x23, 0,
12371 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12374 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12376 unsigned int present_laptop;
12377 unsigned int present_dock;
12379 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12380 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12382 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12383 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12385 /* Laptop mic port overrides dock mic port, design decision */
12387 snd_hda_codec_write(codec, 0x23, 0,
12388 AC_VERB_SET_CONNECT_SEL, 0x3);
12389 if (present_laptop)
12390 snd_hda_codec_write(codec, 0x23, 0,
12391 AC_VERB_SET_CONNECT_SEL, 0x0);
12392 if (!present_dock && !present_laptop)
12393 snd_hda_codec_write(codec, 0x23, 0,
12394 AC_VERB_SET_CONNECT_SEL, 0x1);
12397 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12400 if ((res >> 26) == ALC880_HP_EVENT)
12401 alc269_quanta_fl1_speaker_automute(codec);
12402 if ((res >> 26) == ALC880_MIC_EVENT)
12403 alc269_quanta_fl1_mic_automute(codec);
12406 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12409 if ((res >> 26) == ALC880_HP_EVENT)
12410 alc269_lifebook_speaker_automute(codec);
12411 if ((res >> 26) == ALC880_MIC_EVENT)
12412 alc269_lifebook_mic_autoswitch(codec);
12415 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12417 alc269_quanta_fl1_speaker_automute(codec);
12418 alc269_quanta_fl1_mic_automute(codec);
12421 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12423 alc269_lifebook_speaker_automute(codec);
12424 alc269_lifebook_mic_autoswitch(codec);
12427 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12428 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12429 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12430 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12433 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12434 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12438 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12439 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12440 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12441 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12443 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12448 /* toggle speaker-output according to the hp-jack state */
12449 static void alc269_speaker_automute(struct hda_codec *codec)
12451 unsigned int present;
12452 unsigned char bits;
12454 present = snd_hda_codec_read(codec, 0x15, 0,
12455 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12456 bits = present ? AMP_IN_MUTE(0) : 0;
12457 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12458 AMP_IN_MUTE(0), bits);
12459 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12460 AMP_IN_MUTE(0), bits);
12463 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12465 unsigned int present;
12467 present = snd_hda_codec_read(codec, 0x18, 0,
12468 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12469 snd_hda_codec_write(codec, 0x23, 0,
12470 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12473 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12475 unsigned int present;
12477 present = snd_hda_codec_read(codec, 0x18, 0,
12478 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12479 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12480 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12481 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12482 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12485 /* unsolicited event for HP jack sensing */
12486 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12489 if ((res >> 26) == ALC880_HP_EVENT)
12490 alc269_speaker_automute(codec);
12492 if ((res >> 26) == ALC880_MIC_EVENT)
12493 alc269_eeepc_dmic_automute(codec);
12496 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12498 alc269_speaker_automute(codec);
12499 alc269_eeepc_dmic_automute(codec);
12502 /* unsolicited event for HP jack sensing */
12503 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12506 if ((res >> 26) == ALC880_HP_EVENT)
12507 alc269_speaker_automute(codec);
12509 if ((res >> 26) == ALC880_MIC_EVENT)
12510 alc269_eeepc_amic_automute(codec);
12513 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12515 alc269_speaker_automute(codec);
12516 alc269_eeepc_amic_automute(codec);
12520 * generic initialization of ADC, input mixers and output mixers
12522 static struct hda_verb alc269_init_verbs[] = {
12524 * Unmute ADC0 and set the default input to mic-in
12526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12528 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12529 * analog-loopback mixer widget
12530 * Note: PASD motherboards uses the Line In 2 as the input for
12531 * front panel mic (mic 2)
12533 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12535 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12536 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12538 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12541 * Set up output mixers (0x0c - 0x0e)
12543 /* set vol=0 to output mixers */
12544 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12545 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12547 /* set up input amps for analog loopback */
12548 /* Amp Indices: DAC = 0, mixer = 1 */
12549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12550 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12552 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12553 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12554 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12556 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12558 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12559 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12560 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12561 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12564 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12566 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12567 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12568 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12569 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12570 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12572 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12573 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12575 /* FIXME: use matrix-type input source selection */
12576 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12577 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12580 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12581 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12584 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12585 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12589 /* add playback controls from the parsed DAC table */
12590 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12591 const struct auto_pin_cfg *cfg)
12596 spec->multiout.num_dacs = 1; /* only use one dac */
12597 spec->multiout.dac_nids = spec->private_dac_nids;
12598 spec->multiout.dac_nids[0] = 2;
12600 nid = cfg->line_out_pins[0];
12602 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12603 "Front Playback Volume",
12604 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12607 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12608 "Front Playback Switch",
12609 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12614 nid = cfg->speaker_pins[0];
12616 if (!cfg->line_out_pins[0]) {
12617 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12618 "Speaker Playback Volume",
12619 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12625 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12626 "Speaker Playback Switch",
12627 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12632 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12633 "Speaker Playback Switch",
12634 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12640 nid = cfg->hp_pins[0];
12642 /* spec->multiout.hp_nid = 2; */
12643 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12644 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12645 "Headphone Playback Volume",
12646 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12652 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12653 "Headphone Playback Switch",
12654 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12659 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12660 "Headphone Playback Switch",
12661 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12670 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12671 const struct auto_pin_cfg *cfg)
12675 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12678 /* digital-mic input pin is excluded in alc880_auto_create..()
12679 * because it's under 0x18
12681 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12682 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12683 struct hda_input_mux *imux = &spec->private_imux[0];
12684 imux->items[imux->num_items].label = "Int Mic";
12685 imux->items[imux->num_items].index = 0x05;
12691 #ifdef CONFIG_SND_HDA_POWER_SAVE
12692 #define alc269_loopbacks alc880_loopbacks
12695 /* pcm configuration: identiacal with ALC880 */
12696 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12697 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12698 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12699 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12702 * BIOS auto configuration
12704 static int alc269_parse_auto_config(struct hda_codec *codec)
12706 struct alc_spec *spec = codec->spec;
12708 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12710 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12715 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12718 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12722 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12724 if (spec->autocfg.dig_out_pin)
12725 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12727 if (spec->kctls.list)
12728 add_mixer(spec, spec->kctls.list);
12730 add_verb(spec, alc269_init_verbs);
12731 spec->num_mux_defs = 1;
12732 spec->input_mux = &spec->private_imux[0];
12733 /* set default input source */
12734 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12735 0, AC_VERB_SET_CONNECT_SEL,
12736 spec->input_mux->items[0].index);
12738 err = alc_auto_add_mic_boost(codec);
12742 if (!spec->cap_mixer)
12743 set_capture_mixer(spec);
12745 store_pin_configs(codec);
12749 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12750 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12751 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12754 /* init callback for auto-configuration model -- overriding the default init */
12755 static void alc269_auto_init(struct hda_codec *codec)
12757 struct alc_spec *spec = codec->spec;
12758 alc269_auto_init_multi_out(codec);
12759 alc269_auto_init_hp_out(codec);
12760 alc269_auto_init_analog_input(codec);
12761 if (spec->unsol_event)
12762 alc_inithook(codec);
12766 * configuration and preset
12768 static const char *alc269_models[ALC269_MODEL_LAST] = {
12769 [ALC269_BASIC] = "basic",
12770 [ALC269_QUANTA_FL1] = "quanta",
12771 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12772 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12773 [ALC269_FUJITSU] = "fujitsu",
12774 [ALC269_LIFEBOOK] = "lifebook"
12777 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12778 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12779 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12780 ALC269_ASUS_EEEPC_P703),
12781 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12782 ALC269_ASUS_EEEPC_P901),
12783 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12784 ALC269_ASUS_EEEPC_P901),
12785 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12786 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12790 static struct alc_config_preset alc269_presets[] = {
12792 .mixers = { alc269_base_mixer },
12793 .init_verbs = { alc269_init_verbs },
12794 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12795 .dac_nids = alc269_dac_nids,
12797 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12798 .channel_mode = alc269_modes,
12799 .input_mux = &alc269_capture_source,
12801 [ALC269_QUANTA_FL1] = {
12802 .mixers = { alc269_quanta_fl1_mixer },
12803 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12804 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12805 .dac_nids = alc269_dac_nids,
12807 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12808 .channel_mode = alc269_modes,
12809 .input_mux = &alc269_capture_source,
12810 .unsol_event = alc269_quanta_fl1_unsol_event,
12811 .init_hook = alc269_quanta_fl1_init_hook,
12813 [ALC269_ASUS_EEEPC_P703] = {
12814 .mixers = { alc269_eeepc_mixer },
12815 .cap_mixer = alc269_epc_capture_mixer,
12816 .init_verbs = { alc269_init_verbs,
12817 alc269_eeepc_amic_init_verbs },
12818 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12819 .dac_nids = alc269_dac_nids,
12821 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12822 .channel_mode = alc269_modes,
12823 .input_mux = &alc269_eeepc_amic_capture_source,
12824 .unsol_event = alc269_eeepc_amic_unsol_event,
12825 .init_hook = alc269_eeepc_amic_inithook,
12827 [ALC269_ASUS_EEEPC_P901] = {
12828 .mixers = { alc269_eeepc_mixer },
12829 .cap_mixer = alc269_epc_capture_mixer,
12830 .init_verbs = { alc269_init_verbs,
12831 alc269_eeepc_dmic_init_verbs },
12832 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12833 .dac_nids = alc269_dac_nids,
12835 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12836 .channel_mode = alc269_modes,
12837 .input_mux = &alc269_eeepc_dmic_capture_source,
12838 .unsol_event = alc269_eeepc_dmic_unsol_event,
12839 .init_hook = alc269_eeepc_dmic_inithook,
12841 [ALC269_FUJITSU] = {
12842 .mixers = { alc269_fujitsu_mixer },
12843 .cap_mixer = alc269_epc_capture_mixer,
12844 .init_verbs = { alc269_init_verbs,
12845 alc269_eeepc_dmic_init_verbs },
12846 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12847 .dac_nids = alc269_dac_nids,
12849 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12850 .channel_mode = alc269_modes,
12851 .input_mux = &alc269_eeepc_dmic_capture_source,
12852 .unsol_event = alc269_eeepc_dmic_unsol_event,
12853 .init_hook = alc269_eeepc_dmic_inithook,
12855 [ALC269_LIFEBOOK] = {
12856 .mixers = { alc269_lifebook_mixer },
12857 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12858 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12859 .dac_nids = alc269_dac_nids,
12861 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12862 .channel_mode = alc269_modes,
12863 .input_mux = &alc269_capture_source,
12864 .unsol_event = alc269_lifebook_unsol_event,
12865 .init_hook = alc269_lifebook_init_hook,
12869 static int patch_alc269(struct hda_codec *codec)
12871 struct alc_spec *spec;
12875 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12879 codec->spec = spec;
12881 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12883 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12887 if (board_config < 0) {
12888 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12889 "trying auto-probe from BIOS...\n");
12890 board_config = ALC269_AUTO;
12893 if (board_config == ALC269_AUTO) {
12894 /* automatic parse from the BIOS config */
12895 err = alc269_parse_auto_config(codec);
12901 "hda_codec: Cannot set up configuration "
12902 "from BIOS. Using base mode...\n");
12903 board_config = ALC269_BASIC;
12907 err = snd_hda_attach_beep_device(codec, 0x1);
12913 if (board_config != ALC269_AUTO)
12914 setup_preset(spec, &alc269_presets[board_config]);
12916 spec->stream_name_analog = "ALC269 Analog";
12917 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12918 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12920 spec->stream_name_digital = "ALC269 Digital";
12921 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12922 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12924 spec->adc_nids = alc269_adc_nids;
12925 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12926 spec->capsrc_nids = alc269_capsrc_nids;
12927 if (!spec->cap_mixer)
12928 set_capture_mixer(spec);
12929 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12931 codec->patch_ops = alc_patch_ops;
12932 if (board_config == ALC269_AUTO)
12933 spec->init_hook = alc269_auto_init;
12934 #ifdef CONFIG_SND_HDA_POWER_SAVE
12935 if (!spec->loopback.amplist)
12936 spec->loopback.amplist = alc269_loopbacks;
12938 codec->proc_widget_hook = print_realtek_coef;
12944 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12948 * set the path ways for 2 channel output
12949 * need to set the codec line out and mic 1 pin widgets to inputs
12951 static struct hda_verb alc861_threestack_ch2_init[] = {
12952 /* set pin widget 1Ah (line in) for input */
12953 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12954 /* set pin widget 18h (mic1/2) for input, for mic also enable
12957 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12959 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12961 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12962 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12968 * need to set the codec line out and mic 1 pin widgets to outputs
12970 static struct hda_verb alc861_threestack_ch6_init[] = {
12971 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12972 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12973 /* set pin widget 18h (mic1) for output (CLFE)*/
12974 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12976 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12977 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12979 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12981 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12982 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12987 static struct hda_channel_mode alc861_threestack_modes[2] = {
12988 { 2, alc861_threestack_ch2_init },
12989 { 6, alc861_threestack_ch6_init },
12991 /* Set mic1 as input and unmute the mixer */
12992 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12993 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12994 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12997 /* Set mic1 as output and mute mixer */
12998 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12999 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13000 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13004 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13005 { 2, alc861_uniwill_m31_ch2_init },
13006 { 4, alc861_uniwill_m31_ch4_init },
13009 /* Set mic1 and line-in as input and unmute the mixer */
13010 static struct hda_verb alc861_asus_ch2_init[] = {
13011 /* set pin widget 1Ah (line in) for input */
13012 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13013 /* set pin widget 18h (mic1/2) for input, for mic also enable
13016 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13018 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13020 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13021 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13025 /* Set mic1 nad line-in as output and mute mixer */
13026 static struct hda_verb alc861_asus_ch6_init[] = {
13027 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13028 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13029 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13030 /* set pin widget 18h (mic1) for output (CLFE)*/
13031 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13032 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13033 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13034 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13036 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13038 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13039 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13044 static struct hda_channel_mode alc861_asus_modes[2] = {
13045 { 2, alc861_asus_ch2_init },
13046 { 6, alc861_asus_ch6_init },
13051 static struct snd_kcontrol_new alc861_base_mixer[] = {
13052 /* output mixer control */
13053 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13054 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13055 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13056 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13057 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13059 /*Input mixer control */
13060 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13061 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13062 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13063 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13064 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13065 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13067 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13068 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13069 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13074 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13075 /* output mixer control */
13076 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13077 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13078 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13079 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13080 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13082 /* Input mixer control */
13083 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13084 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13085 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13086 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13087 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13088 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13090 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13091 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13095 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13096 .name = "Channel Mode",
13097 .info = alc_ch_mode_info,
13098 .get = alc_ch_mode_get,
13099 .put = alc_ch_mode_put,
13100 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13105 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13106 /* output mixer control */
13107 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13109 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13114 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13115 /* output mixer control */
13116 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13117 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13118 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13119 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13120 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13122 /* Input mixer control */
13123 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13124 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13125 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13126 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13127 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13128 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13130 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13131 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13136 .name = "Channel Mode",
13137 .info = alc_ch_mode_info,
13138 .get = alc_ch_mode_get,
13139 .put = alc_ch_mode_put,
13140 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13145 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13146 /* output mixer control */
13147 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13148 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13149 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13150 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13151 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13153 /* Input mixer control */
13154 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13155 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13156 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13157 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13158 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13159 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13161 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13162 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13163 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13166 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13167 .name = "Channel Mode",
13168 .info = alc_ch_mode_info,
13169 .get = alc_ch_mode_get,
13170 .put = alc_ch_mode_put,
13171 .private_value = ARRAY_SIZE(alc861_asus_modes),
13176 /* additional mixer */
13177 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13178 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13179 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13184 * generic initialization of ADC, input mixers and output mixers
13186 static struct hda_verb alc861_base_init_verbs[] = {
13188 * Unmute ADC0 and set the default input to mic-in
13190 /* port-A for surround (rear panel) */
13191 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13192 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13193 /* port-B for mic-in (rear panel) with vref */
13194 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13195 /* port-C for line-in (rear panel) */
13196 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13197 /* port-D for Front */
13198 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13199 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13200 /* port-E for HP out (front panel) */
13201 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13202 /* route front PCM to HP */
13203 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13204 /* port-F for mic-in (front panel) with vref */
13205 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13206 /* port-G for CLFE (rear panel) */
13207 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13208 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13209 /* port-H for side (rear panel) */
13210 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13211 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13213 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13214 /* route front mic to ADC1*/
13215 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13216 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13218 /* Unmute DAC0~3 & spdif out*/
13219 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13220 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13221 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13222 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13223 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13225 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13226 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13227 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13228 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13229 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13231 /* Unmute Stereo Mixer 15 */
13232 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13233 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13234 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13235 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13237 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13238 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13239 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13240 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13241 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13242 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13243 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13244 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13245 /* hp used DAC 3 (Front) */
13246 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13247 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13252 static struct hda_verb alc861_threestack_init_verbs[] = {
13254 * Unmute ADC0 and set the default input to mic-in
13256 /* port-A for surround (rear panel) */
13257 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13258 /* port-B for mic-in (rear panel) with vref */
13259 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13260 /* port-C for line-in (rear panel) */
13261 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13262 /* port-D for Front */
13263 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13264 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13265 /* port-E for HP out (front panel) */
13266 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13267 /* route front PCM to HP */
13268 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13269 /* port-F for mic-in (front panel) with vref */
13270 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13271 /* port-G for CLFE (rear panel) */
13272 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13273 /* port-H for side (rear panel) */
13274 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13276 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13277 /* route front mic to ADC1*/
13278 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13279 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13280 /* Unmute DAC0~3 & spdif out*/
13281 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13282 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13283 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13284 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13285 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13287 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13288 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13289 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13290 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13291 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13293 /* Unmute Stereo Mixer 15 */
13294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13295 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13296 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13297 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13299 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13300 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13301 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13302 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13303 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13304 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13305 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13306 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13307 /* hp used DAC 3 (Front) */
13308 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13309 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13313 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13315 * Unmute ADC0 and set the default input to mic-in
13317 /* port-A for surround (rear panel) */
13318 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13319 /* port-B for mic-in (rear panel) with vref */
13320 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13321 /* port-C for line-in (rear panel) */
13322 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13323 /* port-D for Front */
13324 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13325 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13326 /* port-E for HP out (front panel) */
13327 /* this has to be set to VREF80 */
13328 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13329 /* route front PCM to HP */
13330 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13331 /* port-F for mic-in (front panel) with vref */
13332 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13333 /* port-G for CLFE (rear panel) */
13334 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13335 /* port-H for side (rear panel) */
13336 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13338 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13339 /* route front mic to ADC1*/
13340 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13342 /* Unmute DAC0~3 & spdif out*/
13343 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13344 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13345 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13346 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13347 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13349 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13350 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13351 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13352 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13353 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13355 /* Unmute Stereo Mixer 15 */
13356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13357 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13358 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13359 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13361 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13362 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13363 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13364 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13365 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13366 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13367 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13368 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13369 /* hp used DAC 3 (Front) */
13370 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13371 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13375 static struct hda_verb alc861_asus_init_verbs[] = {
13377 * Unmute ADC0 and set the default input to mic-in
13379 /* port-A for surround (rear panel)
13380 * according to codec#0 this is the HP jack
13382 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13383 /* route front PCM to HP */
13384 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13385 /* port-B for mic-in (rear panel) with vref */
13386 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13387 /* port-C for line-in (rear panel) */
13388 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13389 /* port-D for Front */
13390 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13391 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13392 /* port-E for HP out (front panel) */
13393 /* this has to be set to VREF80 */
13394 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13395 /* route front PCM to HP */
13396 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13397 /* port-F for mic-in (front panel) with vref */
13398 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13399 /* port-G for CLFE (rear panel) */
13400 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13401 /* port-H for side (rear panel) */
13402 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13404 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13405 /* route front mic to ADC1*/
13406 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13407 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13408 /* Unmute DAC0~3 & spdif out*/
13409 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13410 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13411 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13412 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13414 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13415 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13416 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13417 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13418 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13420 /* Unmute Stereo Mixer 15 */
13421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13424 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13426 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13427 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13428 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13429 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13432 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13433 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13434 /* hp used DAC 3 (Front) */
13435 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13436 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13440 /* additional init verbs for ASUS laptops */
13441 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13442 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13443 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13448 * generic initialization of ADC, input mixers and output mixers
13450 static struct hda_verb alc861_auto_init_verbs[] = {
13452 * Unmute ADC0 and set the default input to mic-in
13454 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13455 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13457 /* Unmute DAC0~3 & spdif out*/
13458 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13459 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13460 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13461 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13462 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13464 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13465 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13466 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13467 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13468 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13470 /* Unmute Stereo Mixer 15 */
13471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13472 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13473 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13474 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13476 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13477 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13478 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13479 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13481 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13482 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13485 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13488 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13489 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13490 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13491 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13492 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13494 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13499 static struct hda_verb alc861_toshiba_init_verbs[] = {
13500 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13505 /* toggle speaker-output according to the hp-jack state */
13506 static void alc861_toshiba_automute(struct hda_codec *codec)
13508 unsigned int present;
13510 present = snd_hda_codec_read(codec, 0x0f, 0,
13511 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13512 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13513 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13514 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13515 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13518 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13521 if ((res >> 26) == ALC880_HP_EVENT)
13522 alc861_toshiba_automute(codec);
13525 /* pcm configuration: identiacal with ALC880 */
13526 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13527 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13528 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13529 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13532 #define ALC861_DIGOUT_NID 0x07
13534 static struct hda_channel_mode alc861_8ch_modes[1] = {
13538 static hda_nid_t alc861_dac_nids[4] = {
13539 /* front, surround, clfe, side */
13540 0x03, 0x06, 0x05, 0x04
13543 static hda_nid_t alc660_dac_nids[3] = {
13544 /* front, clfe, surround */
13548 static hda_nid_t alc861_adc_nids[1] = {
13553 static struct hda_input_mux alc861_capture_source = {
13557 { "Front Mic", 0x3 },
13564 /* fill in the dac_nids table from the parsed pin configuration */
13565 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13566 const struct auto_pin_cfg *cfg)
13571 spec->multiout.dac_nids = spec->private_dac_nids;
13572 for (i = 0; i < cfg->line_outs; i++) {
13573 nid = cfg->line_out_pins[i];
13575 if (i >= ARRAY_SIZE(alc861_dac_nids))
13577 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13580 spec->multiout.num_dacs = cfg->line_outs;
13584 /* add playback controls from the parsed DAC table */
13585 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13586 const struct auto_pin_cfg *cfg)
13589 static const char *chname[4] = {
13590 "Front", "Surround", NULL /*CLFE*/, "Side"
13595 for (i = 0; i < cfg->line_outs; i++) {
13596 nid = spec->multiout.dac_nids[i];
13601 err = add_control(spec, ALC_CTL_BIND_MUTE,
13602 "Center Playback Switch",
13603 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13607 err = add_control(spec, ALC_CTL_BIND_MUTE,
13608 "LFE Playback Switch",
13609 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13614 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13616 if (nid == alc861_dac_nids[idx])
13618 sprintf(name, "%s Playback Switch", chname[idx]);
13619 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13620 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13629 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13637 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13639 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13640 "Headphone Playback Switch",
13641 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13644 spec->multiout.hp_nid = nid;
13649 /* create playback/capture controls for input pins */
13650 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13651 const struct auto_pin_cfg *cfg)
13653 struct hda_input_mux *imux = &spec->private_imux[0];
13654 int i, err, idx, idx1;
13656 for (i = 0; i < AUTO_PIN_LAST; i++) {
13657 switch (cfg->input_pins[i]) {
13660 idx = 2; /* Line In */
13664 idx = 2; /* Line In */
13668 idx = 1; /* Mic In */
13672 idx = 1; /* Mic In */
13682 err = new_analog_input(spec, cfg->input_pins[i],
13683 auto_pin_cfg_labels[i], idx, 0x15);
13687 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13688 imux->items[imux->num_items].index = idx1;
13694 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13696 int pin_type, int dac_idx)
13698 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13700 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13704 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13706 struct alc_spec *spec = codec->spec;
13709 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13710 for (i = 0; i < spec->autocfg.line_outs; i++) {
13711 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13712 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13714 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13715 spec->multiout.dac_nids[i]);
13719 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13721 struct alc_spec *spec = codec->spec;
13724 pin = spec->autocfg.hp_pins[0];
13725 if (pin) /* connect to front */
13726 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13727 spec->multiout.dac_nids[0]);
13728 pin = spec->autocfg.speaker_pins[0];
13730 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13733 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13735 struct alc_spec *spec = codec->spec;
13738 for (i = 0; i < AUTO_PIN_LAST; i++) {
13739 hda_nid_t nid = spec->autocfg.input_pins[i];
13740 if (nid >= 0x0c && nid <= 0x11) {
13741 snd_hda_codec_write(codec, nid, 0,
13742 AC_VERB_SET_PIN_WIDGET_CONTROL,
13743 i <= AUTO_PIN_FRONT_MIC ?
13744 PIN_VREF80 : PIN_IN);
13749 /* parse the BIOS configuration and set up the alc_spec */
13750 /* return 1 if successful, 0 if the proper config is not found,
13751 * or a negative error code
13753 static int alc861_parse_auto_config(struct hda_codec *codec)
13755 struct alc_spec *spec = codec->spec;
13757 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13759 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13763 if (!spec->autocfg.line_outs)
13764 return 0; /* can't find valid BIOS pin config */
13766 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13769 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13772 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13775 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13779 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13781 if (spec->autocfg.dig_out_pin)
13782 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13784 if (spec->kctls.list)
13785 add_mixer(spec, spec->kctls.list);
13787 add_verb(spec, alc861_auto_init_verbs);
13789 spec->num_mux_defs = 1;
13790 spec->input_mux = &spec->private_imux[0];
13792 spec->adc_nids = alc861_adc_nids;
13793 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13794 set_capture_mixer(spec);
13796 store_pin_configs(codec);
13800 /* additional initialization for auto-configuration model */
13801 static void alc861_auto_init(struct hda_codec *codec)
13803 struct alc_spec *spec = codec->spec;
13804 alc861_auto_init_multi_out(codec);
13805 alc861_auto_init_hp_out(codec);
13806 alc861_auto_init_analog_input(codec);
13807 if (spec->unsol_event)
13808 alc_inithook(codec);
13811 #ifdef CONFIG_SND_HDA_POWER_SAVE
13812 static struct hda_amp_list alc861_loopbacks[] = {
13813 { 0x15, HDA_INPUT, 0 },
13814 { 0x15, HDA_INPUT, 1 },
13815 { 0x15, HDA_INPUT, 2 },
13816 { 0x15, HDA_INPUT, 3 },
13823 * configuration and preset
13825 static const char *alc861_models[ALC861_MODEL_LAST] = {
13826 [ALC861_3ST] = "3stack",
13827 [ALC660_3ST] = "3stack-660",
13828 [ALC861_3ST_DIG] = "3stack-dig",
13829 [ALC861_6ST_DIG] = "6stack-dig",
13830 [ALC861_UNIWILL_M31] = "uniwill-m31",
13831 [ALC861_TOSHIBA] = "toshiba",
13832 [ALC861_ASUS] = "asus",
13833 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13834 [ALC861_AUTO] = "auto",
13837 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13838 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13839 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13840 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13841 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13842 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13843 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13844 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13845 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13846 * Any other models that need this preset?
13848 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13849 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13850 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13851 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13852 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13853 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13854 /* FIXME: the below seems conflict */
13855 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13856 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13857 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13861 static struct alc_config_preset alc861_presets[] = {
13863 .mixers = { alc861_3ST_mixer },
13864 .init_verbs = { alc861_threestack_init_verbs },
13865 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13866 .dac_nids = alc861_dac_nids,
13867 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13868 .channel_mode = alc861_threestack_modes,
13870 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13871 .adc_nids = alc861_adc_nids,
13872 .input_mux = &alc861_capture_source,
13874 [ALC861_3ST_DIG] = {
13875 .mixers = { alc861_base_mixer },
13876 .init_verbs = { alc861_threestack_init_verbs },
13877 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13878 .dac_nids = alc861_dac_nids,
13879 .dig_out_nid = ALC861_DIGOUT_NID,
13880 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13881 .channel_mode = alc861_threestack_modes,
13883 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13884 .adc_nids = alc861_adc_nids,
13885 .input_mux = &alc861_capture_source,
13887 [ALC861_6ST_DIG] = {
13888 .mixers = { alc861_base_mixer },
13889 .init_verbs = { alc861_base_init_verbs },
13890 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13891 .dac_nids = alc861_dac_nids,
13892 .dig_out_nid = ALC861_DIGOUT_NID,
13893 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13894 .channel_mode = alc861_8ch_modes,
13895 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13896 .adc_nids = alc861_adc_nids,
13897 .input_mux = &alc861_capture_source,
13900 .mixers = { alc861_3ST_mixer },
13901 .init_verbs = { alc861_threestack_init_verbs },
13902 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13903 .dac_nids = alc660_dac_nids,
13904 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13905 .channel_mode = alc861_threestack_modes,
13907 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13908 .adc_nids = alc861_adc_nids,
13909 .input_mux = &alc861_capture_source,
13911 [ALC861_UNIWILL_M31] = {
13912 .mixers = { alc861_uniwill_m31_mixer },
13913 .init_verbs = { alc861_uniwill_m31_init_verbs },
13914 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13915 .dac_nids = alc861_dac_nids,
13916 .dig_out_nid = ALC861_DIGOUT_NID,
13917 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13918 .channel_mode = alc861_uniwill_m31_modes,
13920 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13921 .adc_nids = alc861_adc_nids,
13922 .input_mux = &alc861_capture_source,
13924 [ALC861_TOSHIBA] = {
13925 .mixers = { alc861_toshiba_mixer },
13926 .init_verbs = { alc861_base_init_verbs,
13927 alc861_toshiba_init_verbs },
13928 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13929 .dac_nids = alc861_dac_nids,
13930 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13931 .channel_mode = alc883_3ST_2ch_modes,
13932 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13933 .adc_nids = alc861_adc_nids,
13934 .input_mux = &alc861_capture_source,
13935 .unsol_event = alc861_toshiba_unsol_event,
13936 .init_hook = alc861_toshiba_automute,
13939 .mixers = { alc861_asus_mixer },
13940 .init_verbs = { alc861_asus_init_verbs },
13941 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13942 .dac_nids = alc861_dac_nids,
13943 .dig_out_nid = ALC861_DIGOUT_NID,
13944 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13945 .channel_mode = alc861_asus_modes,
13948 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13949 .adc_nids = alc861_adc_nids,
13950 .input_mux = &alc861_capture_source,
13952 [ALC861_ASUS_LAPTOP] = {
13953 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13954 .init_verbs = { alc861_asus_init_verbs,
13955 alc861_asus_laptop_init_verbs },
13956 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13957 .dac_nids = alc861_dac_nids,
13958 .dig_out_nid = ALC861_DIGOUT_NID,
13959 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13960 .channel_mode = alc883_3ST_2ch_modes,
13962 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13963 .adc_nids = alc861_adc_nids,
13964 .input_mux = &alc861_capture_source,
13969 static int patch_alc861(struct hda_codec *codec)
13971 struct alc_spec *spec;
13975 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13979 codec->spec = spec;
13981 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13985 if (board_config < 0) {
13986 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13987 "trying auto-probe from BIOS...\n");
13988 board_config = ALC861_AUTO;
13991 if (board_config == ALC861_AUTO) {
13992 /* automatic parse from the BIOS config */
13993 err = alc861_parse_auto_config(codec);
13999 "hda_codec: Cannot set up configuration "
14000 "from BIOS. Using base mode...\n");
14001 board_config = ALC861_3ST_DIG;
14005 err = snd_hda_attach_beep_device(codec, 0x23);
14011 if (board_config != ALC861_AUTO)
14012 setup_preset(spec, &alc861_presets[board_config]);
14014 spec->stream_name_analog = "ALC861 Analog";
14015 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14016 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14018 spec->stream_name_digital = "ALC861 Digital";
14019 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14020 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14022 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14024 spec->vmaster_nid = 0x03;
14026 codec->patch_ops = alc_patch_ops;
14027 if (board_config == ALC861_AUTO)
14028 spec->init_hook = alc861_auto_init;
14029 #ifdef CONFIG_SND_HDA_POWER_SAVE
14030 if (!spec->loopback.amplist)
14031 spec->loopback.amplist = alc861_loopbacks;
14033 codec->proc_widget_hook = print_realtek_coef;
14039 * ALC861-VD support
14043 * In addition, an independent DAC
14045 #define ALC861VD_DIGOUT_NID 0x06
14047 static hda_nid_t alc861vd_dac_nids[4] = {
14048 /* front, surr, clfe, side surr */
14049 0x02, 0x03, 0x04, 0x05
14052 /* dac_nids for ALC660vd are in a different order - according to
14053 * Realtek's driver.
14054 * This should probably tesult in a different mixer for 6stack models
14055 * of ALC660vd codecs, but for now there is only 3stack mixer
14056 * - and it is the same as in 861vd.
14057 * adc_nids in ALC660vd are (is) the same as in 861vd
14059 static hda_nid_t alc660vd_dac_nids[3] = {
14060 /* front, rear, clfe, rear_surr */
14064 static hda_nid_t alc861vd_adc_nids[1] = {
14069 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14072 /* FIXME: should be a matrix-type input source selection */
14073 static struct hda_input_mux alc861vd_capture_source = {
14077 { "Front Mic", 0x1 },
14083 static struct hda_input_mux alc861vd_dallas_capture_source = {
14086 { "Ext Mic", 0x0 },
14087 { "Int Mic", 0x1 },
14091 static struct hda_input_mux alc861vd_hp_capture_source = {
14094 { "Front Mic", 0x0 },
14095 { "ATAPI Mic", 0x1 },
14102 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14109 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14110 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14111 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14112 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14113 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14120 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14121 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14122 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14123 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14124 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14128 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14129 { 6, alc861vd_6stack_ch6_init },
14130 { 8, alc861vd_6stack_ch8_init },
14133 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14136 .name = "Channel Mode",
14137 .info = alc_ch_mode_info,
14138 .get = alc_ch_mode_get,
14139 .put = alc_ch_mode_put,
14144 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14145 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14147 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14148 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14149 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14151 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14152 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14154 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14156 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14158 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14159 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14161 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14162 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14164 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14166 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14170 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14171 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14172 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14174 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14175 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14177 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14178 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14183 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14184 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14185 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14189 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14193 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14194 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14195 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14197 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14198 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14200 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14201 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14206 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14207 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14208 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14209 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14211 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14213 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14215 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14217 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14218 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14219 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14227 /* Pin assignment: Speaker=0x14, HP = 0x15,
14228 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14230 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14231 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14232 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14233 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14234 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14235 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14236 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14237 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14238 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14239 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14240 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14244 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14245 * Front Mic=0x18, ATAPI Mic = 0x19,
14247 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14248 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14249 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14250 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14251 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14252 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14253 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14254 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14255 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14261 * generic initialization of ADC, input mixers and output mixers
14263 static struct hda_verb alc861vd_volume_init_verbs[] = {
14265 * Unmute ADC0 and set the default input to mic-in
14267 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14270 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14271 * the analog-loopback mixer widget
14273 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14277 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14278 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14280 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14281 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14282 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14283 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14287 * Set up output mixers (0x02 - 0x05)
14289 /* set vol=0 to output mixers */
14290 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14291 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14292 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14293 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14295 /* set up input amps for analog loopback */
14296 /* Amp Indices: DAC = 0, mixer = 1 */
14297 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14298 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14299 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14300 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14301 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14302 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14303 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14304 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14310 * 3-stack pin configuration:
14311 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14313 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14315 * Set pin mode and muting
14317 /* set front pin widgets 0x14 for output */
14318 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14319 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14320 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14322 /* Mic (rear) pin: input vref at 80% */
14323 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14324 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14325 /* Front Mic pin: input vref at 80% */
14326 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14327 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14328 /* Line In pin: input */
14329 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14330 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14331 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14332 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14333 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14334 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14335 /* CD pin widget for input */
14336 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14342 * 6-stack pin configuration:
14344 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14346 * Set pin mode and muting
14348 /* set front pin widgets 0x14 for output */
14349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14350 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14351 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14353 /* Rear Pin: output 1 (0x0d) */
14354 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14355 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14356 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14357 /* CLFE Pin: output 2 (0x0e) */
14358 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14359 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14360 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14361 /* Side Pin: output 3 (0x0f) */
14362 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14363 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14364 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14366 /* Mic (rear) pin: input vref at 80% */
14367 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14368 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14369 /* Front Mic pin: input vref at 80% */
14370 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14371 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14372 /* Line In pin: input */
14373 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14374 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14375 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14376 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14377 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14378 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14379 /* CD pin widget for input */
14380 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14385 static struct hda_verb alc861vd_eapd_verbs[] = {
14386 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14390 static struct hda_verb alc660vd_eapd_verbs[] = {
14391 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14392 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14396 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14400 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14405 /* toggle speaker-output according to the hp-jack state */
14406 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14408 unsigned int present;
14409 unsigned char bits;
14411 present = snd_hda_codec_read(codec, 0x1b, 0,
14412 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14413 bits = present ? HDA_AMP_MUTE : 0;
14414 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14415 HDA_AMP_MUTE, bits);
14418 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14420 unsigned int present;
14421 unsigned char bits;
14423 present = snd_hda_codec_read(codec, 0x18, 0,
14424 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14425 bits = present ? HDA_AMP_MUTE : 0;
14426 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14427 HDA_AMP_MUTE, bits);
14430 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14432 alc861vd_lenovo_hp_automute(codec);
14433 alc861vd_lenovo_mic_automute(codec);
14436 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14439 switch (res >> 26) {
14440 case ALC880_HP_EVENT:
14441 alc861vd_lenovo_hp_automute(codec);
14443 case ALC880_MIC_EVENT:
14444 alc861vd_lenovo_mic_automute(codec);
14449 static struct hda_verb alc861vd_dallas_verbs[] = {
14450 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14451 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14452 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14453 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14458 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14460 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14461 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14462 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14468 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14469 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14470 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14471 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14473 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14474 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14476 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14478 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14479 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14480 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14488 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14489 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14494 /* toggle speaker-output according to the hp-jack state */
14495 static void alc861vd_dallas_automute(struct hda_codec *codec)
14497 unsigned int present;
14499 present = snd_hda_codec_read(codec, 0x15, 0,
14500 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14501 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14502 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14505 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14507 if ((res >> 26) == ALC880_HP_EVENT)
14508 alc861vd_dallas_automute(codec);
14511 #ifdef CONFIG_SND_HDA_POWER_SAVE
14512 #define alc861vd_loopbacks alc880_loopbacks
14515 /* pcm configuration: identiacal with ALC880 */
14516 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14517 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14518 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14519 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14522 * configuration and preset
14524 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14525 [ALC660VD_3ST] = "3stack-660",
14526 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14527 [ALC660VD_ASUS_V1S] = "asus-v1s",
14528 [ALC861VD_3ST] = "3stack",
14529 [ALC861VD_3ST_DIG] = "3stack-digout",
14530 [ALC861VD_6ST_DIG] = "6stack-digout",
14531 [ALC861VD_LENOVO] = "lenovo",
14532 [ALC861VD_DALLAS] = "dallas",
14533 [ALC861VD_HP] = "hp",
14534 [ALC861VD_AUTO] = "auto",
14537 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14538 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14539 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14540 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14541 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14542 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14543 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14544 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14545 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14546 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14547 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14548 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14549 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14550 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14551 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14552 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14556 static struct alc_config_preset alc861vd_presets[] = {
14558 .mixers = { alc861vd_3st_mixer },
14559 .init_verbs = { alc861vd_volume_init_verbs,
14560 alc861vd_3stack_init_verbs },
14561 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14562 .dac_nids = alc660vd_dac_nids,
14563 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14564 .channel_mode = alc861vd_3stack_2ch_modes,
14565 .input_mux = &alc861vd_capture_source,
14567 [ALC660VD_3ST_DIG] = {
14568 .mixers = { alc861vd_3st_mixer },
14569 .init_verbs = { alc861vd_volume_init_verbs,
14570 alc861vd_3stack_init_verbs },
14571 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14572 .dac_nids = alc660vd_dac_nids,
14573 .dig_out_nid = ALC861VD_DIGOUT_NID,
14574 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14575 .channel_mode = alc861vd_3stack_2ch_modes,
14576 .input_mux = &alc861vd_capture_source,
14579 .mixers = { alc861vd_3st_mixer },
14580 .init_verbs = { alc861vd_volume_init_verbs,
14581 alc861vd_3stack_init_verbs },
14582 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14583 .dac_nids = alc861vd_dac_nids,
14584 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14585 .channel_mode = alc861vd_3stack_2ch_modes,
14586 .input_mux = &alc861vd_capture_source,
14588 [ALC861VD_3ST_DIG] = {
14589 .mixers = { alc861vd_3st_mixer },
14590 .init_verbs = { alc861vd_volume_init_verbs,
14591 alc861vd_3stack_init_verbs },
14592 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14593 .dac_nids = alc861vd_dac_nids,
14594 .dig_out_nid = ALC861VD_DIGOUT_NID,
14595 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14596 .channel_mode = alc861vd_3stack_2ch_modes,
14597 .input_mux = &alc861vd_capture_source,
14599 [ALC861VD_6ST_DIG] = {
14600 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14601 .init_verbs = { alc861vd_volume_init_verbs,
14602 alc861vd_6stack_init_verbs },
14603 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14604 .dac_nids = alc861vd_dac_nids,
14605 .dig_out_nid = ALC861VD_DIGOUT_NID,
14606 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14607 .channel_mode = alc861vd_6stack_modes,
14608 .input_mux = &alc861vd_capture_source,
14610 [ALC861VD_LENOVO] = {
14611 .mixers = { alc861vd_lenovo_mixer },
14612 .init_verbs = { alc861vd_volume_init_verbs,
14613 alc861vd_3stack_init_verbs,
14614 alc861vd_eapd_verbs,
14615 alc861vd_lenovo_unsol_verbs },
14616 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14617 .dac_nids = alc660vd_dac_nids,
14618 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14619 .channel_mode = alc861vd_3stack_2ch_modes,
14620 .input_mux = &alc861vd_capture_source,
14621 .unsol_event = alc861vd_lenovo_unsol_event,
14622 .init_hook = alc861vd_lenovo_automute,
14624 [ALC861VD_DALLAS] = {
14625 .mixers = { alc861vd_dallas_mixer },
14626 .init_verbs = { alc861vd_dallas_verbs },
14627 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14628 .dac_nids = alc861vd_dac_nids,
14629 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14630 .channel_mode = alc861vd_3stack_2ch_modes,
14631 .input_mux = &alc861vd_dallas_capture_source,
14632 .unsol_event = alc861vd_dallas_unsol_event,
14633 .init_hook = alc861vd_dallas_automute,
14636 .mixers = { alc861vd_hp_mixer },
14637 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14638 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14639 .dac_nids = alc861vd_dac_nids,
14640 .dig_out_nid = ALC861VD_DIGOUT_NID,
14641 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14642 .channel_mode = alc861vd_3stack_2ch_modes,
14643 .input_mux = &alc861vd_hp_capture_source,
14644 .unsol_event = alc861vd_dallas_unsol_event,
14645 .init_hook = alc861vd_dallas_automute,
14647 [ALC660VD_ASUS_V1S] = {
14648 .mixers = { alc861vd_lenovo_mixer },
14649 .init_verbs = { alc861vd_volume_init_verbs,
14650 alc861vd_3stack_init_verbs,
14651 alc861vd_eapd_verbs,
14652 alc861vd_lenovo_unsol_verbs },
14653 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14654 .dac_nids = alc660vd_dac_nids,
14655 .dig_out_nid = ALC861VD_DIGOUT_NID,
14656 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14657 .channel_mode = alc861vd_3stack_2ch_modes,
14658 .input_mux = &alc861vd_capture_source,
14659 .unsol_event = alc861vd_lenovo_unsol_event,
14660 .init_hook = alc861vd_lenovo_automute,
14665 * BIOS auto configuration
14667 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14668 hda_nid_t nid, int pin_type, int dac_idx)
14670 alc_set_pin_output(codec, nid, pin_type);
14673 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14675 struct alc_spec *spec = codec->spec;
14678 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14679 for (i = 0; i <= HDA_SIDE; i++) {
14680 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14681 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14683 alc861vd_auto_set_output_and_unmute(codec, nid,
14689 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14691 struct alc_spec *spec = codec->spec;
14694 pin = spec->autocfg.hp_pins[0];
14695 if (pin) /* connect to front and use dac 0 */
14696 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14697 pin = spec->autocfg.speaker_pins[0];
14699 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14702 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14703 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14705 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14707 struct alc_spec *spec = codec->spec;
14710 for (i = 0; i < AUTO_PIN_LAST; i++) {
14711 hda_nid_t nid = spec->autocfg.input_pins[i];
14712 if (alc861vd_is_input_pin(nid)) {
14713 snd_hda_codec_write(codec, nid, 0,
14714 AC_VERB_SET_PIN_WIDGET_CONTROL,
14715 i <= AUTO_PIN_FRONT_MIC ?
14716 PIN_VREF80 : PIN_IN);
14717 if (nid != ALC861VD_PIN_CD_NID)
14718 snd_hda_codec_write(codec, nid, 0,
14719 AC_VERB_SET_AMP_GAIN_MUTE,
14725 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14727 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14728 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14730 /* add playback controls from the parsed DAC table */
14731 /* Based on ALC880 version. But ALC861VD has separate,
14732 * different NIDs for mute/unmute switch and volume control */
14733 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14734 const struct auto_pin_cfg *cfg)
14737 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14738 hda_nid_t nid_v, nid_s;
14741 for (i = 0; i < cfg->line_outs; i++) {
14742 if (!spec->multiout.dac_nids[i])
14744 nid_v = alc861vd_idx_to_mixer_vol(
14746 spec->multiout.dac_nids[i]));
14747 nid_s = alc861vd_idx_to_mixer_switch(
14749 spec->multiout.dac_nids[i]));
14753 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14754 "Center Playback Volume",
14755 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14759 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14760 "LFE Playback Volume",
14761 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14765 err = add_control(spec, ALC_CTL_BIND_MUTE,
14766 "Center Playback Switch",
14767 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14771 err = add_control(spec, ALC_CTL_BIND_MUTE,
14772 "LFE Playback Switch",
14773 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14778 sprintf(name, "%s Playback Volume", chname[i]);
14779 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14780 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14784 sprintf(name, "%s Playback Switch", chname[i]);
14785 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14786 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14795 /* add playback controls for speaker and HP outputs */
14796 /* Based on ALC880 version. But ALC861VD has separate,
14797 * different NIDs for mute/unmute switch and volume control */
14798 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14799 hda_nid_t pin, const char *pfx)
14801 hda_nid_t nid_v, nid_s;
14808 if (alc880_is_fixed_pin(pin)) {
14809 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14810 /* specify the DAC as the extra output */
14811 if (!spec->multiout.hp_nid)
14812 spec->multiout.hp_nid = nid_v;
14814 spec->multiout.extra_out_nid[0] = nid_v;
14815 /* control HP volume/switch on the output mixer amp */
14816 nid_v = alc861vd_idx_to_mixer_vol(
14817 alc880_fixed_pin_idx(pin));
14818 nid_s = alc861vd_idx_to_mixer_switch(
14819 alc880_fixed_pin_idx(pin));
14821 sprintf(name, "%s Playback Volume", pfx);
14822 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14823 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14826 sprintf(name, "%s Playback Switch", pfx);
14827 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14828 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14831 } else if (alc880_is_multi_pin(pin)) {
14832 /* set manual connection */
14833 /* we have only a switch on HP-out PIN */
14834 sprintf(name, "%s Playback Switch", pfx);
14835 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14836 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14843 /* parse the BIOS configuration and set up the alc_spec
14844 * return 1 if successful, 0 if the proper config is not found,
14845 * or a negative error code
14846 * Based on ALC880 version - had to change it to override
14847 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14848 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14850 struct alc_spec *spec = codec->spec;
14852 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14854 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14858 if (!spec->autocfg.line_outs)
14859 return 0; /* can't find valid BIOS pin config */
14861 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14864 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14867 err = alc861vd_auto_create_extra_out(spec,
14868 spec->autocfg.speaker_pins[0],
14872 err = alc861vd_auto_create_extra_out(spec,
14873 spec->autocfg.hp_pins[0],
14877 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14881 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14883 if (spec->autocfg.dig_out_pin)
14884 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14886 if (spec->kctls.list)
14887 add_mixer(spec, spec->kctls.list);
14889 add_verb(spec, alc861vd_volume_init_verbs);
14891 spec->num_mux_defs = 1;
14892 spec->input_mux = &spec->private_imux[0];
14894 err = alc_auto_add_mic_boost(codec);
14898 store_pin_configs(codec);
14902 /* additional initialization for auto-configuration model */
14903 static void alc861vd_auto_init(struct hda_codec *codec)
14905 struct alc_spec *spec = codec->spec;
14906 alc861vd_auto_init_multi_out(codec);
14907 alc861vd_auto_init_hp_out(codec);
14908 alc861vd_auto_init_analog_input(codec);
14909 alc861vd_auto_init_input_src(codec);
14910 if (spec->unsol_event)
14911 alc_inithook(codec);
14914 static int patch_alc861vd(struct hda_codec *codec)
14916 struct alc_spec *spec;
14917 int err, board_config;
14919 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14923 codec->spec = spec;
14925 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14929 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14930 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14931 "ALC861VD, trying auto-probe from BIOS...\n");
14932 board_config = ALC861VD_AUTO;
14935 if (board_config == ALC861VD_AUTO) {
14936 /* automatic parse from the BIOS config */
14937 err = alc861vd_parse_auto_config(codec);
14943 "hda_codec: Cannot set up configuration "
14944 "from BIOS. Using base mode...\n");
14945 board_config = ALC861VD_3ST;
14949 err = snd_hda_attach_beep_device(codec, 0x23);
14955 if (board_config != ALC861VD_AUTO)
14956 setup_preset(spec, &alc861vd_presets[board_config]);
14958 if (codec->vendor_id == 0x10ec0660) {
14959 spec->stream_name_analog = "ALC660-VD Analog";
14960 spec->stream_name_digital = "ALC660-VD Digital";
14961 /* always turn on EAPD */
14962 add_verb(spec, alc660vd_eapd_verbs);
14964 spec->stream_name_analog = "ALC861VD Analog";
14965 spec->stream_name_digital = "ALC861VD Digital";
14968 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14969 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14971 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14972 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14974 spec->adc_nids = alc861vd_adc_nids;
14975 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14976 spec->capsrc_nids = alc861vd_capsrc_nids;
14977 spec->capture_style = CAPT_MIX;
14979 set_capture_mixer(spec);
14980 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
14982 spec->vmaster_nid = 0x02;
14984 codec->patch_ops = alc_patch_ops;
14986 if (board_config == ALC861VD_AUTO)
14987 spec->init_hook = alc861vd_auto_init;
14988 #ifdef CONFIG_SND_HDA_POWER_SAVE
14989 if (!spec->loopback.amplist)
14990 spec->loopback.amplist = alc861vd_loopbacks;
14992 codec->proc_widget_hook = print_realtek_coef;
15000 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15001 * configuration. Each pin widget can choose any input DACs and a mixer.
15002 * Each ADC is connected from a mixer of all inputs. This makes possible
15003 * 6-channel independent captures.
15005 * In addition, an independent DAC for the multi-playback (not used in this
15008 #define ALC662_DIGOUT_NID 0x06
15009 #define ALC662_DIGIN_NID 0x0a
15011 static hda_nid_t alc662_dac_nids[4] = {
15012 /* front, rear, clfe, rear_surr */
15016 static hda_nid_t alc662_adc_nids[1] = {
15021 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15024 /* FIXME: should be a matrix-type input source selection */
15025 static struct hda_input_mux alc662_capture_source = {
15029 { "Front Mic", 0x1 },
15035 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15043 static struct hda_input_mux alc662_eeepc_capture_source = {
15051 static struct hda_input_mux alc663_capture_source = {
15055 { "Front Mic", 0x1 },
15060 static struct hda_input_mux alc663_m51va_capture_source = {
15063 { "Ext-Mic", 0x0 },
15071 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15078 static struct hda_verb alc662_3ST_ch2_init[] = {
15079 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15080 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15081 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15082 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15089 static struct hda_verb alc662_3ST_ch6_init[] = {
15090 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15091 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15092 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15093 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15094 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15095 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15099 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15100 { 2, alc662_3ST_ch2_init },
15101 { 6, alc662_3ST_ch6_init },
15107 static struct hda_verb alc662_sixstack_ch6_init[] = {
15108 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15109 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15110 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15117 static struct hda_verb alc662_sixstack_ch8_init[] = {
15118 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15119 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15120 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15124 static struct hda_channel_mode alc662_5stack_modes[2] = {
15125 { 2, alc662_sixstack_ch6_init },
15126 { 6, alc662_sixstack_ch8_init },
15129 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15130 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15133 static struct snd_kcontrol_new alc662_base_mixer[] = {
15134 /* output mixer control */
15135 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15136 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15137 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15138 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15139 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15140 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15141 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15142 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15145 /*Input mixer control */
15146 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15147 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15148 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15149 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15150 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15151 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15152 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15153 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15157 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15158 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15159 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15162 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15163 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15164 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15167 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15168 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15172 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15173 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15174 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15175 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15176 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15177 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15178 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15179 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15180 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15182 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15183 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15184 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15185 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15186 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15187 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15188 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15189 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15193 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15194 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15195 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15196 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15197 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15206 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15207 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15209 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15210 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15212 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15213 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15214 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15216 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15217 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15218 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15222 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15223 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15224 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15225 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15226 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15227 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15228 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15229 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15230 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15231 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15232 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15240 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15241 .ops = &snd_hda_bind_vol,
15243 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15244 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15249 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15250 .ops = &snd_hda_bind_sw,
15252 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15253 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15258 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15259 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15260 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15266 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15267 .ops = &snd_hda_bind_sw,
15269 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15270 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15271 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15276 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15277 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15278 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15281 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15282 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15287 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15288 .ops = &snd_hda_bind_sw,
15290 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15291 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15292 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15297 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15298 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15299 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15302 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15303 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15307 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15308 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15309 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15310 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15312 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15313 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15314 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15318 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15319 .ops = &snd_hda_bind_vol,
15321 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15322 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15327 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15328 .ops = &snd_hda_bind_sw,
15330 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15331 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15336 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15337 HDA_BIND_VOL("Master Playback Volume",
15338 &alc663_asus_two_bind_master_vol),
15339 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15340 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15347 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15348 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15349 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15357 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15358 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15359 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15360 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15361 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15366 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15367 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15371 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15372 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15373 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15378 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15379 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15380 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15381 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15385 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15388 .name = "Channel Mode",
15389 .info = alc_ch_mode_info,
15390 .get = alc_ch_mode_get,
15391 .put = alc_ch_mode_put,
15396 static struct hda_verb alc662_init_verbs[] = {
15397 /* ADC: mute amp left and right */
15398 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15399 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15400 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15405 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15406 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15410 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15415 /* Front Pin: output 0 (0x0c) */
15416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15417 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15419 /* Rear Pin: output 1 (0x0d) */
15420 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15423 /* CLFE Pin: output 2 (0x0e) */
15424 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15425 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15427 /* Mic (rear) pin: input vref at 80% */
15428 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15429 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15430 /* Front Mic pin: input vref at 80% */
15431 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15432 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15433 /* Line In pin: input */
15434 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15435 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15436 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15437 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15438 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15439 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15440 /* CD pin widget for input */
15441 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15443 /* FIXME: use matrix-type input source selection */
15444 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15446 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15448 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15449 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15453 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15454 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15456 /* always trun on EAPD */
15457 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15458 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15463 static struct hda_verb alc662_sue_init_verbs[] = {
15464 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15465 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15469 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15470 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15471 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15475 /* Set Unsolicited Event*/
15476 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15478 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15483 * generic initialization of ADC, input mixers and output mixers
15485 static struct hda_verb alc662_auto_init_verbs[] = {
15487 * Unmute ADC and set the default input to mic-in
15489 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15490 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15492 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15494 * Note: PASD motherboards uses the Line In 2 as the input for front
15495 * panel mic (mic 2)
15497 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15498 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15499 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15505 * Set up output mixers (0x0c - 0x0f)
15507 /* set vol=0 to output mixers */
15508 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15509 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15510 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15512 /* set up input amps for analog loopback */
15513 /* Amp Indices: DAC = 0, mixer = 1 */
15514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15515 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15516 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15517 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15518 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15519 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15522 /* FIXME: use matrix-type input source selection */
15523 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15530 /* additional verbs for ALC663 */
15531 static struct hda_verb alc663_auto_init_verbs[] = {
15532 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15533 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15537 static struct hda_verb alc663_m51va_init_verbs[] = {
15538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15539 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15540 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15541 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15542 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15544 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15545 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15546 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15550 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15551 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15552 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15553 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15556 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15557 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15561 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15562 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15563 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15564 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15565 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15568 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15569 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15573 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15574 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15576 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15579 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15580 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15584 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15586 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15587 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15588 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* 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, 0x0}, /* 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 {0x21, 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_two_hp_amic_m2_init_verbs[] = {
15601 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15602 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15603 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15604 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15606 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15607 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15610 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15611 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15612 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15616 static struct hda_verb alc663_g71v_init_verbs[] = {
15617 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15618 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15619 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15621 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15622 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15623 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15626 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15627 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15631 static struct hda_verb alc663_g50v_init_verbs[] = {
15632 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15633 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15634 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15636 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15637 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15641 static struct hda_verb alc662_ecs_init_verbs[] = {
15642 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15643 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15644 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15645 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15649 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15650 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15651 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15655 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15657 unsigned int present;
15658 unsigned char bits;
15660 present = snd_hda_codec_read(codec, 0x14, 0,
15661 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15662 bits = present ? HDA_AMP_MUTE : 0;
15663 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15664 HDA_AMP_MUTE, bits);
15667 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15669 unsigned int present;
15670 unsigned char bits;
15672 present = snd_hda_codec_read(codec, 0x1b, 0,
15673 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15674 bits = present ? HDA_AMP_MUTE : 0;
15675 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15676 HDA_AMP_MUTE, bits);
15677 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15678 HDA_AMP_MUTE, bits);
15681 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15684 if ((res >> 26) == ALC880_HP_EVENT)
15685 alc662_lenovo_101e_all_automute(codec);
15686 if ((res >> 26) == ALC880_FRONT_EVENT)
15687 alc662_lenovo_101e_ispeaker_automute(codec);
15690 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15692 unsigned int present;
15694 present = snd_hda_codec_read(codec, 0x18, 0,
15695 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15696 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15697 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15698 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15699 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15700 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15701 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15702 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15703 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15706 /* unsolicited event for HP jack sensing */
15707 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15710 if ((res >> 26) == ALC880_HP_EVENT)
15711 alc262_hippo1_automute( codec );
15713 if ((res >> 26) == ALC880_MIC_EVENT)
15714 alc662_eeepc_mic_automute(codec);
15717 static void alc662_eeepc_inithook(struct hda_codec *codec)
15719 alc262_hippo1_automute( codec );
15720 alc662_eeepc_mic_automute(codec);
15723 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15726 unsigned int present;
15728 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15729 present = snd_hda_codec_read(codec, 0x14, 0,
15730 AC_VERB_GET_PIN_SENSE, 0);
15731 present = (present & 0x80000000) != 0;
15733 /* mute internal speaker */
15734 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15735 HDA_AMP_MUTE, HDA_AMP_MUTE);
15737 /* unmute internal speaker if necessary */
15738 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15739 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15740 HDA_AMP_MUTE, mute);
15744 /* unsolicited event for HP jack sensing */
15745 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15748 if ((res >> 26) == ALC880_HP_EVENT)
15749 alc662_eeepc_ep20_automute(codec);
15752 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15754 alc662_eeepc_ep20_automute(codec);
15757 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15759 unsigned int present;
15760 unsigned char bits;
15762 present = snd_hda_codec_read(codec, 0x21, 0,
15763 AC_VERB_GET_PIN_SENSE, 0)
15764 & AC_PINSENSE_PRESENCE;
15765 bits = present ? HDA_AMP_MUTE : 0;
15766 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15767 AMP_IN_MUTE(0), bits);
15768 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15769 AMP_IN_MUTE(0), bits);
15772 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15774 unsigned int present;
15775 unsigned char bits;
15777 present = snd_hda_codec_read(codec, 0x21, 0,
15778 AC_VERB_GET_PIN_SENSE, 0)
15779 & AC_PINSENSE_PRESENCE;
15780 bits = present ? HDA_AMP_MUTE : 0;
15781 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15782 AMP_IN_MUTE(0), bits);
15783 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15784 AMP_IN_MUTE(0), bits);
15785 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15786 AMP_IN_MUTE(0), bits);
15787 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15788 AMP_IN_MUTE(0), bits);
15791 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15793 unsigned int present;
15794 unsigned char bits;
15796 present = snd_hda_codec_read(codec, 0x15, 0,
15797 AC_VERB_GET_PIN_SENSE, 0)
15798 & AC_PINSENSE_PRESENCE;
15799 bits = present ? HDA_AMP_MUTE : 0;
15800 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15801 AMP_IN_MUTE(0), bits);
15802 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15803 AMP_IN_MUTE(0), bits);
15804 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15805 AMP_IN_MUTE(0), bits);
15806 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15807 AMP_IN_MUTE(0), bits);
15810 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15812 unsigned int present;
15813 unsigned char bits;
15815 present = snd_hda_codec_read(codec, 0x1b, 0,
15816 AC_VERB_GET_PIN_SENSE, 0)
15817 & AC_PINSENSE_PRESENCE;
15818 bits = present ? 0 : PIN_OUT;
15819 snd_hda_codec_write(codec, 0x14, 0,
15820 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15823 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15825 unsigned int present1, present2;
15827 present1 = snd_hda_codec_read(codec, 0x21, 0,
15828 AC_VERB_GET_PIN_SENSE, 0)
15829 & AC_PINSENSE_PRESENCE;
15830 present2 = snd_hda_codec_read(codec, 0x15, 0,
15831 AC_VERB_GET_PIN_SENSE, 0)
15832 & AC_PINSENSE_PRESENCE;
15834 if (present1 || present2) {
15835 snd_hda_codec_write_cache(codec, 0x14, 0,
15836 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15838 snd_hda_codec_write_cache(codec, 0x14, 0,
15839 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15843 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15845 unsigned int present1, present2;
15847 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15848 AC_VERB_GET_PIN_SENSE, 0)
15849 & AC_PINSENSE_PRESENCE;
15850 present2 = snd_hda_codec_read(codec, 0x15, 0,
15851 AC_VERB_GET_PIN_SENSE, 0)
15852 & AC_PINSENSE_PRESENCE;
15854 if (present1 || present2) {
15855 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15856 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15857 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15858 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15860 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15861 AMP_IN_MUTE(0), 0);
15862 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15863 AMP_IN_MUTE(0), 0);
15867 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15869 unsigned int present;
15871 present = snd_hda_codec_read(codec, 0x18, 0,
15872 AC_VERB_GET_PIN_SENSE, 0)
15873 & AC_PINSENSE_PRESENCE;
15874 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15875 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15876 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15877 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15878 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15879 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15880 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15881 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15884 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15887 switch (res >> 26) {
15888 case ALC880_HP_EVENT:
15889 alc663_m51va_speaker_automute(codec);
15891 case ALC880_MIC_EVENT:
15892 alc663_m51va_mic_automute(codec);
15897 static void alc663_m51va_inithook(struct hda_codec *codec)
15899 alc663_m51va_speaker_automute(codec);
15900 alc663_m51va_mic_automute(codec);
15903 /* ***************** Mode1 ******************************/
15904 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15907 switch (res >> 26) {
15908 case ALC880_HP_EVENT:
15909 alc663_m51va_speaker_automute(codec);
15911 case ALC880_MIC_EVENT:
15912 alc662_eeepc_mic_automute(codec);
15917 static void alc663_mode1_inithook(struct hda_codec *codec)
15919 alc663_m51va_speaker_automute(codec);
15920 alc662_eeepc_mic_automute(codec);
15922 /* ***************** Mode2 ******************************/
15923 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15926 switch (res >> 26) {
15927 case ALC880_HP_EVENT:
15928 alc662_f5z_speaker_automute(codec);
15930 case ALC880_MIC_EVENT:
15931 alc662_eeepc_mic_automute(codec);
15936 static void alc662_mode2_inithook(struct hda_codec *codec)
15938 alc662_f5z_speaker_automute(codec);
15939 alc662_eeepc_mic_automute(codec);
15941 /* ***************** Mode3 ******************************/
15942 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15945 switch (res >> 26) {
15946 case ALC880_HP_EVENT:
15947 alc663_two_hp_m1_speaker_automute(codec);
15949 case ALC880_MIC_EVENT:
15950 alc662_eeepc_mic_automute(codec);
15955 static void alc663_mode3_inithook(struct hda_codec *codec)
15957 alc663_two_hp_m1_speaker_automute(codec);
15958 alc662_eeepc_mic_automute(codec);
15960 /* ***************** Mode4 ******************************/
15961 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15964 switch (res >> 26) {
15965 case ALC880_HP_EVENT:
15966 alc663_21jd_two_speaker_automute(codec);
15968 case ALC880_MIC_EVENT:
15969 alc662_eeepc_mic_automute(codec);
15974 static void alc663_mode4_inithook(struct hda_codec *codec)
15976 alc663_21jd_two_speaker_automute(codec);
15977 alc662_eeepc_mic_automute(codec);
15979 /* ***************** Mode5 ******************************/
15980 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15983 switch (res >> 26) {
15984 case ALC880_HP_EVENT:
15985 alc663_15jd_two_speaker_automute(codec);
15987 case ALC880_MIC_EVENT:
15988 alc662_eeepc_mic_automute(codec);
15993 static void alc663_mode5_inithook(struct hda_codec *codec)
15995 alc663_15jd_two_speaker_automute(codec);
15996 alc662_eeepc_mic_automute(codec);
15998 /* ***************** Mode6 ******************************/
15999 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16002 switch (res >> 26) {
16003 case ALC880_HP_EVENT:
16004 alc663_two_hp_m2_speaker_automute(codec);
16006 case ALC880_MIC_EVENT:
16007 alc662_eeepc_mic_automute(codec);
16012 static void alc663_mode6_inithook(struct hda_codec *codec)
16014 alc663_two_hp_m2_speaker_automute(codec);
16015 alc662_eeepc_mic_automute(codec);
16018 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16020 unsigned int present;
16021 unsigned char bits;
16023 present = snd_hda_codec_read(codec, 0x21, 0,
16024 AC_VERB_GET_PIN_SENSE, 0)
16025 & AC_PINSENSE_PRESENCE;
16026 bits = present ? HDA_AMP_MUTE : 0;
16027 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16028 HDA_AMP_MUTE, bits);
16029 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16030 HDA_AMP_MUTE, bits);
16033 static void alc663_g71v_front_automute(struct hda_codec *codec)
16035 unsigned int present;
16036 unsigned char bits;
16038 present = snd_hda_codec_read(codec, 0x15, 0,
16039 AC_VERB_GET_PIN_SENSE, 0)
16040 & AC_PINSENSE_PRESENCE;
16041 bits = present ? HDA_AMP_MUTE : 0;
16042 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16043 HDA_AMP_MUTE, bits);
16046 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16049 switch (res >> 26) {
16050 case ALC880_HP_EVENT:
16051 alc663_g71v_hp_automute(codec);
16053 case ALC880_FRONT_EVENT:
16054 alc663_g71v_front_automute(codec);
16056 case ALC880_MIC_EVENT:
16057 alc662_eeepc_mic_automute(codec);
16062 static void alc663_g71v_inithook(struct hda_codec *codec)
16064 alc663_g71v_front_automute(codec);
16065 alc663_g71v_hp_automute(codec);
16066 alc662_eeepc_mic_automute(codec);
16069 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16072 switch (res >> 26) {
16073 case ALC880_HP_EVENT:
16074 alc663_m51va_speaker_automute(codec);
16076 case ALC880_MIC_EVENT:
16077 alc662_eeepc_mic_automute(codec);
16082 static void alc663_g50v_inithook(struct hda_codec *codec)
16084 alc663_m51va_speaker_automute(codec);
16085 alc662_eeepc_mic_automute(codec);
16088 /* bind hp and internal speaker mute (with plug check) */
16089 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16090 struct snd_ctl_elem_value *ucontrol)
16092 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16093 long *valp = ucontrol->value.integer.value;
16096 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16098 valp[0] ? 0 : HDA_AMP_MUTE);
16099 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16101 valp[1] ? 0 : HDA_AMP_MUTE);
16103 alc262_hippo1_automute(codec);
16107 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16108 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16111 .name = "Master Playback Switch",
16112 .info = snd_hda_mixer_amp_switch_info,
16113 .get = snd_hda_mixer_amp_switch_get,
16114 .put = alc662_ecs_master_sw_put,
16115 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16118 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16119 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16120 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16122 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16123 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16124 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16128 #ifdef CONFIG_SND_HDA_POWER_SAVE
16129 #define alc662_loopbacks alc880_loopbacks
16133 /* pcm configuration: identiacal with ALC880 */
16134 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16135 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16136 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16137 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16140 * configuration and preset
16142 static const char *alc662_models[ALC662_MODEL_LAST] = {
16143 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16144 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16145 [ALC662_3ST_6ch] = "3stack-6ch",
16146 [ALC662_5ST_DIG] = "6stack-dig",
16147 [ALC662_LENOVO_101E] = "lenovo-101e",
16148 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16149 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16150 [ALC662_ECS] = "ecs",
16151 [ALC663_ASUS_M51VA] = "m51va",
16152 [ALC663_ASUS_G71V] = "g71v",
16153 [ALC663_ASUS_H13] = "h13",
16154 [ALC663_ASUS_G50V] = "g50v",
16155 [ALC663_ASUS_MODE1] = "asus-mode1",
16156 [ALC662_ASUS_MODE2] = "asus-mode2",
16157 [ALC663_ASUS_MODE3] = "asus-mode3",
16158 [ALC663_ASUS_MODE4] = "asus-mode4",
16159 [ALC663_ASUS_MODE5] = "asus-mode5",
16160 [ALC663_ASUS_MODE6] = "asus-mode6",
16161 [ALC662_AUTO] = "auto",
16164 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16165 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16166 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16167 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16168 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16169 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16170 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16171 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16172 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16173 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16174 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16175 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16176 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16177 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16178 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16179 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16180 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16181 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16182 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16183 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16184 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16185 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16186 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16187 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16188 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16189 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16190 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16191 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16192 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16193 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16194 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16195 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16196 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16197 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16198 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16199 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16200 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16201 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16202 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16203 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16204 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16205 ALC662_3ST_6ch_DIG),
16206 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16207 ALC662_3ST_6ch_DIG),
16208 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16209 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16210 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16211 ALC662_3ST_6ch_DIG),
16212 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16217 static struct alc_config_preset alc662_presets[] = {
16218 [ALC662_3ST_2ch_DIG] = {
16219 .mixers = { alc662_3ST_2ch_mixer },
16220 .init_verbs = { alc662_init_verbs },
16221 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16222 .dac_nids = alc662_dac_nids,
16223 .dig_out_nid = ALC662_DIGOUT_NID,
16224 .dig_in_nid = ALC662_DIGIN_NID,
16225 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16226 .channel_mode = alc662_3ST_2ch_modes,
16227 .input_mux = &alc662_capture_source,
16229 [ALC662_3ST_6ch_DIG] = {
16230 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16231 .init_verbs = { alc662_init_verbs },
16232 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16233 .dac_nids = alc662_dac_nids,
16234 .dig_out_nid = ALC662_DIGOUT_NID,
16235 .dig_in_nid = ALC662_DIGIN_NID,
16236 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16237 .channel_mode = alc662_3ST_6ch_modes,
16239 .input_mux = &alc662_capture_source,
16241 [ALC662_3ST_6ch] = {
16242 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16243 .init_verbs = { alc662_init_verbs },
16244 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16245 .dac_nids = alc662_dac_nids,
16246 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16247 .channel_mode = alc662_3ST_6ch_modes,
16249 .input_mux = &alc662_capture_source,
16251 [ALC662_5ST_DIG] = {
16252 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16253 .init_verbs = { alc662_init_verbs },
16254 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16255 .dac_nids = alc662_dac_nids,
16256 .dig_out_nid = ALC662_DIGOUT_NID,
16257 .dig_in_nid = ALC662_DIGIN_NID,
16258 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16259 .channel_mode = alc662_5stack_modes,
16260 .input_mux = &alc662_capture_source,
16262 [ALC662_LENOVO_101E] = {
16263 .mixers = { alc662_lenovo_101e_mixer },
16264 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16265 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16266 .dac_nids = alc662_dac_nids,
16267 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16268 .channel_mode = alc662_3ST_2ch_modes,
16269 .input_mux = &alc662_lenovo_101e_capture_source,
16270 .unsol_event = alc662_lenovo_101e_unsol_event,
16271 .init_hook = alc662_lenovo_101e_all_automute,
16273 [ALC662_ASUS_EEEPC_P701] = {
16274 .mixers = { alc662_eeepc_p701_mixer },
16275 .init_verbs = { alc662_init_verbs,
16276 alc662_eeepc_sue_init_verbs },
16277 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16278 .dac_nids = alc662_dac_nids,
16279 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16280 .channel_mode = alc662_3ST_2ch_modes,
16281 .input_mux = &alc662_eeepc_capture_source,
16282 .unsol_event = alc662_eeepc_unsol_event,
16283 .init_hook = alc662_eeepc_inithook,
16285 [ALC662_ASUS_EEEPC_EP20] = {
16286 .mixers = { alc662_eeepc_ep20_mixer,
16287 alc662_chmode_mixer },
16288 .init_verbs = { alc662_init_verbs,
16289 alc662_eeepc_ep20_sue_init_verbs },
16290 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16291 .dac_nids = alc662_dac_nids,
16292 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16293 .channel_mode = alc662_3ST_6ch_modes,
16294 .input_mux = &alc662_lenovo_101e_capture_source,
16295 .unsol_event = alc662_eeepc_ep20_unsol_event,
16296 .init_hook = alc662_eeepc_ep20_inithook,
16299 .mixers = { alc662_ecs_mixer },
16300 .init_verbs = { alc662_init_verbs,
16301 alc662_ecs_init_verbs },
16302 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16303 .dac_nids = alc662_dac_nids,
16304 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16305 .channel_mode = alc662_3ST_2ch_modes,
16306 .input_mux = &alc662_eeepc_capture_source,
16307 .unsol_event = alc662_eeepc_unsol_event,
16308 .init_hook = alc662_eeepc_inithook,
16310 [ALC663_ASUS_M51VA] = {
16311 .mixers = { alc663_m51va_mixer },
16312 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16313 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16314 .dac_nids = alc662_dac_nids,
16315 .dig_out_nid = ALC662_DIGOUT_NID,
16316 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16317 .channel_mode = alc662_3ST_2ch_modes,
16318 .input_mux = &alc663_m51va_capture_source,
16319 .unsol_event = alc663_m51va_unsol_event,
16320 .init_hook = alc663_m51va_inithook,
16322 [ALC663_ASUS_G71V] = {
16323 .mixers = { alc663_g71v_mixer },
16324 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16325 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16326 .dac_nids = alc662_dac_nids,
16327 .dig_out_nid = ALC662_DIGOUT_NID,
16328 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16329 .channel_mode = alc662_3ST_2ch_modes,
16330 .input_mux = &alc662_eeepc_capture_source,
16331 .unsol_event = alc663_g71v_unsol_event,
16332 .init_hook = alc663_g71v_inithook,
16334 [ALC663_ASUS_H13] = {
16335 .mixers = { alc663_m51va_mixer },
16336 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16337 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16338 .dac_nids = alc662_dac_nids,
16339 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16340 .channel_mode = alc662_3ST_2ch_modes,
16341 .input_mux = &alc663_m51va_capture_source,
16342 .unsol_event = alc663_m51va_unsol_event,
16343 .init_hook = alc663_m51va_inithook,
16345 [ALC663_ASUS_G50V] = {
16346 .mixers = { alc663_g50v_mixer },
16347 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16348 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16349 .dac_nids = alc662_dac_nids,
16350 .dig_out_nid = ALC662_DIGOUT_NID,
16351 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16352 .channel_mode = alc662_3ST_6ch_modes,
16353 .input_mux = &alc663_capture_source,
16354 .unsol_event = alc663_g50v_unsol_event,
16355 .init_hook = alc663_g50v_inithook,
16357 [ALC663_ASUS_MODE1] = {
16358 .mixers = { alc663_m51va_mixer },
16359 .cap_mixer = alc662_auto_capture_mixer,
16360 .init_verbs = { alc662_init_verbs,
16361 alc663_21jd_amic_init_verbs },
16362 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16364 .dac_nids = alc662_dac_nids,
16365 .dig_out_nid = ALC662_DIGOUT_NID,
16366 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16367 .channel_mode = alc662_3ST_2ch_modes,
16368 .input_mux = &alc662_eeepc_capture_source,
16369 .unsol_event = alc663_mode1_unsol_event,
16370 .init_hook = alc663_mode1_inithook,
16372 [ALC662_ASUS_MODE2] = {
16373 .mixers = { alc662_1bjd_mixer },
16374 .cap_mixer = alc662_auto_capture_mixer,
16375 .init_verbs = { alc662_init_verbs,
16376 alc662_1bjd_amic_init_verbs },
16377 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16378 .dac_nids = alc662_dac_nids,
16379 .dig_out_nid = ALC662_DIGOUT_NID,
16380 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16381 .channel_mode = alc662_3ST_2ch_modes,
16382 .input_mux = &alc662_eeepc_capture_source,
16383 .unsol_event = alc662_mode2_unsol_event,
16384 .init_hook = alc662_mode2_inithook,
16386 [ALC663_ASUS_MODE3] = {
16387 .mixers = { alc663_two_hp_m1_mixer },
16388 .cap_mixer = alc662_auto_capture_mixer,
16389 .init_verbs = { alc662_init_verbs,
16390 alc663_two_hp_amic_m1_init_verbs },
16391 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16393 .dac_nids = alc662_dac_nids,
16394 .dig_out_nid = ALC662_DIGOUT_NID,
16395 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16396 .channel_mode = alc662_3ST_2ch_modes,
16397 .input_mux = &alc662_eeepc_capture_source,
16398 .unsol_event = alc663_mode3_unsol_event,
16399 .init_hook = alc663_mode3_inithook,
16401 [ALC663_ASUS_MODE4] = {
16402 .mixers = { alc663_asus_21jd_clfe_mixer },
16403 .cap_mixer = alc662_auto_capture_mixer,
16404 .init_verbs = { alc662_init_verbs,
16405 alc663_21jd_amic_init_verbs},
16406 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16408 .dac_nids = alc662_dac_nids,
16409 .dig_out_nid = ALC662_DIGOUT_NID,
16410 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16411 .channel_mode = alc662_3ST_2ch_modes,
16412 .input_mux = &alc662_eeepc_capture_source,
16413 .unsol_event = alc663_mode4_unsol_event,
16414 .init_hook = alc663_mode4_inithook,
16416 [ALC663_ASUS_MODE5] = {
16417 .mixers = { alc663_asus_15jd_clfe_mixer },
16418 .cap_mixer = alc662_auto_capture_mixer,
16419 .init_verbs = { alc662_init_verbs,
16420 alc663_15jd_amic_init_verbs },
16421 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16423 .dac_nids = alc662_dac_nids,
16424 .dig_out_nid = ALC662_DIGOUT_NID,
16425 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16426 .channel_mode = alc662_3ST_2ch_modes,
16427 .input_mux = &alc662_eeepc_capture_source,
16428 .unsol_event = alc663_mode5_unsol_event,
16429 .init_hook = alc663_mode5_inithook,
16431 [ALC663_ASUS_MODE6] = {
16432 .mixers = { alc663_two_hp_m2_mixer },
16433 .cap_mixer = alc662_auto_capture_mixer,
16434 .init_verbs = { alc662_init_verbs,
16435 alc663_two_hp_amic_m2_init_verbs },
16436 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16438 .dac_nids = alc662_dac_nids,
16439 .dig_out_nid = ALC662_DIGOUT_NID,
16440 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16441 .channel_mode = alc662_3ST_2ch_modes,
16442 .input_mux = &alc662_eeepc_capture_source,
16443 .unsol_event = alc663_mode6_unsol_event,
16444 .init_hook = alc663_mode6_inithook,
16450 * BIOS auto configuration
16453 /* add playback controls from the parsed DAC table */
16454 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16455 const struct auto_pin_cfg *cfg)
16458 static const char *chname[4] = {
16459 "Front", "Surround", NULL /*CLFE*/, "Side"
16464 for (i = 0; i < cfg->line_outs; i++) {
16465 if (!spec->multiout.dac_nids[i])
16467 nid = alc880_idx_to_dac(i);
16470 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16471 "Center Playback Volume",
16472 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16476 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16477 "LFE Playback Volume",
16478 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16482 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16483 "Center Playback Switch",
16484 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16488 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16489 "LFE Playback Switch",
16490 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16495 sprintf(name, "%s Playback Volume", chname[i]);
16496 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16497 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16501 sprintf(name, "%s Playback Switch", chname[i]);
16502 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16503 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16512 /* add playback controls for speaker and HP outputs */
16513 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16524 /* ALC663 has a mono output pin on 0x17 */
16525 sprintf(name, "%s Playback Switch", pfx);
16526 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16527 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16531 if (alc880_is_fixed_pin(pin)) {
16532 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16533 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16534 /* specify the DAC as the extra output */
16535 if (!spec->multiout.hp_nid)
16536 spec->multiout.hp_nid = nid;
16538 spec->multiout.extra_out_nid[0] = nid;
16539 /* control HP volume/switch on the output mixer amp */
16540 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16541 sprintf(name, "%s Playback Volume", pfx);
16542 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16543 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16546 sprintf(name, "%s Playback Switch", pfx);
16547 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16548 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16551 } else if (alc880_is_multi_pin(pin)) {
16552 /* set manual connection */
16553 /* we have only a switch on HP-out PIN */
16554 sprintf(name, "%s Playback Switch", pfx);
16555 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16556 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16563 /* create playback/capture controls for input pins */
16564 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16565 const struct auto_pin_cfg *cfg)
16567 struct hda_input_mux *imux = &spec->private_imux[0];
16570 for (i = 0; i < AUTO_PIN_LAST; i++) {
16571 if (alc880_is_input_pin(cfg->input_pins[i])) {
16572 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16573 err = new_analog_input(spec, cfg->input_pins[i],
16574 auto_pin_cfg_labels[i],
16578 imux->items[imux->num_items].label =
16579 auto_pin_cfg_labels[i];
16580 imux->items[imux->num_items].index =
16581 alc880_input_pin_idx(cfg->input_pins[i]);
16588 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16589 hda_nid_t nid, int pin_type,
16592 alc_set_pin_output(codec, nid, pin_type);
16593 /* need the manual connection? */
16594 if (alc880_is_multi_pin(nid)) {
16595 struct alc_spec *spec = codec->spec;
16596 int idx = alc880_multi_pin_idx(nid);
16597 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16598 AC_VERB_SET_CONNECT_SEL,
16599 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16603 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16605 struct alc_spec *spec = codec->spec;
16608 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16609 for (i = 0; i <= HDA_SIDE; i++) {
16610 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16611 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16613 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16618 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16620 struct alc_spec *spec = codec->spec;
16623 pin = spec->autocfg.hp_pins[0];
16624 if (pin) /* connect to front */
16626 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16627 pin = spec->autocfg.speaker_pins[0];
16629 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16632 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16633 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16635 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16637 struct alc_spec *spec = codec->spec;
16640 for (i = 0; i < AUTO_PIN_LAST; i++) {
16641 hda_nid_t nid = spec->autocfg.input_pins[i];
16642 if (alc662_is_input_pin(nid)) {
16643 snd_hda_codec_write(codec, nid, 0,
16644 AC_VERB_SET_PIN_WIDGET_CONTROL,
16645 (i <= AUTO_PIN_FRONT_MIC ?
16646 PIN_VREF80 : PIN_IN));
16647 if (nid != ALC662_PIN_CD_NID)
16648 snd_hda_codec_write(codec, nid, 0,
16649 AC_VERB_SET_AMP_GAIN_MUTE,
16655 #define alc662_auto_init_input_src alc882_auto_init_input_src
16657 static int alc662_parse_auto_config(struct hda_codec *codec)
16659 struct alc_spec *spec = codec->spec;
16661 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16663 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16667 if (!spec->autocfg.line_outs)
16668 return 0; /* can't find valid BIOS pin config */
16670 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16673 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16676 err = alc662_auto_create_extra_out(spec,
16677 spec->autocfg.speaker_pins[0],
16681 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16685 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16689 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16691 if (spec->autocfg.dig_out_pin)
16692 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16694 if (spec->kctls.list)
16695 add_mixer(spec, spec->kctls.list);
16697 spec->num_mux_defs = 1;
16698 spec->input_mux = &spec->private_imux[0];
16700 add_verb(spec, alc662_auto_init_verbs);
16701 if (codec->vendor_id == 0x10ec0663)
16702 add_verb(spec, alc663_auto_init_verbs);
16704 err = alc_auto_add_mic_boost(codec);
16708 store_pin_configs(codec);
16712 /* additional initialization for auto-configuration model */
16713 static void alc662_auto_init(struct hda_codec *codec)
16715 struct alc_spec *spec = codec->spec;
16716 alc662_auto_init_multi_out(codec);
16717 alc662_auto_init_hp_out(codec);
16718 alc662_auto_init_analog_input(codec);
16719 alc662_auto_init_input_src(codec);
16720 if (spec->unsol_event)
16721 alc_inithook(codec);
16724 static int patch_alc662(struct hda_codec *codec)
16726 struct alc_spec *spec;
16727 int err, board_config;
16729 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16733 codec->spec = spec;
16735 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16737 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16740 if (board_config < 0) {
16741 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16742 "trying auto-probe from BIOS...\n");
16743 board_config = ALC662_AUTO;
16746 if (board_config == ALC662_AUTO) {
16747 /* automatic parse from the BIOS config */
16748 err = alc662_parse_auto_config(codec);
16754 "hda_codec: Cannot set up configuration "
16755 "from BIOS. Using base mode...\n");
16756 board_config = ALC662_3ST_2ch_DIG;
16760 err = snd_hda_attach_beep_device(codec, 0x1);
16766 if (board_config != ALC662_AUTO)
16767 setup_preset(spec, &alc662_presets[board_config]);
16769 if (codec->vendor_id == 0x10ec0663) {
16770 spec->stream_name_analog = "ALC663 Analog";
16771 spec->stream_name_digital = "ALC663 Digital";
16772 } else if (codec->vendor_id == 0x10ec0272) {
16773 spec->stream_name_analog = "ALC272 Analog";
16774 spec->stream_name_digital = "ALC272 Digital";
16776 spec->stream_name_analog = "ALC662 Analog";
16777 spec->stream_name_digital = "ALC662 Digital";
16780 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16781 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16783 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16784 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16786 spec->adc_nids = alc662_adc_nids;
16787 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16788 spec->capsrc_nids = alc662_capsrc_nids;
16789 spec->capture_style = CAPT_MIX;
16791 if (!spec->cap_mixer)
16792 set_capture_mixer(spec);
16793 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16795 spec->vmaster_nid = 0x02;
16797 codec->patch_ops = alc_patch_ops;
16798 if (board_config == ALC662_AUTO)
16799 spec->init_hook = alc662_auto_init;
16800 #ifdef CONFIG_SND_HDA_POWER_SAVE
16801 if (!spec->loopback.amplist)
16802 spec->loopback.amplist = alc662_loopbacks;
16804 codec->proc_widget_hook = print_realtek_coef;
16812 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16813 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16814 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16815 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16816 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16817 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16818 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16819 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16820 .patch = patch_alc861 },
16821 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16822 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16823 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16824 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16825 .patch = patch_alc883 },
16826 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16827 .patch = patch_alc662 },
16828 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16829 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16830 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16831 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16832 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16833 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16834 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16835 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16836 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16837 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16838 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16839 .patch = patch_alc883 },
16840 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16841 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16842 {} /* terminator */
16845 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16847 MODULE_LICENSE("GPL");
16848 MODULE_DESCRIPTION("Realtek HD-audio codec");
16850 static struct hda_codec_preset_list realtek_list = {
16851 .preset = snd_hda_preset_realtek,
16852 .owner = THIS_MODULE,
16855 static int __init patch_realtek_init(void)
16857 return snd_hda_add_codec_preset(&realtek_list);
16860 static void __exit patch_realtek_exit(void)
16862 snd_hda_delete_codec_preset(&realtek_list);
16865 module_init(patch_realtek_init)
16866 module_exit(patch_realtek_exit)