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_cleanup(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_cleanup(codec, &spec->multiout);
2990 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2991 struct hda_codec *codec,
2992 struct snd_pcm_substream *substream)
2994 struct alc_spec *spec = codec->spec;
2995 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3001 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3002 struct hda_codec *codec,
3003 unsigned int stream_tag,
3004 unsigned int format,
3005 struct snd_pcm_substream *substream)
3007 struct alc_spec *spec = codec->spec;
3009 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3010 stream_tag, 0, format);
3014 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3015 struct hda_codec *codec,
3016 struct snd_pcm_substream *substream)
3018 struct alc_spec *spec = codec->spec;
3020 snd_hda_codec_cleanup_stream(codec,
3021 spec->adc_nids[substream->number + 1]);
3028 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3032 /* NID is set in alc_build_pcms */
3034 .open = alc880_playback_pcm_open,
3035 .prepare = alc880_playback_pcm_prepare,
3036 .cleanup = alc880_playback_pcm_cleanup
3040 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3044 /* NID is set in alc_build_pcms */
3047 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3051 /* NID is set in alc_build_pcms */
3054 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3055 .substreams = 2, /* can be overridden */
3058 /* NID is set in alc_build_pcms */
3060 .prepare = alc880_alt_capture_pcm_prepare,
3061 .cleanup = alc880_alt_capture_pcm_cleanup
3065 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3069 /* NID is set in alc_build_pcms */
3071 .open = alc880_dig_playback_pcm_open,
3072 .close = alc880_dig_playback_pcm_close,
3073 .prepare = alc880_dig_playback_pcm_prepare,
3074 .cleanup = alc880_dig_playback_pcm_cleanup
3078 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3082 /* NID is set in alc_build_pcms */
3085 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3086 static struct hda_pcm_stream alc_pcm_null_stream = {
3092 static int alc_build_pcms(struct hda_codec *codec)
3094 struct alc_spec *spec = codec->spec;
3095 struct hda_pcm *info = spec->pcm_rec;
3098 codec->num_pcms = 1;
3099 codec->pcm_info = info;
3101 if (spec->no_analog)
3104 info->name = spec->stream_name_analog;
3105 if (spec->stream_analog_playback) {
3106 if (snd_BUG_ON(!spec->multiout.dac_nids))
3108 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3109 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3111 if (spec->stream_analog_capture) {
3112 if (snd_BUG_ON(!spec->adc_nids))
3114 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3115 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3118 if (spec->channel_mode) {
3119 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3120 for (i = 0; i < spec->num_channel_mode; i++) {
3121 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3122 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3128 /* SPDIF for stream index #1 */
3129 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3130 codec->num_pcms = 2;
3131 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3132 info = spec->pcm_rec + 1;
3133 info->name = spec->stream_name_digital;
3134 if (spec->dig_out_type)
3135 info->pcm_type = spec->dig_out_type;
3137 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3138 if (spec->multiout.dig_out_nid &&
3139 spec->stream_digital_playback) {
3140 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3141 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3143 if (spec->dig_in_nid &&
3144 spec->stream_digital_capture) {
3145 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3146 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3148 /* FIXME: do we need this for all Realtek codec models? */
3149 codec->spdif_status_reset = 1;
3152 if (spec->no_analog)
3155 /* If the use of more than one ADC is requested for the current
3156 * model, configure a second analog capture-only PCM.
3158 /* Additional Analaog capture for index #2 */
3159 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3160 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3161 codec->num_pcms = 3;
3162 info = spec->pcm_rec + 2;
3163 info->name = spec->stream_name_analog;
3164 if (spec->alt_dac_nid) {
3165 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3166 *spec->stream_analog_alt_playback;
3167 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3170 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3171 alc_pcm_null_stream;
3172 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3174 if (spec->num_adc_nids > 1) {
3175 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3176 *spec->stream_analog_alt_capture;
3177 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3179 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3180 spec->num_adc_nids - 1;
3182 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3183 alc_pcm_null_stream;
3184 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3191 static void alc_free_kctls(struct hda_codec *codec)
3193 struct alc_spec *spec = codec->spec;
3195 if (spec->kctls.list) {
3196 struct snd_kcontrol_new *kctl = spec->kctls.list;
3198 for (i = 0; i < spec->kctls.used; i++)
3199 kfree(kctl[i].name);
3201 snd_array_free(&spec->kctls);
3204 static void alc_free(struct hda_codec *codec)
3206 struct alc_spec *spec = codec->spec;
3211 alc_free_kctls(codec);
3213 snd_hda_detach_beep_device(codec);
3216 #ifdef SND_HDA_NEEDS_RESUME
3217 static void store_pin_configs(struct hda_codec *codec)
3219 struct alc_spec *spec = codec->spec;
3220 hda_nid_t nid, end_nid;
3222 end_nid = codec->start_nid + codec->num_nodes;
3223 for (nid = codec->start_nid; nid < end_nid; nid++) {
3224 unsigned int wid_caps = get_wcaps(codec, nid);
3225 unsigned int wid_type =
3226 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3227 if (wid_type != AC_WID_PIN)
3229 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3231 spec->pin_nids[spec->num_pins] = nid;
3232 spec->pin_cfgs[spec->num_pins] =
3233 snd_hda_codec_read(codec, nid, 0,
3234 AC_VERB_GET_CONFIG_DEFAULT, 0);
3239 static void resume_pin_configs(struct hda_codec *codec)
3241 struct alc_spec *spec = codec->spec;
3244 for (i = 0; i < spec->num_pins; i++) {
3245 hda_nid_t pin_nid = spec->pin_nids[i];
3246 unsigned int pin_config = spec->pin_cfgs[i];
3247 snd_hda_codec_write(codec, pin_nid, 0,
3248 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3249 pin_config & 0x000000ff);
3250 snd_hda_codec_write(codec, pin_nid, 0,
3251 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3252 (pin_config & 0x0000ff00) >> 8);
3253 snd_hda_codec_write(codec, pin_nid, 0,
3254 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3255 (pin_config & 0x00ff0000) >> 16);
3256 snd_hda_codec_write(codec, pin_nid, 0,
3257 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3262 static int alc_resume(struct hda_codec *codec)
3264 resume_pin_configs(codec);
3265 codec->patch_ops.init(codec);
3266 snd_hda_codec_resume_amp(codec);
3267 snd_hda_codec_resume_cache(codec);
3271 #define store_pin_configs(codec)
3276 static struct hda_codec_ops alc_patch_ops = {
3277 .build_controls = alc_build_controls,
3278 .build_pcms = alc_build_pcms,
3281 .unsol_event = alc_unsol_event,
3282 #ifdef SND_HDA_NEEDS_RESUME
3283 .resume = alc_resume,
3285 #ifdef CONFIG_SND_HDA_POWER_SAVE
3286 .check_power_status = alc_check_power_status,
3292 * Test configuration for debugging
3294 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3297 #ifdef CONFIG_SND_DEBUG
3298 static hda_nid_t alc880_test_dac_nids[4] = {
3299 0x02, 0x03, 0x04, 0x05
3302 static struct hda_input_mux alc880_test_capture_source = {
3311 { "Surround", 0x6 },
3315 static struct hda_channel_mode alc880_test_modes[4] = {
3322 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3323 struct snd_ctl_elem_info *uinfo)
3325 static char *texts[] = {
3326 "N/A", "Line Out", "HP Out",
3327 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3329 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3331 uinfo->value.enumerated.items = 8;
3332 if (uinfo->value.enumerated.item >= 8)
3333 uinfo->value.enumerated.item = 7;
3334 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3338 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3339 struct snd_ctl_elem_value *ucontrol)
3341 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3342 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3343 unsigned int pin_ctl, item = 0;
3345 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3346 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3347 if (pin_ctl & AC_PINCTL_OUT_EN) {
3348 if (pin_ctl & AC_PINCTL_HP_EN)
3352 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3353 switch (pin_ctl & AC_PINCTL_VREFEN) {
3354 case AC_PINCTL_VREF_HIZ: item = 3; break;
3355 case AC_PINCTL_VREF_50: item = 4; break;
3356 case AC_PINCTL_VREF_GRD: item = 5; break;
3357 case AC_PINCTL_VREF_80: item = 6; break;
3358 case AC_PINCTL_VREF_100: item = 7; break;
3361 ucontrol->value.enumerated.item[0] = item;
3365 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3366 struct snd_ctl_elem_value *ucontrol)
3368 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3369 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3370 static unsigned int ctls[] = {
3371 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3372 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3373 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3374 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3375 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3376 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3378 unsigned int old_ctl, new_ctl;
3380 old_ctl = snd_hda_codec_read(codec, nid, 0,
3381 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3382 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3383 if (old_ctl != new_ctl) {
3385 snd_hda_codec_write_cache(codec, nid, 0,
3386 AC_VERB_SET_PIN_WIDGET_CONTROL,
3388 val = ucontrol->value.enumerated.item[0] >= 3 ?
3390 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3397 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3398 struct snd_ctl_elem_info *uinfo)
3400 static char *texts[] = {
3401 "Front", "Surround", "CLFE", "Side"
3403 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3405 uinfo->value.enumerated.items = 4;
3406 if (uinfo->value.enumerated.item >= 4)
3407 uinfo->value.enumerated.item = 3;
3408 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3412 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3413 struct snd_ctl_elem_value *ucontrol)
3415 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3416 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3419 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3420 ucontrol->value.enumerated.item[0] = sel & 3;
3424 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3425 struct snd_ctl_elem_value *ucontrol)
3427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3428 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3431 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3432 if (ucontrol->value.enumerated.item[0] != sel) {
3433 sel = ucontrol->value.enumerated.item[0] & 3;
3434 snd_hda_codec_write_cache(codec, nid, 0,
3435 AC_VERB_SET_CONNECT_SEL, sel);
3441 #define PIN_CTL_TEST(xname,nid) { \
3442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3444 .info = alc_test_pin_ctl_info, \
3445 .get = alc_test_pin_ctl_get, \
3446 .put = alc_test_pin_ctl_put, \
3447 .private_value = nid \
3450 #define PIN_SRC_TEST(xname,nid) { \
3451 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3453 .info = alc_test_pin_src_info, \
3454 .get = alc_test_pin_src_get, \
3455 .put = alc_test_pin_src_put, \
3456 .private_value = nid \
3459 static struct snd_kcontrol_new alc880_test_mixer[] = {
3460 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3461 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3462 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3463 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3464 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3465 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3466 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3467 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3468 PIN_CTL_TEST("Front Pin Mode", 0x14),
3469 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3470 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3471 PIN_CTL_TEST("Side Pin Mode", 0x17),
3472 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3473 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3474 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3475 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3476 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3477 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3478 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3479 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3480 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3481 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3482 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3483 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3484 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3485 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3486 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3487 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3488 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3489 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3491 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3492 .name = "Channel Mode",
3493 .info = alc_ch_mode_info,
3494 .get = alc_ch_mode_get,
3495 .put = alc_ch_mode_put,
3500 static struct hda_verb alc880_test_init_verbs[] = {
3501 /* Unmute inputs of 0x0c - 0x0f */
3502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3508 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3509 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3510 /* Vol output for 0x0c-0x0f */
3511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3515 /* Set output pins 0x14-0x17 */
3516 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3518 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3519 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3520 /* Unmute output pins 0x14-0x17 */
3521 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3522 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3523 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3524 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3525 /* Set input pins 0x18-0x1c */
3526 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3528 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3530 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3531 /* Mute input pins 0x18-0x1b */
3532 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3533 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3535 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3537 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3538 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3539 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3540 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3542 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3543 /* Analog input/passthru */
3544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3556 static const char *alc880_models[ALC880_MODEL_LAST] = {
3557 [ALC880_3ST] = "3stack",
3558 [ALC880_TCL_S700] = "tcl",
3559 [ALC880_3ST_DIG] = "3stack-digout",
3560 [ALC880_CLEVO] = "clevo",
3561 [ALC880_5ST] = "5stack",
3562 [ALC880_5ST_DIG] = "5stack-digout",
3563 [ALC880_W810] = "w810",
3564 [ALC880_Z71V] = "z71v",
3565 [ALC880_6ST] = "6stack",
3566 [ALC880_6ST_DIG] = "6stack-digout",
3567 [ALC880_ASUS] = "asus",
3568 [ALC880_ASUS_W1V] = "asus-w1v",
3569 [ALC880_ASUS_DIG] = "asus-dig",
3570 [ALC880_ASUS_DIG2] = "asus-dig2",
3571 [ALC880_UNIWILL_DIG] = "uniwill",
3572 [ALC880_UNIWILL_P53] = "uniwill-p53",
3573 [ALC880_FUJITSU] = "fujitsu",
3574 [ALC880_F1734] = "F1734",
3576 [ALC880_LG_LW] = "lg-lw",
3577 [ALC880_MEDION_RIM] = "medion",
3578 #ifdef CONFIG_SND_DEBUG
3579 [ALC880_TEST] = "test",
3581 [ALC880_AUTO] = "auto",
3584 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3585 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3586 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3587 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3588 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3589 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3590 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3591 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3592 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3593 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3594 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3595 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3596 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3597 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3598 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3599 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3600 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3601 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3602 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3603 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3604 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3605 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3606 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3607 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3608 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3609 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3610 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3611 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3612 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3613 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3614 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3615 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3616 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3617 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3618 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3619 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3620 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3621 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3622 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3623 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3624 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3625 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3626 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3627 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3628 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3629 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3630 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3631 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3632 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3633 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3634 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3635 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3636 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3637 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3638 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3639 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3640 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3641 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3642 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3643 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3644 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3645 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3646 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3647 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3648 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3649 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3650 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3651 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3652 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3654 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3655 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3656 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3661 * ALC880 codec presets
3663 static struct alc_config_preset alc880_presets[] = {
3665 .mixers = { alc880_three_stack_mixer },
3666 .init_verbs = { alc880_volume_init_verbs,
3667 alc880_pin_3stack_init_verbs },
3668 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3669 .dac_nids = alc880_dac_nids,
3670 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3671 .channel_mode = alc880_threestack_modes,
3673 .input_mux = &alc880_capture_source,
3675 [ALC880_3ST_DIG] = {
3676 .mixers = { alc880_three_stack_mixer },
3677 .init_verbs = { alc880_volume_init_verbs,
3678 alc880_pin_3stack_init_verbs },
3679 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3680 .dac_nids = alc880_dac_nids,
3681 .dig_out_nid = ALC880_DIGOUT_NID,
3682 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3683 .channel_mode = alc880_threestack_modes,
3685 .input_mux = &alc880_capture_source,
3687 [ALC880_TCL_S700] = {
3688 .mixers = { alc880_tcl_s700_mixer },
3689 .init_verbs = { alc880_volume_init_verbs,
3690 alc880_pin_tcl_S700_init_verbs,
3691 alc880_gpio2_init_verbs },
3692 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3693 .dac_nids = alc880_dac_nids,
3694 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3695 .num_adc_nids = 1, /* single ADC */
3697 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3698 .channel_mode = alc880_2_jack_modes,
3699 .input_mux = &alc880_capture_source,
3702 .mixers = { alc880_three_stack_mixer,
3703 alc880_five_stack_mixer},
3704 .init_verbs = { alc880_volume_init_verbs,
3705 alc880_pin_5stack_init_verbs },
3706 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3707 .dac_nids = alc880_dac_nids,
3708 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3709 .channel_mode = alc880_fivestack_modes,
3710 .input_mux = &alc880_capture_source,
3712 [ALC880_5ST_DIG] = {
3713 .mixers = { alc880_three_stack_mixer,
3714 alc880_five_stack_mixer },
3715 .init_verbs = { alc880_volume_init_verbs,
3716 alc880_pin_5stack_init_verbs },
3717 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3718 .dac_nids = alc880_dac_nids,
3719 .dig_out_nid = ALC880_DIGOUT_NID,
3720 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3721 .channel_mode = alc880_fivestack_modes,
3722 .input_mux = &alc880_capture_source,
3725 .mixers = { alc880_six_stack_mixer },
3726 .init_verbs = { alc880_volume_init_verbs,
3727 alc880_pin_6stack_init_verbs },
3728 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3729 .dac_nids = alc880_6st_dac_nids,
3730 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3731 .channel_mode = alc880_sixstack_modes,
3732 .input_mux = &alc880_6stack_capture_source,
3734 [ALC880_6ST_DIG] = {
3735 .mixers = { alc880_six_stack_mixer },
3736 .init_verbs = { alc880_volume_init_verbs,
3737 alc880_pin_6stack_init_verbs },
3738 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3739 .dac_nids = alc880_6st_dac_nids,
3740 .dig_out_nid = ALC880_DIGOUT_NID,
3741 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3742 .channel_mode = alc880_sixstack_modes,
3743 .input_mux = &alc880_6stack_capture_source,
3746 .mixers = { alc880_w810_base_mixer },
3747 .init_verbs = { alc880_volume_init_verbs,
3748 alc880_pin_w810_init_verbs,
3749 alc880_gpio2_init_verbs },
3750 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3751 .dac_nids = alc880_w810_dac_nids,
3752 .dig_out_nid = ALC880_DIGOUT_NID,
3753 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3754 .channel_mode = alc880_w810_modes,
3755 .input_mux = &alc880_capture_source,
3758 .mixers = { alc880_z71v_mixer },
3759 .init_verbs = { alc880_volume_init_verbs,
3760 alc880_pin_z71v_init_verbs },
3761 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3762 .dac_nids = alc880_z71v_dac_nids,
3763 .dig_out_nid = ALC880_DIGOUT_NID,
3765 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3766 .channel_mode = alc880_2_jack_modes,
3767 .input_mux = &alc880_capture_source,
3770 .mixers = { alc880_f1734_mixer },
3771 .init_verbs = { alc880_volume_init_verbs,
3772 alc880_pin_f1734_init_verbs },
3773 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3774 .dac_nids = alc880_f1734_dac_nids,
3776 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3777 .channel_mode = alc880_2_jack_modes,
3778 .input_mux = &alc880_f1734_capture_source,
3779 .unsol_event = alc880_uniwill_p53_unsol_event,
3780 .init_hook = alc880_uniwill_p53_hp_automute,
3783 .mixers = { alc880_asus_mixer },
3784 .init_verbs = { alc880_volume_init_verbs,
3785 alc880_pin_asus_init_verbs,
3786 alc880_gpio1_init_verbs },
3787 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3788 .dac_nids = alc880_asus_dac_nids,
3789 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3790 .channel_mode = alc880_asus_modes,
3792 .input_mux = &alc880_capture_source,
3794 [ALC880_ASUS_DIG] = {
3795 .mixers = { alc880_asus_mixer },
3796 .init_verbs = { alc880_volume_init_verbs,
3797 alc880_pin_asus_init_verbs,
3798 alc880_gpio1_init_verbs },
3799 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3800 .dac_nids = alc880_asus_dac_nids,
3801 .dig_out_nid = ALC880_DIGOUT_NID,
3802 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3803 .channel_mode = alc880_asus_modes,
3805 .input_mux = &alc880_capture_source,
3807 [ALC880_ASUS_DIG2] = {
3808 .mixers = { alc880_asus_mixer },
3809 .init_verbs = { alc880_volume_init_verbs,
3810 alc880_pin_asus_init_verbs,
3811 alc880_gpio2_init_verbs }, /* use GPIO2 */
3812 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3813 .dac_nids = alc880_asus_dac_nids,
3814 .dig_out_nid = ALC880_DIGOUT_NID,
3815 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3816 .channel_mode = alc880_asus_modes,
3818 .input_mux = &alc880_capture_source,
3820 [ALC880_ASUS_W1V] = {
3821 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3822 .init_verbs = { alc880_volume_init_verbs,
3823 alc880_pin_asus_init_verbs,
3824 alc880_gpio1_init_verbs },
3825 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3826 .dac_nids = alc880_asus_dac_nids,
3827 .dig_out_nid = ALC880_DIGOUT_NID,
3828 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3829 .channel_mode = alc880_asus_modes,
3831 .input_mux = &alc880_capture_source,
3833 [ALC880_UNIWILL_DIG] = {
3834 .mixers = { alc880_asus_mixer },
3835 .init_verbs = { alc880_volume_init_verbs,
3836 alc880_pin_asus_init_verbs },
3837 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3838 .dac_nids = alc880_asus_dac_nids,
3839 .dig_out_nid = ALC880_DIGOUT_NID,
3840 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3841 .channel_mode = alc880_asus_modes,
3843 .input_mux = &alc880_capture_source,
3845 [ALC880_UNIWILL] = {
3846 .mixers = { alc880_uniwill_mixer },
3847 .init_verbs = { alc880_volume_init_verbs,
3848 alc880_uniwill_init_verbs },
3849 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3850 .dac_nids = alc880_asus_dac_nids,
3851 .dig_out_nid = ALC880_DIGOUT_NID,
3852 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3853 .channel_mode = alc880_threestack_modes,
3855 .input_mux = &alc880_capture_source,
3856 .unsol_event = alc880_uniwill_unsol_event,
3857 .init_hook = alc880_uniwill_automute,
3859 [ALC880_UNIWILL_P53] = {
3860 .mixers = { alc880_uniwill_p53_mixer },
3861 .init_verbs = { alc880_volume_init_verbs,
3862 alc880_uniwill_p53_init_verbs },
3863 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3864 .dac_nids = alc880_asus_dac_nids,
3865 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3866 .channel_mode = alc880_threestack_modes,
3867 .input_mux = &alc880_capture_source,
3868 .unsol_event = alc880_uniwill_p53_unsol_event,
3869 .init_hook = alc880_uniwill_p53_hp_automute,
3871 [ALC880_FUJITSU] = {
3872 .mixers = { alc880_fujitsu_mixer },
3873 .init_verbs = { alc880_volume_init_verbs,
3874 alc880_uniwill_p53_init_verbs,
3875 alc880_beep_init_verbs },
3876 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3877 .dac_nids = alc880_dac_nids,
3878 .dig_out_nid = ALC880_DIGOUT_NID,
3879 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3880 .channel_mode = alc880_2_jack_modes,
3881 .input_mux = &alc880_capture_source,
3882 .unsol_event = alc880_uniwill_p53_unsol_event,
3883 .init_hook = alc880_uniwill_p53_hp_automute,
3886 .mixers = { alc880_three_stack_mixer },
3887 .init_verbs = { alc880_volume_init_verbs,
3888 alc880_pin_clevo_init_verbs },
3889 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3890 .dac_nids = alc880_dac_nids,
3892 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3893 .channel_mode = alc880_threestack_modes,
3895 .input_mux = &alc880_capture_source,
3898 .mixers = { alc880_lg_mixer },
3899 .init_verbs = { alc880_volume_init_verbs,
3900 alc880_lg_init_verbs },
3901 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3902 .dac_nids = alc880_lg_dac_nids,
3903 .dig_out_nid = ALC880_DIGOUT_NID,
3904 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3905 .channel_mode = alc880_lg_ch_modes,
3907 .input_mux = &alc880_lg_capture_source,
3908 .unsol_event = alc880_lg_unsol_event,
3909 .init_hook = alc880_lg_automute,
3910 #ifdef CONFIG_SND_HDA_POWER_SAVE
3911 .loopbacks = alc880_lg_loopbacks,
3915 .mixers = { alc880_lg_lw_mixer },
3916 .init_verbs = { alc880_volume_init_verbs,
3917 alc880_lg_lw_init_verbs },
3918 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3919 .dac_nids = alc880_dac_nids,
3920 .dig_out_nid = ALC880_DIGOUT_NID,
3921 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3922 .channel_mode = alc880_lg_lw_modes,
3923 .input_mux = &alc880_lg_lw_capture_source,
3924 .unsol_event = alc880_lg_lw_unsol_event,
3925 .init_hook = alc880_lg_lw_automute,
3927 [ALC880_MEDION_RIM] = {
3928 .mixers = { alc880_medion_rim_mixer },
3929 .init_verbs = { alc880_volume_init_verbs,
3930 alc880_medion_rim_init_verbs,
3931 alc_gpio2_init_verbs },
3932 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3933 .dac_nids = alc880_dac_nids,
3934 .dig_out_nid = ALC880_DIGOUT_NID,
3935 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3936 .channel_mode = alc880_2_jack_modes,
3937 .input_mux = &alc880_medion_rim_capture_source,
3938 .unsol_event = alc880_medion_rim_unsol_event,
3939 .init_hook = alc880_medion_rim_automute,
3941 #ifdef CONFIG_SND_DEBUG
3943 .mixers = { alc880_test_mixer },
3944 .init_verbs = { alc880_test_init_verbs },
3945 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3946 .dac_nids = alc880_test_dac_nids,
3947 .dig_out_nid = ALC880_DIGOUT_NID,
3948 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3949 .channel_mode = alc880_test_modes,
3950 .input_mux = &alc880_test_capture_source,
3956 * Automatic parse of I/O pins from the BIOS configuration
3961 ALC_CTL_WIDGET_MUTE,
3964 static struct snd_kcontrol_new alc880_control_templates[] = {
3965 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3966 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3967 HDA_BIND_MUTE(NULL, 0, 0, 0),
3970 /* add dynamic controls */
3971 static int add_control(struct alc_spec *spec, int type, const char *name,
3974 struct snd_kcontrol_new *knew;
3976 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3977 knew = snd_array_new(&spec->kctls);
3980 *knew = alc880_control_templates[type];
3981 knew->name = kstrdup(name, GFP_KERNEL);
3984 knew->private_value = val;
3988 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3989 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3990 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3991 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3992 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3993 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3994 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3995 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3996 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3997 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3998 #define ALC880_PIN_CD_NID 0x1c
4000 /* fill in the dac_nids table from the parsed pin configuration */
4001 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4002 const struct auto_pin_cfg *cfg)
4008 memset(assigned, 0, sizeof(assigned));
4009 spec->multiout.dac_nids = spec->private_dac_nids;
4011 /* check the pins hardwired to 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)) {
4015 int idx = alc880_fixed_pin_idx(nid);
4016 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4020 /* left pins can be connect to any audio widget */
4021 for (i = 0; i < cfg->line_outs; i++) {
4022 nid = cfg->line_out_pins[i];
4023 if (alc880_is_fixed_pin(nid))
4025 /* search for an empty channel */
4026 for (j = 0; j < cfg->line_outs; j++) {
4028 spec->multiout.dac_nids[i] =
4029 alc880_idx_to_dac(j);
4035 spec->multiout.num_dacs = cfg->line_outs;
4039 /* add playback controls from the parsed DAC table */
4040 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4041 const struct auto_pin_cfg *cfg)
4044 static const char *chname[4] = {
4045 "Front", "Surround", NULL /*CLFE*/, "Side"
4050 for (i = 0; i < cfg->line_outs; i++) {
4051 if (!spec->multiout.dac_nids[i])
4053 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4056 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4057 "Center Playback Volume",
4058 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4062 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4063 "LFE Playback Volume",
4064 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4068 err = add_control(spec, ALC_CTL_BIND_MUTE,
4069 "Center Playback Switch",
4070 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4074 err = add_control(spec, ALC_CTL_BIND_MUTE,
4075 "LFE Playback Switch",
4076 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4081 sprintf(name, "%s Playback Volume", chname[i]);
4082 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4083 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4087 sprintf(name, "%s Playback Switch", chname[i]);
4088 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4089 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4098 /* add playback controls for speaker and HP outputs */
4099 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4109 if (alc880_is_fixed_pin(pin)) {
4110 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4111 /* specify the DAC as the extra output */
4112 if (!spec->multiout.hp_nid)
4113 spec->multiout.hp_nid = nid;
4115 spec->multiout.extra_out_nid[0] = nid;
4116 /* control HP volume/switch on the output mixer amp */
4117 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4118 sprintf(name, "%s Playback Volume", pfx);
4119 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4120 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4123 sprintf(name, "%s Playback Switch", pfx);
4124 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4125 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4128 } else if (alc880_is_multi_pin(pin)) {
4129 /* set manual connection */
4130 /* we have only a switch on HP-out PIN */
4131 sprintf(name, "%s Playback Switch", pfx);
4132 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4133 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4140 /* create input playback/capture controls for the given pin */
4141 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4142 const char *ctlname,
4143 int idx, hda_nid_t mix_nid)
4148 sprintf(name, "%s Playback Volume", ctlname);
4149 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4150 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4153 sprintf(name, "%s Playback Switch", ctlname);
4154 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4155 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4161 /* create playback/capture controls for input pins */
4162 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4163 const struct auto_pin_cfg *cfg)
4165 struct hda_input_mux *imux = &spec->private_imux[0];
4168 for (i = 0; i < AUTO_PIN_LAST; i++) {
4169 if (alc880_is_input_pin(cfg->input_pins[i])) {
4170 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4171 err = new_analog_input(spec, cfg->input_pins[i],
4172 auto_pin_cfg_labels[i],
4176 imux->items[imux->num_items].label =
4177 auto_pin_cfg_labels[i];
4178 imux->items[imux->num_items].index =
4179 alc880_input_pin_idx(cfg->input_pins[i]);
4186 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4187 unsigned int pin_type)
4189 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4192 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4196 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4197 hda_nid_t nid, int pin_type,
4200 alc_set_pin_output(codec, nid, pin_type);
4201 /* need the manual connection? */
4202 if (alc880_is_multi_pin(nid)) {
4203 struct alc_spec *spec = codec->spec;
4204 int idx = alc880_multi_pin_idx(nid);
4205 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4206 AC_VERB_SET_CONNECT_SEL,
4207 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4211 static int get_pin_type(int line_out_type)
4213 if (line_out_type == AUTO_PIN_HP_OUT)
4219 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4221 struct alc_spec *spec = codec->spec;
4224 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4225 for (i = 0; i < spec->autocfg.line_outs; i++) {
4226 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4227 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4228 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4232 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4234 struct alc_spec *spec = codec->spec;
4237 pin = spec->autocfg.speaker_pins[0];
4238 if (pin) /* connect to front */
4239 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4240 pin = spec->autocfg.hp_pins[0];
4241 if (pin) /* connect to front */
4242 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4245 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4247 struct alc_spec *spec = codec->spec;
4250 for (i = 0; i < AUTO_PIN_LAST; i++) {
4251 hda_nid_t nid = spec->autocfg.input_pins[i];
4252 if (alc880_is_input_pin(nid)) {
4253 snd_hda_codec_write(codec, nid, 0,
4254 AC_VERB_SET_PIN_WIDGET_CONTROL,
4255 i <= AUTO_PIN_FRONT_MIC ?
4256 PIN_VREF80 : PIN_IN);
4257 if (nid != ALC880_PIN_CD_NID)
4258 snd_hda_codec_write(codec, nid, 0,
4259 AC_VERB_SET_AMP_GAIN_MUTE,
4265 /* parse the BIOS configuration and set up the alc_spec */
4266 /* return 1 if successful, 0 if the proper config is not found,
4267 * or a negative error code
4269 static int alc880_parse_auto_config(struct hda_codec *codec)
4271 struct alc_spec *spec = codec->spec;
4273 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4275 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4279 if (!spec->autocfg.line_outs)
4280 return 0; /* can't find valid BIOS pin config */
4282 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4285 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4288 err = alc880_auto_create_extra_out(spec,
4289 spec->autocfg.speaker_pins[0],
4293 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4297 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4301 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4303 if (spec->autocfg.dig_outs)
4304 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4305 if (spec->autocfg.dig_in_pin)
4306 spec->dig_in_nid = ALC880_DIGIN_NID;
4308 if (spec->kctls.list)
4309 add_mixer(spec, spec->kctls.list);
4311 add_verb(spec, alc880_volume_init_verbs);
4313 spec->num_mux_defs = 1;
4314 spec->input_mux = &spec->private_imux[0];
4316 store_pin_configs(codec);
4320 /* additional initialization for auto-configuration model */
4321 static void alc880_auto_init(struct hda_codec *codec)
4323 struct alc_spec *spec = codec->spec;
4324 alc880_auto_init_multi_out(codec);
4325 alc880_auto_init_extra_out(codec);
4326 alc880_auto_init_analog_input(codec);
4327 if (spec->unsol_event)
4328 alc_inithook(codec);
4331 static void set_capture_mixer(struct alc_spec *spec)
4333 static struct snd_kcontrol_new *caps[3] = {
4338 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4339 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4342 #define set_beep_amp(spec, nid, idx, dir) \
4343 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4346 * OK, here we have finally the patch for ALC880
4349 static int patch_alc880(struct hda_codec *codec)
4351 struct alc_spec *spec;
4355 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4361 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4364 if (board_config < 0) {
4365 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4366 "trying auto-probe from BIOS...\n");
4367 board_config = ALC880_AUTO;
4370 if (board_config == ALC880_AUTO) {
4371 /* automatic parse from the BIOS config */
4372 err = alc880_parse_auto_config(codec);
4378 "hda_codec: Cannot set up configuration "
4379 "from BIOS. Using 3-stack mode...\n");
4380 board_config = ALC880_3ST;
4384 err = snd_hda_attach_beep_device(codec, 0x1);
4390 if (board_config != ALC880_AUTO)
4391 setup_preset(spec, &alc880_presets[board_config]);
4393 spec->stream_name_analog = "ALC880 Analog";
4394 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4395 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4396 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4398 spec->stream_name_digital = "ALC880 Digital";
4399 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4400 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4402 if (!spec->adc_nids && spec->input_mux) {
4403 /* check whether NID 0x07 is valid */
4404 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4406 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4407 if (wcap != AC_WID_AUD_IN) {
4408 spec->adc_nids = alc880_adc_nids_alt;
4409 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4411 spec->adc_nids = alc880_adc_nids;
4412 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4415 set_capture_mixer(spec);
4416 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4418 spec->vmaster_nid = 0x0c;
4420 codec->patch_ops = alc_patch_ops;
4421 if (board_config == ALC880_AUTO)
4422 spec->init_hook = alc880_auto_init;
4423 #ifdef CONFIG_SND_HDA_POWER_SAVE
4424 if (!spec->loopback.amplist)
4425 spec->loopback.amplist = alc880_loopbacks;
4427 codec->proc_widget_hook = print_realtek_coef;
4437 static hda_nid_t alc260_dac_nids[1] = {
4442 static hda_nid_t alc260_adc_nids[1] = {
4447 static hda_nid_t alc260_adc_nids_alt[1] = {
4452 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4453 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4455 static hda_nid_t alc260_dual_adc_nids[2] = {
4460 #define ALC260_DIGOUT_NID 0x03
4461 #define ALC260_DIGIN_NID 0x06
4463 static struct hda_input_mux alc260_capture_source = {
4467 { "Front Mic", 0x1 },
4473 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4474 * headphone jack and the internal CD lines since these are the only pins at
4475 * which audio can appear. For flexibility, also allow the option of
4476 * recording the mixer output on the second ADC (ADC0 doesn't have a
4477 * connection to the mixer output).
4479 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4483 { "Mic/Line", 0x0 },
4485 { "Headphone", 0x2 },
4491 { "Mic/Line", 0x0 },
4493 { "Headphone", 0x2 },
4500 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4501 * the Fujitsu S702x, but jacks are marked differently.
4503 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4510 { "Headphone", 0x5 },
4519 { "Headphone", 0x6 },
4525 * This is just place-holder, so there's something for alc_build_pcms to look
4526 * at when it calculates the maximum number of channels. ALC260 has no mixer
4527 * element which allows changing the channel mode, so the verb list is
4530 static struct hda_channel_mode alc260_modes[1] = {
4535 /* Mixer combinations
4537 * basic: base_output + input + pc_beep + capture
4538 * HP: base_output + input + capture_alt
4539 * HP_3013: hp_3013 + input + capture
4540 * fujitsu: fujitsu + capture
4541 * acer: acer + capture
4544 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4545 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4546 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4547 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4548 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4549 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4550 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4554 static struct snd_kcontrol_new alc260_input_mixer[] = {
4555 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4556 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4557 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4558 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4560 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4561 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4562 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4566 /* update HP, line and mono out pins according to the master switch */
4567 static void alc260_hp_master_update(struct hda_codec *codec,
4568 hda_nid_t hp, hda_nid_t line,
4571 struct alc_spec *spec = codec->spec;
4572 unsigned int val = spec->master_sw ? PIN_HP : 0;
4573 /* change HP and line-out pins */
4574 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4576 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4578 /* mono (speaker) depending on the HP jack sense */
4579 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4580 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4584 static int alc260_hp_master_sw_get(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 *ucontrol->value.integer.value = spec->master_sw;
4593 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4594 struct snd_ctl_elem_value *ucontrol)
4596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4597 struct alc_spec *spec = codec->spec;
4598 int val = !!*ucontrol->value.integer.value;
4599 hda_nid_t hp, line, mono;
4601 if (val == spec->master_sw)
4603 spec->master_sw = val;
4604 hp = (kcontrol->private_value >> 16) & 0xff;
4605 line = (kcontrol->private_value >> 8) & 0xff;
4606 mono = kcontrol->private_value & 0xff;
4607 alc260_hp_master_update(codec, hp, line, mono);
4611 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4613 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4614 .name = "Master Playback Switch",
4615 .info = snd_ctl_boolean_mono_info,
4616 .get = alc260_hp_master_sw_get,
4617 .put = alc260_hp_master_sw_put,
4618 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4620 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4621 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4622 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4623 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4624 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4626 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4630 static struct hda_verb alc260_hp_unsol_verbs[] = {
4631 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4635 static void alc260_hp_automute(struct hda_codec *codec)
4637 struct alc_spec *spec = codec->spec;
4638 unsigned int present;
4640 present = snd_hda_codec_read(codec, 0x10, 0,
4641 AC_VERB_GET_PIN_SENSE, 0);
4642 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4643 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4646 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4648 if ((res >> 26) == ALC880_HP_EVENT)
4649 alc260_hp_automute(codec);
4652 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4654 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4655 .name = "Master Playback Switch",
4656 .info = snd_ctl_boolean_mono_info,
4657 .get = alc260_hp_master_sw_get,
4658 .put = alc260_hp_master_sw_put,
4659 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4661 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4662 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4663 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4664 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4665 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4666 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4667 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4668 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4672 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4673 .ops = &snd_hda_bind_vol,
4675 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4676 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4677 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4682 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4683 .ops = &snd_hda_bind_sw,
4685 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4686 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4691 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4692 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4693 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4694 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4695 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4699 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4700 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4704 static void alc260_hp_3013_automute(struct hda_codec *codec)
4706 struct alc_spec *spec = codec->spec;
4707 unsigned int present;
4709 present = snd_hda_codec_read(codec, 0x15, 0,
4710 AC_VERB_GET_PIN_SENSE, 0);
4711 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4712 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4715 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4718 if ((res >> 26) == ALC880_HP_EVENT)
4719 alc260_hp_3013_automute(codec);
4722 static void alc260_hp_3012_automute(struct hda_codec *codec)
4724 unsigned int present, bits;
4726 present = snd_hda_codec_read(codec, 0x10, 0,
4727 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4729 bits = present ? 0 : PIN_OUT;
4730 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4732 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4734 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4738 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4741 if ((res >> 26) == ALC880_HP_EVENT)
4742 alc260_hp_3012_automute(codec);
4745 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4746 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4748 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4749 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4750 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4751 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4752 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4753 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4754 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4755 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4756 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4757 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4758 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4762 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4763 * versions of the ALC260 don't act on requests to enable mic bias from NID
4764 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4765 * datasheet doesn't mention this restriction. At this stage it's not clear
4766 * whether this behaviour is intentional or is a hardware bug in chip
4767 * revisions available in early 2006. Therefore for now allow the
4768 * "Headphone Jack Mode" control to span all choices, but if it turns out
4769 * that the lack of mic bias for this NID is intentional we could change the
4770 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4772 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4773 * don't appear to make the mic bias available from the "line" jack, even
4774 * though the NID used for this jack (0x14) can supply it. The theory is
4775 * that perhaps Acer have included blocking capacitors between the ALC260
4776 * and the output jack. If this turns out to be the case for all such
4777 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4778 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4780 * The C20x Tablet series have a mono internal speaker which is controlled
4781 * via the chip's Mono sum widget and pin complex, so include the necessary
4782 * controls for such models. On models without a "mono speaker" the control
4783 * won't do anything.
4785 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4786 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4787 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4788 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4789 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4791 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4793 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4794 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4796 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4797 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4798 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4799 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4800 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4804 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4805 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4807 static struct snd_kcontrol_new alc260_will_mixer[] = {
4808 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4809 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4811 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4812 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4813 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4814 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4815 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4816 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4817 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4821 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4822 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4824 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4825 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4826 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4828 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4829 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4830 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4831 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4832 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4833 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4834 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4839 * initialization verbs
4841 static struct hda_verb alc260_init_verbs[] = {
4842 /* Line In pin widget for input */
4843 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4844 /* CD pin widget for input */
4845 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4846 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4847 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4848 /* Mic2 (front panel) pin widget for input and vref at 80% */
4849 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4850 /* LINE-2 is used for line-out in rear */
4851 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4852 /* select line-out */
4853 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4855 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4857 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4859 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4860 /* mute capture amp left and right */
4861 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4862 /* set connection select to line in (default select for this ADC) */
4863 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4864 /* mute capture amp left and right */
4865 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4866 /* set connection select to line in (default select for this ADC) */
4867 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4868 /* set vol=0 Line-Out mixer amp left and right */
4869 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4870 /* unmute pin widget amp left and right (no gain on this amp) */
4871 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4872 /* set vol=0 HP mixer amp left and right */
4873 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4874 /* unmute pin widget amp left and right (no gain on this amp) */
4875 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4876 /* set vol=0 Mono mixer amp left and right */
4877 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4878 /* unmute pin widget amp left and right (no gain on this amp) */
4879 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4880 /* unmute LINE-2 out pin */
4881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4882 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4885 /* mute analog inputs */
4886 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4888 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4890 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4891 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4892 /* mute Front out path */
4893 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4894 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4895 /* mute Headphone out path */
4896 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4897 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4898 /* mute Mono out path */
4899 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4900 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4904 #if 0 /* should be identical with alc260_init_verbs? */
4905 static struct hda_verb alc260_hp_init_verbs[] = {
4906 /* Headphone and output */
4907 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4909 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4910 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4911 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4912 /* Mic2 (front panel) pin widget for input and vref at 80% */
4913 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4914 /* Line In pin widget for input */
4915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4916 /* Line-2 pin widget for output */
4917 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4918 /* CD pin widget for input */
4919 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4920 /* unmute amp left and right */
4921 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4922 /* set connection select to line in (default select for this ADC) */
4923 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4924 /* unmute Line-Out mixer amp left and right (volume = 0) */
4925 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4926 /* mute pin widget amp left and right (no gain on this amp) */
4927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4928 /* unmute HP mixer amp left and right (volume = 0) */
4929 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4930 /* mute pin widget amp left and right (no gain on this amp) */
4931 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4932 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4935 /* mute analog inputs */
4936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4941 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4942 /* Unmute Front out path */
4943 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4944 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4945 /* Unmute Headphone out path */
4946 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4947 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4948 /* Unmute Mono out path */
4949 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4950 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4955 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4956 /* Line out and output */
4957 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4959 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4960 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4961 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4962 /* Mic2 (front panel) pin widget for input and vref at 80% */
4963 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4964 /* Line In pin widget for input */
4965 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4966 /* Headphone pin widget for output */
4967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4968 /* CD pin widget for input */
4969 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4970 /* unmute amp left and right */
4971 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4972 /* set connection select to line in (default select for this ADC) */
4973 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4974 /* unmute Line-Out mixer amp left and right (volume = 0) */
4975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4976 /* mute pin widget amp left and right (no gain on this amp) */
4977 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4978 /* unmute HP mixer amp left and right (volume = 0) */
4979 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4980 /* mute pin widget amp left and right (no gain on this amp) */
4981 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4982 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4985 /* mute analog inputs */
4986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4990 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4991 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4992 /* Unmute Front out path */
4993 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4994 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4995 /* Unmute Headphone out path */
4996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4997 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4998 /* Unmute Mono out path */
4999 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5000 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5004 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5005 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5006 * audio = 0x16, internal speaker = 0x10.
5008 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5009 /* Disable all GPIOs */
5010 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5011 /* Internal speaker is connected to headphone pin */
5012 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5013 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5014 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5015 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5016 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5017 /* Ensure all other unused pins are disabled and muted. */
5018 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5019 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5020 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5021 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5022 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5023 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5024 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5025 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5027 /* Disable digital (SPDIF) pins */
5028 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5029 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5031 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5032 * when acting as an output.
5034 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5036 /* Start with output sum widgets muted and their output gains at min */
5037 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5038 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5040 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5041 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5043 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5044 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5045 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5047 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5048 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5049 /* Unmute Line1 pin widget output buffer since it starts as an output.
5050 * If the pin mode is changed by the user the pin mode control will
5051 * take care of enabling the pin's input/output buffers as needed.
5052 * Therefore there's no need to enable the input buffer at this
5055 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5056 /* Unmute input buffer of pin widget used for Line-in (no equiv
5059 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5061 /* Mute capture amp left and right */
5062 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5063 /* Set ADC connection select to match default mixer setting - line
5066 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5068 /* Do the same for the second ADC: mute capture input amp and
5069 * set ADC connection to line in (on mic1 pin)
5071 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5072 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5074 /* Mute all inputs to mixer widget (even unconnected ones) */
5075 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5077 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5078 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5079 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5087 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5088 * similar laptops (adapted from Fujitsu init verbs).
5090 static struct hda_verb alc260_acer_init_verbs[] = {
5091 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5092 * the headphone jack. Turn this on and rely on the standard mute
5093 * methods whenever the user wants to turn these outputs off.
5095 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5096 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5097 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5098 /* Internal speaker/Headphone jack is connected to Line-out pin */
5099 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5100 /* Internal microphone/Mic jack is connected to Mic1 pin */
5101 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5102 /* Line In jack is connected to Line1 pin */
5103 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5104 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5105 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5106 /* Ensure all other unused pins are disabled and muted. */
5107 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5108 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5109 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5110 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5111 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5113 /* Disable digital (SPDIF) pins */
5114 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5115 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5117 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5118 * bus when acting as outputs.
5120 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5121 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5123 /* Start with output sum widgets muted and their output gains at min */
5124 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5125 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5126 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5127 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5128 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5129 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5130 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5131 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5132 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5134 /* Unmute Line-out pin widget amp left and right
5135 * (no equiv mixer ctrl)
5137 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5138 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5139 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5140 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5141 * inputs. If the pin mode is changed by the user the pin mode control
5142 * will take care of enabling the pin's input/output buffers as needed.
5143 * Therefore there's no need to enable the input buffer at this
5146 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5147 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5149 /* Mute capture amp left and right */
5150 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5151 /* Set ADC connection select to match default mixer setting - mic
5154 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5156 /* Do similar with the second ADC: mute capture input amp and
5157 * set ADC connection to mic to match ALSA's default state.
5159 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5160 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5162 /* Mute all inputs to mixer widget (even unconnected ones) */
5163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5164 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5168 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5175 static struct hda_verb alc260_will_verbs[] = {
5176 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5177 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5178 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5179 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5180 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5181 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5185 static struct hda_verb alc260_replacer_672v_verbs[] = {
5186 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5187 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5188 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5190 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5191 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5192 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5194 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5198 /* toggle speaker-output according to the hp-jack state */
5199 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5201 unsigned int present;
5203 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5204 present = snd_hda_codec_read(codec, 0x0f, 0,
5205 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5207 snd_hda_codec_write_cache(codec, 0x01, 0,
5208 AC_VERB_SET_GPIO_DATA, 1);
5209 snd_hda_codec_write_cache(codec, 0x0f, 0,
5210 AC_VERB_SET_PIN_WIDGET_CONTROL,
5213 snd_hda_codec_write_cache(codec, 0x01, 0,
5214 AC_VERB_SET_GPIO_DATA, 0);
5215 snd_hda_codec_write_cache(codec, 0x0f, 0,
5216 AC_VERB_SET_PIN_WIDGET_CONTROL,
5221 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5224 if ((res >> 26) == ALC880_HP_EVENT)
5225 alc260_replacer_672v_automute(codec);
5228 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5229 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5230 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5231 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5232 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5233 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5234 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5235 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5236 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5237 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5238 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5242 /* Test configuration for debugging, modelled after the ALC880 test
5245 #ifdef CONFIG_SND_DEBUG
5246 static hda_nid_t alc260_test_dac_nids[1] = {
5249 static hda_nid_t alc260_test_adc_nids[2] = {
5252 /* For testing the ALC260, each input MUX needs its own definition since
5253 * the signal assignments are different. This assumes that the first ADC
5256 static struct hda_input_mux alc260_test_capture_sources[2] = {
5260 { "MIC1 pin", 0x0 },
5261 { "MIC2 pin", 0x1 },
5262 { "LINE1 pin", 0x2 },
5263 { "LINE2 pin", 0x3 },
5265 { "LINE-OUT pin", 0x5 },
5266 { "HP-OUT pin", 0x6 },
5272 { "MIC1 pin", 0x0 },
5273 { "MIC2 pin", 0x1 },
5274 { "LINE1 pin", 0x2 },
5275 { "LINE2 pin", 0x3 },
5278 { "LINE-OUT pin", 0x6 },
5279 { "HP-OUT pin", 0x7 },
5283 static struct snd_kcontrol_new alc260_test_mixer[] = {
5284 /* Output driver widgets */
5285 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5286 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5287 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5288 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5289 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5290 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5292 /* Modes for retasking pin widgets
5293 * Note: the ALC260 doesn't seem to act on requests to enable mic
5294 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5295 * mention this restriction. At this stage it's not clear whether
5296 * this behaviour is intentional or is a hardware bug in chip
5297 * revisions available at least up until early 2006. Therefore for
5298 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5299 * choices, but if it turns out that the lack of mic bias for these
5300 * NIDs is intentional we could change their modes from
5301 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5303 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5304 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5305 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5306 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5307 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5308 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5310 /* Loopback mixer controls */
5311 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5312 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5313 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5314 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5315 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5316 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5317 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5318 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5319 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5320 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5321 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5322 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5323 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5324 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5326 /* Controls for GPIO pins, assuming they are configured as outputs */
5327 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5328 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5329 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5330 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5332 /* Switches to allow the digital IO pins to be enabled. The datasheet
5333 * is ambigious as to which NID is which; testing on laptops which
5334 * make this output available should provide clarification.
5336 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5337 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5339 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5340 * this output to turn on an external amplifier.
5342 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5343 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5347 static struct hda_verb alc260_test_init_verbs[] = {
5348 /* Enable all GPIOs as outputs with an initial value of 0 */
5349 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5350 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5351 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5353 /* Enable retasking pins as output, initially without power amp */
5354 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5355 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5358 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5359 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5361 /* Disable digital (SPDIF) pins initially, but users can enable
5362 * them via a mixer switch. In the case of SPDIF-out, this initverb
5363 * payload also sets the generation to 0, output to be in "consumer"
5364 * PCM format, copyright asserted, no pre-emphasis and no validity
5367 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5368 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5370 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5371 * OUT1 sum bus when acting as an output.
5373 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5374 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5375 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5376 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5378 /* Start with output sum widgets muted and their output gains at min */
5379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5380 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5383 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5385 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5386 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5387 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5389 /* Unmute retasking pin widget output buffers since the default
5390 * state appears to be output. As the pin mode is changed by the
5391 * user the pin mode control will take care of enabling the pin's
5392 * input/output buffers as needed.
5394 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5395 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5397 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5398 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5399 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5400 /* Also unmute the mono-out pin widget */
5401 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5403 /* Mute capture amp left and right */
5404 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5405 /* Set ADC connection select to match default mixer setting (mic1
5408 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5410 /* Do the same for the second ADC: mute capture input amp and
5411 * set ADC connection to mic1 pin
5413 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5414 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5416 /* Mute all inputs to mixer widget (even unconnected ones) */
5417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5423 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5430 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5431 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5433 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5434 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5437 * for BIOS auto-configuration
5440 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5441 const char *pfx, int *vol_bits)
5444 unsigned long vol_val, sw_val;
5448 if (nid >= 0x0f && nid < 0x11) {
5449 nid_vol = nid - 0x7;
5450 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5451 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5452 } else if (nid == 0x11) {
5453 nid_vol = nid - 0x7;
5454 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5455 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5456 } else if (nid >= 0x12 && nid <= 0x15) {
5458 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5459 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5463 if (!(*vol_bits & (1 << nid_vol))) {
5464 /* first control for the volume widget */
5465 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5466 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5469 *vol_bits |= (1 << nid_vol);
5471 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5472 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5478 /* add playback controls from the parsed DAC table */
5479 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5480 const struct auto_pin_cfg *cfg)
5486 spec->multiout.num_dacs = 1;
5487 spec->multiout.dac_nids = spec->private_dac_nids;
5488 spec->multiout.dac_nids[0] = 0x02;
5490 nid = cfg->line_out_pins[0];
5492 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5497 nid = cfg->speaker_pins[0];
5499 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5504 nid = cfg->hp_pins[0];
5506 err = alc260_add_playback_controls(spec, nid, "Headphone",
5514 /* create playback/capture controls for input pins */
5515 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5516 const struct auto_pin_cfg *cfg)
5518 struct hda_input_mux *imux = &spec->private_imux[0];
5521 for (i = 0; i < AUTO_PIN_LAST; i++) {
5522 if (cfg->input_pins[i] >= 0x12) {
5523 idx = cfg->input_pins[i] - 0x12;
5524 err = new_analog_input(spec, cfg->input_pins[i],
5525 auto_pin_cfg_labels[i], idx,
5529 imux->items[imux->num_items].label =
5530 auto_pin_cfg_labels[i];
5531 imux->items[imux->num_items].index = idx;
5534 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5535 idx = cfg->input_pins[i] - 0x09;
5536 err = new_analog_input(spec, cfg->input_pins[i],
5537 auto_pin_cfg_labels[i], idx,
5541 imux->items[imux->num_items].label =
5542 auto_pin_cfg_labels[i];
5543 imux->items[imux->num_items].index = idx;
5550 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5551 hda_nid_t nid, int pin_type,
5554 alc_set_pin_output(codec, nid, pin_type);
5555 /* need the manual connection? */
5557 int idx = nid - 0x12;
5558 snd_hda_codec_write(codec, idx + 0x0b, 0,
5559 AC_VERB_SET_CONNECT_SEL, sel_idx);
5563 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5565 struct alc_spec *spec = codec->spec;
5568 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5569 nid = spec->autocfg.line_out_pins[0];
5571 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5572 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5575 nid = spec->autocfg.speaker_pins[0];
5577 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5579 nid = spec->autocfg.hp_pins[0];
5581 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5584 #define ALC260_PIN_CD_NID 0x16
5585 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5587 struct alc_spec *spec = codec->spec;
5590 for (i = 0; i < AUTO_PIN_LAST; i++) {
5591 hda_nid_t nid = spec->autocfg.input_pins[i];
5593 snd_hda_codec_write(codec, nid, 0,
5594 AC_VERB_SET_PIN_WIDGET_CONTROL,
5595 i <= AUTO_PIN_FRONT_MIC ?
5596 PIN_VREF80 : PIN_IN);
5597 if (nid != ALC260_PIN_CD_NID)
5598 snd_hda_codec_write(codec, nid, 0,
5599 AC_VERB_SET_AMP_GAIN_MUTE,
5606 * generic initialization of ADC, input mixers and output mixers
5608 static struct hda_verb alc260_volume_init_verbs[] = {
5610 * Unmute ADC0-1 and set the default input to mic-in
5612 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5613 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5614 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5615 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5617 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5619 * Note: PASD motherboards uses the Line In 2 as the input for
5620 * front panel mic (mic 2)
5622 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5623 /* mute analog inputs */
5624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5626 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5627 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5631 * Set up output mixers (0x08 - 0x0a)
5633 /* set vol=0 to output mixers */
5634 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5635 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5636 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5637 /* set up input amps for analog loopback */
5638 /* Amp Indices: DAC = 0, mixer = 1 */
5639 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5640 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5641 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5642 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5643 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5644 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5649 static int alc260_parse_auto_config(struct hda_codec *codec)
5651 struct alc_spec *spec = codec->spec;
5653 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5655 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5659 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5662 if (!spec->kctls.list)
5663 return 0; /* can't find valid BIOS pin config */
5664 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5668 spec->multiout.max_channels = 2;
5670 if (spec->autocfg.dig_outs)
5671 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5672 if (spec->kctls.list)
5673 add_mixer(spec, spec->kctls.list);
5675 add_verb(spec, alc260_volume_init_verbs);
5677 spec->num_mux_defs = 1;
5678 spec->input_mux = &spec->private_imux[0];
5680 store_pin_configs(codec);
5684 /* additional initialization for auto-configuration model */
5685 static void alc260_auto_init(struct hda_codec *codec)
5687 struct alc_spec *spec = codec->spec;
5688 alc260_auto_init_multi_out(codec);
5689 alc260_auto_init_analog_input(codec);
5690 if (spec->unsol_event)
5691 alc_inithook(codec);
5694 #ifdef CONFIG_SND_HDA_POWER_SAVE
5695 static struct hda_amp_list alc260_loopbacks[] = {
5696 { 0x07, HDA_INPUT, 0 },
5697 { 0x07, HDA_INPUT, 1 },
5698 { 0x07, HDA_INPUT, 2 },
5699 { 0x07, HDA_INPUT, 3 },
5700 { 0x07, HDA_INPUT, 4 },
5706 * ALC260 configurations
5708 static const char *alc260_models[ALC260_MODEL_LAST] = {
5709 [ALC260_BASIC] = "basic",
5711 [ALC260_HP_3013] = "hp-3013",
5712 [ALC260_HP_DC7600] = "hp-dc7600",
5713 [ALC260_FUJITSU_S702X] = "fujitsu",
5714 [ALC260_ACER] = "acer",
5715 [ALC260_WILL] = "will",
5716 [ALC260_REPLACER_672V] = "replacer",
5717 #ifdef CONFIG_SND_DEBUG
5718 [ALC260_TEST] = "test",
5720 [ALC260_AUTO] = "auto",
5723 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5724 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5725 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5726 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5727 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5728 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5729 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5730 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5731 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5732 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5733 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5734 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5735 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5736 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5737 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5738 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5739 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5740 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5741 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5745 static struct alc_config_preset alc260_presets[] = {
5747 .mixers = { alc260_base_output_mixer,
5748 alc260_input_mixer },
5749 .init_verbs = { alc260_init_verbs },
5750 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5751 .dac_nids = alc260_dac_nids,
5752 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5753 .adc_nids = alc260_adc_nids,
5754 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5755 .channel_mode = alc260_modes,
5756 .input_mux = &alc260_capture_source,
5759 .mixers = { alc260_hp_output_mixer,
5760 alc260_input_mixer },
5761 .init_verbs = { alc260_init_verbs,
5762 alc260_hp_unsol_verbs },
5763 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5764 .dac_nids = alc260_dac_nids,
5765 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5766 .adc_nids = alc260_adc_nids_alt,
5767 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5768 .channel_mode = alc260_modes,
5769 .input_mux = &alc260_capture_source,
5770 .unsol_event = alc260_hp_unsol_event,
5771 .init_hook = alc260_hp_automute,
5773 [ALC260_HP_DC7600] = {
5774 .mixers = { alc260_hp_dc7600_mixer,
5775 alc260_input_mixer },
5776 .init_verbs = { alc260_init_verbs,
5777 alc260_hp_dc7600_verbs },
5778 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5779 .dac_nids = alc260_dac_nids,
5780 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5781 .adc_nids = alc260_adc_nids_alt,
5782 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5783 .channel_mode = alc260_modes,
5784 .input_mux = &alc260_capture_source,
5785 .unsol_event = alc260_hp_3012_unsol_event,
5786 .init_hook = alc260_hp_3012_automute,
5788 [ALC260_HP_3013] = {
5789 .mixers = { alc260_hp_3013_mixer,
5790 alc260_input_mixer },
5791 .init_verbs = { alc260_hp_3013_init_verbs,
5792 alc260_hp_3013_unsol_verbs },
5793 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5794 .dac_nids = alc260_dac_nids,
5795 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5796 .adc_nids = alc260_adc_nids_alt,
5797 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5798 .channel_mode = alc260_modes,
5799 .input_mux = &alc260_capture_source,
5800 .unsol_event = alc260_hp_3013_unsol_event,
5801 .init_hook = alc260_hp_3013_automute,
5803 [ALC260_FUJITSU_S702X] = {
5804 .mixers = { alc260_fujitsu_mixer },
5805 .init_verbs = { alc260_fujitsu_init_verbs },
5806 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5807 .dac_nids = alc260_dac_nids,
5808 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5809 .adc_nids = alc260_dual_adc_nids,
5810 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5811 .channel_mode = alc260_modes,
5812 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5813 .input_mux = alc260_fujitsu_capture_sources,
5816 .mixers = { alc260_acer_mixer },
5817 .init_verbs = { alc260_acer_init_verbs },
5818 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5819 .dac_nids = alc260_dac_nids,
5820 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5821 .adc_nids = alc260_dual_adc_nids,
5822 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5823 .channel_mode = alc260_modes,
5824 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5825 .input_mux = alc260_acer_capture_sources,
5828 .mixers = { alc260_will_mixer },
5829 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5830 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5831 .dac_nids = alc260_dac_nids,
5832 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5833 .adc_nids = alc260_adc_nids,
5834 .dig_out_nid = ALC260_DIGOUT_NID,
5835 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5836 .channel_mode = alc260_modes,
5837 .input_mux = &alc260_capture_source,
5839 [ALC260_REPLACER_672V] = {
5840 .mixers = { alc260_replacer_672v_mixer },
5841 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5842 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5843 .dac_nids = alc260_dac_nids,
5844 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5845 .adc_nids = alc260_adc_nids,
5846 .dig_out_nid = ALC260_DIGOUT_NID,
5847 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5848 .channel_mode = alc260_modes,
5849 .input_mux = &alc260_capture_source,
5850 .unsol_event = alc260_replacer_672v_unsol_event,
5851 .init_hook = alc260_replacer_672v_automute,
5853 #ifdef CONFIG_SND_DEBUG
5855 .mixers = { alc260_test_mixer },
5856 .init_verbs = { alc260_test_init_verbs },
5857 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5858 .dac_nids = alc260_test_dac_nids,
5859 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5860 .adc_nids = alc260_test_adc_nids,
5861 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5862 .channel_mode = alc260_modes,
5863 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5864 .input_mux = alc260_test_capture_sources,
5869 static int patch_alc260(struct hda_codec *codec)
5871 struct alc_spec *spec;
5872 int err, board_config;
5874 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5880 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5883 if (board_config < 0) {
5884 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5885 "trying auto-probe from BIOS...\n");
5886 board_config = ALC260_AUTO;
5889 if (board_config == ALC260_AUTO) {
5890 /* automatic parse from the BIOS config */
5891 err = alc260_parse_auto_config(codec);
5897 "hda_codec: Cannot set up configuration "
5898 "from BIOS. Using base mode...\n");
5899 board_config = ALC260_BASIC;
5903 err = snd_hda_attach_beep_device(codec, 0x1);
5909 if (board_config != ALC260_AUTO)
5910 setup_preset(spec, &alc260_presets[board_config]);
5912 spec->stream_name_analog = "ALC260 Analog";
5913 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5914 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5916 spec->stream_name_digital = "ALC260 Digital";
5917 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5918 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5920 if (!spec->adc_nids && spec->input_mux) {
5921 /* check whether NID 0x04 is valid */
5922 unsigned int wcap = get_wcaps(codec, 0x04);
5923 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5925 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5926 spec->adc_nids = alc260_adc_nids_alt;
5927 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5929 spec->adc_nids = alc260_adc_nids;
5930 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5933 set_capture_mixer(spec);
5934 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
5936 spec->vmaster_nid = 0x08;
5938 codec->patch_ops = alc_patch_ops;
5939 if (board_config == ALC260_AUTO)
5940 spec->init_hook = alc260_auto_init;
5941 #ifdef CONFIG_SND_HDA_POWER_SAVE
5942 if (!spec->loopback.amplist)
5943 spec->loopback.amplist = alc260_loopbacks;
5945 codec->proc_widget_hook = print_realtek_coef;
5954 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5955 * configuration. Each pin widget can choose any input DACs and a mixer.
5956 * Each ADC is connected from a mixer of all inputs. This makes possible
5957 * 6-channel independent captures.
5959 * In addition, an independent DAC for the multi-playback (not used in this
5962 #define ALC882_DIGOUT_NID 0x06
5963 #define ALC882_DIGIN_NID 0x0a
5965 static struct hda_channel_mode alc882_ch_modes[1] = {
5969 static hda_nid_t alc882_dac_nids[4] = {
5970 /* front, rear, clfe, rear_surr */
5971 0x02, 0x03, 0x04, 0x05
5974 /* identical with ALC880 */
5975 #define alc882_adc_nids alc880_adc_nids
5976 #define alc882_adc_nids_alt alc880_adc_nids_alt
5978 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5979 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5982 /* FIXME: should be a matrix-type input source selection */
5984 static struct hda_input_mux alc882_capture_source = {
5988 { "Front Mic", 0x1 },
5996 static struct hda_verb alc882_3ST_ch2_init[] = {
5997 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5998 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5999 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6000 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6007 static struct hda_verb alc882_3ST_ch6_init[] = {
6008 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6009 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6010 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6011 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6012 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6013 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6017 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6018 { 2, alc882_3ST_ch2_init },
6019 { 6, alc882_3ST_ch6_init },
6025 static struct hda_verb alc882_sixstack_ch6_init[] = {
6026 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6027 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6028 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6029 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6036 static struct hda_verb alc882_sixstack_ch8_init[] = {
6037 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6038 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6039 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6040 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6044 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6045 { 6, alc882_sixstack_ch6_init },
6046 { 8, alc882_sixstack_ch8_init },
6050 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6056 static struct hda_verb alc885_mbp_ch2_init[] = {
6057 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6058 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6059 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6066 static struct hda_verb alc885_mbp_ch6_init[] = {
6067 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6068 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6069 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6070 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6071 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6075 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6076 { 2, alc885_mbp_ch2_init },
6077 { 6, alc885_mbp_ch6_init },
6081 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6082 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6084 static struct snd_kcontrol_new alc882_base_mixer[] = {
6085 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6086 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6087 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6088 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6089 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6090 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6091 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6092 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6093 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6094 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6095 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6096 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6097 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6098 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6099 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6100 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6101 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6103 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6104 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6105 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6109 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6110 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6111 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6112 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6113 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6115 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6117 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6118 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6122 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6124 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6130 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6135 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6136 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6137 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6139 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6140 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6141 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6142 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6148 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6152 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6153 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6155 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6156 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6157 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6159 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6160 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6161 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6164 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6165 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6172 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6173 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6174 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6186 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6188 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6189 .name = "Channel Mode",
6190 .info = alc_ch_mode_info,
6191 .get = alc_ch_mode_get,
6192 .put = alc_ch_mode_put,
6197 static struct hda_verb alc882_init_verbs[] = {
6198 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6203 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6205 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6208 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6209 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6211 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6212 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6213 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6215 /* Front Pin: output 0 (0x0c) */
6216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6217 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6218 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6219 /* Rear Pin: output 1 (0x0d) */
6220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6222 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6223 /* CLFE Pin: output 2 (0x0e) */
6224 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6225 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6226 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6227 /* Side Pin: output 3 (0x0f) */
6228 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6229 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6230 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6231 /* Mic (rear) pin: input vref at 80% */
6232 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6233 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6234 /* Front Mic pin: input vref at 80% */
6235 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6236 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6237 /* Line In pin: input */
6238 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6239 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6240 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6241 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6242 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6243 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6244 /* CD pin widget for input */
6245 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6247 /* FIXME: use matrix-type input source selection */
6248 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6249 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6250 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6251 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6252 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6253 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6255 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6256 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6257 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6264 /* ADC1: mute amp left and right */
6265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6266 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6267 /* ADC2: mute amp left and right */
6268 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6269 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6270 /* ADC3: mute amp left and right */
6271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6272 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6277 static struct hda_verb alc882_eapd_verbs[] = {
6278 /* change to EAPD mode */
6279 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6280 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6285 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6286 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6287 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6288 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6289 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6290 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6291 /* FIXME: this looks suspicious...
6292 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6293 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6298 static struct hda_verb alc882_macpro_init_verbs[] = {
6299 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6303 /* Front Pin: output 0 (0x0c) */
6304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6306 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6307 /* Front Mic pin: input vref at 80% */
6308 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6309 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6310 /* Speaker: output */
6311 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6312 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6313 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6314 /* Headphone output (output 0 - 0x0c) */
6315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6316 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6317 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6319 /* FIXME: use matrix-type input source selection */
6320 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6321 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6322 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6336 /* ADC1: mute amp left and right */
6337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6338 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6339 /* ADC2: mute amp left and right */
6340 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6341 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6342 /* ADC3: mute amp left and right */
6343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6344 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6349 /* Macbook Pro rev3 */
6350 static struct hda_verb alc885_mbp3_init_verbs[] = {
6351 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6357 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6358 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6359 /* Front Pin: output 0 (0x0c) */
6360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6361 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6362 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6363 /* HP Pin: output 0 (0x0d) */
6364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6365 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6366 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6367 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6368 /* Mic (rear) pin: input vref at 80% */
6369 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6370 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6371 /* Front Mic pin: input vref at 80% */
6372 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6373 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6374 /* Line In pin: use output 1 when in LineOut mode */
6375 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6377 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6379 /* FIXME: use matrix-type input source selection */
6380 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6381 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6382 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6387 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6388 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6392 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6396 /* ADC1: mute amp left and right */
6397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6398 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6399 /* ADC2: mute amp left and right */
6400 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6401 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6402 /* ADC3: mute amp left and right */
6403 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6404 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6409 /* iMac 24 mixer. */
6410 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6411 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6412 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6416 /* iMac 24 init verbs. */
6417 static struct hda_verb alc885_imac24_init_verbs[] = {
6418 /* Internal speakers: output 0 (0x0c) */
6419 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6420 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6421 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6422 /* Internal speakers: output 0 (0x0c) */
6423 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6424 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6425 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6426 /* Headphone: output 0 (0x0c) */
6427 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6428 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6429 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6430 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6431 /* Front Mic: input vref at 80% */
6432 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6433 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6437 /* Toggle speaker-output according to the hp-jack state */
6438 static void alc885_imac24_automute(struct hda_codec *codec)
6440 unsigned int present;
6442 present = snd_hda_codec_read(codec, 0x14, 0,
6443 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6444 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6445 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6446 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6447 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6450 /* Processes unsolicited events. */
6451 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6454 /* Headphone insertion or removal. */
6455 if ((res >> 26) == ALC880_HP_EVENT)
6456 alc885_imac24_automute(codec);
6459 static void alc885_mbp3_automute(struct hda_codec *codec)
6461 unsigned int present;
6463 present = snd_hda_codec_read(codec, 0x15, 0,
6464 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6465 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6466 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6467 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6468 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6471 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6474 /* Headphone insertion or removal. */
6475 if ((res >> 26) == ALC880_HP_EVENT)
6476 alc885_mbp3_automute(codec);
6480 static struct hda_verb alc882_targa_verbs[] = {
6481 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6482 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6485 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6487 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6488 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6489 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6491 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6492 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6493 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6494 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6498 /* toggle speaker-output according to the hp-jack state */
6499 static void alc882_targa_automute(struct hda_codec *codec)
6501 unsigned int present;
6503 present = snd_hda_codec_read(codec, 0x14, 0,
6504 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6505 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6506 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6507 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6511 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6513 /* Looks like the unsol event is incompatible with the standard
6514 * definition. 4bit tag is placed at 26 bit!
6516 if (((res >> 26) == ALC880_HP_EVENT)) {
6517 alc882_targa_automute(codec);
6521 static struct hda_verb alc882_asus_a7j_verbs[] = {
6522 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6529 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6530 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6531 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6533 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6534 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6535 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6539 static struct hda_verb alc882_asus_a7m_verbs[] = {
6540 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6544 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6545 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6547 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6548 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6549 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6551 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6552 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6553 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6557 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6559 unsigned int gpiostate, gpiomask, gpiodir;
6561 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6562 AC_VERB_GET_GPIO_DATA, 0);
6565 gpiostate |= (1 << pin);
6567 gpiostate &= ~(1 << pin);
6569 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6570 AC_VERB_GET_GPIO_MASK, 0);
6571 gpiomask |= (1 << pin);
6573 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6574 AC_VERB_GET_GPIO_DIRECTION, 0);
6575 gpiodir |= (1 << pin);
6578 snd_hda_codec_write(codec, codec->afg, 0,
6579 AC_VERB_SET_GPIO_MASK, gpiomask);
6580 snd_hda_codec_write(codec, codec->afg, 0,
6581 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6585 snd_hda_codec_write(codec, codec->afg, 0,
6586 AC_VERB_SET_GPIO_DATA, gpiostate);
6589 /* set up GPIO at initialization */
6590 static void alc885_macpro_init_hook(struct hda_codec *codec)
6592 alc882_gpio_mute(codec, 0, 0);
6593 alc882_gpio_mute(codec, 1, 0);
6596 /* set up GPIO and update auto-muting at initialization */
6597 static void alc885_imac24_init_hook(struct hda_codec *codec)
6599 alc885_macpro_init_hook(codec);
6600 alc885_imac24_automute(codec);
6604 * generic initialization of ADC, input mixers and output mixers
6606 static struct hda_verb alc882_auto_init_verbs[] = {
6608 * Unmute ADC0-2 and set the default input to mic-in
6610 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6612 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6613 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6614 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6615 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6617 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6619 * Note: PASD motherboards uses the Line In 2 as the input for
6620 * front panel mic (mic 2)
6622 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6630 * Set up output mixers (0x0c - 0x0f)
6632 /* set vol=0 to output mixers */
6633 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6634 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6635 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6636 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6637 /* set up input amps for analog loopback */
6638 /* Amp Indices: DAC = 0, mixer = 1 */
6639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6641 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6643 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6645 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6647 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6648 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6650 /* FIXME: use matrix-type input source selection */
6651 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6652 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6653 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6658 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6659 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6663 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6671 #ifdef CONFIG_SND_HDA_POWER_SAVE
6672 #define alc882_loopbacks alc880_loopbacks
6675 /* pcm configuration: identiacal with ALC880 */
6676 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6677 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6678 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6679 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6682 * configuration and preset
6684 static const char *alc882_models[ALC882_MODEL_LAST] = {
6685 [ALC882_3ST_DIG] = "3stack-dig",
6686 [ALC882_6ST_DIG] = "6stack-dig",
6687 [ALC882_ARIMA] = "arima",
6688 [ALC882_W2JC] = "w2jc",
6689 [ALC882_TARGA] = "targa",
6690 [ALC882_ASUS_A7J] = "asus-a7j",
6691 [ALC882_ASUS_A7M] = "asus-a7m",
6692 [ALC885_MACPRO] = "macpro",
6693 [ALC885_MBP3] = "mbp3",
6694 [ALC885_IMAC24] = "imac24",
6695 [ALC882_AUTO] = "auto",
6698 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6699 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6700 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6701 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6702 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6703 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6704 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6705 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6706 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6707 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6708 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6709 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6710 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6714 static struct alc_config_preset alc882_presets[] = {
6715 [ALC882_3ST_DIG] = {
6716 .mixers = { alc882_base_mixer },
6717 .init_verbs = { alc882_init_verbs },
6718 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6719 .dac_nids = alc882_dac_nids,
6720 .dig_out_nid = ALC882_DIGOUT_NID,
6721 .dig_in_nid = ALC882_DIGIN_NID,
6722 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6723 .channel_mode = alc882_ch_modes,
6725 .input_mux = &alc882_capture_source,
6727 [ALC882_6ST_DIG] = {
6728 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6729 .init_verbs = { alc882_init_verbs },
6730 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6731 .dac_nids = alc882_dac_nids,
6732 .dig_out_nid = ALC882_DIGOUT_NID,
6733 .dig_in_nid = ALC882_DIGIN_NID,
6734 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6735 .channel_mode = alc882_sixstack_modes,
6736 .input_mux = &alc882_capture_source,
6739 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6740 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6741 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6742 .dac_nids = alc882_dac_nids,
6743 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6744 .channel_mode = alc882_sixstack_modes,
6745 .input_mux = &alc882_capture_source,
6748 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6749 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6750 alc880_gpio1_init_verbs },
6751 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6752 .dac_nids = alc882_dac_nids,
6753 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6754 .channel_mode = alc880_threestack_modes,
6756 .input_mux = &alc882_capture_source,
6757 .dig_out_nid = ALC882_DIGOUT_NID,
6760 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6761 .init_verbs = { alc885_mbp3_init_verbs,
6762 alc880_gpio1_init_verbs },
6763 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6764 .dac_nids = alc882_dac_nids,
6765 .channel_mode = alc885_mbp_6ch_modes,
6766 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6767 .input_mux = &alc882_capture_source,
6768 .dig_out_nid = ALC882_DIGOUT_NID,
6769 .dig_in_nid = ALC882_DIGIN_NID,
6770 .unsol_event = alc885_mbp3_unsol_event,
6771 .init_hook = alc885_mbp3_automute,
6774 .mixers = { alc882_macpro_mixer },
6775 .init_verbs = { alc882_macpro_init_verbs },
6776 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6777 .dac_nids = alc882_dac_nids,
6778 .dig_out_nid = ALC882_DIGOUT_NID,
6779 .dig_in_nid = ALC882_DIGIN_NID,
6780 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6781 .channel_mode = alc882_ch_modes,
6782 .input_mux = &alc882_capture_source,
6783 .init_hook = alc885_macpro_init_hook,
6786 .mixers = { alc885_imac24_mixer },
6787 .init_verbs = { alc885_imac24_init_verbs },
6788 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6789 .dac_nids = alc882_dac_nids,
6790 .dig_out_nid = ALC882_DIGOUT_NID,
6791 .dig_in_nid = ALC882_DIGIN_NID,
6792 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6793 .channel_mode = alc882_ch_modes,
6794 .input_mux = &alc882_capture_source,
6795 .unsol_event = alc885_imac24_unsol_event,
6796 .init_hook = alc885_imac24_init_hook,
6799 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6800 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6801 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6802 .dac_nids = alc882_dac_nids,
6803 .dig_out_nid = ALC882_DIGOUT_NID,
6804 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6805 .adc_nids = alc882_adc_nids,
6806 .capsrc_nids = alc882_capsrc_nids,
6807 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6808 .channel_mode = alc882_3ST_6ch_modes,
6810 .input_mux = &alc882_capture_source,
6811 .unsol_event = alc882_targa_unsol_event,
6812 .init_hook = alc882_targa_automute,
6814 [ALC882_ASUS_A7J] = {
6815 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6816 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6817 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6818 .dac_nids = alc882_dac_nids,
6819 .dig_out_nid = ALC882_DIGOUT_NID,
6820 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6821 .adc_nids = alc882_adc_nids,
6822 .capsrc_nids = alc882_capsrc_nids,
6823 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6824 .channel_mode = alc882_3ST_6ch_modes,
6826 .input_mux = &alc882_capture_source,
6828 [ALC882_ASUS_A7M] = {
6829 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6830 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6831 alc880_gpio1_init_verbs,
6832 alc882_asus_a7m_verbs },
6833 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6834 .dac_nids = alc882_dac_nids,
6835 .dig_out_nid = ALC882_DIGOUT_NID,
6836 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6837 .channel_mode = alc880_threestack_modes,
6839 .input_mux = &alc882_capture_source,
6848 PINFIX_ABIT_AW9D_MAX
6851 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6852 { 0x15, 0x01080104 }, /* side */
6853 { 0x16, 0x01011012 }, /* rear */
6854 { 0x17, 0x01016011 }, /* clfe */
6858 static const struct alc_pincfg *alc882_pin_fixes[] = {
6859 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6862 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6863 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6868 * BIOS auto configuration
6870 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6871 hda_nid_t nid, int pin_type,
6875 struct alc_spec *spec = codec->spec;
6878 alc_set_pin_output(codec, nid, pin_type);
6879 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6882 idx = spec->multiout.dac_nids[dac_idx] - 2;
6883 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6887 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6889 struct alc_spec *spec = codec->spec;
6892 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6893 for (i = 0; i <= HDA_SIDE; i++) {
6894 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6895 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6897 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6902 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6904 struct alc_spec *spec = codec->spec;
6907 pin = spec->autocfg.hp_pins[0];
6908 if (pin) /* connect to front */
6910 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6911 pin = spec->autocfg.speaker_pins[0];
6913 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6916 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6917 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6919 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6921 struct alc_spec *spec = codec->spec;
6924 for (i = 0; i < AUTO_PIN_LAST; i++) {
6925 hda_nid_t nid = spec->autocfg.input_pins[i];
6930 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6931 unsigned int pincap;
6932 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6933 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6937 snd_hda_codec_write(codec, nid, 0,
6938 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6939 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6940 snd_hda_codec_write(codec, nid, 0,
6941 AC_VERB_SET_AMP_GAIN_MUTE,
6946 static void alc882_auto_init_input_src(struct hda_codec *codec)
6948 struct alc_spec *spec = codec->spec;
6951 for (c = 0; c < spec->num_adc_nids; c++) {
6952 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6953 hda_nid_t nid = spec->capsrc_nids[c];
6954 unsigned int mux_idx;
6955 const struct hda_input_mux *imux;
6956 int conns, mute, idx, item;
6958 conns = snd_hda_get_connections(codec, nid, conn_list,
6959 ARRAY_SIZE(conn_list));
6962 mux_idx = c >= spec->num_mux_defs ? 0 : c;
6963 imux = &spec->input_mux[mux_idx];
6964 for (idx = 0; idx < conns; idx++) {
6965 /* if the current connection is the selected one,
6966 * unmute it as default - otherwise mute it
6968 mute = AMP_IN_MUTE(idx);
6969 for (item = 0; item < imux->num_items; item++) {
6970 if (imux->items[item].index == idx) {
6971 if (spec->cur_mux[c] == item)
6972 mute = AMP_IN_UNMUTE(idx);
6976 /* check if we have a selector or mixer
6977 * we could check for the widget type instead, but
6978 * just check for Amp-In presence (in case of mixer
6979 * without amp-in there is something wrong, this
6980 * function shouldn't be used or capsrc nid is wrong)
6982 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
6983 snd_hda_codec_write(codec, nid, 0,
6984 AC_VERB_SET_AMP_GAIN_MUTE,
6986 else if (mute != AMP_IN_MUTE(idx))
6987 snd_hda_codec_write(codec, nid, 0,
6988 AC_VERB_SET_CONNECT_SEL,
6994 /* add mic boosts if needed */
6995 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6997 struct alc_spec *spec = codec->spec;
7001 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7002 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7003 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7005 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7009 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7010 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7011 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7013 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7020 /* almost identical with ALC880 parser... */
7021 static int alc882_parse_auto_config(struct hda_codec *codec)
7023 struct alc_spec *spec = codec->spec;
7024 int err = alc880_parse_auto_config(codec);
7029 return 0; /* no config found */
7031 err = alc_auto_add_mic_boost(codec);
7035 /* hack - override the init verbs */
7036 spec->init_verbs[0] = alc882_auto_init_verbs;
7038 return 1; /* config found */
7041 /* additional initialization for auto-configuration model */
7042 static void alc882_auto_init(struct hda_codec *codec)
7044 struct alc_spec *spec = codec->spec;
7045 alc882_auto_init_multi_out(codec);
7046 alc882_auto_init_hp_out(codec);
7047 alc882_auto_init_analog_input(codec);
7048 alc882_auto_init_input_src(codec);
7049 if (spec->unsol_event)
7050 alc_inithook(codec);
7053 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7055 static int patch_alc882(struct hda_codec *codec)
7057 struct alc_spec *spec;
7058 int err, board_config;
7060 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7066 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7070 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7071 /* Pick up systems that don't supply PCI SSID */
7072 switch (codec->subsystem_id) {
7073 case 0x106b0c00: /* Mac Pro */
7074 board_config = ALC885_MACPRO;
7076 case 0x106b1000: /* iMac 24 */
7077 case 0x106b2800: /* AppleTV */
7078 case 0x106b3e00: /* iMac 24 Aluminium */
7079 board_config = ALC885_IMAC24;
7081 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7082 case 0x106b00a4: /* MacbookPro4,1 */
7083 case 0x106b2c00: /* Macbook Pro rev3 */
7084 case 0x106b3600: /* Macbook 3.1 */
7085 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7086 board_config = ALC885_MBP3;
7089 /* ALC889A is handled better as ALC888-compatible */
7090 if (codec->revision_id == 0x100101 ||
7091 codec->revision_id == 0x100103) {
7093 return patch_alc883(codec);
7095 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7096 "trying auto-probe from BIOS...\n");
7097 board_config = ALC882_AUTO;
7101 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7103 if (board_config == ALC882_AUTO) {
7104 /* automatic parse from the BIOS config */
7105 err = alc882_parse_auto_config(codec);
7111 "hda_codec: Cannot set up configuration "
7112 "from BIOS. Using base mode...\n");
7113 board_config = ALC882_3ST_DIG;
7117 err = snd_hda_attach_beep_device(codec, 0x1);
7123 if (board_config != ALC882_AUTO)
7124 setup_preset(spec, &alc882_presets[board_config]);
7126 if (codec->vendor_id == 0x10ec0885) {
7127 spec->stream_name_analog = "ALC885 Analog";
7128 spec->stream_name_digital = "ALC885 Digital";
7130 spec->stream_name_analog = "ALC882 Analog";
7131 spec->stream_name_digital = "ALC882 Digital";
7134 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7135 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7136 /* FIXME: setup DAC5 */
7137 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7138 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7140 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7141 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7143 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7144 if (!spec->adc_nids && spec->input_mux) {
7145 /* check whether NID 0x07 is valid */
7146 unsigned int wcap = get_wcaps(codec, 0x07);
7148 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7149 if (wcap != AC_WID_AUD_IN) {
7150 spec->adc_nids = alc882_adc_nids_alt;
7151 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7152 spec->capsrc_nids = alc882_capsrc_nids_alt;
7154 spec->adc_nids = alc882_adc_nids;
7155 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7156 spec->capsrc_nids = alc882_capsrc_nids;
7159 set_capture_mixer(spec);
7160 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7162 spec->vmaster_nid = 0x0c;
7164 codec->patch_ops = alc_patch_ops;
7165 if (board_config == ALC882_AUTO)
7166 spec->init_hook = alc882_auto_init;
7167 #ifdef CONFIG_SND_HDA_POWER_SAVE
7168 if (!spec->loopback.amplist)
7169 spec->loopback.amplist = alc882_loopbacks;
7171 codec->proc_widget_hook = print_realtek_coef;
7179 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7180 * configuration. Each pin widget can choose any input DACs and a mixer.
7181 * Each ADC is connected from a mixer of all inputs. This makes possible
7182 * 6-channel independent captures.
7184 * In addition, an independent DAC for the multi-playback (not used in this
7187 #define ALC883_DIGOUT_NID 0x06
7188 #define ALC883_DIGIN_NID 0x0a
7190 #define ALC1200_DIGOUT_NID 0x10
7192 static hda_nid_t alc883_dac_nids[4] = {
7193 /* front, rear, clfe, rear_surr */
7194 0x02, 0x03, 0x04, 0x05
7197 static hda_nid_t alc883_adc_nids[2] = {
7202 static hda_nid_t alc883_adc_nids_alt[1] = {
7207 static hda_nid_t alc883_adc_nids_rev[2] = {
7212 #define alc889_adc_nids alc880_adc_nids
7214 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7216 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7218 #define alc889_capsrc_nids alc882_capsrc_nids
7221 /* FIXME: should be a matrix-type input source selection */
7223 static struct hda_input_mux alc883_capture_source = {
7227 { "Front Mic", 0x1 },
7233 static struct hda_input_mux alc883_3stack_6ch_intel = {
7237 { "Front Mic", 0x0 },
7243 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7251 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7261 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7269 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7273 { "Front Mic", 0x1 },
7278 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7289 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7296 static struct hda_verb alc883_3ST_ch2_init[] = {
7297 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7298 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7299 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7300 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7307 static struct hda_verb alc883_3ST_ch4_init[] = {
7308 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7309 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7310 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7311 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7312 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7319 static struct hda_verb alc883_3ST_ch6_init[] = {
7320 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7321 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7322 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7323 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7324 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7325 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7329 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7330 { 2, alc883_3ST_ch2_init },
7331 { 4, alc883_3ST_ch4_init },
7332 { 6, alc883_3ST_ch6_init },
7338 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7339 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7340 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7341 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7342 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7349 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7350 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7351 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7352 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7353 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7354 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7361 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7362 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7363 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7364 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7365 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7366 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7367 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7371 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7372 { 2, alc883_3ST_ch2_intel_init },
7373 { 4, alc883_3ST_ch4_intel_init },
7374 { 6, alc883_3ST_ch6_intel_init },
7380 static struct hda_verb alc883_sixstack_ch6_init[] = {
7381 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7382 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7383 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7384 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7391 static struct hda_verb alc883_sixstack_ch8_init[] = {
7392 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7393 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7394 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7395 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7399 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7400 { 6, alc883_sixstack_ch6_init },
7401 { 8, alc883_sixstack_ch8_init },
7404 static struct hda_verb alc883_medion_eapd_verbs[] = {
7405 /* eanable EAPD on medion laptop */
7406 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7407 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7411 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7412 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7415 static struct snd_kcontrol_new alc883_base_mixer[] = {
7416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7417 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7418 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7419 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7420 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7421 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7422 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7423 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7425 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7426 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7427 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7428 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7429 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7430 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7431 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7432 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7435 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7436 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7440 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7441 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7442 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7443 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7444 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7445 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7446 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7447 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7448 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7449 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7452 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7453 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7457 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7458 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7459 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7460 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7461 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7463 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7465 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7466 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7467 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7471 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7472 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7473 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7475 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7477 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7478 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7479 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7480 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7481 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7485 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7486 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7487 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7488 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7489 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7490 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7491 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7492 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7494 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7495 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7496 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7498 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7502 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7503 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7504 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7505 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7506 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7507 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7508 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7509 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7510 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7511 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7512 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7513 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7514 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7515 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7516 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7517 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7518 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7519 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7520 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7521 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7525 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7526 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7527 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7528 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7529 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7530 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7532 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7533 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7534 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7535 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7536 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7537 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7538 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7539 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7541 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7543 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7545 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7549 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7550 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7551 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7552 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7553 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7554 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7555 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7556 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7557 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7559 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7560 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7561 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7562 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7564 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7566 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7567 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7568 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7572 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7573 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7575 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7576 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7577 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7578 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7579 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7580 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7581 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7582 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7583 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7584 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7585 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7587 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7592 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7593 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7594 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7595 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7596 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7597 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7598 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7599 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7600 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7601 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7602 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7603 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7607 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7608 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7609 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7610 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7611 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7614 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7615 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7619 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7620 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7621 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7622 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7623 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7624 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7627 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7628 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7632 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7633 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7635 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7636 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7637 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7640 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7645 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7646 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7647 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7649 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7650 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7651 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7653 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7657 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7658 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7659 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7660 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7661 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7662 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7663 0x0d, 1, 0x0, HDA_OUTPUT),
7664 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7665 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7666 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7667 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7668 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7670 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7671 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7672 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7673 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7674 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7675 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7676 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7677 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7678 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7679 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7680 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7684 static struct hda_bind_ctls alc883_bind_cap_vol = {
7685 .ops = &snd_hda_bind_vol,
7687 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7688 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7693 static struct hda_bind_ctls alc883_bind_cap_switch = {
7694 .ops = &snd_hda_bind_sw,
7696 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7697 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7702 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7703 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7704 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7705 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7706 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7707 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7709 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7710 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7714 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7715 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7716 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7718 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7719 /* .name = "Capture Source", */
7720 .name = "Input Source",
7722 .info = alc_mux_enum_info,
7723 .get = alc_mux_enum_get,
7724 .put = alc_mux_enum_put,
7729 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7731 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7732 .name = "Channel Mode",
7733 .info = alc_ch_mode_info,
7734 .get = alc_ch_mode_get,
7735 .put = alc_ch_mode_put,
7740 static struct hda_verb alc883_init_verbs[] = {
7741 /* ADC1: mute amp left and right */
7742 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7743 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7744 /* ADC2: mute amp left and right */
7745 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7746 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7747 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7749 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7752 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7758 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7760 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7761 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7764 /* mute analog input loopbacks */
7765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7768 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7769 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7771 /* Front Pin: output 0 (0x0c) */
7772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7774 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7775 /* Rear Pin: output 1 (0x0d) */
7776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7777 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7778 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7779 /* CLFE Pin: output 2 (0x0e) */
7780 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7781 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7782 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7783 /* Side Pin: output 3 (0x0f) */
7784 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7785 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7786 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7787 /* Mic (rear) pin: input vref at 80% */
7788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7790 /* Front Mic pin: input vref at 80% */
7791 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7792 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7793 /* Line In pin: input */
7794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7796 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7799 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7800 /* CD pin widget for input */
7801 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7803 /* FIXME: use matrix-type input source selection */
7804 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7806 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7807 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7808 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7809 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7811 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7812 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7813 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7814 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7818 /* toggle speaker-output according to the hp-jack state */
7819 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7821 unsigned int present;
7823 present = snd_hda_codec_read(codec, 0x15, 0,
7824 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7825 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7826 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7827 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7828 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7831 /* auto-toggle front mic */
7833 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7835 unsigned int present;
7838 present = snd_hda_codec_read(codec, 0x18, 0,
7839 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7840 bits = present ? HDA_AMP_MUTE : 0;
7841 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7845 static void alc883_mitac_automute(struct hda_codec *codec)
7847 alc883_mitac_hp_automute(codec);
7848 /* alc883_mitac_mic_automute(codec); */
7851 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7854 switch (res >> 26) {
7855 case ALC880_HP_EVENT:
7856 alc883_mitac_hp_automute(codec);
7858 case ALC880_MIC_EVENT:
7859 /* alc883_mitac_mic_automute(codec); */
7864 static struct hda_verb alc883_mitac_verbs[] = {
7866 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7867 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7869 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7870 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7872 /* enable unsolicited event */
7873 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7874 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7879 static struct hda_verb alc883_clevo_m720_verbs[] = {
7881 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7882 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7884 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7887 /* enable unsolicited event */
7888 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7889 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7894 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7896 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7897 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7899 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7902 /* enable unsolicited event */
7903 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7908 static struct hda_verb alc883_tagra_verbs[] = {
7909 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7910 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7912 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7913 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7915 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7916 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7917 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7919 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7920 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7921 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7922 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7927 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7928 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7929 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7930 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7934 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7935 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7936 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7937 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7942 static struct hda_verb alc888_lenovo_ms7195_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)},
7945 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7946 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7947 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7951 static struct hda_verb alc883_haier_w66_verbs[] = {
7952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7955 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7957 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7958 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7959 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7960 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7964 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7965 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7967 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7968 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7969 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7970 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7971 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7972 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7976 static struct hda_verb alc888_3st_hp_verbs[] = {
7977 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7978 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7979 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7983 static struct hda_verb alc888_6st_dell_verbs[] = {
7984 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7988 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7989 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7990 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7991 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7992 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7996 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7997 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7998 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7999 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8000 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8004 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
8005 { 2, alc888_3st_hp_2ch_init },
8006 { 6, alc888_3st_hp_6ch_init },
8009 /* toggle front-jack and RCA according to the hp-jack state */
8010 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8012 unsigned int present;
8014 present = snd_hda_codec_read(codec, 0x1b, 0,
8015 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8016 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8017 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8018 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8019 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8022 /* toggle RCA according to the front-jack state */
8023 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8025 unsigned int present;
8027 present = snd_hda_codec_read(codec, 0x14, 0,
8028 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8029 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8030 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8033 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8036 if ((res >> 26) == ALC880_HP_EVENT)
8037 alc888_lenovo_ms7195_front_automute(codec);
8038 if ((res >> 26) == ALC880_FRONT_EVENT)
8039 alc888_lenovo_ms7195_rca_automute(codec);
8042 static struct hda_verb alc883_medion_md2_verbs[] = {
8043 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8044 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8048 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8052 /* toggle speaker-output according to the hp-jack state */
8053 static void alc883_medion_md2_automute(struct hda_codec *codec)
8055 unsigned int present;
8057 present = snd_hda_codec_read(codec, 0x14, 0,
8058 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8059 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8060 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8063 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8066 if ((res >> 26) == ALC880_HP_EVENT)
8067 alc883_medion_md2_automute(codec);
8070 /* toggle speaker-output according to the hp-jack state */
8071 static void alc883_tagra_automute(struct hda_codec *codec)
8073 unsigned int present;
8076 present = snd_hda_codec_read(codec, 0x14, 0,
8077 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8078 bits = present ? HDA_AMP_MUTE : 0;
8079 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8080 HDA_AMP_MUTE, bits);
8081 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8085 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8087 if ((res >> 26) == ALC880_HP_EVENT)
8088 alc883_tagra_automute(codec);
8091 /* toggle speaker-output according to the hp-jack state */
8092 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8094 unsigned int present;
8097 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8098 & AC_PINSENSE_PRESENCE;
8099 bits = present ? HDA_AMP_MUTE : 0;
8100 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8101 HDA_AMP_MUTE, bits);
8104 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8106 unsigned int present;
8108 present = snd_hda_codec_read(codec, 0x18, 0,
8109 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8110 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8111 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8114 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8116 alc883_clevo_m720_hp_automute(codec);
8117 alc883_clevo_m720_mic_automute(codec);
8120 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8123 switch (res >> 26) {
8124 case ALC880_HP_EVENT:
8125 alc883_clevo_m720_hp_automute(codec);
8127 case ALC880_MIC_EVENT:
8128 alc883_clevo_m720_mic_automute(codec);
8133 /* toggle speaker-output according to the hp-jack state */
8134 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8136 unsigned int present;
8139 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8140 & AC_PINSENSE_PRESENCE;
8141 bits = present ? HDA_AMP_MUTE : 0;
8142 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8143 HDA_AMP_MUTE, bits);
8146 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8149 if ((res >> 26) == ALC880_HP_EVENT)
8150 alc883_2ch_fujitsu_pi2515_automute(codec);
8153 static void alc883_haier_w66_automute(struct hda_codec *codec)
8155 unsigned int present;
8158 present = snd_hda_codec_read(codec, 0x1b, 0,
8159 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8160 bits = present ? 0x80 : 0;
8161 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8165 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8168 if ((res >> 26) == ALC880_HP_EVENT)
8169 alc883_haier_w66_automute(codec);
8172 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8174 unsigned int present;
8177 present = snd_hda_codec_read(codec, 0x14, 0,
8178 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8179 bits = present ? HDA_AMP_MUTE : 0;
8180 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8181 HDA_AMP_MUTE, bits);
8184 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8186 unsigned int present;
8189 present = snd_hda_codec_read(codec, 0x1b, 0,
8190 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8191 bits = present ? HDA_AMP_MUTE : 0;
8192 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8193 HDA_AMP_MUTE, bits);
8194 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8195 HDA_AMP_MUTE, bits);
8198 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8201 if ((res >> 26) == ALC880_HP_EVENT)
8202 alc883_lenovo_101e_all_automute(codec);
8203 if ((res >> 26) == ALC880_FRONT_EVENT)
8204 alc883_lenovo_101e_ispeaker_automute(codec);
8207 /* toggle speaker-output according to the hp-jack state */
8208 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8210 unsigned int present;
8212 present = snd_hda_codec_read(codec, 0x14, 0,
8213 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8214 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8215 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8216 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8217 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8220 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8223 if ((res >> 26) == ALC880_HP_EVENT)
8224 alc883_acer_aspire_automute(codec);
8227 static struct hda_verb alc883_acer_eapd_verbs[] = {
8228 /* HP Pin: output 0 (0x0c) */
8229 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8230 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8231 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8232 /* Front Pin: output 0 (0x0c) */
8233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8234 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8235 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8236 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8237 /* eanable EAPD on medion laptop */
8238 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8239 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8240 /* enable unsolicited event */
8241 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8245 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8247 unsigned int present;
8249 present = snd_hda_codec_read(codec, 0x1b, 0,
8250 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8251 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8252 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8253 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8254 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8255 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8256 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8257 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8258 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8261 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8264 switch (res >> 26) {
8265 case ALC880_HP_EVENT:
8266 /* printk(KERN_DEBUG "hp_event\n"); */
8267 alc888_6st_dell_front_automute(codec);
8272 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8275 unsigned int present;
8277 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8278 present = snd_hda_codec_read(codec, 0x1b, 0,
8279 AC_VERB_GET_PIN_SENSE, 0);
8280 present = (present & 0x80000000) != 0;
8282 /* mute internal speaker */
8283 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8284 HDA_AMP_MUTE, HDA_AMP_MUTE);
8285 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8286 HDA_AMP_MUTE, HDA_AMP_MUTE);
8287 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8288 HDA_AMP_MUTE, HDA_AMP_MUTE);
8289 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8290 HDA_AMP_MUTE, HDA_AMP_MUTE);
8291 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8292 HDA_AMP_MUTE, HDA_AMP_MUTE);
8294 /* unmute internal speaker if necessary */
8295 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8296 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8297 HDA_AMP_MUTE, mute);
8298 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8299 HDA_AMP_MUTE, mute);
8300 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8301 HDA_AMP_MUTE, mute);
8302 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8303 HDA_AMP_MUTE, mute);
8304 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8305 HDA_AMP_MUTE, mute);
8309 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8312 if ((res >> 26) == ALC880_HP_EVENT)
8313 alc888_lenovo_sky_front_automute(codec);
8317 * generic initialization of ADC, input mixers and output mixers
8319 static struct hda_verb alc883_auto_init_verbs[] = {
8321 * Unmute ADC0-2 and set the default input to mic-in
8323 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8324 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8325 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8328 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8330 * Note: PASD motherboards uses the Line In 2 as the input for
8331 * front panel mic (mic 2)
8333 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8334 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8341 * Set up output mixers (0x0c - 0x0f)
8343 /* set vol=0 to output mixers */
8344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8345 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8348 /* set up input amps for analog loopback */
8349 /* Amp Indices: DAC = 0, mixer = 1 */
8350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8352 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8356 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8358 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8359 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8361 /* FIXME: use matrix-type input source selection */
8362 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8367 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8373 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8379 static struct hda_verb alc888_asus_m90v_verbs[] = {
8380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8383 /* enable unsolicited event */
8384 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8385 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8389 static void alc883_nb_mic_automute(struct hda_codec *codec)
8391 unsigned int present;
8393 present = snd_hda_codec_read(codec, 0x18, 0,
8394 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8395 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8396 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8397 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8398 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8401 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8403 unsigned int present;
8406 present = snd_hda_codec_read(codec, 0x1b, 0,
8407 AC_VERB_GET_PIN_SENSE, 0)
8408 & AC_PINSENSE_PRESENCE;
8409 bits = present ? 0 : PIN_OUT;
8410 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8412 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8414 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8418 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8421 switch (res >> 26) {
8422 case ALC880_HP_EVENT:
8423 alc883_M90V_speaker_automute(codec);
8425 case ALC880_MIC_EVENT:
8426 alc883_nb_mic_automute(codec);
8431 static void alc883_mode2_inithook(struct hda_codec *codec)
8433 alc883_M90V_speaker_automute(codec);
8434 alc883_nb_mic_automute(codec);
8437 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8439 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8441 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8443 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8444 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8445 /* enable unsolicited event */
8446 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8450 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8452 unsigned int present;
8455 present = snd_hda_codec_read(codec, 0x14, 0,
8456 AC_VERB_GET_PIN_SENSE, 0)
8457 & AC_PINSENSE_PRESENCE;
8458 bits = present ? 0 : PIN_OUT;
8459 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8463 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8466 switch (res >> 26) {
8467 case ALC880_HP_EVENT:
8468 alc883_eee1601_speaker_automute(codec);
8473 static void alc883_eee1601_inithook(struct hda_codec *codec)
8475 alc883_eee1601_speaker_automute(codec);
8478 #ifdef CONFIG_SND_HDA_POWER_SAVE
8479 #define alc883_loopbacks alc880_loopbacks
8482 /* pcm configuration: identiacal with ALC880 */
8483 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8484 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8485 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8486 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8487 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8490 * configuration and preset
8492 static const char *alc883_models[ALC883_MODEL_LAST] = {
8493 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8494 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8495 [ALC883_3ST_6ch] = "3stack-6ch",
8496 [ALC883_6ST_DIG] = "6stack-dig",
8497 [ALC883_TARGA_DIG] = "targa-dig",
8498 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8499 [ALC883_ACER] = "acer",
8500 [ALC883_ACER_ASPIRE] = "acer-aspire",
8501 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8502 [ALC883_MEDION] = "medion",
8503 [ALC883_MEDION_MD2] = "medion-md2",
8504 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8505 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8506 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8507 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8508 [ALC888_LENOVO_SKY] = "lenovo-sky",
8509 [ALC883_HAIER_W66] = "haier-w66",
8510 [ALC888_3ST_HP] = "3stack-hp",
8511 [ALC888_6ST_DELL] = "6stack-dell",
8512 [ALC883_MITAC] = "mitac",
8513 [ALC883_CLEVO_M720] = "clevo-m720",
8514 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8515 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8516 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8517 [ALC1200_ASUS_P5Q] = "asus-p5q",
8518 [ALC883_AUTO] = "auto",
8521 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8522 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8523 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8524 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8525 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8526 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8527 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8528 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8529 ALC888_ACER_ASPIRE_4930G),
8530 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8531 ALC888_ACER_ASPIRE_4930G),
8532 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8533 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8534 ALC888_ACER_ASPIRE_4930G),
8536 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8537 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8538 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8539 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8540 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8541 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8542 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8543 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8544 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8545 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8546 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8547 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8548 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8549 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8550 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8551 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8552 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8553 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8554 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8555 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8556 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8557 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8558 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8559 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8560 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8561 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8562 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8563 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8564 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8565 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8566 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8567 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8568 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8569 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8570 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8571 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8572 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8573 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8574 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8575 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8576 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8577 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8578 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8579 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8580 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8581 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8582 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8583 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8584 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8585 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
8586 ALC883_FUJITSU_PI2515),
8587 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8588 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8589 ALC888_FUJITSU_XA3530),
8590 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8591 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8592 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8593 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8594 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8595 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8596 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8597 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8598 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8599 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8600 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8601 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8602 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8603 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8607 static hda_nid_t alc1200_slave_dig_outs[] = {
8608 ALC883_DIGOUT_NID, 0,
8611 static struct alc_config_preset alc883_presets[] = {
8612 [ALC883_3ST_2ch_DIG] = {
8613 .mixers = { alc883_3ST_2ch_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_2ch_modes),
8620 .channel_mode = alc883_3ST_2ch_modes,
8621 .input_mux = &alc883_capture_source,
8623 [ALC883_3ST_6ch_DIG] = {
8624 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8625 .init_verbs = { alc883_init_verbs },
8626 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8627 .dac_nids = alc883_dac_nids,
8628 .dig_out_nid = ALC883_DIGOUT_NID,
8629 .dig_in_nid = ALC883_DIGIN_NID,
8630 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8631 .channel_mode = alc883_3ST_6ch_modes,
8633 .input_mux = &alc883_capture_source,
8635 [ALC883_3ST_6ch] = {
8636 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8637 .init_verbs = { alc883_init_verbs },
8638 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8639 .dac_nids = alc883_dac_nids,
8640 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8641 .channel_mode = alc883_3ST_6ch_modes,
8643 .input_mux = &alc883_capture_source,
8645 [ALC883_3ST_6ch_INTEL] = {
8646 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8647 .init_verbs = { alc883_init_verbs },
8648 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8649 .dac_nids = alc883_dac_nids,
8650 .dig_out_nid = ALC883_DIGOUT_NID,
8651 .dig_in_nid = ALC883_DIGIN_NID,
8652 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8653 .channel_mode = alc883_3ST_6ch_intel_modes,
8655 .input_mux = &alc883_3stack_6ch_intel,
8657 [ALC883_6ST_DIG] = {
8658 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8659 .init_verbs = { alc883_init_verbs },
8660 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8661 .dac_nids = alc883_dac_nids,
8662 .dig_out_nid = ALC883_DIGOUT_NID,
8663 .dig_in_nid = ALC883_DIGIN_NID,
8664 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8665 .channel_mode = alc883_sixstack_modes,
8666 .input_mux = &alc883_capture_source,
8668 [ALC883_TARGA_DIG] = {
8669 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8670 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8671 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8672 .dac_nids = alc883_dac_nids,
8673 .dig_out_nid = ALC883_DIGOUT_NID,
8674 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8675 .channel_mode = alc883_3ST_6ch_modes,
8677 .input_mux = &alc883_capture_source,
8678 .unsol_event = alc883_tagra_unsol_event,
8679 .init_hook = alc883_tagra_automute,
8681 [ALC883_TARGA_2ch_DIG] = {
8682 .mixers = { alc883_tagra_2ch_mixer},
8683 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8684 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8685 .dac_nids = alc883_dac_nids,
8686 .adc_nids = alc883_adc_nids_alt,
8687 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8688 .dig_out_nid = ALC883_DIGOUT_NID,
8689 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8690 .channel_mode = alc883_3ST_2ch_modes,
8691 .input_mux = &alc883_capture_source,
8692 .unsol_event = alc883_tagra_unsol_event,
8693 .init_hook = alc883_tagra_automute,
8696 .mixers = { alc883_base_mixer },
8697 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8698 * and the headphone jack. Turn this on and rely on the
8699 * standard mute methods whenever the user wants to turn
8700 * these outputs off.
8702 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8703 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8704 .dac_nids = alc883_dac_nids,
8705 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8706 .channel_mode = alc883_3ST_2ch_modes,
8707 .input_mux = &alc883_capture_source,
8709 [ALC883_ACER_ASPIRE] = {
8710 .mixers = { alc883_acer_aspire_mixer },
8711 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8712 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8713 .dac_nids = alc883_dac_nids,
8714 .dig_out_nid = ALC883_DIGOUT_NID,
8715 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8716 .channel_mode = alc883_3ST_2ch_modes,
8717 .input_mux = &alc883_capture_source,
8718 .unsol_event = alc883_acer_aspire_unsol_event,
8719 .init_hook = alc883_acer_aspire_automute,
8721 [ALC888_ACER_ASPIRE_4930G] = {
8722 .mixers = { alc888_base_mixer,
8723 alc883_chmode_mixer },
8724 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8725 alc888_acer_aspire_4930g_verbs },
8726 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8727 .dac_nids = alc883_dac_nids,
8728 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8729 .adc_nids = alc883_adc_nids_rev,
8730 .capsrc_nids = alc883_capsrc_nids_rev,
8731 .dig_out_nid = ALC883_DIGOUT_NID,
8732 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8733 .channel_mode = alc883_3ST_6ch_modes,
8736 ARRAY_SIZE(alc888_2_capture_sources),
8737 .input_mux = alc888_2_capture_sources,
8738 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8739 .init_hook = alc888_acer_aspire_4930g_automute,
8742 .mixers = { alc883_fivestack_mixer,
8743 alc883_chmode_mixer },
8744 .init_verbs = { alc883_init_verbs,
8745 alc883_medion_eapd_verbs },
8746 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8747 .dac_nids = alc883_dac_nids,
8748 .adc_nids = alc883_adc_nids_alt,
8749 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8750 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8751 .channel_mode = alc883_sixstack_modes,
8752 .input_mux = &alc883_capture_source,
8754 [ALC883_MEDION_MD2] = {
8755 .mixers = { alc883_medion_md2_mixer},
8756 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8757 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8758 .dac_nids = alc883_dac_nids,
8759 .dig_out_nid = ALC883_DIGOUT_NID,
8760 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8761 .channel_mode = alc883_3ST_2ch_modes,
8762 .input_mux = &alc883_capture_source,
8763 .unsol_event = alc883_medion_md2_unsol_event,
8764 .init_hook = alc883_medion_md2_automute,
8766 [ALC883_LAPTOP_EAPD] = {
8767 .mixers = { alc883_base_mixer },
8768 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8769 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8770 .dac_nids = alc883_dac_nids,
8771 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8772 .channel_mode = alc883_3ST_2ch_modes,
8773 .input_mux = &alc883_capture_source,
8775 [ALC883_CLEVO_M720] = {
8776 .mixers = { alc883_clevo_m720_mixer },
8777 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8778 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8779 .dac_nids = alc883_dac_nids,
8780 .dig_out_nid = ALC883_DIGOUT_NID,
8781 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8782 .channel_mode = alc883_3ST_2ch_modes,
8783 .input_mux = &alc883_capture_source,
8784 .unsol_event = alc883_clevo_m720_unsol_event,
8785 .init_hook = alc883_clevo_m720_automute,
8787 [ALC883_LENOVO_101E_2ch] = {
8788 .mixers = { alc883_lenovo_101e_2ch_mixer},
8789 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8790 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8791 .dac_nids = alc883_dac_nids,
8792 .adc_nids = alc883_adc_nids_alt,
8793 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8794 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8795 .channel_mode = alc883_3ST_2ch_modes,
8796 .input_mux = &alc883_lenovo_101e_capture_source,
8797 .unsol_event = alc883_lenovo_101e_unsol_event,
8798 .init_hook = alc883_lenovo_101e_all_automute,
8800 [ALC883_LENOVO_NB0763] = {
8801 .mixers = { alc883_lenovo_nb0763_mixer },
8802 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8803 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8804 .dac_nids = alc883_dac_nids,
8805 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8806 .channel_mode = alc883_3ST_2ch_modes,
8808 .input_mux = &alc883_lenovo_nb0763_capture_source,
8809 .unsol_event = alc883_medion_md2_unsol_event,
8810 .init_hook = alc883_medion_md2_automute,
8812 [ALC888_LENOVO_MS7195_DIG] = {
8813 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8814 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8815 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8816 .dac_nids = alc883_dac_nids,
8817 .dig_out_nid = ALC883_DIGOUT_NID,
8818 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8819 .channel_mode = alc883_3ST_6ch_modes,
8821 .input_mux = &alc883_capture_source,
8822 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8823 .init_hook = alc888_lenovo_ms7195_front_automute,
8825 [ALC883_HAIER_W66] = {
8826 .mixers = { alc883_tagra_2ch_mixer},
8827 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8828 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8829 .dac_nids = alc883_dac_nids,
8830 .dig_out_nid = ALC883_DIGOUT_NID,
8831 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8832 .channel_mode = alc883_3ST_2ch_modes,
8833 .input_mux = &alc883_capture_source,
8834 .unsol_event = alc883_haier_w66_unsol_event,
8835 .init_hook = alc883_haier_w66_automute,
8838 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8839 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8840 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8841 .dac_nids = alc883_dac_nids,
8842 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8843 .channel_mode = alc888_3st_hp_modes,
8845 .input_mux = &alc883_capture_source,
8847 [ALC888_6ST_DELL] = {
8848 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8849 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8850 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8851 .dac_nids = alc883_dac_nids,
8852 .dig_out_nid = ALC883_DIGOUT_NID,
8853 .dig_in_nid = ALC883_DIGIN_NID,
8854 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8855 .channel_mode = alc883_sixstack_modes,
8856 .input_mux = &alc883_capture_source,
8857 .unsol_event = alc888_6st_dell_unsol_event,
8858 .init_hook = alc888_6st_dell_front_automute,
8861 .mixers = { alc883_mitac_mixer },
8862 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8863 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8864 .dac_nids = alc883_dac_nids,
8865 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8866 .channel_mode = alc883_3ST_2ch_modes,
8867 .input_mux = &alc883_capture_source,
8868 .unsol_event = alc883_mitac_unsol_event,
8869 .init_hook = alc883_mitac_automute,
8871 [ALC883_FUJITSU_PI2515] = {
8872 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8873 .init_verbs = { alc883_init_verbs,
8874 alc883_2ch_fujitsu_pi2515_verbs},
8875 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8876 .dac_nids = alc883_dac_nids,
8877 .dig_out_nid = ALC883_DIGOUT_NID,
8878 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8879 .channel_mode = alc883_3ST_2ch_modes,
8880 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8881 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8882 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8884 [ALC888_FUJITSU_XA3530] = {
8885 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8886 .init_verbs = { alc883_init_verbs,
8887 alc888_fujitsu_xa3530_verbs },
8888 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8889 .dac_nids = alc883_dac_nids,
8890 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8891 .adc_nids = alc883_adc_nids_rev,
8892 .capsrc_nids = alc883_capsrc_nids_rev,
8893 .dig_out_nid = ALC883_DIGOUT_NID,
8894 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8895 .channel_mode = alc888_4ST_8ch_intel_modes,
8897 ARRAY_SIZE(alc888_2_capture_sources),
8898 .input_mux = alc888_2_capture_sources,
8899 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8900 .init_hook = alc888_fujitsu_xa3530_automute,
8902 [ALC888_LENOVO_SKY] = {
8903 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8904 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8905 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8906 .dac_nids = alc883_dac_nids,
8907 .dig_out_nid = ALC883_DIGOUT_NID,
8908 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8909 .channel_mode = alc883_sixstack_modes,
8911 .input_mux = &alc883_lenovo_sky_capture_source,
8912 .unsol_event = alc883_lenovo_sky_unsol_event,
8913 .init_hook = alc888_lenovo_sky_front_automute,
8915 [ALC888_ASUS_M90V] = {
8916 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8917 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8918 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8919 .dac_nids = alc883_dac_nids,
8920 .dig_out_nid = ALC883_DIGOUT_NID,
8921 .dig_in_nid = ALC883_DIGIN_NID,
8922 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8923 .channel_mode = alc883_3ST_6ch_modes,
8925 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8926 .unsol_event = alc883_mode2_unsol_event,
8927 .init_hook = alc883_mode2_inithook,
8929 [ALC888_ASUS_EEE1601] = {
8930 .mixers = { alc883_asus_eee1601_mixer },
8931 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8932 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8933 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8934 .dac_nids = alc883_dac_nids,
8935 .dig_out_nid = ALC883_DIGOUT_NID,
8936 .dig_in_nid = ALC883_DIGIN_NID,
8937 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8938 .channel_mode = alc883_3ST_2ch_modes,
8940 .input_mux = &alc883_asus_eee1601_capture_source,
8941 .unsol_event = alc883_eee1601_unsol_event,
8942 .init_hook = alc883_eee1601_inithook,
8944 [ALC1200_ASUS_P5Q] = {
8945 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8946 .init_verbs = { alc883_init_verbs },
8947 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8948 .dac_nids = alc883_dac_nids,
8949 .dig_out_nid = ALC1200_DIGOUT_NID,
8950 .dig_in_nid = ALC883_DIGIN_NID,
8951 .slave_dig_outs = alc1200_slave_dig_outs,
8952 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8953 .channel_mode = alc883_sixstack_modes,
8954 .input_mux = &alc883_capture_source,
8960 * BIOS auto configuration
8962 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8963 hda_nid_t nid, int pin_type,
8967 struct alc_spec *spec = codec->spec;
8970 alc_set_pin_output(codec, nid, pin_type);
8971 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8974 idx = spec->multiout.dac_nids[dac_idx] - 2;
8975 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8979 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8981 struct alc_spec *spec = codec->spec;
8984 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8985 for (i = 0; i <= HDA_SIDE; i++) {
8986 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8987 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8989 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8994 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8996 struct alc_spec *spec = codec->spec;
8999 pin = spec->autocfg.hp_pins[0];
9000 if (pin) /* connect to front */
9002 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9003 pin = spec->autocfg.speaker_pins[0];
9005 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9008 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9009 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9011 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9013 struct alc_spec *spec = codec->spec;
9016 for (i = 0; i < AUTO_PIN_LAST; i++) {
9017 hda_nid_t nid = spec->autocfg.input_pins[i];
9018 if (alc883_is_input_pin(nid)) {
9019 snd_hda_codec_write(codec, nid, 0,
9020 AC_VERB_SET_PIN_WIDGET_CONTROL,
9021 (i <= AUTO_PIN_FRONT_MIC ?
9022 PIN_VREF80 : PIN_IN));
9023 if (nid != ALC883_PIN_CD_NID)
9024 snd_hda_codec_write(codec, nid, 0,
9025 AC_VERB_SET_AMP_GAIN_MUTE,
9031 #define alc883_auto_init_input_src alc882_auto_init_input_src
9033 /* almost identical with ALC880 parser... */
9034 static int alc883_parse_auto_config(struct hda_codec *codec)
9036 struct alc_spec *spec = codec->spec;
9037 int err = alc880_parse_auto_config(codec);
9038 struct auto_pin_cfg *cfg = &spec->autocfg;
9044 return 0; /* no config found */
9046 err = alc_auto_add_mic_boost(codec);
9050 /* hack - override the init verbs */
9051 spec->init_verbs[0] = alc883_auto_init_verbs;
9053 /* setup input_mux for ALC889 */
9054 if (codec->vendor_id == 0x10ec0889) {
9055 /* digital-mic input pin is excluded in alc880_auto_create..()
9056 * because it's under 0x18
9058 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9059 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9060 struct hda_input_mux *imux = &spec->private_imux[0];
9061 for (i = 1; i < 3; i++)
9062 memcpy(&spec->private_imux[i],
9063 &spec->private_imux[0],
9064 sizeof(spec->private_imux[0]));
9065 imux->items[imux->num_items].label = "Int DMic";
9066 imux->items[imux->num_items].index = 0x0b;
9068 spec->num_mux_defs = 3;
9069 spec->input_mux = spec->private_imux;
9073 return 1; /* config found */
9076 /* additional initialization for auto-configuration model */
9077 static void alc883_auto_init(struct hda_codec *codec)
9079 struct alc_spec *spec = codec->spec;
9080 alc883_auto_init_multi_out(codec);
9081 alc883_auto_init_hp_out(codec);
9082 alc883_auto_init_analog_input(codec);
9083 alc883_auto_init_input_src(codec);
9084 if (spec->unsol_event)
9085 alc_inithook(codec);
9088 static int patch_alc883(struct hda_codec *codec)
9090 struct alc_spec *spec;
9091 int err, board_config;
9093 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9099 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9101 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9104 if (board_config < 0) {
9105 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9106 "trying auto-probe from BIOS...\n");
9107 board_config = ALC883_AUTO;
9110 if (board_config == ALC883_AUTO) {
9111 /* automatic parse from the BIOS config */
9112 err = alc883_parse_auto_config(codec);
9118 "hda_codec: Cannot set up configuration "
9119 "from BIOS. Using base mode...\n");
9120 board_config = ALC883_3ST_2ch_DIG;
9124 err = snd_hda_attach_beep_device(codec, 0x1);
9130 if (board_config != ALC883_AUTO)
9131 setup_preset(spec, &alc883_presets[board_config]);
9133 switch (codec->vendor_id) {
9135 if (codec->revision_id == 0x100101) {
9136 spec->stream_name_analog = "ALC1200 Analog";
9137 spec->stream_name_digital = "ALC1200 Digital";
9139 spec->stream_name_analog = "ALC888 Analog";
9140 spec->stream_name_digital = "ALC888 Digital";
9142 if (!spec->num_adc_nids) {
9143 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9144 spec->adc_nids = alc883_adc_nids;
9146 if (!spec->capsrc_nids)
9147 spec->capsrc_nids = alc883_capsrc_nids;
9148 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9151 spec->stream_name_analog = "ALC889 Analog";
9152 spec->stream_name_digital = "ALC889 Digital";
9153 if (!spec->num_adc_nids) {
9154 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9155 spec->adc_nids = alc889_adc_nids;
9157 if (!spec->capsrc_nids)
9158 spec->capsrc_nids = alc889_capsrc_nids;
9159 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9163 spec->stream_name_analog = "ALC883 Analog";
9164 spec->stream_name_digital = "ALC883 Digital";
9165 if (!spec->num_adc_nids) {
9166 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9167 spec->adc_nids = alc883_adc_nids;
9169 if (!spec->capsrc_nids)
9170 spec->capsrc_nids = alc883_capsrc_nids;
9171 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9175 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9176 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9177 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9179 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9180 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9182 if (!spec->cap_mixer)
9183 set_capture_mixer(spec);
9184 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9186 spec->vmaster_nid = 0x0c;
9188 codec->patch_ops = alc_patch_ops;
9189 if (board_config == ALC883_AUTO)
9190 spec->init_hook = alc883_auto_init;
9192 #ifdef CONFIG_SND_HDA_POWER_SAVE
9193 if (!spec->loopback.amplist)
9194 spec->loopback.amplist = alc883_loopbacks;
9196 codec->proc_widget_hook = print_realtek_coef;
9205 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9206 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9208 #define alc262_dac_nids alc260_dac_nids
9209 #define alc262_adc_nids alc882_adc_nids
9210 #define alc262_adc_nids_alt alc882_adc_nids_alt
9211 #define alc262_capsrc_nids alc882_capsrc_nids
9212 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9214 #define alc262_modes alc260_modes
9215 #define alc262_capture_source alc882_capture_source
9217 static hda_nid_t alc262_dmic_adc_nids[1] = {
9222 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9224 static struct snd_kcontrol_new alc262_base_mixer[] = {
9225 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9226 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9227 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9228 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9229 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9230 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9233 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9236 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9237 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9239 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9240 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9244 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9246 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9250 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9254 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9255 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9256 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9257 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9262 /* update HP, line and mono-out pins according to the master switch */
9263 static void alc262_hp_master_update(struct hda_codec *codec)
9265 struct alc_spec *spec = codec->spec;
9266 int val = spec->master_sw;
9269 snd_hda_codec_write_cache(codec, 0x1b, 0,
9270 AC_VERB_SET_PIN_WIDGET_CONTROL,
9272 snd_hda_codec_write_cache(codec, 0x15, 0,
9273 AC_VERB_SET_PIN_WIDGET_CONTROL,
9275 /* mono (speaker) depending on the HP jack sense */
9276 val = val && !spec->jack_present;
9277 snd_hda_codec_write_cache(codec, 0x16, 0,
9278 AC_VERB_SET_PIN_WIDGET_CONTROL,
9282 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9284 struct alc_spec *spec = codec->spec;
9285 unsigned int presence;
9286 presence = snd_hda_codec_read(codec, 0x1b, 0,
9287 AC_VERB_GET_PIN_SENSE, 0);
9288 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9289 alc262_hp_master_update(codec);
9292 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9294 if ((res >> 26) != ALC880_HP_EVENT)
9296 alc262_hp_bpc_automute(codec);
9299 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9301 struct alc_spec *spec = codec->spec;
9302 unsigned int presence;
9303 presence = snd_hda_codec_read(codec, 0x15, 0,
9304 AC_VERB_GET_PIN_SENSE, 0);
9305 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9306 alc262_hp_master_update(codec);
9309 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9312 if ((res >> 26) != ALC880_HP_EVENT)
9314 alc262_hp_wildwest_automute(codec);
9317 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9318 struct snd_ctl_elem_value *ucontrol)
9320 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9321 struct alc_spec *spec = codec->spec;
9322 *ucontrol->value.integer.value = spec->master_sw;
9326 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9327 struct snd_ctl_elem_value *ucontrol)
9329 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9330 struct alc_spec *spec = codec->spec;
9331 int val = !!*ucontrol->value.integer.value;
9333 if (val == spec->master_sw)
9335 spec->master_sw = val;
9336 alc262_hp_master_update(codec);
9340 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9342 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9343 .name = "Master Playback Switch",
9344 .info = snd_ctl_boolean_mono_info,
9345 .get = alc262_hp_master_sw_get,
9346 .put = alc262_hp_master_sw_put,
9348 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9349 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9351 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9353 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9357 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9358 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9359 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9360 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9361 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9362 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9363 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9364 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9365 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9366 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9370 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9373 .name = "Master Playback Switch",
9374 .info = snd_ctl_boolean_mono_info,
9375 .get = alc262_hp_master_sw_get,
9376 .put = alc262_hp_master_sw_put,
9378 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9379 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9381 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9382 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9384 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9386 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9387 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9388 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9389 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9390 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9391 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9392 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9396 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9397 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9398 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9399 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9403 /* mute/unmute internal speaker according to the hp jack and mute state */
9404 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9406 struct alc_spec *spec = codec->spec;
9408 if (force || !spec->sense_updated) {
9409 unsigned int present;
9410 present = snd_hda_codec_read(codec, 0x15, 0,
9411 AC_VERB_GET_PIN_SENSE, 0);
9412 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9413 spec->sense_updated = 1;
9415 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9416 spec->jack_present ? HDA_AMP_MUTE : 0);
9419 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9422 if ((res >> 26) != ALC880_HP_EVENT)
9424 alc262_hp_t5735_automute(codec, 1);
9427 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9429 alc262_hp_t5735_automute(codec, 1);
9432 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9433 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9434 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9435 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9436 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9438 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9439 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9443 static struct hda_verb alc262_hp_t5735_verbs[] = {
9444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9447 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9451 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9452 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9453 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9454 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9455 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9456 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9457 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9461 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9462 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9463 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9464 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9465 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9466 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9467 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9468 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9470 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9475 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9482 /* bind hp and internal speaker mute (with plug check) */
9483 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9484 struct snd_ctl_elem_value *ucontrol)
9486 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9487 long *valp = ucontrol->value.integer.value;
9490 /* change hp mute */
9491 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9493 valp[0] ? 0 : HDA_AMP_MUTE);
9494 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9496 valp[1] ? 0 : HDA_AMP_MUTE);
9498 /* change speaker according to HP jack state */
9499 struct alc_spec *spec = codec->spec;
9501 if (spec->jack_present)
9502 mute = HDA_AMP_MUTE;
9504 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9506 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9507 HDA_AMP_MUTE, mute);
9512 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9513 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9515 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9516 .name = "Master Playback Switch",
9517 .info = snd_hda_mixer_amp_switch_info,
9518 .get = snd_hda_mixer_amp_switch_get,
9519 .put = alc262_sony_master_sw_put,
9520 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, 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_benq_t31_mixer[] = {
9530 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9531 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9535 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9536 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9540 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9541 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9542 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9543 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9544 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9545 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9546 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9548 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9549 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9550 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9551 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9552 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9556 static struct hda_verb alc262_tyan_verbs[] = {
9557 /* Headphone automute */
9558 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9560 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9562 /* P11 AUX_IN, white 4-pin connector */
9563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9564 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9565 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9566 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9571 /* unsolicited event for HP jack sensing */
9572 static void alc262_tyan_automute(struct hda_codec *codec)
9575 unsigned int present;
9577 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9578 present = snd_hda_codec_read(codec, 0x1b, 0,
9579 AC_VERB_GET_PIN_SENSE, 0);
9580 present = (present & 0x80000000) != 0;
9582 /* mute line output on ATX panel */
9583 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9584 HDA_AMP_MUTE, HDA_AMP_MUTE);
9586 /* unmute line output if necessary */
9587 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9588 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9589 HDA_AMP_MUTE, mute);
9593 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9596 if ((res >> 26) != ALC880_HP_EVENT)
9598 alc262_tyan_automute(codec);
9601 #define alc262_capture_mixer alc882_capture_mixer
9602 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9605 * generic initialization of ADC, input mixers and output mixers
9607 static struct hda_verb alc262_init_verbs[] = {
9609 * Unmute ADC0-2 and set the default input to mic-in
9611 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9613 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9615 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9618 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9620 * Note: PASD motherboards uses the Line In 2 as the input for
9621 * front panel mic (mic 2)
9623 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9631 * Set up output mixers (0x0c - 0x0e)
9633 /* set vol=0 to output mixers */
9634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9637 /* set up input amps for analog loopback */
9638 /* Amp Indices: DAC = 0, mixer = 1 */
9639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9641 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9643 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9647 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9648 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9649 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9650 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9651 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9653 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9654 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9655 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9656 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9657 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9659 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9660 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9662 /* FIXME: use matrix-type input source selection */
9663 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9664 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9667 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9668 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9672 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9673 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9676 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9678 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9683 static struct hda_verb alc262_eapd_verbs[] = {
9684 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9685 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9689 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9690 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9695 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9696 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9697 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9698 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9700 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9701 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9705 static struct hda_verb alc262_sony_unsol_verbs[] = {
9706 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9707 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9708 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9710 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9715 static struct hda_input_mux alc262_dmic_capture_source = {
9718 { "Int DMic", 0x9 },
9723 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9724 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9725 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9726 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9728 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9732 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9733 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9734 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9736 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9737 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9738 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9739 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9740 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9744 static void alc262_dmic_automute(struct hda_codec *codec)
9746 unsigned int present;
9748 present = snd_hda_codec_read(codec, 0x18, 0,
9749 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9750 snd_hda_codec_write(codec, 0x22, 0,
9751 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9754 /* toggle speaker-output according to the hp-jack state */
9755 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9757 unsigned int present;
9760 present = snd_hda_codec_read(codec, 0x15, 0,
9761 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9762 bits = present ? 0 : PIN_OUT;
9763 snd_hda_codec_write(codec, 0x14, 0,
9764 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9769 /* unsolicited event for HP jack sensing */
9770 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9773 if ((res >> 26) == ALC880_HP_EVENT)
9774 alc262_toshiba_s06_speaker_automute(codec);
9775 if ((res >> 26) == ALC880_MIC_EVENT)
9776 alc262_dmic_automute(codec);
9780 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9782 alc262_toshiba_s06_speaker_automute(codec);
9783 alc262_dmic_automute(codec);
9786 /* mute/unmute internal speaker according to the hp jack and mute state */
9787 static void alc262_hippo_automute(struct hda_codec *codec)
9789 struct alc_spec *spec = codec->spec;
9791 unsigned int present;
9793 /* need to execute and sync at first */
9794 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9795 present = snd_hda_codec_read(codec, 0x15, 0,
9796 AC_VERB_GET_PIN_SENSE, 0);
9797 spec->jack_present = (present & 0x80000000) != 0;
9798 if (spec->jack_present) {
9799 /* mute internal speaker */
9800 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9801 HDA_AMP_MUTE, HDA_AMP_MUTE);
9803 /* unmute internal speaker if necessary */
9804 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9805 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9806 HDA_AMP_MUTE, mute);
9810 /* unsolicited event for HP jack sensing */
9811 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9814 if ((res >> 26) != ALC880_HP_EVENT)
9816 alc262_hippo_automute(codec);
9819 static void alc262_hippo1_automute(struct hda_codec *codec)
9822 unsigned int present;
9824 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9825 present = snd_hda_codec_read(codec, 0x1b, 0,
9826 AC_VERB_GET_PIN_SENSE, 0);
9827 present = (present & 0x80000000) != 0;
9829 /* mute internal speaker */
9830 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9831 HDA_AMP_MUTE, HDA_AMP_MUTE);
9833 /* unmute internal speaker if necessary */
9834 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9835 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9836 HDA_AMP_MUTE, mute);
9840 /* unsolicited event for HP jack sensing */
9841 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9844 if ((res >> 26) != ALC880_HP_EVENT)
9846 alc262_hippo1_automute(codec);
9852 * 0x16 = internal speaker
9853 * 0x18 = external mic
9856 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9857 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9858 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9862 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9864 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9869 static struct hda_verb alc262_nec_verbs[] = {
9870 /* Unmute Speaker */
9871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9874 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9877 /* External mic to headphone */
9878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9879 /* External mic to speaker */
9880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9886 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9887 * 0x1b = port replicator headphone out
9890 #define ALC_HP_EVENT 0x37
9892 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9893 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9895 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9896 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9900 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9901 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9902 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9906 static struct hda_input_mux alc262_fujitsu_capture_source = {
9915 static struct hda_input_mux alc262_HP_capture_source = {
9919 { "Front Mic", 0x1 },
9926 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9930 { "Front Mic", 0x2 },
9936 /* mute/unmute internal speaker according to the hp jacks and mute state */
9937 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9939 struct alc_spec *spec = codec->spec;
9942 if (force || !spec->sense_updated) {
9943 unsigned int present;
9944 /* need to execute and sync at first */
9945 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9946 /* check laptop HP jack */
9947 present = snd_hda_codec_read(codec, 0x14, 0,
9948 AC_VERB_GET_PIN_SENSE, 0);
9949 /* need to execute and sync at first */
9950 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9951 /* check docking HP jack */
9952 present |= snd_hda_codec_read(codec, 0x1b, 0,
9953 AC_VERB_GET_PIN_SENSE, 0);
9954 if (present & AC_PINSENSE_PRESENCE)
9955 spec->jack_present = 1;
9957 spec->jack_present = 0;
9958 spec->sense_updated = 1;
9960 /* unmute internal speaker only if both HPs are unplugged and
9961 * master switch is on
9963 if (spec->jack_present)
9964 mute = HDA_AMP_MUTE;
9966 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9967 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9968 HDA_AMP_MUTE, mute);
9971 /* unsolicited event for HP jack sensing */
9972 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9975 if ((res >> 26) != ALC_HP_EVENT)
9977 alc262_fujitsu_automute(codec, 1);
9980 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9982 alc262_fujitsu_automute(codec, 1);
9985 /* bind volumes of both NID 0x0c and 0x0d */
9986 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9987 .ops = &snd_hda_bind_vol,
9989 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9990 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9995 /* mute/unmute internal speaker according to the hp jack and mute state */
9996 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9998 struct alc_spec *spec = codec->spec;
10001 if (force || !spec->sense_updated) {
10002 unsigned int present_int_hp;
10003 /* need to execute and sync at first */
10004 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10005 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10006 AC_VERB_GET_PIN_SENSE, 0);
10007 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10008 spec->sense_updated = 1;
10010 if (spec->jack_present) {
10011 /* mute internal speaker */
10012 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10013 HDA_AMP_MUTE, HDA_AMP_MUTE);
10014 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10015 HDA_AMP_MUTE, HDA_AMP_MUTE);
10017 /* unmute internal speaker if necessary */
10018 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10019 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10020 HDA_AMP_MUTE, mute);
10021 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10022 HDA_AMP_MUTE, mute);
10026 /* unsolicited event for HP jack sensing */
10027 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10030 if ((res >> 26) != ALC_HP_EVENT)
10032 alc262_lenovo_3000_automute(codec, 1);
10035 /* bind hp and internal speaker mute (with plug check) */
10036 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10037 struct snd_ctl_elem_value *ucontrol)
10039 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10040 long *valp = ucontrol->value.integer.value;
10043 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10045 valp ? 0 : HDA_AMP_MUTE);
10046 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10048 valp ? 0 : HDA_AMP_MUTE);
10051 alc262_fujitsu_automute(codec, 0);
10055 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10056 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10058 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10059 .name = "Master Playback Switch",
10060 .info = snd_hda_mixer_amp_switch_info,
10061 .get = snd_hda_mixer_amp_switch_get,
10062 .put = alc262_fujitsu_master_sw_put,
10063 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10065 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10066 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10068 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10069 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10070 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10071 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10072 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10076 /* bind hp and internal speaker mute (with plug check) */
10077 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10078 struct snd_ctl_elem_value *ucontrol)
10080 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10081 long *valp = ucontrol->value.integer.value;
10084 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10086 valp ? 0 : HDA_AMP_MUTE);
10089 alc262_lenovo_3000_automute(codec, 0);
10093 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10094 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10096 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10097 .name = "Master Playback Switch",
10098 .info = snd_hda_mixer_amp_switch_info,
10099 .get = snd_hda_mixer_amp_switch_get,
10100 .put = alc262_lenovo_3000_master_sw_put,
10101 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10105 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10107 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10108 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10109 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10110 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10114 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10115 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10118 .name = "Master Playback Switch",
10119 .info = snd_hda_mixer_amp_switch_info,
10120 .get = snd_hda_mixer_amp_switch_get,
10121 .put = alc262_sony_master_sw_put,
10122 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10126 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10127 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10128 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10129 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10133 /* additional init verbs for Benq laptops */
10134 static struct hda_verb alc262_EAPD_verbs[] = {
10135 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10136 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10140 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10141 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10142 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10144 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10145 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10149 /* Samsung Q1 Ultra Vista model setup */
10150 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10151 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10152 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10155 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10156 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10160 static struct hda_verb alc262_ultra_verbs[] = {
10162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10166 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10167 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10168 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10169 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10174 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10175 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10177 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10179 /* ADC, choose mic */
10180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10186 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10187 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10188 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10189 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10193 /* mute/unmute internal speaker according to the hp jack and mute state */
10194 static void alc262_ultra_automute(struct hda_codec *codec)
10196 struct alc_spec *spec = codec->spec;
10200 /* auto-mute only when HP is used as HP */
10201 if (!spec->cur_mux[0]) {
10202 unsigned int present;
10203 /* need to execute and sync at first */
10204 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10205 present = snd_hda_codec_read(codec, 0x15, 0,
10206 AC_VERB_GET_PIN_SENSE, 0);
10207 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10208 if (spec->jack_present)
10209 mute = HDA_AMP_MUTE;
10211 /* mute/unmute internal speaker */
10212 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10213 HDA_AMP_MUTE, mute);
10214 /* mute/unmute HP */
10215 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10216 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10219 /* unsolicited event for HP jack sensing */
10220 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10223 if ((res >> 26) != ALC880_HP_EVENT)
10225 alc262_ultra_automute(codec);
10228 static struct hda_input_mux alc262_ultra_capture_source = {
10232 { "Headphone", 0x7 },
10236 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10237 struct snd_ctl_elem_value *ucontrol)
10239 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10240 struct alc_spec *spec = codec->spec;
10243 ret = alc_mux_enum_put(kcontrol, ucontrol);
10246 /* reprogram the HP pin as mic or HP according to the input source */
10247 snd_hda_codec_write_cache(codec, 0x15, 0,
10248 AC_VERB_SET_PIN_WIDGET_CONTROL,
10249 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10250 alc262_ultra_automute(codec); /* mute/unmute HP */
10254 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10255 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10256 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10258 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10259 .name = "Capture Source",
10260 .info = alc_mux_enum_info,
10261 .get = alc_mux_enum_get,
10262 .put = alc262_ultra_mux_enum_put,
10267 /* add playback controls from the parsed DAC table */
10268 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10269 const struct auto_pin_cfg *cfg)
10274 spec->multiout.num_dacs = 1; /* only use one dac */
10275 spec->multiout.dac_nids = spec->private_dac_nids;
10276 spec->multiout.dac_nids[0] = 2;
10278 nid = cfg->line_out_pins[0];
10280 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10281 "Front Playback Volume",
10282 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10285 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10286 "Front Playback Switch",
10287 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10292 nid = cfg->speaker_pins[0];
10295 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10296 "Speaker Playback Volume",
10297 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10301 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10302 "Speaker Playback Switch",
10303 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10308 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10309 "Speaker Playback Switch",
10310 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10316 nid = cfg->hp_pins[0];
10318 /* spec->multiout.hp_nid = 2; */
10320 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10321 "Headphone Playback Volume",
10322 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10326 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10327 "Headphone Playback Switch",
10328 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10333 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10334 "Headphone Playback Switch",
10335 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10344 /* identical with ALC880 */
10345 #define alc262_auto_create_analog_input_ctls \
10346 alc880_auto_create_analog_input_ctls
10349 * generic initialization of ADC, input mixers and output mixers
10351 static struct hda_verb alc262_volume_init_verbs[] = {
10353 * Unmute ADC0-2 and set the default input to mic-in
10355 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10357 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10358 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10359 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10360 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10362 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10364 * Note: PASD motherboards uses the Line In 2 as the input for
10365 * front panel mic (mic 2)
10367 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10375 * Set up output mixers (0x0c - 0x0f)
10377 /* set vol=0 to output mixers */
10378 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10379 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10380 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10382 /* set up input amps for analog loopback */
10383 /* Amp Indices: DAC = 0, mixer = 1 */
10384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10386 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10388 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10389 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10391 /* FIXME: use matrix-type input source selection */
10392 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10393 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10407 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10412 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10414 * Unmute ADC0-2 and set the default input to mic-in
10416 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10418 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10419 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10420 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10421 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10423 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10425 * Note: PASD motherboards uses the Line In 2 as the input for
10426 * front panel mic (mic 2)
10428 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10429 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10430 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10431 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10432 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10433 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10434 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10438 * Set up output mixers (0x0c - 0x0e)
10440 /* set vol=0 to output mixers */
10441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10442 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10443 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10445 /* set up input amps for analog loopback */
10446 /* Amp Indices: DAC = 0, mixer = 1 */
10447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10451 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10452 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10454 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10456 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10458 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10459 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10461 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10465 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10466 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10467 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10468 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10470 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10471 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10472 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10473 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10474 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10475 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10478 /* FIXME: use matrix-type input source selection */
10479 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10480 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10482 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10483 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10484 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10496 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10501 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10503 * Unmute ADC0-2 and set the default input to mic-in
10505 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10507 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10509 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10512 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10514 * Note: PASD motherboards uses the Line In 2 as the input for front
10515 * panel mic (mic 2)
10517 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10527 * Set up output mixers (0x0c - 0x0e)
10529 /* set vol=0 to output mixers */
10530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10534 /* set up input amps for analog loopback */
10535 /* Amp Indices: DAC = 0, mixer = 1 */
10536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10539 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10540 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10544 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10545 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10546 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10547 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10548 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10549 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10550 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10552 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10553 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10555 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10556 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10558 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10559 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10560 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10561 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10562 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10563 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10565 /* FIXME: use matrix-type input source selection */
10566 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10567 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10568 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10573 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10577 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10580 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10581 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10582 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10584 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10589 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10592 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10597 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10601 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10603 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10604 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10605 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10606 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10610 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10615 #ifdef CONFIG_SND_HDA_POWER_SAVE
10616 #define alc262_loopbacks alc880_loopbacks
10619 /* pcm configuration: identiacal with ALC880 */
10620 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10621 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10622 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10623 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10626 * BIOS auto configuration
10628 static int alc262_parse_auto_config(struct hda_codec *codec)
10630 struct alc_spec *spec = codec->spec;
10632 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10634 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10638 if (!spec->autocfg.line_outs) {
10639 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10640 spec->multiout.max_channels = 2;
10641 spec->no_analog = 1;
10644 return 0; /* can't find valid BIOS pin config */
10646 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10649 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10653 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10656 if (spec->autocfg.dig_outs) {
10657 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10658 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10660 if (spec->autocfg.dig_in_pin)
10661 spec->dig_in_nid = ALC262_DIGIN_NID;
10663 if (spec->kctls.list)
10664 add_mixer(spec, spec->kctls.list);
10666 add_verb(spec, alc262_volume_init_verbs);
10667 spec->num_mux_defs = 1;
10668 spec->input_mux = &spec->private_imux[0];
10670 err = alc_auto_add_mic_boost(codec);
10674 store_pin_configs(codec);
10678 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10679 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10680 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10681 #define alc262_auto_init_input_src alc882_auto_init_input_src
10684 /* init callback for auto-configuration model -- overriding the default init */
10685 static void alc262_auto_init(struct hda_codec *codec)
10687 struct alc_spec *spec = codec->spec;
10688 alc262_auto_init_multi_out(codec);
10689 alc262_auto_init_hp_out(codec);
10690 alc262_auto_init_analog_input(codec);
10691 alc262_auto_init_input_src(codec);
10692 if (spec->unsol_event)
10693 alc_inithook(codec);
10697 * configuration and preset
10699 static const char *alc262_models[ALC262_MODEL_LAST] = {
10700 [ALC262_BASIC] = "basic",
10701 [ALC262_HIPPO] = "hippo",
10702 [ALC262_HIPPO_1] = "hippo_1",
10703 [ALC262_FUJITSU] = "fujitsu",
10704 [ALC262_HP_BPC] = "hp-bpc",
10705 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10706 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10707 [ALC262_HP_RP5700] = "hp-rp5700",
10708 [ALC262_BENQ_ED8] = "benq",
10709 [ALC262_BENQ_T31] = "benq-t31",
10710 [ALC262_SONY_ASSAMD] = "sony-assamd",
10711 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10712 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10713 [ALC262_ULTRA] = "ultra",
10714 [ALC262_LENOVO_3000] = "lenovo-3000",
10715 [ALC262_NEC] = "nec",
10716 [ALC262_TYAN] = "tyan",
10717 [ALC262_AUTO] = "auto",
10720 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10721 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10722 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10723 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10725 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10727 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10728 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10729 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10730 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10731 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10732 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10733 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10734 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10735 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10736 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10737 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10738 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10739 ALC262_HP_TC_T5735),
10740 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10741 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10742 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10743 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10744 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10745 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10746 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10747 ALC262_SONY_ASSAMD),
10748 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10749 ALC262_TOSHIBA_RX1),
10750 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10751 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10752 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10753 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10754 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10756 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10757 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10758 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10759 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10760 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10764 static struct alc_config_preset alc262_presets[] = {
10766 .mixers = { alc262_base_mixer },
10767 .init_verbs = { alc262_init_verbs },
10768 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10769 .dac_nids = alc262_dac_nids,
10771 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10772 .channel_mode = alc262_modes,
10773 .input_mux = &alc262_capture_source,
10776 .mixers = { alc262_base_mixer },
10777 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10778 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10779 .dac_nids = alc262_dac_nids,
10781 .dig_out_nid = ALC262_DIGOUT_NID,
10782 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10783 .channel_mode = alc262_modes,
10784 .input_mux = &alc262_capture_source,
10785 .unsol_event = alc262_hippo_unsol_event,
10786 .init_hook = alc262_hippo_automute,
10788 [ALC262_HIPPO_1] = {
10789 .mixers = { alc262_hippo1_mixer },
10790 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10792 .dac_nids = alc262_dac_nids,
10794 .dig_out_nid = ALC262_DIGOUT_NID,
10795 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10796 .channel_mode = alc262_modes,
10797 .input_mux = &alc262_capture_source,
10798 .unsol_event = alc262_hippo1_unsol_event,
10799 .init_hook = alc262_hippo1_automute,
10801 [ALC262_FUJITSU] = {
10802 .mixers = { alc262_fujitsu_mixer },
10803 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10804 alc262_fujitsu_unsol_verbs },
10805 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10806 .dac_nids = alc262_dac_nids,
10808 .dig_out_nid = ALC262_DIGOUT_NID,
10809 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10810 .channel_mode = alc262_modes,
10811 .input_mux = &alc262_fujitsu_capture_source,
10812 .unsol_event = alc262_fujitsu_unsol_event,
10813 .init_hook = alc262_fujitsu_init_hook,
10815 [ALC262_HP_BPC] = {
10816 .mixers = { alc262_HP_BPC_mixer },
10817 .init_verbs = { alc262_HP_BPC_init_verbs },
10818 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10819 .dac_nids = alc262_dac_nids,
10821 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10822 .channel_mode = alc262_modes,
10823 .input_mux = &alc262_HP_capture_source,
10824 .unsol_event = alc262_hp_bpc_unsol_event,
10825 .init_hook = alc262_hp_bpc_automute,
10827 [ALC262_HP_BPC_D7000_WF] = {
10828 .mixers = { alc262_HP_BPC_WildWest_mixer },
10829 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10830 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10831 .dac_nids = alc262_dac_nids,
10833 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10834 .channel_mode = alc262_modes,
10835 .input_mux = &alc262_HP_D7000_capture_source,
10836 .unsol_event = alc262_hp_wildwest_unsol_event,
10837 .init_hook = alc262_hp_wildwest_automute,
10839 [ALC262_HP_BPC_D7000_WL] = {
10840 .mixers = { alc262_HP_BPC_WildWest_mixer,
10841 alc262_HP_BPC_WildWest_option_mixer },
10842 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10843 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10844 .dac_nids = alc262_dac_nids,
10846 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10847 .channel_mode = alc262_modes,
10848 .input_mux = &alc262_HP_D7000_capture_source,
10849 .unsol_event = alc262_hp_wildwest_unsol_event,
10850 .init_hook = alc262_hp_wildwest_automute,
10852 [ALC262_HP_TC_T5735] = {
10853 .mixers = { alc262_hp_t5735_mixer },
10854 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10855 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10856 .dac_nids = alc262_dac_nids,
10858 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10859 .channel_mode = alc262_modes,
10860 .input_mux = &alc262_capture_source,
10861 .unsol_event = alc262_hp_t5735_unsol_event,
10862 .init_hook = alc262_hp_t5735_init_hook,
10864 [ALC262_HP_RP5700] = {
10865 .mixers = { alc262_hp_rp5700_mixer },
10866 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10867 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10868 .dac_nids = alc262_dac_nids,
10869 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10870 .channel_mode = alc262_modes,
10871 .input_mux = &alc262_hp_rp5700_capture_source,
10873 [ALC262_BENQ_ED8] = {
10874 .mixers = { alc262_base_mixer },
10875 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10876 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10877 .dac_nids = alc262_dac_nids,
10879 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10880 .channel_mode = alc262_modes,
10881 .input_mux = &alc262_capture_source,
10883 [ALC262_SONY_ASSAMD] = {
10884 .mixers = { alc262_sony_mixer },
10885 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10886 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10887 .dac_nids = alc262_dac_nids,
10889 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10890 .channel_mode = alc262_modes,
10891 .input_mux = &alc262_capture_source,
10892 .unsol_event = alc262_hippo_unsol_event,
10893 .init_hook = alc262_hippo_automute,
10895 [ALC262_BENQ_T31] = {
10896 .mixers = { alc262_benq_t31_mixer },
10897 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10898 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10899 .dac_nids = alc262_dac_nids,
10901 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10902 .channel_mode = alc262_modes,
10903 .input_mux = &alc262_capture_source,
10904 .unsol_event = alc262_hippo_unsol_event,
10905 .init_hook = alc262_hippo_automute,
10908 .mixers = { alc262_ultra_mixer },
10909 .cap_mixer = alc262_ultra_capture_mixer,
10910 .init_verbs = { alc262_ultra_verbs },
10911 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10912 .dac_nids = alc262_dac_nids,
10913 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10914 .channel_mode = alc262_modes,
10915 .input_mux = &alc262_ultra_capture_source,
10916 .adc_nids = alc262_adc_nids, /* ADC0 */
10917 .capsrc_nids = alc262_capsrc_nids,
10918 .num_adc_nids = 1, /* single ADC */
10919 .unsol_event = alc262_ultra_unsol_event,
10920 .init_hook = alc262_ultra_automute,
10922 [ALC262_LENOVO_3000] = {
10923 .mixers = { alc262_lenovo_3000_mixer },
10924 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10925 alc262_lenovo_3000_unsol_verbs },
10926 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10927 .dac_nids = alc262_dac_nids,
10929 .dig_out_nid = ALC262_DIGOUT_NID,
10930 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10931 .channel_mode = alc262_modes,
10932 .input_mux = &alc262_fujitsu_capture_source,
10933 .unsol_event = alc262_lenovo_3000_unsol_event,
10936 .mixers = { alc262_nec_mixer },
10937 .init_verbs = { alc262_nec_verbs },
10938 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10939 .dac_nids = alc262_dac_nids,
10941 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10942 .channel_mode = alc262_modes,
10943 .input_mux = &alc262_capture_source,
10945 [ALC262_TOSHIBA_S06] = {
10946 .mixers = { alc262_toshiba_s06_mixer },
10947 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10948 alc262_eapd_verbs },
10949 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10950 .capsrc_nids = alc262_dmic_capsrc_nids,
10951 .dac_nids = alc262_dac_nids,
10952 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10953 .dig_out_nid = ALC262_DIGOUT_NID,
10954 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10955 .channel_mode = alc262_modes,
10956 .input_mux = &alc262_dmic_capture_source,
10957 .unsol_event = alc262_toshiba_s06_unsol_event,
10958 .init_hook = alc262_toshiba_s06_init_hook,
10960 [ALC262_TOSHIBA_RX1] = {
10961 .mixers = { alc262_toshiba_rx1_mixer },
10962 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10963 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10964 .dac_nids = alc262_dac_nids,
10966 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10967 .channel_mode = alc262_modes,
10968 .input_mux = &alc262_capture_source,
10969 .unsol_event = alc262_hippo_unsol_event,
10970 .init_hook = alc262_hippo_automute,
10973 .mixers = { alc262_tyan_mixer },
10974 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
10975 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10976 .dac_nids = alc262_dac_nids,
10978 .dig_out_nid = ALC262_DIGOUT_NID,
10979 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10980 .channel_mode = alc262_modes,
10981 .input_mux = &alc262_capture_source,
10982 .unsol_event = alc262_tyan_unsol_event,
10983 .init_hook = alc262_tyan_automute,
10987 static int patch_alc262(struct hda_codec *codec)
10989 struct alc_spec *spec;
10993 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10997 codec->spec = spec;
10999 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11004 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11005 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11006 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11007 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11011 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11013 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11017 if (board_config < 0) {
11018 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11019 "trying auto-probe from BIOS...\n");
11020 board_config = ALC262_AUTO;
11023 if (board_config == ALC262_AUTO) {
11024 /* automatic parse from the BIOS config */
11025 err = alc262_parse_auto_config(codec);
11031 "hda_codec: Cannot set up configuration "
11032 "from BIOS. Using base mode...\n");
11033 board_config = ALC262_BASIC;
11037 err = snd_hda_attach_beep_device(codec, 0x1);
11043 if (board_config != ALC262_AUTO)
11044 setup_preset(spec, &alc262_presets[board_config]);
11046 spec->stream_name_analog = "ALC262 Analog";
11047 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11048 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11050 spec->stream_name_digital = "ALC262 Digital";
11051 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11052 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11054 spec->capture_style = CAPT_MIX;
11055 if (!spec->adc_nids && spec->input_mux) {
11056 /* check whether NID 0x07 is valid */
11057 unsigned int wcap = get_wcaps(codec, 0x07);
11060 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11061 if (wcap != AC_WID_AUD_IN) {
11062 spec->adc_nids = alc262_adc_nids_alt;
11063 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11064 spec->capsrc_nids = alc262_capsrc_nids_alt;
11066 spec->adc_nids = alc262_adc_nids;
11067 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11068 spec->capsrc_nids = alc262_capsrc_nids;
11071 if (!spec->cap_mixer && !spec->no_analog)
11072 set_capture_mixer(spec);
11073 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11075 spec->vmaster_nid = 0x0c;
11077 codec->patch_ops = alc_patch_ops;
11078 if (board_config == ALC262_AUTO)
11079 spec->init_hook = alc262_auto_init;
11080 #ifdef CONFIG_SND_HDA_POWER_SAVE
11081 if (!spec->loopback.amplist)
11082 spec->loopback.amplist = alc262_loopbacks;
11084 codec->proc_widget_hook = print_realtek_coef;
11090 * ALC268 channel source setting (2 channel)
11092 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11093 #define alc268_modes alc260_modes
11095 static hda_nid_t alc268_dac_nids[2] = {
11100 static hda_nid_t alc268_adc_nids[2] = {
11105 static hda_nid_t alc268_adc_nids_alt[1] = {
11110 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11112 static struct snd_kcontrol_new alc268_base_mixer[] = {
11113 /* output mixer control */
11114 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11115 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11116 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11118 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11119 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11120 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11124 /* bind Beep switches of both NID 0x0f and 0x10 */
11125 static struct hda_bind_ctls alc268_bind_beep_sw = {
11126 .ops = &snd_hda_bind_sw,
11128 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11129 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11134 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11135 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11136 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11140 static struct hda_verb alc268_eapd_verbs[] = {
11141 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11142 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11146 /* Toshiba specific */
11147 #define alc268_toshiba_automute alc262_hippo_automute
11149 static struct hda_verb alc268_toshiba_verbs[] = {
11150 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11154 static struct hda_input_mux alc268_acer_lc_capture_source = {
11162 /* Acer specific */
11163 /* bind volumes of both NID 0x02 and 0x03 */
11164 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11165 .ops = &snd_hda_bind_vol,
11167 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11168 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11173 /* mute/unmute internal speaker according to the hp jack and mute state */
11174 static void alc268_acer_automute(struct hda_codec *codec, int force)
11176 struct alc_spec *spec = codec->spec;
11179 if (force || !spec->sense_updated) {
11180 unsigned int present;
11181 present = snd_hda_codec_read(codec, 0x14, 0,
11182 AC_VERB_GET_PIN_SENSE, 0);
11183 spec->jack_present = (present & 0x80000000) != 0;
11184 spec->sense_updated = 1;
11186 if (spec->jack_present)
11187 mute = HDA_AMP_MUTE; /* mute internal speaker */
11188 else /* unmute internal speaker if necessary */
11189 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11190 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11191 HDA_AMP_MUTE, mute);
11195 /* bind hp and internal speaker mute (with plug check) */
11196 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11197 struct snd_ctl_elem_value *ucontrol)
11199 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11200 long *valp = ucontrol->value.integer.value;
11203 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11205 valp[0] ? 0 : HDA_AMP_MUTE);
11206 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11208 valp[1] ? 0 : HDA_AMP_MUTE);
11210 alc268_acer_automute(codec, 0);
11214 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11215 /* output mixer control */
11216 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11219 .name = "Master Playback Switch",
11220 .info = snd_hda_mixer_amp_switch_info,
11221 .get = snd_hda_mixer_amp_switch_get,
11222 .put = alc268_acer_master_sw_put,
11223 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11225 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11229 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11230 /* output mixer control */
11231 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11234 .name = "Master Playback Switch",
11235 .info = snd_hda_mixer_amp_switch_info,
11236 .get = snd_hda_mixer_amp_switch_get,
11237 .put = alc268_acer_master_sw_put,
11238 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11240 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11241 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11242 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11246 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11247 /* output mixer control */
11248 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11250 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11251 .name = "Master Playback Switch",
11252 .info = snd_hda_mixer_amp_switch_info,
11253 .get = snd_hda_mixer_amp_switch_get,
11254 .put = alc268_acer_master_sw_put,
11255 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11257 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11258 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11262 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11263 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11265 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11266 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11267 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11272 static struct hda_verb alc268_acer_verbs[] = {
11273 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11274 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11276 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11278 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11279 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11283 /* unsolicited event for HP jack sensing */
11284 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11287 if ((res >> 26) != ALC880_HP_EVENT)
11289 alc268_toshiba_automute(codec);
11292 static void alc268_acer_unsol_event(struct hda_codec *codec,
11295 if ((res >> 26) != ALC880_HP_EVENT)
11297 alc268_acer_automute(codec, 1);
11300 static void alc268_acer_init_hook(struct hda_codec *codec)
11302 alc268_acer_automute(codec, 1);
11305 /* toggle speaker-output according to the hp-jack state */
11306 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11308 unsigned int present;
11309 unsigned char bits;
11311 present = snd_hda_codec_read(codec, 0x15, 0,
11312 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11313 bits = present ? AMP_IN_MUTE(0) : 0;
11314 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11315 AMP_IN_MUTE(0), bits);
11316 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11317 AMP_IN_MUTE(0), bits);
11321 static void alc268_acer_mic_automute(struct hda_codec *codec)
11323 unsigned int present;
11325 present = snd_hda_codec_read(codec, 0x18, 0,
11326 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11327 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11328 present ? 0x0 : 0x6);
11331 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11334 if ((res >> 26) == ALC880_HP_EVENT)
11335 alc268_aspire_one_speaker_automute(codec);
11336 if ((res >> 26) == ALC880_MIC_EVENT)
11337 alc268_acer_mic_automute(codec);
11340 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11342 alc268_aspire_one_speaker_automute(codec);
11343 alc268_acer_mic_automute(codec);
11346 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11347 /* output mixer control */
11348 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11349 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11352 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11353 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11357 static struct hda_verb alc268_dell_verbs[] = {
11358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11360 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11364 /* mute/unmute internal speaker according to the hp jack and mute state */
11365 static void alc268_dell_automute(struct hda_codec *codec)
11367 unsigned int present;
11370 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11371 if (present & 0x80000000)
11372 mute = HDA_AMP_MUTE;
11374 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11375 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11376 HDA_AMP_MUTE, mute);
11379 static void alc268_dell_unsol_event(struct hda_codec *codec,
11382 if ((res >> 26) != ALC880_HP_EVENT)
11384 alc268_dell_automute(codec);
11387 #define alc268_dell_init_hook alc268_dell_automute
11389 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11390 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11391 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11392 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11394 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11395 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11396 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11397 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11401 static struct hda_verb alc267_quanta_il1_verbs[] = {
11402 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11403 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11407 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11409 unsigned int present;
11411 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11412 & AC_PINSENSE_PRESENCE;
11413 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11414 present ? 0 : PIN_OUT);
11417 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11419 unsigned int present;
11421 present = snd_hda_codec_read(codec, 0x18, 0,
11422 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11423 snd_hda_codec_write(codec, 0x23, 0,
11424 AC_VERB_SET_CONNECT_SEL,
11425 present ? 0x00 : 0x01);
11428 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11430 alc267_quanta_il1_hp_automute(codec);
11431 alc267_quanta_il1_mic_automute(codec);
11434 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11437 switch (res >> 26) {
11438 case ALC880_HP_EVENT:
11439 alc267_quanta_il1_hp_automute(codec);
11441 case ALC880_MIC_EVENT:
11442 alc267_quanta_il1_mic_automute(codec);
11448 * generic initialization of ADC, input mixers and output mixers
11450 static struct hda_verb alc268_base_init_verbs[] = {
11451 /* Unmute DAC0-1 and set vol = 0 */
11452 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11453 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11456 * Set up output mixers (0x0c - 0x0e)
11458 /* set vol=0 to output mixers */
11459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11460 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11462 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11463 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11467 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11468 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11469 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11470 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11471 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11472 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11474 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11476 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11477 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11478 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11480 /* set PCBEEP vol = 0, mute connections */
11481 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11482 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11483 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11485 /* Unmute Selector 23h,24h and set the default input to mic-in */
11487 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11489 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11496 * generic initialization of ADC, input mixers and output mixers
11498 static struct hda_verb alc268_volume_init_verbs[] = {
11499 /* set output DAC */
11500 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11501 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11503 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11504 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11505 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11506 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11507 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11509 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11510 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11511 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11513 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11514 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11516 /* set PCBEEP vol = 0, mute connections */
11517 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11518 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11519 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11524 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11525 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11526 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11528 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11529 /* The multiple "Capture Source" controls confuse alsamixer
11530 * So call somewhat different..
11532 /* .name = "Capture Source", */
11533 .name = "Input Source",
11535 .info = alc_mux_enum_info,
11536 .get = alc_mux_enum_get,
11537 .put = alc_mux_enum_put,
11542 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11543 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11544 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11545 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11546 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11548 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11549 /* The multiple "Capture Source" controls confuse alsamixer
11550 * So call somewhat different..
11552 /* .name = "Capture Source", */
11553 .name = "Input Source",
11555 .info = alc_mux_enum_info,
11556 .get = alc_mux_enum_get,
11557 .put = alc_mux_enum_put,
11562 static struct hda_input_mux alc268_capture_source = {
11566 { "Front Mic", 0x1 },
11572 static struct hda_input_mux alc268_acer_capture_source = {
11576 { "Internal Mic", 0x1 },
11581 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11585 { "Internal Mic", 0x6 },
11590 #ifdef CONFIG_SND_DEBUG
11591 static struct snd_kcontrol_new alc268_test_mixer[] = {
11592 /* Volume widgets */
11593 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11594 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11595 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11596 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11597 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11598 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11599 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11600 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11601 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11602 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11603 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11604 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11605 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11606 /* The below appears problematic on some hardwares */
11607 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11608 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11609 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11610 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11611 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11613 /* Modes for retasking pin widgets */
11614 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11615 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11616 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11617 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11619 /* Controls for GPIO pins, assuming they are configured as outputs */
11620 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11621 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11622 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11623 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11625 /* Switches to allow the digital SPDIF output pin to be enabled.
11626 * The ALC268 does not have an SPDIF input.
11628 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11630 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11631 * this output to turn on an external amplifier.
11633 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11634 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11640 /* create input playback/capture controls for the given pin */
11641 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11642 const char *ctlname, int idx)
11647 sprintf(name, "%s Playback Volume", ctlname);
11649 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11650 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11654 } else if (nid == 0x15) {
11655 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11656 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11662 sprintf(name, "%s Playback Switch", ctlname);
11663 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11664 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11670 /* add playback controls from the parsed DAC table */
11671 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11672 const struct auto_pin_cfg *cfg)
11677 spec->multiout.num_dacs = 2; /* only use one dac */
11678 spec->multiout.dac_nids = spec->private_dac_nids;
11679 spec->multiout.dac_nids[0] = 2;
11680 spec->multiout.dac_nids[1] = 3;
11682 nid = cfg->line_out_pins[0];
11684 alc268_new_analog_output(spec, nid, "Front", 0);
11686 nid = cfg->speaker_pins[0];
11688 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11689 "Speaker Playback Volume",
11690 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11694 nid = cfg->hp_pins[0];
11696 alc268_new_analog_output(spec, nid, "Headphone", 0);
11698 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11700 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11701 "Mono Playback Switch",
11702 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11709 /* create playback/capture controls for input pins */
11710 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11711 const struct auto_pin_cfg *cfg)
11713 struct hda_input_mux *imux = &spec->private_imux[0];
11716 for (i = 0; i < AUTO_PIN_LAST; i++) {
11717 switch(cfg->input_pins[i]) {
11719 idx1 = 0; /* Mic 1 */
11722 idx1 = 1; /* Mic 2 */
11725 idx1 = 2; /* Line In */
11732 idx1 = 6; /* digital mics */
11737 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11738 imux->items[imux->num_items].index = idx1;
11744 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11746 struct alc_spec *spec = codec->spec;
11747 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11748 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11749 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11750 unsigned int dac_vol1, dac_vol2;
11753 snd_hda_codec_write(codec, speaker_nid, 0,
11754 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11755 snd_hda_codec_write(codec, 0x0f, 0,
11756 AC_VERB_SET_AMP_GAIN_MUTE,
11758 snd_hda_codec_write(codec, 0x10, 0,
11759 AC_VERB_SET_AMP_GAIN_MUTE,
11762 snd_hda_codec_write(codec, 0x0f, 0,
11763 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11764 snd_hda_codec_write(codec, 0x10, 0,
11765 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11768 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11769 if (line_nid == 0x14)
11770 dac_vol2 = AMP_OUT_ZERO;
11771 else if (line_nid == 0x15)
11772 dac_vol1 = AMP_OUT_ZERO;
11773 if (hp_nid == 0x14)
11774 dac_vol2 = AMP_OUT_ZERO;
11775 else if (hp_nid == 0x15)
11776 dac_vol1 = AMP_OUT_ZERO;
11777 if (line_nid != 0x16 || hp_nid != 0x16 ||
11778 spec->autocfg.line_out_pins[1] != 0x16 ||
11779 spec->autocfg.line_out_pins[2] != 0x16)
11780 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11782 snd_hda_codec_write(codec, 0x02, 0,
11783 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11784 snd_hda_codec_write(codec, 0x03, 0,
11785 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11788 /* pcm configuration: identiacal with ALC880 */
11789 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11790 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11791 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11792 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11795 * BIOS auto configuration
11797 static int alc268_parse_auto_config(struct hda_codec *codec)
11799 struct alc_spec *spec = codec->spec;
11801 static hda_nid_t alc268_ignore[] = { 0 };
11803 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11807 if (!spec->autocfg.line_outs)
11808 return 0; /* can't find valid BIOS pin config */
11810 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11813 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11817 spec->multiout.max_channels = 2;
11819 /* digital only support output */
11820 if (spec->autocfg.dig_outs)
11821 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11823 if (spec->kctls.list)
11824 add_mixer(spec, spec->kctls.list);
11826 if (spec->autocfg.speaker_pins[0] != 0x1d)
11827 add_mixer(spec, alc268_beep_mixer);
11829 add_verb(spec, alc268_volume_init_verbs);
11830 spec->num_mux_defs = 1;
11831 spec->input_mux = &spec->private_imux[0];
11833 err = alc_auto_add_mic_boost(codec);
11837 store_pin_configs(codec);
11841 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11842 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11843 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11845 /* init callback for auto-configuration model -- overriding the default init */
11846 static void alc268_auto_init(struct hda_codec *codec)
11848 struct alc_spec *spec = codec->spec;
11849 alc268_auto_init_multi_out(codec);
11850 alc268_auto_init_hp_out(codec);
11851 alc268_auto_init_mono_speaker_out(codec);
11852 alc268_auto_init_analog_input(codec);
11853 if (spec->unsol_event)
11854 alc_inithook(codec);
11858 * configuration and preset
11860 static const char *alc268_models[ALC268_MODEL_LAST] = {
11861 [ALC267_QUANTA_IL1] = "quanta-il1",
11862 [ALC268_3ST] = "3stack",
11863 [ALC268_TOSHIBA] = "toshiba",
11864 [ALC268_ACER] = "acer",
11865 [ALC268_ACER_DMIC] = "acer-dmic",
11866 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11867 [ALC268_DELL] = "dell",
11868 [ALC268_ZEPTO] = "zepto",
11869 #ifdef CONFIG_SND_DEBUG
11870 [ALC268_TEST] = "test",
11872 [ALC268_AUTO] = "auto",
11875 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11876 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11877 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11878 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11879 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11880 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11881 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11882 ALC268_ACER_ASPIRE_ONE),
11883 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11884 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11885 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11886 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11887 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11888 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11889 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11890 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11891 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11892 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11893 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11897 static struct alc_config_preset alc268_presets[] = {
11898 [ALC267_QUANTA_IL1] = {
11899 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
11900 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11901 alc267_quanta_il1_verbs },
11902 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11903 .dac_nids = alc268_dac_nids,
11904 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11905 .adc_nids = alc268_adc_nids_alt,
11907 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11908 .channel_mode = alc268_modes,
11909 .input_mux = &alc268_capture_source,
11910 .unsol_event = alc267_quanta_il1_unsol_event,
11911 .init_hook = alc267_quanta_il1_automute,
11914 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11915 alc268_beep_mixer },
11916 .init_verbs = { alc268_base_init_verbs },
11917 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11918 .dac_nids = alc268_dac_nids,
11919 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11920 .adc_nids = alc268_adc_nids_alt,
11921 .capsrc_nids = alc268_capsrc_nids,
11923 .dig_out_nid = ALC268_DIGOUT_NID,
11924 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11925 .channel_mode = alc268_modes,
11926 .input_mux = &alc268_capture_source,
11928 [ALC268_TOSHIBA] = {
11929 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11930 alc268_beep_mixer },
11931 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11932 alc268_toshiba_verbs },
11933 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11934 .dac_nids = alc268_dac_nids,
11935 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11936 .adc_nids = alc268_adc_nids_alt,
11937 .capsrc_nids = alc268_capsrc_nids,
11939 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11940 .channel_mode = alc268_modes,
11941 .input_mux = &alc268_capture_source,
11942 .unsol_event = alc268_toshiba_unsol_event,
11943 .init_hook = alc268_toshiba_automute,
11946 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11947 alc268_beep_mixer },
11948 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11949 alc268_acer_verbs },
11950 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11951 .dac_nids = alc268_dac_nids,
11952 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11953 .adc_nids = alc268_adc_nids_alt,
11954 .capsrc_nids = alc268_capsrc_nids,
11956 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11957 .channel_mode = alc268_modes,
11958 .input_mux = &alc268_acer_capture_source,
11959 .unsol_event = alc268_acer_unsol_event,
11960 .init_hook = alc268_acer_init_hook,
11962 [ALC268_ACER_DMIC] = {
11963 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11964 alc268_beep_mixer },
11965 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11966 alc268_acer_verbs },
11967 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11968 .dac_nids = alc268_dac_nids,
11969 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11970 .adc_nids = alc268_adc_nids_alt,
11971 .capsrc_nids = alc268_capsrc_nids,
11973 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11974 .channel_mode = alc268_modes,
11975 .input_mux = &alc268_acer_dmic_capture_source,
11976 .unsol_event = alc268_acer_unsol_event,
11977 .init_hook = alc268_acer_init_hook,
11979 [ALC268_ACER_ASPIRE_ONE] = {
11980 .mixers = { alc268_acer_aspire_one_mixer,
11982 alc268_capture_alt_mixer },
11983 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11984 alc268_acer_aspire_one_verbs },
11985 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11986 .dac_nids = alc268_dac_nids,
11987 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11988 .adc_nids = alc268_adc_nids_alt,
11989 .capsrc_nids = alc268_capsrc_nids,
11991 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11992 .channel_mode = alc268_modes,
11993 .input_mux = &alc268_acer_lc_capture_source,
11994 .unsol_event = alc268_acer_lc_unsol_event,
11995 .init_hook = alc268_acer_lc_init_hook,
11998 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11999 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12000 alc268_dell_verbs },
12001 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12002 .dac_nids = alc268_dac_nids,
12004 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12005 .channel_mode = alc268_modes,
12006 .unsol_event = alc268_dell_unsol_event,
12007 .init_hook = alc268_dell_init_hook,
12008 .input_mux = &alc268_capture_source,
12011 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12012 alc268_beep_mixer },
12013 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12014 alc268_toshiba_verbs },
12015 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12016 .dac_nids = alc268_dac_nids,
12017 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12018 .adc_nids = alc268_adc_nids_alt,
12019 .capsrc_nids = alc268_capsrc_nids,
12021 .dig_out_nid = ALC268_DIGOUT_NID,
12022 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12023 .channel_mode = alc268_modes,
12024 .input_mux = &alc268_capture_source,
12025 .unsol_event = alc268_toshiba_unsol_event,
12026 .init_hook = alc268_toshiba_automute
12028 #ifdef CONFIG_SND_DEBUG
12030 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12031 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12032 alc268_volume_init_verbs },
12033 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12034 .dac_nids = alc268_dac_nids,
12035 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12036 .adc_nids = alc268_adc_nids_alt,
12037 .capsrc_nids = alc268_capsrc_nids,
12039 .dig_out_nid = ALC268_DIGOUT_NID,
12040 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12041 .channel_mode = alc268_modes,
12042 .input_mux = &alc268_capture_source,
12047 static int patch_alc268(struct hda_codec *codec)
12049 struct alc_spec *spec;
12051 int i, has_beep, err;
12053 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12057 codec->spec = spec;
12059 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12063 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12064 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12065 "trying auto-probe from BIOS...\n");
12066 board_config = ALC268_AUTO;
12069 if (board_config == ALC268_AUTO) {
12070 /* automatic parse from the BIOS config */
12071 err = alc268_parse_auto_config(codec);
12077 "hda_codec: Cannot set up configuration "
12078 "from BIOS. Using base mode...\n");
12079 board_config = ALC268_3ST;
12083 err = snd_hda_attach_beep_device(codec, 0x1);
12089 if (board_config != ALC268_AUTO)
12090 setup_preset(spec, &alc268_presets[board_config]);
12092 if (codec->vendor_id == 0x10ec0267) {
12093 spec->stream_name_analog = "ALC267 Analog";
12094 spec->stream_name_digital = "ALC267 Digital";
12096 spec->stream_name_analog = "ALC268 Analog";
12097 spec->stream_name_digital = "ALC268 Digital";
12100 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12101 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12102 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12104 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12107 for (i = 0; i < spec->num_mixers; i++) {
12108 if (spec->mixers[i] == alc268_beep_mixer) {
12115 err = snd_hda_attach_beep_device(codec, 0x1);
12120 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12121 /* override the amp caps for beep generator */
12122 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12123 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12124 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12125 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12126 (0 << AC_AMPCAP_MUTE_SHIFT));
12129 if (!spec->adc_nids && spec->input_mux) {
12130 /* check whether NID 0x07 is valid */
12131 unsigned int wcap = get_wcaps(codec, 0x07);
12135 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12136 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12137 spec->adc_nids = alc268_adc_nids_alt;
12138 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12139 add_mixer(spec, alc268_capture_alt_mixer);
12141 spec->adc_nids = alc268_adc_nids;
12142 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12143 add_mixer(spec, alc268_capture_mixer);
12145 spec->capsrc_nids = alc268_capsrc_nids;
12146 /* set default input source */
12147 for (i = 0; i < spec->num_adc_nids; i++)
12148 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12149 0, AC_VERB_SET_CONNECT_SEL,
12150 spec->input_mux->items[0].index);
12153 spec->vmaster_nid = 0x02;
12155 codec->patch_ops = alc_patch_ops;
12156 if (board_config == ALC268_AUTO)
12157 spec->init_hook = alc268_auto_init;
12159 codec->proc_widget_hook = print_realtek_coef;
12165 * ALC269 channel source setting (2 channel)
12167 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12169 #define alc269_dac_nids alc260_dac_nids
12171 static hda_nid_t alc269_adc_nids[1] = {
12176 static hda_nid_t alc269_capsrc_nids[1] = {
12180 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12184 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12192 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12200 #define alc269_modes alc260_modes
12201 #define alc269_capture_source alc880_lg_lw_capture_source
12203 static struct snd_kcontrol_new alc269_base_mixer[] = {
12204 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12205 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12207 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12210 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12211 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12212 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12213 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12215 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12219 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12220 /* output mixer control */
12221 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12223 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12224 .name = "Master Playback Switch",
12225 .info = snd_hda_mixer_amp_switch_info,
12226 .get = snd_hda_mixer_amp_switch_get,
12227 .put = alc268_acer_master_sw_put,
12228 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12232 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12233 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12234 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12235 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12239 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12240 /* output mixer control */
12241 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12243 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12244 .name = "Master Playback Switch",
12245 .info = snd_hda_mixer_amp_switch_info,
12246 .get = snd_hda_mixer_amp_switch_get,
12247 .put = alc268_acer_master_sw_put,
12248 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12253 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12254 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12255 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12256 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12257 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12258 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12262 /* bind volumes of both NID 0x0c and 0x0d */
12263 static struct hda_bind_ctls alc269_epc_bind_vol = {
12264 .ops = &snd_hda_bind_vol,
12266 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12267 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12272 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12273 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12274 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12275 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12279 /* capture mixer elements */
12280 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12281 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12282 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12283 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12288 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12289 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12291 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12295 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12296 {0x15, 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 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12301 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12305 static struct hda_verb alc269_lifebook_verbs[] = {
12306 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12307 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12308 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12310 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12311 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12312 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12313 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12314 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12315 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12319 /* toggle speaker-output according to the hp-jack state */
12320 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12322 unsigned int present;
12323 unsigned char bits;
12325 present = snd_hda_codec_read(codec, 0x15, 0,
12326 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12327 bits = present ? AMP_IN_MUTE(0) : 0;
12328 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12329 AMP_IN_MUTE(0), bits);
12330 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12331 AMP_IN_MUTE(0), bits);
12333 snd_hda_codec_write(codec, 0x20, 0,
12334 AC_VERB_SET_COEF_INDEX, 0x0c);
12335 snd_hda_codec_write(codec, 0x20, 0,
12336 AC_VERB_SET_PROC_COEF, 0x680);
12338 snd_hda_codec_write(codec, 0x20, 0,
12339 AC_VERB_SET_COEF_INDEX, 0x0c);
12340 snd_hda_codec_write(codec, 0x20, 0,
12341 AC_VERB_SET_PROC_COEF, 0x480);
12344 /* toggle speaker-output according to the hp-jacks state */
12345 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12347 unsigned int present;
12348 unsigned char bits;
12350 /* Check laptop headphone socket */
12351 present = snd_hda_codec_read(codec, 0x15, 0,
12352 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12354 /* Check port replicator headphone socket */
12355 present |= snd_hda_codec_read(codec, 0x1a, 0,
12356 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12358 bits = present ? AMP_IN_MUTE(0) : 0;
12359 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12360 AMP_IN_MUTE(0), bits);
12361 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12362 AMP_IN_MUTE(0), bits);
12364 snd_hda_codec_write(codec, 0x20, 0,
12365 AC_VERB_SET_COEF_INDEX, 0x0c);
12366 snd_hda_codec_write(codec, 0x20, 0,
12367 AC_VERB_SET_PROC_COEF, 0x680);
12369 snd_hda_codec_write(codec, 0x20, 0,
12370 AC_VERB_SET_COEF_INDEX, 0x0c);
12371 snd_hda_codec_write(codec, 0x20, 0,
12372 AC_VERB_SET_PROC_COEF, 0x480);
12375 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12377 unsigned int present;
12379 present = snd_hda_codec_read(codec, 0x18, 0,
12380 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12381 snd_hda_codec_write(codec, 0x23, 0,
12382 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12385 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12387 unsigned int present_laptop;
12388 unsigned int present_dock;
12390 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12391 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12393 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12394 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12396 /* Laptop mic port overrides dock mic port, design decision */
12398 snd_hda_codec_write(codec, 0x23, 0,
12399 AC_VERB_SET_CONNECT_SEL, 0x3);
12400 if (present_laptop)
12401 snd_hda_codec_write(codec, 0x23, 0,
12402 AC_VERB_SET_CONNECT_SEL, 0x0);
12403 if (!present_dock && !present_laptop)
12404 snd_hda_codec_write(codec, 0x23, 0,
12405 AC_VERB_SET_CONNECT_SEL, 0x1);
12408 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12411 if ((res >> 26) == ALC880_HP_EVENT)
12412 alc269_quanta_fl1_speaker_automute(codec);
12413 if ((res >> 26) == ALC880_MIC_EVENT)
12414 alc269_quanta_fl1_mic_automute(codec);
12417 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12420 if ((res >> 26) == ALC880_HP_EVENT)
12421 alc269_lifebook_speaker_automute(codec);
12422 if ((res >> 26) == ALC880_MIC_EVENT)
12423 alc269_lifebook_mic_autoswitch(codec);
12426 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12428 alc269_quanta_fl1_speaker_automute(codec);
12429 alc269_quanta_fl1_mic_automute(codec);
12432 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12434 alc269_lifebook_speaker_automute(codec);
12435 alc269_lifebook_mic_autoswitch(codec);
12438 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12439 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12440 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12441 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12443 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12444 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12445 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12449 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12450 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12451 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12452 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12453 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12454 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12455 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12459 /* toggle speaker-output according to the hp-jack state */
12460 static void alc269_speaker_automute(struct hda_codec *codec)
12462 unsigned int present;
12463 unsigned char bits;
12465 present = snd_hda_codec_read(codec, 0x15, 0,
12466 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12467 bits = present ? AMP_IN_MUTE(0) : 0;
12468 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12469 AMP_IN_MUTE(0), bits);
12470 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12471 AMP_IN_MUTE(0), bits);
12474 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12476 unsigned int present;
12478 present = snd_hda_codec_read(codec, 0x18, 0,
12479 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12480 snd_hda_codec_write(codec, 0x23, 0,
12481 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12484 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12486 unsigned int present;
12488 present = snd_hda_codec_read(codec, 0x18, 0,
12489 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12490 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12491 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12492 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12493 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12496 /* unsolicited event for HP jack sensing */
12497 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12500 if ((res >> 26) == ALC880_HP_EVENT)
12501 alc269_speaker_automute(codec);
12503 if ((res >> 26) == ALC880_MIC_EVENT)
12504 alc269_eeepc_dmic_automute(codec);
12507 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12509 alc269_speaker_automute(codec);
12510 alc269_eeepc_dmic_automute(codec);
12513 /* unsolicited event for HP jack sensing */
12514 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12517 if ((res >> 26) == ALC880_HP_EVENT)
12518 alc269_speaker_automute(codec);
12520 if ((res >> 26) == ALC880_MIC_EVENT)
12521 alc269_eeepc_amic_automute(codec);
12524 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12526 alc269_speaker_automute(codec);
12527 alc269_eeepc_amic_automute(codec);
12531 * generic initialization of ADC, input mixers and output mixers
12533 static struct hda_verb alc269_init_verbs[] = {
12535 * Unmute ADC0 and set the default input to mic-in
12537 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12539 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12540 * analog-loopback mixer widget
12541 * Note: PASD motherboards uses the Line In 2 as the input for
12542 * front panel mic (mic 2)
12544 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12552 * Set up output mixers (0x0c - 0x0e)
12554 /* set vol=0 to output mixers */
12555 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12556 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12558 /* set up input amps for analog loopback */
12559 /* Amp Indices: DAC = 0, mixer = 1 */
12560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12564 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12567 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12568 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12569 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12570 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12571 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12572 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12573 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12575 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12577 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12578 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12579 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12580 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12581 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12583 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12584 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12586 /* FIXME: use matrix-type input source selection */
12587 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12588 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12589 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12590 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12591 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12595 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12596 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12600 /* add playback controls from the parsed DAC table */
12601 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12602 const struct auto_pin_cfg *cfg)
12607 spec->multiout.num_dacs = 1; /* only use one dac */
12608 spec->multiout.dac_nids = spec->private_dac_nids;
12609 spec->multiout.dac_nids[0] = 2;
12611 nid = cfg->line_out_pins[0];
12613 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12614 "Front Playback Volume",
12615 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12618 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12619 "Front Playback Switch",
12620 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12625 nid = cfg->speaker_pins[0];
12627 if (!cfg->line_out_pins[0]) {
12628 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12629 "Speaker Playback Volume",
12630 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12636 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12637 "Speaker Playback Switch",
12638 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12643 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12644 "Speaker Playback Switch",
12645 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12651 nid = cfg->hp_pins[0];
12653 /* spec->multiout.hp_nid = 2; */
12654 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12655 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12656 "Headphone Playback Volume",
12657 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12663 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12664 "Headphone Playback Switch",
12665 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12670 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12671 "Headphone Playback Switch",
12672 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12681 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12682 const struct auto_pin_cfg *cfg)
12686 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12689 /* digital-mic input pin is excluded in alc880_auto_create..()
12690 * because it's under 0x18
12692 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12693 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12694 struct hda_input_mux *imux = &spec->private_imux[0];
12695 imux->items[imux->num_items].label = "Int Mic";
12696 imux->items[imux->num_items].index = 0x05;
12702 #ifdef CONFIG_SND_HDA_POWER_SAVE
12703 #define alc269_loopbacks alc880_loopbacks
12706 /* pcm configuration: identiacal with ALC880 */
12707 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12708 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12709 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12710 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12713 * BIOS auto configuration
12715 static int alc269_parse_auto_config(struct hda_codec *codec)
12717 struct alc_spec *spec = codec->spec;
12719 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12721 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12726 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12729 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12733 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12735 if (spec->autocfg.dig_outs)
12736 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12738 if (spec->kctls.list)
12739 add_mixer(spec, spec->kctls.list);
12741 add_verb(spec, alc269_init_verbs);
12742 spec->num_mux_defs = 1;
12743 spec->input_mux = &spec->private_imux[0];
12744 /* set default input source */
12745 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12746 0, AC_VERB_SET_CONNECT_SEL,
12747 spec->input_mux->items[0].index);
12749 err = alc_auto_add_mic_boost(codec);
12753 if (!spec->cap_mixer)
12754 set_capture_mixer(spec);
12756 store_pin_configs(codec);
12760 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12761 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12762 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12765 /* init callback for auto-configuration model -- overriding the default init */
12766 static void alc269_auto_init(struct hda_codec *codec)
12768 struct alc_spec *spec = codec->spec;
12769 alc269_auto_init_multi_out(codec);
12770 alc269_auto_init_hp_out(codec);
12771 alc269_auto_init_analog_input(codec);
12772 if (spec->unsol_event)
12773 alc_inithook(codec);
12777 * configuration and preset
12779 static const char *alc269_models[ALC269_MODEL_LAST] = {
12780 [ALC269_BASIC] = "basic",
12781 [ALC269_QUANTA_FL1] = "quanta",
12782 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12783 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12784 [ALC269_FUJITSU] = "fujitsu",
12785 [ALC269_LIFEBOOK] = "lifebook"
12788 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12789 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12790 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12791 ALC269_ASUS_EEEPC_P703),
12792 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12793 ALC269_ASUS_EEEPC_P901),
12794 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12795 ALC269_ASUS_EEEPC_P901),
12796 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12797 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12801 static struct alc_config_preset alc269_presets[] = {
12803 .mixers = { alc269_base_mixer },
12804 .init_verbs = { alc269_init_verbs },
12805 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12806 .dac_nids = alc269_dac_nids,
12808 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12809 .channel_mode = alc269_modes,
12810 .input_mux = &alc269_capture_source,
12812 [ALC269_QUANTA_FL1] = {
12813 .mixers = { alc269_quanta_fl1_mixer },
12814 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12815 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12816 .dac_nids = alc269_dac_nids,
12818 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12819 .channel_mode = alc269_modes,
12820 .input_mux = &alc269_capture_source,
12821 .unsol_event = alc269_quanta_fl1_unsol_event,
12822 .init_hook = alc269_quanta_fl1_init_hook,
12824 [ALC269_ASUS_EEEPC_P703] = {
12825 .mixers = { alc269_eeepc_mixer },
12826 .cap_mixer = alc269_epc_capture_mixer,
12827 .init_verbs = { alc269_init_verbs,
12828 alc269_eeepc_amic_init_verbs },
12829 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12830 .dac_nids = alc269_dac_nids,
12832 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12833 .channel_mode = alc269_modes,
12834 .input_mux = &alc269_eeepc_amic_capture_source,
12835 .unsol_event = alc269_eeepc_amic_unsol_event,
12836 .init_hook = alc269_eeepc_amic_inithook,
12838 [ALC269_ASUS_EEEPC_P901] = {
12839 .mixers = { alc269_eeepc_mixer },
12840 .cap_mixer = alc269_epc_capture_mixer,
12841 .init_verbs = { alc269_init_verbs,
12842 alc269_eeepc_dmic_init_verbs },
12843 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12844 .dac_nids = alc269_dac_nids,
12846 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12847 .channel_mode = alc269_modes,
12848 .input_mux = &alc269_eeepc_dmic_capture_source,
12849 .unsol_event = alc269_eeepc_dmic_unsol_event,
12850 .init_hook = alc269_eeepc_dmic_inithook,
12852 [ALC269_FUJITSU] = {
12853 .mixers = { alc269_fujitsu_mixer },
12854 .cap_mixer = alc269_epc_capture_mixer,
12855 .init_verbs = { alc269_init_verbs,
12856 alc269_eeepc_dmic_init_verbs },
12857 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12858 .dac_nids = alc269_dac_nids,
12860 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12861 .channel_mode = alc269_modes,
12862 .input_mux = &alc269_eeepc_dmic_capture_source,
12863 .unsol_event = alc269_eeepc_dmic_unsol_event,
12864 .init_hook = alc269_eeepc_dmic_inithook,
12866 [ALC269_LIFEBOOK] = {
12867 .mixers = { alc269_lifebook_mixer },
12868 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12869 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12870 .dac_nids = alc269_dac_nids,
12872 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12873 .channel_mode = alc269_modes,
12874 .input_mux = &alc269_capture_source,
12875 .unsol_event = alc269_lifebook_unsol_event,
12876 .init_hook = alc269_lifebook_init_hook,
12880 static int patch_alc269(struct hda_codec *codec)
12882 struct alc_spec *spec;
12886 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12890 codec->spec = spec;
12892 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12894 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12898 if (board_config < 0) {
12899 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12900 "trying auto-probe from BIOS...\n");
12901 board_config = ALC269_AUTO;
12904 if (board_config == ALC269_AUTO) {
12905 /* automatic parse from the BIOS config */
12906 err = alc269_parse_auto_config(codec);
12912 "hda_codec: Cannot set up configuration "
12913 "from BIOS. Using base mode...\n");
12914 board_config = ALC269_BASIC;
12918 err = snd_hda_attach_beep_device(codec, 0x1);
12924 if (board_config != ALC269_AUTO)
12925 setup_preset(spec, &alc269_presets[board_config]);
12927 spec->stream_name_analog = "ALC269 Analog";
12928 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12929 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12931 spec->stream_name_digital = "ALC269 Digital";
12932 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12933 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12935 spec->adc_nids = alc269_adc_nids;
12936 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12937 spec->capsrc_nids = alc269_capsrc_nids;
12938 if (!spec->cap_mixer)
12939 set_capture_mixer(spec);
12940 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12942 codec->patch_ops = alc_patch_ops;
12943 if (board_config == ALC269_AUTO)
12944 spec->init_hook = alc269_auto_init;
12945 #ifdef CONFIG_SND_HDA_POWER_SAVE
12946 if (!spec->loopback.amplist)
12947 spec->loopback.amplist = alc269_loopbacks;
12949 codec->proc_widget_hook = print_realtek_coef;
12955 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12959 * set the path ways for 2 channel output
12960 * need to set the codec line out and mic 1 pin widgets to inputs
12962 static struct hda_verb alc861_threestack_ch2_init[] = {
12963 /* set pin widget 1Ah (line in) for input */
12964 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12965 /* set pin widget 18h (mic1/2) for input, for mic also enable
12968 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12970 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12972 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12973 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12979 * need to set the codec line out and mic 1 pin widgets to outputs
12981 static struct hda_verb alc861_threestack_ch6_init[] = {
12982 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12983 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12984 /* set pin widget 18h (mic1) for output (CLFE)*/
12985 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12987 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12988 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12990 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12992 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12993 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12998 static struct hda_channel_mode alc861_threestack_modes[2] = {
12999 { 2, alc861_threestack_ch2_init },
13000 { 6, alc861_threestack_ch6_init },
13002 /* Set mic1 as input and unmute the mixer */
13003 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13004 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13005 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13008 /* Set mic1 as output and mute mixer */
13009 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13010 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13011 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13015 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13016 { 2, alc861_uniwill_m31_ch2_init },
13017 { 4, alc861_uniwill_m31_ch4_init },
13020 /* Set mic1 and line-in as input and unmute the mixer */
13021 static struct hda_verb alc861_asus_ch2_init[] = {
13022 /* set pin widget 1Ah (line in) for input */
13023 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13024 /* set pin widget 18h (mic1/2) for input, for mic also enable
13027 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13029 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13031 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13032 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13036 /* Set mic1 nad line-in as output and mute mixer */
13037 static struct hda_verb alc861_asus_ch6_init[] = {
13038 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13039 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13040 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13041 /* set pin widget 18h (mic1) for output (CLFE)*/
13042 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13043 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13044 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13045 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13047 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13049 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13050 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13055 static struct hda_channel_mode alc861_asus_modes[2] = {
13056 { 2, alc861_asus_ch2_init },
13057 { 6, alc861_asus_ch6_init },
13062 static struct snd_kcontrol_new alc861_base_mixer[] = {
13063 /* output mixer control */
13064 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13065 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13066 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13067 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13068 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13070 /*Input mixer control */
13071 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13072 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13073 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13074 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13075 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13076 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13077 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13078 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13079 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13080 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13085 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13086 /* output mixer control */
13087 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13088 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13089 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13090 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13091 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13093 /* Input mixer control */
13094 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13095 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13096 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13097 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13098 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13099 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13100 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13101 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13102 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13106 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13107 .name = "Channel Mode",
13108 .info = alc_ch_mode_info,
13109 .get = alc_ch_mode_get,
13110 .put = alc_ch_mode_put,
13111 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13116 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13117 /* output mixer control */
13118 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13120 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13125 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13126 /* output mixer control */
13127 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13128 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13129 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13130 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13131 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13133 /* Input mixer control */
13134 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13135 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13136 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13137 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13138 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13139 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13141 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13142 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13147 .name = "Channel Mode",
13148 .info = alc_ch_mode_info,
13149 .get = alc_ch_mode_get,
13150 .put = alc_ch_mode_put,
13151 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13156 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13157 /* output mixer control */
13158 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13159 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13160 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13161 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13162 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13164 /* Input mixer control */
13165 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13166 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13167 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13168 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13169 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13170 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13172 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13177 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13178 .name = "Channel Mode",
13179 .info = alc_ch_mode_info,
13180 .get = alc_ch_mode_get,
13181 .put = alc_ch_mode_put,
13182 .private_value = ARRAY_SIZE(alc861_asus_modes),
13187 /* additional mixer */
13188 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13189 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13190 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13195 * generic initialization of ADC, input mixers and output mixers
13197 static struct hda_verb alc861_base_init_verbs[] = {
13199 * Unmute ADC0 and set the default input to mic-in
13201 /* port-A for surround (rear panel) */
13202 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13203 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13204 /* port-B for mic-in (rear panel) with vref */
13205 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13206 /* port-C for line-in (rear panel) */
13207 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13208 /* port-D for Front */
13209 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13210 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13211 /* port-E for HP out (front panel) */
13212 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13213 /* route front PCM to HP */
13214 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13215 /* port-F for mic-in (front panel) with vref */
13216 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13217 /* port-G for CLFE (rear panel) */
13218 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13219 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13220 /* port-H for side (rear panel) */
13221 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13222 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13224 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13225 /* route front mic to ADC1*/
13226 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13227 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13229 /* Unmute DAC0~3 & spdif out*/
13230 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13231 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13232 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13233 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13236 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13237 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13238 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13239 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13240 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13242 /* Unmute Stereo Mixer 15 */
13243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13244 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13245 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13248 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13249 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13250 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13251 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13252 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13253 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13254 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13255 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13256 /* hp used DAC 3 (Front) */
13257 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13258 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13263 static struct hda_verb alc861_threestack_init_verbs[] = {
13265 * Unmute ADC0 and set the default input to mic-in
13267 /* port-A for surround (rear panel) */
13268 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13269 /* port-B for mic-in (rear panel) with vref */
13270 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13271 /* port-C for line-in (rear panel) */
13272 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13273 /* port-D for Front */
13274 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13275 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13276 /* port-E for HP out (front panel) */
13277 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13278 /* route front PCM to HP */
13279 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13280 /* port-F for mic-in (front panel) with vref */
13281 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13282 /* port-G for CLFE (rear panel) */
13283 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13284 /* port-H for side (rear panel) */
13285 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13287 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13288 /* route front mic to ADC1*/
13289 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13291 /* Unmute DAC0~3 & spdif out*/
13292 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13293 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13294 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13295 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13296 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13298 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13299 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13300 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13301 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13302 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13304 /* Unmute Stereo Mixer 15 */
13305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13308 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13310 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13311 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13312 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13313 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13314 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13316 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13317 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13318 /* hp used DAC 3 (Front) */
13319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13324 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13326 * Unmute ADC0 and set the default input to mic-in
13328 /* port-A for surround (rear panel) */
13329 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13330 /* port-B for mic-in (rear panel) with vref */
13331 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13332 /* port-C for line-in (rear panel) */
13333 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13334 /* port-D for Front */
13335 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13336 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13337 /* port-E for HP out (front panel) */
13338 /* this has to be set to VREF80 */
13339 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13340 /* route front PCM to HP */
13341 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13342 /* port-F for mic-in (front panel) with vref */
13343 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13344 /* port-G for CLFE (rear panel) */
13345 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13346 /* port-H for side (rear panel) */
13347 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13349 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13350 /* route front mic to ADC1*/
13351 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13353 /* Unmute DAC0~3 & spdif out*/
13354 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13355 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13356 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13357 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13360 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13361 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13362 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13363 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13364 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13366 /* Unmute Stereo Mixer 15 */
13367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13370 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13372 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13373 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13374 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13375 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13376 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13378 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13379 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13380 /* hp used DAC 3 (Front) */
13381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13382 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13386 static struct hda_verb alc861_asus_init_verbs[] = {
13388 * Unmute ADC0 and set the default input to mic-in
13390 /* port-A for surround (rear panel)
13391 * according to codec#0 this is the HP jack
13393 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13394 /* route front PCM to HP */
13395 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13396 /* port-B for mic-in (rear panel) with vref */
13397 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13398 /* port-C for line-in (rear panel) */
13399 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13400 /* port-D for Front */
13401 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13402 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13403 /* port-E for HP out (front panel) */
13404 /* this has to be set to VREF80 */
13405 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13406 /* route front PCM to HP */
13407 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13408 /* port-F for mic-in (front panel) with vref */
13409 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13410 /* port-G for CLFE (rear panel) */
13411 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13412 /* port-H for side (rear panel) */
13413 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13415 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13416 /* route front mic to ADC1*/
13417 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13419 /* Unmute DAC0~3 & spdif out*/
13420 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13421 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13422 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13423 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13425 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13426 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13427 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13428 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13429 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13431 /* Unmute Stereo Mixer 15 */
13432 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13433 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13434 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13435 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13437 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13438 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13439 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13440 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13441 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13442 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13444 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13445 /* hp used DAC 3 (Front) */
13446 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13447 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13451 /* additional init verbs for ASUS laptops */
13452 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13453 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13454 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13459 * generic initialization of ADC, input mixers and output mixers
13461 static struct hda_verb alc861_auto_init_verbs[] = {
13463 * Unmute ADC0 and set the default input to mic-in
13465 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13466 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13468 /* Unmute DAC0~3 & spdif out*/
13469 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13470 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13471 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13472 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13475 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13476 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13477 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13478 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13479 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13481 /* Unmute Stereo Mixer 15 */
13482 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13483 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13485 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13487 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13488 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13489 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13490 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13491 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13492 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13493 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13494 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13496 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13497 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13498 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13499 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13500 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13501 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13502 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13503 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13505 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13510 static struct hda_verb alc861_toshiba_init_verbs[] = {
13511 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13516 /* toggle speaker-output according to the hp-jack state */
13517 static void alc861_toshiba_automute(struct hda_codec *codec)
13519 unsigned int present;
13521 present = snd_hda_codec_read(codec, 0x0f, 0,
13522 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13523 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13524 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13525 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13526 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13529 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13532 if ((res >> 26) == ALC880_HP_EVENT)
13533 alc861_toshiba_automute(codec);
13536 /* pcm configuration: identiacal with ALC880 */
13537 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13538 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13539 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13540 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13543 #define ALC861_DIGOUT_NID 0x07
13545 static struct hda_channel_mode alc861_8ch_modes[1] = {
13549 static hda_nid_t alc861_dac_nids[4] = {
13550 /* front, surround, clfe, side */
13551 0x03, 0x06, 0x05, 0x04
13554 static hda_nid_t alc660_dac_nids[3] = {
13555 /* front, clfe, surround */
13559 static hda_nid_t alc861_adc_nids[1] = {
13564 static struct hda_input_mux alc861_capture_source = {
13568 { "Front Mic", 0x3 },
13575 /* fill in the dac_nids table from the parsed pin configuration */
13576 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13577 const struct auto_pin_cfg *cfg)
13582 spec->multiout.dac_nids = spec->private_dac_nids;
13583 for (i = 0; i < cfg->line_outs; i++) {
13584 nid = cfg->line_out_pins[i];
13586 if (i >= ARRAY_SIZE(alc861_dac_nids))
13588 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13591 spec->multiout.num_dacs = cfg->line_outs;
13595 /* add playback controls from the parsed DAC table */
13596 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13597 const struct auto_pin_cfg *cfg)
13600 static const char *chname[4] = {
13601 "Front", "Surround", NULL /*CLFE*/, "Side"
13606 for (i = 0; i < cfg->line_outs; i++) {
13607 nid = spec->multiout.dac_nids[i];
13612 err = add_control(spec, ALC_CTL_BIND_MUTE,
13613 "Center Playback Switch",
13614 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13618 err = add_control(spec, ALC_CTL_BIND_MUTE,
13619 "LFE Playback Switch",
13620 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13625 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13627 if (nid == alc861_dac_nids[idx])
13629 sprintf(name, "%s Playback Switch", chname[idx]);
13630 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13631 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13640 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13648 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13650 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13651 "Headphone Playback Switch",
13652 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13655 spec->multiout.hp_nid = nid;
13660 /* create playback/capture controls for input pins */
13661 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13662 const struct auto_pin_cfg *cfg)
13664 struct hda_input_mux *imux = &spec->private_imux[0];
13665 int i, err, idx, idx1;
13667 for (i = 0; i < AUTO_PIN_LAST; i++) {
13668 switch (cfg->input_pins[i]) {
13671 idx = 2; /* Line In */
13675 idx = 2; /* Line In */
13679 idx = 1; /* Mic In */
13683 idx = 1; /* Mic In */
13693 err = new_analog_input(spec, cfg->input_pins[i],
13694 auto_pin_cfg_labels[i], idx, 0x15);
13698 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13699 imux->items[imux->num_items].index = idx1;
13705 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13707 int pin_type, int dac_idx)
13709 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13711 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13715 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13717 struct alc_spec *spec = codec->spec;
13720 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13721 for (i = 0; i < spec->autocfg.line_outs; i++) {
13722 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13723 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13725 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13726 spec->multiout.dac_nids[i]);
13730 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13732 struct alc_spec *spec = codec->spec;
13735 pin = spec->autocfg.hp_pins[0];
13736 if (pin) /* connect to front */
13737 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13738 spec->multiout.dac_nids[0]);
13739 pin = spec->autocfg.speaker_pins[0];
13741 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13744 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13746 struct alc_spec *spec = codec->spec;
13749 for (i = 0; i < AUTO_PIN_LAST; i++) {
13750 hda_nid_t nid = spec->autocfg.input_pins[i];
13751 if (nid >= 0x0c && nid <= 0x11) {
13752 snd_hda_codec_write(codec, nid, 0,
13753 AC_VERB_SET_PIN_WIDGET_CONTROL,
13754 i <= AUTO_PIN_FRONT_MIC ?
13755 PIN_VREF80 : PIN_IN);
13760 /* parse the BIOS configuration and set up the alc_spec */
13761 /* return 1 if successful, 0 if the proper config is not found,
13762 * or a negative error code
13764 static int alc861_parse_auto_config(struct hda_codec *codec)
13766 struct alc_spec *spec = codec->spec;
13768 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13770 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13774 if (!spec->autocfg.line_outs)
13775 return 0; /* can't find valid BIOS pin config */
13777 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13780 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13783 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13786 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13790 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13792 if (spec->autocfg.dig_outs)
13793 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13795 if (spec->kctls.list)
13796 add_mixer(spec, spec->kctls.list);
13798 add_verb(spec, alc861_auto_init_verbs);
13800 spec->num_mux_defs = 1;
13801 spec->input_mux = &spec->private_imux[0];
13803 spec->adc_nids = alc861_adc_nids;
13804 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13805 set_capture_mixer(spec);
13807 store_pin_configs(codec);
13811 /* additional initialization for auto-configuration model */
13812 static void alc861_auto_init(struct hda_codec *codec)
13814 struct alc_spec *spec = codec->spec;
13815 alc861_auto_init_multi_out(codec);
13816 alc861_auto_init_hp_out(codec);
13817 alc861_auto_init_analog_input(codec);
13818 if (spec->unsol_event)
13819 alc_inithook(codec);
13822 #ifdef CONFIG_SND_HDA_POWER_SAVE
13823 static struct hda_amp_list alc861_loopbacks[] = {
13824 { 0x15, HDA_INPUT, 0 },
13825 { 0x15, HDA_INPUT, 1 },
13826 { 0x15, HDA_INPUT, 2 },
13827 { 0x15, HDA_INPUT, 3 },
13834 * configuration and preset
13836 static const char *alc861_models[ALC861_MODEL_LAST] = {
13837 [ALC861_3ST] = "3stack",
13838 [ALC660_3ST] = "3stack-660",
13839 [ALC861_3ST_DIG] = "3stack-dig",
13840 [ALC861_6ST_DIG] = "6stack-dig",
13841 [ALC861_UNIWILL_M31] = "uniwill-m31",
13842 [ALC861_TOSHIBA] = "toshiba",
13843 [ALC861_ASUS] = "asus",
13844 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13845 [ALC861_AUTO] = "auto",
13848 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13849 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13850 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13851 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13852 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13853 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13854 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13855 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13856 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13857 * Any other models that need this preset?
13859 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13860 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13861 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13862 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13863 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13864 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13865 /* FIXME: the below seems conflict */
13866 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13867 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13868 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13872 static struct alc_config_preset alc861_presets[] = {
13874 .mixers = { alc861_3ST_mixer },
13875 .init_verbs = { alc861_threestack_init_verbs },
13876 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13877 .dac_nids = alc861_dac_nids,
13878 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13879 .channel_mode = alc861_threestack_modes,
13881 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13882 .adc_nids = alc861_adc_nids,
13883 .input_mux = &alc861_capture_source,
13885 [ALC861_3ST_DIG] = {
13886 .mixers = { alc861_base_mixer },
13887 .init_verbs = { alc861_threestack_init_verbs },
13888 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13889 .dac_nids = alc861_dac_nids,
13890 .dig_out_nid = ALC861_DIGOUT_NID,
13891 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13892 .channel_mode = alc861_threestack_modes,
13894 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13895 .adc_nids = alc861_adc_nids,
13896 .input_mux = &alc861_capture_source,
13898 [ALC861_6ST_DIG] = {
13899 .mixers = { alc861_base_mixer },
13900 .init_verbs = { alc861_base_init_verbs },
13901 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13902 .dac_nids = alc861_dac_nids,
13903 .dig_out_nid = ALC861_DIGOUT_NID,
13904 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13905 .channel_mode = alc861_8ch_modes,
13906 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13907 .adc_nids = alc861_adc_nids,
13908 .input_mux = &alc861_capture_source,
13911 .mixers = { alc861_3ST_mixer },
13912 .init_verbs = { alc861_threestack_init_verbs },
13913 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13914 .dac_nids = alc660_dac_nids,
13915 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13916 .channel_mode = alc861_threestack_modes,
13918 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13919 .adc_nids = alc861_adc_nids,
13920 .input_mux = &alc861_capture_source,
13922 [ALC861_UNIWILL_M31] = {
13923 .mixers = { alc861_uniwill_m31_mixer },
13924 .init_verbs = { alc861_uniwill_m31_init_verbs },
13925 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13926 .dac_nids = alc861_dac_nids,
13927 .dig_out_nid = ALC861_DIGOUT_NID,
13928 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13929 .channel_mode = alc861_uniwill_m31_modes,
13931 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13932 .adc_nids = alc861_adc_nids,
13933 .input_mux = &alc861_capture_source,
13935 [ALC861_TOSHIBA] = {
13936 .mixers = { alc861_toshiba_mixer },
13937 .init_verbs = { alc861_base_init_verbs,
13938 alc861_toshiba_init_verbs },
13939 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13940 .dac_nids = alc861_dac_nids,
13941 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13942 .channel_mode = alc883_3ST_2ch_modes,
13943 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13944 .adc_nids = alc861_adc_nids,
13945 .input_mux = &alc861_capture_source,
13946 .unsol_event = alc861_toshiba_unsol_event,
13947 .init_hook = alc861_toshiba_automute,
13950 .mixers = { alc861_asus_mixer },
13951 .init_verbs = { alc861_asus_init_verbs },
13952 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13953 .dac_nids = alc861_dac_nids,
13954 .dig_out_nid = ALC861_DIGOUT_NID,
13955 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13956 .channel_mode = alc861_asus_modes,
13959 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13960 .adc_nids = alc861_adc_nids,
13961 .input_mux = &alc861_capture_source,
13963 [ALC861_ASUS_LAPTOP] = {
13964 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13965 .init_verbs = { alc861_asus_init_verbs,
13966 alc861_asus_laptop_init_verbs },
13967 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13968 .dac_nids = alc861_dac_nids,
13969 .dig_out_nid = ALC861_DIGOUT_NID,
13970 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13971 .channel_mode = alc883_3ST_2ch_modes,
13973 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13974 .adc_nids = alc861_adc_nids,
13975 .input_mux = &alc861_capture_source,
13980 static int patch_alc861(struct hda_codec *codec)
13982 struct alc_spec *spec;
13986 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13990 codec->spec = spec;
13992 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13996 if (board_config < 0) {
13997 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13998 "trying auto-probe from BIOS...\n");
13999 board_config = ALC861_AUTO;
14002 if (board_config == ALC861_AUTO) {
14003 /* automatic parse from the BIOS config */
14004 err = alc861_parse_auto_config(codec);
14010 "hda_codec: Cannot set up configuration "
14011 "from BIOS. Using base mode...\n");
14012 board_config = ALC861_3ST_DIG;
14016 err = snd_hda_attach_beep_device(codec, 0x23);
14022 if (board_config != ALC861_AUTO)
14023 setup_preset(spec, &alc861_presets[board_config]);
14025 spec->stream_name_analog = "ALC861 Analog";
14026 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14027 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14029 spec->stream_name_digital = "ALC861 Digital";
14030 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14031 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14033 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14035 spec->vmaster_nid = 0x03;
14037 codec->patch_ops = alc_patch_ops;
14038 if (board_config == ALC861_AUTO)
14039 spec->init_hook = alc861_auto_init;
14040 #ifdef CONFIG_SND_HDA_POWER_SAVE
14041 if (!spec->loopback.amplist)
14042 spec->loopback.amplist = alc861_loopbacks;
14044 codec->proc_widget_hook = print_realtek_coef;
14050 * ALC861-VD support
14054 * In addition, an independent DAC
14056 #define ALC861VD_DIGOUT_NID 0x06
14058 static hda_nid_t alc861vd_dac_nids[4] = {
14059 /* front, surr, clfe, side surr */
14060 0x02, 0x03, 0x04, 0x05
14063 /* dac_nids for ALC660vd are in a different order - according to
14064 * Realtek's driver.
14065 * This should probably tesult in a different mixer for 6stack models
14066 * of ALC660vd codecs, but for now there is only 3stack mixer
14067 * - and it is the same as in 861vd.
14068 * adc_nids in ALC660vd are (is) the same as in 861vd
14070 static hda_nid_t alc660vd_dac_nids[3] = {
14071 /* front, rear, clfe, rear_surr */
14075 static hda_nid_t alc861vd_adc_nids[1] = {
14080 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14083 /* FIXME: should be a matrix-type input source selection */
14084 static struct hda_input_mux alc861vd_capture_source = {
14088 { "Front Mic", 0x1 },
14094 static struct hda_input_mux alc861vd_dallas_capture_source = {
14097 { "Ext Mic", 0x0 },
14098 { "Int Mic", 0x1 },
14102 static struct hda_input_mux alc861vd_hp_capture_source = {
14105 { "Front Mic", 0x0 },
14106 { "ATAPI Mic", 0x1 },
14113 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14120 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14121 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
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 },
14131 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14132 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14133 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14134 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14135 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14139 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14140 { 6, alc861vd_6stack_ch6_init },
14141 { 8, alc861vd_6stack_ch8_init },
14144 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14147 .name = "Channel Mode",
14148 .info = alc_ch_mode_info,
14149 .get = alc_ch_mode_get,
14150 .put = alc_ch_mode_put,
14155 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14156 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14158 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14159 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14160 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14162 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14163 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14165 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14167 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14169 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14170 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14172 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14173 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14177 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14181 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14182 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14183 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14185 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14186 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14188 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14189 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14194 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14195 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14196 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14200 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14204 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14206 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14208 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14209 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14217 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14218 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14219 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14220 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14222 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14224 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14226 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14228 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14229 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14230 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14238 /* Pin assignment: Speaker=0x14, HP = 0x15,
14239 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14241 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14242 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14243 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14245 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14246 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14247 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14248 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14249 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14250 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14251 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14255 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14256 * Front Mic=0x18, ATAPI Mic = 0x19,
14258 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14259 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14261 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14262 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14263 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14264 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14265 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14266 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14272 * generic initialization of ADC, input mixers and output mixers
14274 static struct hda_verb alc861vd_volume_init_verbs[] = {
14276 * Unmute ADC0 and set the default input to mic-in
14278 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14279 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14281 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14282 * the analog-loopback mixer widget
14284 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14291 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14293 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14294 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14295 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14298 * Set up output mixers (0x02 - 0x05)
14300 /* set vol=0 to output mixers */
14301 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14302 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14303 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14304 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14306 /* set up input amps for analog loopback */
14307 /* Amp Indices: DAC = 0, mixer = 1 */
14308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14321 * 3-stack pin configuration:
14322 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14324 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14326 * Set pin mode and muting
14328 /* set front pin widgets 0x14 for output */
14329 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14330 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14331 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14333 /* Mic (rear) pin: input vref at 80% */
14334 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14335 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14336 /* Front Mic pin: input vref at 80% */
14337 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14338 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14339 /* Line In pin: input */
14340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14342 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14343 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14344 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14345 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14346 /* CD pin widget for input */
14347 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14353 * 6-stack pin configuration:
14355 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14357 * Set pin mode and muting
14359 /* set front pin widgets 0x14 for output */
14360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14361 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14362 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14364 /* Rear Pin: output 1 (0x0d) */
14365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14367 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14368 /* CLFE Pin: output 2 (0x0e) */
14369 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14370 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14371 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14372 /* Side Pin: output 3 (0x0f) */
14373 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14374 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14375 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14377 /* Mic (rear) pin: input vref at 80% */
14378 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14379 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14380 /* Front Mic pin: input vref at 80% */
14381 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14382 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14383 /* Line In pin: input */
14384 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14385 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14386 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14387 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14388 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14389 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14390 /* CD pin widget for input */
14391 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14396 static struct hda_verb alc861vd_eapd_verbs[] = {
14397 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14401 static struct hda_verb alc660vd_eapd_verbs[] = {
14402 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14403 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14407 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14410 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14411 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14412 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14416 /* toggle speaker-output according to the hp-jack state */
14417 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14419 unsigned int present;
14420 unsigned char bits;
14422 present = snd_hda_codec_read(codec, 0x1b, 0,
14423 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14424 bits = present ? HDA_AMP_MUTE : 0;
14425 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14426 HDA_AMP_MUTE, bits);
14429 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14431 unsigned int present;
14432 unsigned char bits;
14434 present = snd_hda_codec_read(codec, 0x18, 0,
14435 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14436 bits = present ? HDA_AMP_MUTE : 0;
14437 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14438 HDA_AMP_MUTE, bits);
14441 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14443 alc861vd_lenovo_hp_automute(codec);
14444 alc861vd_lenovo_mic_automute(codec);
14447 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14450 switch (res >> 26) {
14451 case ALC880_HP_EVENT:
14452 alc861vd_lenovo_hp_automute(codec);
14454 case ALC880_MIC_EVENT:
14455 alc861vd_lenovo_mic_automute(codec);
14460 static struct hda_verb alc861vd_dallas_verbs[] = {
14461 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14462 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14463 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14464 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14472 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14473 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14475 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14477 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14479 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14480 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14481 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14482 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14484 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14486 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14487 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14488 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14490 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14491 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14498 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14499 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14500 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14505 /* toggle speaker-output according to the hp-jack state */
14506 static void alc861vd_dallas_automute(struct hda_codec *codec)
14508 unsigned int present;
14510 present = snd_hda_codec_read(codec, 0x15, 0,
14511 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14512 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14513 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14516 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14518 if ((res >> 26) == ALC880_HP_EVENT)
14519 alc861vd_dallas_automute(codec);
14522 #ifdef CONFIG_SND_HDA_POWER_SAVE
14523 #define alc861vd_loopbacks alc880_loopbacks
14526 /* pcm configuration: identiacal with ALC880 */
14527 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14528 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14529 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14530 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14533 * configuration and preset
14535 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14536 [ALC660VD_3ST] = "3stack-660",
14537 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14538 [ALC660VD_ASUS_V1S] = "asus-v1s",
14539 [ALC861VD_3ST] = "3stack",
14540 [ALC861VD_3ST_DIG] = "3stack-digout",
14541 [ALC861VD_6ST_DIG] = "6stack-digout",
14542 [ALC861VD_LENOVO] = "lenovo",
14543 [ALC861VD_DALLAS] = "dallas",
14544 [ALC861VD_HP] = "hp",
14545 [ALC861VD_AUTO] = "auto",
14548 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14549 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14550 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14551 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14552 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14553 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14554 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14555 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14556 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14557 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14558 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14559 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14560 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14561 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14562 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14563 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14567 static struct alc_config_preset alc861vd_presets[] = {
14569 .mixers = { alc861vd_3st_mixer },
14570 .init_verbs = { alc861vd_volume_init_verbs,
14571 alc861vd_3stack_init_verbs },
14572 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14573 .dac_nids = alc660vd_dac_nids,
14574 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14575 .channel_mode = alc861vd_3stack_2ch_modes,
14576 .input_mux = &alc861vd_capture_source,
14578 [ALC660VD_3ST_DIG] = {
14579 .mixers = { alc861vd_3st_mixer },
14580 .init_verbs = { alc861vd_volume_init_verbs,
14581 alc861vd_3stack_init_verbs },
14582 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14583 .dac_nids = alc660vd_dac_nids,
14584 .dig_out_nid = ALC861VD_DIGOUT_NID,
14585 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14586 .channel_mode = alc861vd_3stack_2ch_modes,
14587 .input_mux = &alc861vd_capture_source,
14590 .mixers = { alc861vd_3st_mixer },
14591 .init_verbs = { alc861vd_volume_init_verbs,
14592 alc861vd_3stack_init_verbs },
14593 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14594 .dac_nids = alc861vd_dac_nids,
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_3ST_DIG] = {
14600 .mixers = { alc861vd_3st_mixer },
14601 .init_verbs = { alc861vd_volume_init_verbs,
14602 alc861vd_3stack_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_3stack_2ch_modes),
14607 .channel_mode = alc861vd_3stack_2ch_modes,
14608 .input_mux = &alc861vd_capture_source,
14610 [ALC861VD_6ST_DIG] = {
14611 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14612 .init_verbs = { alc861vd_volume_init_verbs,
14613 alc861vd_6stack_init_verbs },
14614 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14615 .dac_nids = alc861vd_dac_nids,
14616 .dig_out_nid = ALC861VD_DIGOUT_NID,
14617 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14618 .channel_mode = alc861vd_6stack_modes,
14619 .input_mux = &alc861vd_capture_source,
14621 [ALC861VD_LENOVO] = {
14622 .mixers = { alc861vd_lenovo_mixer },
14623 .init_verbs = { alc861vd_volume_init_verbs,
14624 alc861vd_3stack_init_verbs,
14625 alc861vd_eapd_verbs,
14626 alc861vd_lenovo_unsol_verbs },
14627 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14628 .dac_nids = alc660vd_dac_nids,
14629 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14630 .channel_mode = alc861vd_3stack_2ch_modes,
14631 .input_mux = &alc861vd_capture_source,
14632 .unsol_event = alc861vd_lenovo_unsol_event,
14633 .init_hook = alc861vd_lenovo_automute,
14635 [ALC861VD_DALLAS] = {
14636 .mixers = { alc861vd_dallas_mixer },
14637 .init_verbs = { alc861vd_dallas_verbs },
14638 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14639 .dac_nids = alc861vd_dac_nids,
14640 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14641 .channel_mode = alc861vd_3stack_2ch_modes,
14642 .input_mux = &alc861vd_dallas_capture_source,
14643 .unsol_event = alc861vd_dallas_unsol_event,
14644 .init_hook = alc861vd_dallas_automute,
14647 .mixers = { alc861vd_hp_mixer },
14648 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14649 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14650 .dac_nids = alc861vd_dac_nids,
14651 .dig_out_nid = ALC861VD_DIGOUT_NID,
14652 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14653 .channel_mode = alc861vd_3stack_2ch_modes,
14654 .input_mux = &alc861vd_hp_capture_source,
14655 .unsol_event = alc861vd_dallas_unsol_event,
14656 .init_hook = alc861vd_dallas_automute,
14658 [ALC660VD_ASUS_V1S] = {
14659 .mixers = { alc861vd_lenovo_mixer },
14660 .init_verbs = { alc861vd_volume_init_verbs,
14661 alc861vd_3stack_init_verbs,
14662 alc861vd_eapd_verbs,
14663 alc861vd_lenovo_unsol_verbs },
14664 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14665 .dac_nids = alc660vd_dac_nids,
14666 .dig_out_nid = ALC861VD_DIGOUT_NID,
14667 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14668 .channel_mode = alc861vd_3stack_2ch_modes,
14669 .input_mux = &alc861vd_capture_source,
14670 .unsol_event = alc861vd_lenovo_unsol_event,
14671 .init_hook = alc861vd_lenovo_automute,
14676 * BIOS auto configuration
14678 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14679 hda_nid_t nid, int pin_type, int dac_idx)
14681 alc_set_pin_output(codec, nid, pin_type);
14684 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14686 struct alc_spec *spec = codec->spec;
14689 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14690 for (i = 0; i <= HDA_SIDE; i++) {
14691 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14692 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14694 alc861vd_auto_set_output_and_unmute(codec, nid,
14700 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14702 struct alc_spec *spec = codec->spec;
14705 pin = spec->autocfg.hp_pins[0];
14706 if (pin) /* connect to front and use dac 0 */
14707 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14708 pin = spec->autocfg.speaker_pins[0];
14710 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14713 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14714 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14716 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14718 struct alc_spec *spec = codec->spec;
14721 for (i = 0; i < AUTO_PIN_LAST; i++) {
14722 hda_nid_t nid = spec->autocfg.input_pins[i];
14723 if (alc861vd_is_input_pin(nid)) {
14724 snd_hda_codec_write(codec, nid, 0,
14725 AC_VERB_SET_PIN_WIDGET_CONTROL,
14726 i <= AUTO_PIN_FRONT_MIC ?
14727 PIN_VREF80 : PIN_IN);
14728 if (nid != ALC861VD_PIN_CD_NID)
14729 snd_hda_codec_write(codec, nid, 0,
14730 AC_VERB_SET_AMP_GAIN_MUTE,
14736 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14738 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14739 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14741 /* add playback controls from the parsed DAC table */
14742 /* Based on ALC880 version. But ALC861VD has separate,
14743 * different NIDs for mute/unmute switch and volume control */
14744 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14745 const struct auto_pin_cfg *cfg)
14748 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14749 hda_nid_t nid_v, nid_s;
14752 for (i = 0; i < cfg->line_outs; i++) {
14753 if (!spec->multiout.dac_nids[i])
14755 nid_v = alc861vd_idx_to_mixer_vol(
14757 spec->multiout.dac_nids[i]));
14758 nid_s = alc861vd_idx_to_mixer_switch(
14760 spec->multiout.dac_nids[i]));
14764 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14765 "Center Playback Volume",
14766 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14770 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14771 "LFE Playback Volume",
14772 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14776 err = add_control(spec, ALC_CTL_BIND_MUTE,
14777 "Center Playback Switch",
14778 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14782 err = add_control(spec, ALC_CTL_BIND_MUTE,
14783 "LFE Playback Switch",
14784 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14789 sprintf(name, "%s Playback Volume", chname[i]);
14790 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14791 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14795 sprintf(name, "%s Playback Switch", chname[i]);
14796 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14797 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14806 /* add playback controls for speaker and HP outputs */
14807 /* Based on ALC880 version. But ALC861VD has separate,
14808 * different NIDs for mute/unmute switch and volume control */
14809 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14810 hda_nid_t pin, const char *pfx)
14812 hda_nid_t nid_v, nid_s;
14819 if (alc880_is_fixed_pin(pin)) {
14820 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14821 /* specify the DAC as the extra output */
14822 if (!spec->multiout.hp_nid)
14823 spec->multiout.hp_nid = nid_v;
14825 spec->multiout.extra_out_nid[0] = nid_v;
14826 /* control HP volume/switch on the output mixer amp */
14827 nid_v = alc861vd_idx_to_mixer_vol(
14828 alc880_fixed_pin_idx(pin));
14829 nid_s = alc861vd_idx_to_mixer_switch(
14830 alc880_fixed_pin_idx(pin));
14832 sprintf(name, "%s Playback Volume", pfx);
14833 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14834 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14837 sprintf(name, "%s Playback Switch", pfx);
14838 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14839 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14842 } else if (alc880_is_multi_pin(pin)) {
14843 /* set manual connection */
14844 /* we have only a switch on HP-out PIN */
14845 sprintf(name, "%s Playback Switch", pfx);
14846 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14847 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14854 /* parse the BIOS configuration and set up the alc_spec
14855 * return 1 if successful, 0 if the proper config is not found,
14856 * or a negative error code
14857 * Based on ALC880 version - had to change it to override
14858 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14859 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14861 struct alc_spec *spec = codec->spec;
14863 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14865 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14869 if (!spec->autocfg.line_outs)
14870 return 0; /* can't find valid BIOS pin config */
14872 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14875 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14878 err = alc861vd_auto_create_extra_out(spec,
14879 spec->autocfg.speaker_pins[0],
14883 err = alc861vd_auto_create_extra_out(spec,
14884 spec->autocfg.hp_pins[0],
14888 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14892 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14894 if (spec->autocfg.dig_outs)
14895 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14897 if (spec->kctls.list)
14898 add_mixer(spec, spec->kctls.list);
14900 add_verb(spec, alc861vd_volume_init_verbs);
14902 spec->num_mux_defs = 1;
14903 spec->input_mux = &spec->private_imux[0];
14905 err = alc_auto_add_mic_boost(codec);
14909 store_pin_configs(codec);
14913 /* additional initialization for auto-configuration model */
14914 static void alc861vd_auto_init(struct hda_codec *codec)
14916 struct alc_spec *spec = codec->spec;
14917 alc861vd_auto_init_multi_out(codec);
14918 alc861vd_auto_init_hp_out(codec);
14919 alc861vd_auto_init_analog_input(codec);
14920 alc861vd_auto_init_input_src(codec);
14921 if (spec->unsol_event)
14922 alc_inithook(codec);
14925 static int patch_alc861vd(struct hda_codec *codec)
14927 struct alc_spec *spec;
14928 int err, board_config;
14930 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14934 codec->spec = spec;
14936 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14940 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14941 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14942 "ALC861VD, trying auto-probe from BIOS...\n");
14943 board_config = ALC861VD_AUTO;
14946 if (board_config == ALC861VD_AUTO) {
14947 /* automatic parse from the BIOS config */
14948 err = alc861vd_parse_auto_config(codec);
14954 "hda_codec: Cannot set up configuration "
14955 "from BIOS. Using base mode...\n");
14956 board_config = ALC861VD_3ST;
14960 err = snd_hda_attach_beep_device(codec, 0x23);
14966 if (board_config != ALC861VD_AUTO)
14967 setup_preset(spec, &alc861vd_presets[board_config]);
14969 if (codec->vendor_id == 0x10ec0660) {
14970 spec->stream_name_analog = "ALC660-VD Analog";
14971 spec->stream_name_digital = "ALC660-VD Digital";
14972 /* always turn on EAPD */
14973 add_verb(spec, alc660vd_eapd_verbs);
14975 spec->stream_name_analog = "ALC861VD Analog";
14976 spec->stream_name_digital = "ALC861VD Digital";
14979 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14980 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14982 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14983 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14985 spec->adc_nids = alc861vd_adc_nids;
14986 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14987 spec->capsrc_nids = alc861vd_capsrc_nids;
14988 spec->capture_style = CAPT_MIX;
14990 set_capture_mixer(spec);
14991 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
14993 spec->vmaster_nid = 0x02;
14995 codec->patch_ops = alc_patch_ops;
14997 if (board_config == ALC861VD_AUTO)
14998 spec->init_hook = alc861vd_auto_init;
14999 #ifdef CONFIG_SND_HDA_POWER_SAVE
15000 if (!spec->loopback.amplist)
15001 spec->loopback.amplist = alc861vd_loopbacks;
15003 codec->proc_widget_hook = print_realtek_coef;
15011 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15012 * configuration. Each pin widget can choose any input DACs and a mixer.
15013 * Each ADC is connected from a mixer of all inputs. This makes possible
15014 * 6-channel independent captures.
15016 * In addition, an independent DAC for the multi-playback (not used in this
15019 #define ALC662_DIGOUT_NID 0x06
15020 #define ALC662_DIGIN_NID 0x0a
15022 static hda_nid_t alc662_dac_nids[4] = {
15023 /* front, rear, clfe, rear_surr */
15027 static hda_nid_t alc662_adc_nids[1] = {
15032 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15035 /* FIXME: should be a matrix-type input source selection */
15036 static struct hda_input_mux alc662_capture_source = {
15040 { "Front Mic", 0x1 },
15046 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15054 static struct hda_input_mux alc662_eeepc_capture_source = {
15062 static struct hda_input_mux alc663_capture_source = {
15066 { "Front Mic", 0x1 },
15071 static struct hda_input_mux alc663_m51va_capture_source = {
15074 { "Ext-Mic", 0x0 },
15082 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15089 static struct hda_verb alc662_3ST_ch2_init[] = {
15090 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15091 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15092 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15093 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15100 static struct hda_verb alc662_3ST_ch6_init[] = {
15101 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15102 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15103 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15104 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15105 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15106 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15110 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15111 { 2, alc662_3ST_ch2_init },
15112 { 6, alc662_3ST_ch6_init },
15118 static struct hda_verb alc662_sixstack_ch6_init[] = {
15119 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15120 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15121 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15128 static struct hda_verb alc662_sixstack_ch8_init[] = {
15129 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15130 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15131 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15135 static struct hda_channel_mode alc662_5stack_modes[2] = {
15136 { 2, alc662_sixstack_ch6_init },
15137 { 6, alc662_sixstack_ch8_init },
15140 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15141 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15144 static struct snd_kcontrol_new alc662_base_mixer[] = {
15145 /* output mixer control */
15146 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15147 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15148 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15149 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15150 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15151 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15152 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15153 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15156 /*Input mixer control */
15157 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15158 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15159 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15160 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15161 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15162 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15163 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15164 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15168 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15169 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15170 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15172 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15173 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15174 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15175 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15178 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15179 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15183 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15184 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15185 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15186 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15187 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15188 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15189 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15190 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15191 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15193 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15194 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15199 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15204 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15205 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15206 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15207 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15208 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15210 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15211 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15217 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15218 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15220 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15221 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15223 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15224 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15225 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15227 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15228 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15229 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15233 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15234 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15235 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15236 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15237 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15238 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15239 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15240 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15241 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15242 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15243 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15244 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15245 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15251 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15252 .ops = &snd_hda_bind_vol,
15254 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15255 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15260 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15261 .ops = &snd_hda_bind_sw,
15263 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15264 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15269 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15270 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15271 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15277 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15278 .ops = &snd_hda_bind_sw,
15280 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15281 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15282 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15287 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15288 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15289 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15292 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15293 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15298 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15299 .ops = &snd_hda_bind_sw,
15301 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15302 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15303 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15308 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15309 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15310 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
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 snd_kcontrol_new alc662_1bjd_mixer[] = {
15319 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15320 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15323 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15324 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15325 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15329 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15330 .ops = &snd_hda_bind_vol,
15332 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15333 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15338 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15339 .ops = &snd_hda_bind_sw,
15341 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15342 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15347 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15348 HDA_BIND_VOL("Master Playback Volume",
15349 &alc663_asus_two_bind_master_vol),
15350 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15351 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15358 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15359 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15360 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15361 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15368 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15369 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15370 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15371 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15372 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15376 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15377 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15378 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15382 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15383 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15384 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15387 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15389 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15390 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15391 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15392 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15396 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15398 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15399 .name = "Channel Mode",
15400 .info = alc_ch_mode_info,
15401 .get = alc_ch_mode_get,
15402 .put = alc_ch_mode_put,
15407 static struct hda_verb alc662_init_verbs[] = {
15408 /* ADC: mute amp left and right */
15409 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15410 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15411 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15413 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15414 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15422 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15423 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15424 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15426 /* Front Pin: output 0 (0x0c) */
15427 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15428 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15430 /* Rear Pin: output 1 (0x0d) */
15431 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15432 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15434 /* CLFE Pin: output 2 (0x0e) */
15435 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15436 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15438 /* Mic (rear) pin: input vref at 80% */
15439 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15440 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15441 /* Front Mic pin: input vref at 80% */
15442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15444 /* Line In pin: input */
15445 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15446 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15447 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15448 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15449 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15450 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15451 /* CD pin widget for input */
15452 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15454 /* FIXME: use matrix-type input source selection */
15455 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15467 /* always trun on EAPD */
15468 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15469 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15474 static struct hda_verb alc662_sue_init_verbs[] = {
15475 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15476 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15480 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15481 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15482 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15486 /* Set Unsolicited Event*/
15487 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15488 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15489 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15494 * generic initialization of ADC, input mixers and output mixers
15496 static struct hda_verb alc662_auto_init_verbs[] = {
15498 * Unmute ADC and set the default input to mic-in
15500 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15501 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15503 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15505 * Note: PASD motherboards uses the Line In 2 as the input for front
15506 * panel mic (mic 2)
15508 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15511 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15512 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15516 * Set up output mixers (0x0c - 0x0f)
15518 /* set vol=0 to output mixers */
15519 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15520 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15521 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15523 /* set up input amps for analog loopback */
15524 /* Amp Indices: DAC = 0, mixer = 1 */
15525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15528 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15529 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15533 /* FIXME: use matrix-type input source selection */
15534 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15537 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15541 /* additional verbs for ALC663 */
15542 static struct hda_verb alc663_auto_init_verbs[] = {
15543 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15544 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15548 static struct hda_verb alc663_m51va_init_verbs[] = {
15549 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15550 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
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(9)},
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 alc663_21jd_amic_init_verbs[] = {
15562 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15563 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15564 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15565 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15567 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15568 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15572 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15573 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15575 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15576 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* 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 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15584 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15586 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15587 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15590 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15591 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15595 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15596 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15597 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15598 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15599 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15601 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15602 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15603 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15605 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15606 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15607 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15611 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15613 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15614 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15615 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15616 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15618 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15621 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15622 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15627 static struct hda_verb alc663_g71v_init_verbs[] = {
15628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15629 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15630 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
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 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15637 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15638 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15642 static struct hda_verb alc663_g50v_init_verbs[] = {
15643 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15644 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15645 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15647 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15648 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15652 static struct hda_verb alc662_ecs_init_verbs[] = {
15653 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15655 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15656 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15660 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15661 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15662 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15666 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15668 unsigned int present;
15669 unsigned char bits;
15671 present = snd_hda_codec_read(codec, 0x14, 0,
15672 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15673 bits = present ? HDA_AMP_MUTE : 0;
15674 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15675 HDA_AMP_MUTE, bits);
15678 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15680 unsigned int present;
15681 unsigned char bits;
15683 present = snd_hda_codec_read(codec, 0x1b, 0,
15684 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15685 bits = present ? HDA_AMP_MUTE : 0;
15686 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15687 HDA_AMP_MUTE, bits);
15688 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15689 HDA_AMP_MUTE, bits);
15692 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15695 if ((res >> 26) == ALC880_HP_EVENT)
15696 alc662_lenovo_101e_all_automute(codec);
15697 if ((res >> 26) == ALC880_FRONT_EVENT)
15698 alc662_lenovo_101e_ispeaker_automute(codec);
15701 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15703 unsigned int present;
15705 present = snd_hda_codec_read(codec, 0x18, 0,
15706 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15707 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15708 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15709 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15710 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15711 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15712 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15713 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15714 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15717 /* unsolicited event for HP jack sensing */
15718 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15721 if ((res >> 26) == ALC880_HP_EVENT)
15722 alc262_hippo1_automute( codec );
15724 if ((res >> 26) == ALC880_MIC_EVENT)
15725 alc662_eeepc_mic_automute(codec);
15728 static void alc662_eeepc_inithook(struct hda_codec *codec)
15730 alc262_hippo1_automute( codec );
15731 alc662_eeepc_mic_automute(codec);
15734 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15737 unsigned int present;
15739 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15740 present = snd_hda_codec_read(codec, 0x14, 0,
15741 AC_VERB_GET_PIN_SENSE, 0);
15742 present = (present & 0x80000000) != 0;
15744 /* mute internal speaker */
15745 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15746 HDA_AMP_MUTE, HDA_AMP_MUTE);
15748 /* unmute internal speaker if necessary */
15749 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15750 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15751 HDA_AMP_MUTE, mute);
15755 /* unsolicited event for HP jack sensing */
15756 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15759 if ((res >> 26) == ALC880_HP_EVENT)
15760 alc662_eeepc_ep20_automute(codec);
15763 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15765 alc662_eeepc_ep20_automute(codec);
15768 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15770 unsigned int present;
15771 unsigned char bits;
15773 present = snd_hda_codec_read(codec, 0x21, 0,
15774 AC_VERB_GET_PIN_SENSE, 0)
15775 & AC_PINSENSE_PRESENCE;
15776 bits = present ? HDA_AMP_MUTE : 0;
15777 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15778 AMP_IN_MUTE(0), bits);
15779 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15780 AMP_IN_MUTE(0), bits);
15783 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15785 unsigned int present;
15786 unsigned char bits;
15788 present = snd_hda_codec_read(codec, 0x21, 0,
15789 AC_VERB_GET_PIN_SENSE, 0)
15790 & AC_PINSENSE_PRESENCE;
15791 bits = present ? HDA_AMP_MUTE : 0;
15792 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15793 AMP_IN_MUTE(0), bits);
15794 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15795 AMP_IN_MUTE(0), bits);
15796 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15797 AMP_IN_MUTE(0), bits);
15798 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15799 AMP_IN_MUTE(0), bits);
15802 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15804 unsigned int present;
15805 unsigned char bits;
15807 present = snd_hda_codec_read(codec, 0x15, 0,
15808 AC_VERB_GET_PIN_SENSE, 0)
15809 & AC_PINSENSE_PRESENCE;
15810 bits = present ? HDA_AMP_MUTE : 0;
15811 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15812 AMP_IN_MUTE(0), bits);
15813 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15814 AMP_IN_MUTE(0), bits);
15815 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15816 AMP_IN_MUTE(0), bits);
15817 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15818 AMP_IN_MUTE(0), bits);
15821 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15823 unsigned int present;
15824 unsigned char bits;
15826 present = snd_hda_codec_read(codec, 0x1b, 0,
15827 AC_VERB_GET_PIN_SENSE, 0)
15828 & AC_PINSENSE_PRESENCE;
15829 bits = present ? 0 : PIN_OUT;
15830 snd_hda_codec_write(codec, 0x14, 0,
15831 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15834 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15836 unsigned int present1, present2;
15838 present1 = snd_hda_codec_read(codec, 0x21, 0,
15839 AC_VERB_GET_PIN_SENSE, 0)
15840 & AC_PINSENSE_PRESENCE;
15841 present2 = snd_hda_codec_read(codec, 0x15, 0,
15842 AC_VERB_GET_PIN_SENSE, 0)
15843 & AC_PINSENSE_PRESENCE;
15845 if (present1 || present2) {
15846 snd_hda_codec_write_cache(codec, 0x14, 0,
15847 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15849 snd_hda_codec_write_cache(codec, 0x14, 0,
15850 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15854 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15856 unsigned int present1, present2;
15858 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15859 AC_VERB_GET_PIN_SENSE, 0)
15860 & AC_PINSENSE_PRESENCE;
15861 present2 = snd_hda_codec_read(codec, 0x15, 0,
15862 AC_VERB_GET_PIN_SENSE, 0)
15863 & AC_PINSENSE_PRESENCE;
15865 if (present1 || present2) {
15866 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15867 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15868 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15869 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15871 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15872 AMP_IN_MUTE(0), 0);
15873 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15874 AMP_IN_MUTE(0), 0);
15878 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15880 unsigned int present;
15882 present = snd_hda_codec_read(codec, 0x18, 0,
15883 AC_VERB_GET_PIN_SENSE, 0)
15884 & AC_PINSENSE_PRESENCE;
15885 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15886 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15887 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15888 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15889 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15890 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15891 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15892 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15895 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15898 switch (res >> 26) {
15899 case ALC880_HP_EVENT:
15900 alc663_m51va_speaker_automute(codec);
15902 case ALC880_MIC_EVENT:
15903 alc663_m51va_mic_automute(codec);
15908 static void alc663_m51va_inithook(struct hda_codec *codec)
15910 alc663_m51va_speaker_automute(codec);
15911 alc663_m51va_mic_automute(codec);
15914 /* ***************** Mode1 ******************************/
15915 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15918 switch (res >> 26) {
15919 case ALC880_HP_EVENT:
15920 alc663_m51va_speaker_automute(codec);
15922 case ALC880_MIC_EVENT:
15923 alc662_eeepc_mic_automute(codec);
15928 static void alc663_mode1_inithook(struct hda_codec *codec)
15930 alc663_m51va_speaker_automute(codec);
15931 alc662_eeepc_mic_automute(codec);
15933 /* ***************** Mode2 ******************************/
15934 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15937 switch (res >> 26) {
15938 case ALC880_HP_EVENT:
15939 alc662_f5z_speaker_automute(codec);
15941 case ALC880_MIC_EVENT:
15942 alc662_eeepc_mic_automute(codec);
15947 static void alc662_mode2_inithook(struct hda_codec *codec)
15949 alc662_f5z_speaker_automute(codec);
15950 alc662_eeepc_mic_automute(codec);
15952 /* ***************** Mode3 ******************************/
15953 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15956 switch (res >> 26) {
15957 case ALC880_HP_EVENT:
15958 alc663_two_hp_m1_speaker_automute(codec);
15960 case ALC880_MIC_EVENT:
15961 alc662_eeepc_mic_automute(codec);
15966 static void alc663_mode3_inithook(struct hda_codec *codec)
15968 alc663_two_hp_m1_speaker_automute(codec);
15969 alc662_eeepc_mic_automute(codec);
15971 /* ***************** Mode4 ******************************/
15972 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15975 switch (res >> 26) {
15976 case ALC880_HP_EVENT:
15977 alc663_21jd_two_speaker_automute(codec);
15979 case ALC880_MIC_EVENT:
15980 alc662_eeepc_mic_automute(codec);
15985 static void alc663_mode4_inithook(struct hda_codec *codec)
15987 alc663_21jd_two_speaker_automute(codec);
15988 alc662_eeepc_mic_automute(codec);
15990 /* ***************** Mode5 ******************************/
15991 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15994 switch (res >> 26) {
15995 case ALC880_HP_EVENT:
15996 alc663_15jd_two_speaker_automute(codec);
15998 case ALC880_MIC_EVENT:
15999 alc662_eeepc_mic_automute(codec);
16004 static void alc663_mode5_inithook(struct hda_codec *codec)
16006 alc663_15jd_two_speaker_automute(codec);
16007 alc662_eeepc_mic_automute(codec);
16009 /* ***************** Mode6 ******************************/
16010 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16013 switch (res >> 26) {
16014 case ALC880_HP_EVENT:
16015 alc663_two_hp_m2_speaker_automute(codec);
16017 case ALC880_MIC_EVENT:
16018 alc662_eeepc_mic_automute(codec);
16023 static void alc663_mode6_inithook(struct hda_codec *codec)
16025 alc663_two_hp_m2_speaker_automute(codec);
16026 alc662_eeepc_mic_automute(codec);
16029 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16031 unsigned int present;
16032 unsigned char bits;
16034 present = snd_hda_codec_read(codec, 0x21, 0,
16035 AC_VERB_GET_PIN_SENSE, 0)
16036 & AC_PINSENSE_PRESENCE;
16037 bits = present ? HDA_AMP_MUTE : 0;
16038 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16039 HDA_AMP_MUTE, bits);
16040 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16041 HDA_AMP_MUTE, bits);
16044 static void alc663_g71v_front_automute(struct hda_codec *codec)
16046 unsigned int present;
16047 unsigned char bits;
16049 present = snd_hda_codec_read(codec, 0x15, 0,
16050 AC_VERB_GET_PIN_SENSE, 0)
16051 & AC_PINSENSE_PRESENCE;
16052 bits = present ? HDA_AMP_MUTE : 0;
16053 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16054 HDA_AMP_MUTE, bits);
16057 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16060 switch (res >> 26) {
16061 case ALC880_HP_EVENT:
16062 alc663_g71v_hp_automute(codec);
16064 case ALC880_FRONT_EVENT:
16065 alc663_g71v_front_automute(codec);
16067 case ALC880_MIC_EVENT:
16068 alc662_eeepc_mic_automute(codec);
16073 static void alc663_g71v_inithook(struct hda_codec *codec)
16075 alc663_g71v_front_automute(codec);
16076 alc663_g71v_hp_automute(codec);
16077 alc662_eeepc_mic_automute(codec);
16080 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16083 switch (res >> 26) {
16084 case ALC880_HP_EVENT:
16085 alc663_m51va_speaker_automute(codec);
16087 case ALC880_MIC_EVENT:
16088 alc662_eeepc_mic_automute(codec);
16093 static void alc663_g50v_inithook(struct hda_codec *codec)
16095 alc663_m51va_speaker_automute(codec);
16096 alc662_eeepc_mic_automute(codec);
16099 /* bind hp and internal speaker mute (with plug check) */
16100 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16101 struct snd_ctl_elem_value *ucontrol)
16103 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16104 long *valp = ucontrol->value.integer.value;
16107 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16109 valp[0] ? 0 : HDA_AMP_MUTE);
16110 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16112 valp[1] ? 0 : HDA_AMP_MUTE);
16114 alc262_hippo1_automute(codec);
16118 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16119 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16121 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16122 .name = "Master Playback Switch",
16123 .info = snd_hda_mixer_amp_switch_info,
16124 .get = snd_hda_mixer_amp_switch_get,
16125 .put = alc662_ecs_master_sw_put,
16126 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16129 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16130 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16131 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16133 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16134 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16135 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16139 #ifdef CONFIG_SND_HDA_POWER_SAVE
16140 #define alc662_loopbacks alc880_loopbacks
16144 /* pcm configuration: identiacal with ALC880 */
16145 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16146 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16147 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16148 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16151 * configuration and preset
16153 static const char *alc662_models[ALC662_MODEL_LAST] = {
16154 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16155 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16156 [ALC662_3ST_6ch] = "3stack-6ch",
16157 [ALC662_5ST_DIG] = "6stack-dig",
16158 [ALC662_LENOVO_101E] = "lenovo-101e",
16159 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16160 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16161 [ALC662_ECS] = "ecs",
16162 [ALC663_ASUS_M51VA] = "m51va",
16163 [ALC663_ASUS_G71V] = "g71v",
16164 [ALC663_ASUS_H13] = "h13",
16165 [ALC663_ASUS_G50V] = "g50v",
16166 [ALC663_ASUS_MODE1] = "asus-mode1",
16167 [ALC662_ASUS_MODE2] = "asus-mode2",
16168 [ALC663_ASUS_MODE3] = "asus-mode3",
16169 [ALC663_ASUS_MODE4] = "asus-mode4",
16170 [ALC663_ASUS_MODE5] = "asus-mode5",
16171 [ALC663_ASUS_MODE6] = "asus-mode6",
16172 [ALC662_AUTO] = "auto",
16175 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16176 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16177 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16178 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16179 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16180 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16181 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16182 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16183 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16184 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16185 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16186 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16187 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16188 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16189 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16190 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16191 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16192 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16193 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16194 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16195 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16196 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16197 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16198 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16199 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16200 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16201 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16202 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16203 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16204 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16205 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16206 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16207 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16208 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16209 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16210 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16211 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16212 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16213 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16214 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16215 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16216 ALC662_3ST_6ch_DIG),
16217 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16218 ALC662_3ST_6ch_DIG),
16219 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16220 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16221 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16222 ALC662_3ST_6ch_DIG),
16223 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16228 static struct alc_config_preset alc662_presets[] = {
16229 [ALC662_3ST_2ch_DIG] = {
16230 .mixers = { alc662_3ST_2ch_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_2ch_modes),
16237 .channel_mode = alc662_3ST_2ch_modes,
16238 .input_mux = &alc662_capture_source,
16240 [ALC662_3ST_6ch_DIG] = {
16241 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16242 .init_verbs = { alc662_init_verbs },
16243 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16244 .dac_nids = alc662_dac_nids,
16245 .dig_out_nid = ALC662_DIGOUT_NID,
16246 .dig_in_nid = ALC662_DIGIN_NID,
16247 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16248 .channel_mode = alc662_3ST_6ch_modes,
16250 .input_mux = &alc662_capture_source,
16252 [ALC662_3ST_6ch] = {
16253 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16254 .init_verbs = { alc662_init_verbs },
16255 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16256 .dac_nids = alc662_dac_nids,
16257 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16258 .channel_mode = alc662_3ST_6ch_modes,
16260 .input_mux = &alc662_capture_source,
16262 [ALC662_5ST_DIG] = {
16263 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16264 .init_verbs = { alc662_init_verbs },
16265 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16266 .dac_nids = alc662_dac_nids,
16267 .dig_out_nid = ALC662_DIGOUT_NID,
16268 .dig_in_nid = ALC662_DIGIN_NID,
16269 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16270 .channel_mode = alc662_5stack_modes,
16271 .input_mux = &alc662_capture_source,
16273 [ALC662_LENOVO_101E] = {
16274 .mixers = { alc662_lenovo_101e_mixer },
16275 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16276 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16277 .dac_nids = alc662_dac_nids,
16278 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16279 .channel_mode = alc662_3ST_2ch_modes,
16280 .input_mux = &alc662_lenovo_101e_capture_source,
16281 .unsol_event = alc662_lenovo_101e_unsol_event,
16282 .init_hook = alc662_lenovo_101e_all_automute,
16284 [ALC662_ASUS_EEEPC_P701] = {
16285 .mixers = { alc662_eeepc_p701_mixer },
16286 .init_verbs = { alc662_init_verbs,
16287 alc662_eeepc_sue_init_verbs },
16288 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16289 .dac_nids = alc662_dac_nids,
16290 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16291 .channel_mode = alc662_3ST_2ch_modes,
16292 .input_mux = &alc662_eeepc_capture_source,
16293 .unsol_event = alc662_eeepc_unsol_event,
16294 .init_hook = alc662_eeepc_inithook,
16296 [ALC662_ASUS_EEEPC_EP20] = {
16297 .mixers = { alc662_eeepc_ep20_mixer,
16298 alc662_chmode_mixer },
16299 .init_verbs = { alc662_init_verbs,
16300 alc662_eeepc_ep20_sue_init_verbs },
16301 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16302 .dac_nids = alc662_dac_nids,
16303 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16304 .channel_mode = alc662_3ST_6ch_modes,
16305 .input_mux = &alc662_lenovo_101e_capture_source,
16306 .unsol_event = alc662_eeepc_ep20_unsol_event,
16307 .init_hook = alc662_eeepc_ep20_inithook,
16310 .mixers = { alc662_ecs_mixer },
16311 .init_verbs = { alc662_init_verbs,
16312 alc662_ecs_init_verbs },
16313 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16314 .dac_nids = alc662_dac_nids,
16315 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16316 .channel_mode = alc662_3ST_2ch_modes,
16317 .input_mux = &alc662_eeepc_capture_source,
16318 .unsol_event = alc662_eeepc_unsol_event,
16319 .init_hook = alc662_eeepc_inithook,
16321 [ALC663_ASUS_M51VA] = {
16322 .mixers = { alc663_m51va_mixer },
16323 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16324 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16325 .dac_nids = alc662_dac_nids,
16326 .dig_out_nid = ALC662_DIGOUT_NID,
16327 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16328 .channel_mode = alc662_3ST_2ch_modes,
16329 .input_mux = &alc663_m51va_capture_source,
16330 .unsol_event = alc663_m51va_unsol_event,
16331 .init_hook = alc663_m51va_inithook,
16333 [ALC663_ASUS_G71V] = {
16334 .mixers = { alc663_g71v_mixer },
16335 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16336 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16337 .dac_nids = alc662_dac_nids,
16338 .dig_out_nid = ALC662_DIGOUT_NID,
16339 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16340 .channel_mode = alc662_3ST_2ch_modes,
16341 .input_mux = &alc662_eeepc_capture_source,
16342 .unsol_event = alc663_g71v_unsol_event,
16343 .init_hook = alc663_g71v_inithook,
16345 [ALC663_ASUS_H13] = {
16346 .mixers = { alc663_m51va_mixer },
16347 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16348 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16349 .dac_nids = alc662_dac_nids,
16350 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16351 .channel_mode = alc662_3ST_2ch_modes,
16352 .input_mux = &alc663_m51va_capture_source,
16353 .unsol_event = alc663_m51va_unsol_event,
16354 .init_hook = alc663_m51va_inithook,
16356 [ALC663_ASUS_G50V] = {
16357 .mixers = { alc663_g50v_mixer },
16358 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16359 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16360 .dac_nids = alc662_dac_nids,
16361 .dig_out_nid = ALC662_DIGOUT_NID,
16362 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16363 .channel_mode = alc662_3ST_6ch_modes,
16364 .input_mux = &alc663_capture_source,
16365 .unsol_event = alc663_g50v_unsol_event,
16366 .init_hook = alc663_g50v_inithook,
16368 [ALC663_ASUS_MODE1] = {
16369 .mixers = { alc663_m51va_mixer },
16370 .cap_mixer = alc662_auto_capture_mixer,
16371 .init_verbs = { alc662_init_verbs,
16372 alc663_21jd_amic_init_verbs },
16373 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16375 .dac_nids = alc662_dac_nids,
16376 .dig_out_nid = ALC662_DIGOUT_NID,
16377 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16378 .channel_mode = alc662_3ST_2ch_modes,
16379 .input_mux = &alc662_eeepc_capture_source,
16380 .unsol_event = alc663_mode1_unsol_event,
16381 .init_hook = alc663_mode1_inithook,
16383 [ALC662_ASUS_MODE2] = {
16384 .mixers = { alc662_1bjd_mixer },
16385 .cap_mixer = alc662_auto_capture_mixer,
16386 .init_verbs = { alc662_init_verbs,
16387 alc662_1bjd_amic_init_verbs },
16388 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16389 .dac_nids = alc662_dac_nids,
16390 .dig_out_nid = ALC662_DIGOUT_NID,
16391 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16392 .channel_mode = alc662_3ST_2ch_modes,
16393 .input_mux = &alc662_eeepc_capture_source,
16394 .unsol_event = alc662_mode2_unsol_event,
16395 .init_hook = alc662_mode2_inithook,
16397 [ALC663_ASUS_MODE3] = {
16398 .mixers = { alc663_two_hp_m1_mixer },
16399 .cap_mixer = alc662_auto_capture_mixer,
16400 .init_verbs = { alc662_init_verbs,
16401 alc663_two_hp_amic_m1_init_verbs },
16402 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16404 .dac_nids = alc662_dac_nids,
16405 .dig_out_nid = ALC662_DIGOUT_NID,
16406 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16407 .channel_mode = alc662_3ST_2ch_modes,
16408 .input_mux = &alc662_eeepc_capture_source,
16409 .unsol_event = alc663_mode3_unsol_event,
16410 .init_hook = alc663_mode3_inithook,
16412 [ALC663_ASUS_MODE4] = {
16413 .mixers = { alc663_asus_21jd_clfe_mixer },
16414 .cap_mixer = alc662_auto_capture_mixer,
16415 .init_verbs = { alc662_init_verbs,
16416 alc663_21jd_amic_init_verbs},
16417 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16419 .dac_nids = alc662_dac_nids,
16420 .dig_out_nid = ALC662_DIGOUT_NID,
16421 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16422 .channel_mode = alc662_3ST_2ch_modes,
16423 .input_mux = &alc662_eeepc_capture_source,
16424 .unsol_event = alc663_mode4_unsol_event,
16425 .init_hook = alc663_mode4_inithook,
16427 [ALC663_ASUS_MODE5] = {
16428 .mixers = { alc663_asus_15jd_clfe_mixer },
16429 .cap_mixer = alc662_auto_capture_mixer,
16430 .init_verbs = { alc662_init_verbs,
16431 alc663_15jd_amic_init_verbs },
16432 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16434 .dac_nids = alc662_dac_nids,
16435 .dig_out_nid = ALC662_DIGOUT_NID,
16436 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16437 .channel_mode = alc662_3ST_2ch_modes,
16438 .input_mux = &alc662_eeepc_capture_source,
16439 .unsol_event = alc663_mode5_unsol_event,
16440 .init_hook = alc663_mode5_inithook,
16442 [ALC663_ASUS_MODE6] = {
16443 .mixers = { alc663_two_hp_m2_mixer },
16444 .cap_mixer = alc662_auto_capture_mixer,
16445 .init_verbs = { alc662_init_verbs,
16446 alc663_two_hp_amic_m2_init_verbs },
16447 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16449 .dac_nids = alc662_dac_nids,
16450 .dig_out_nid = ALC662_DIGOUT_NID,
16451 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16452 .channel_mode = alc662_3ST_2ch_modes,
16453 .input_mux = &alc662_eeepc_capture_source,
16454 .unsol_event = alc663_mode6_unsol_event,
16455 .init_hook = alc663_mode6_inithook,
16461 * BIOS auto configuration
16464 /* add playback controls from the parsed DAC table */
16465 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16466 const struct auto_pin_cfg *cfg)
16469 static const char *chname[4] = {
16470 "Front", "Surround", NULL /*CLFE*/, "Side"
16475 for (i = 0; i < cfg->line_outs; i++) {
16476 if (!spec->multiout.dac_nids[i])
16478 nid = alc880_idx_to_dac(i);
16481 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16482 "Center Playback Volume",
16483 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16487 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16488 "LFE Playback Volume",
16489 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16493 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16494 "Center Playback Switch",
16495 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16499 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16500 "LFE Playback Switch",
16501 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16506 sprintf(name, "%s Playback Volume", chname[i]);
16507 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16508 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16512 sprintf(name, "%s Playback Switch", chname[i]);
16513 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16514 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16523 /* add playback controls for speaker and HP outputs */
16524 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16535 /* ALC663 has a mono output pin on 0x17 */
16536 sprintf(name, "%s Playback Switch", pfx);
16537 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16538 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16542 if (alc880_is_fixed_pin(pin)) {
16543 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16544 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16545 /* specify the DAC as the extra output */
16546 if (!spec->multiout.hp_nid)
16547 spec->multiout.hp_nid = nid;
16549 spec->multiout.extra_out_nid[0] = nid;
16550 /* control HP volume/switch on the output mixer amp */
16551 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16552 sprintf(name, "%s Playback Volume", pfx);
16553 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16554 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16557 sprintf(name, "%s Playback Switch", pfx);
16558 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16559 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16562 } else if (alc880_is_multi_pin(pin)) {
16563 /* set manual connection */
16564 /* we have only a switch on HP-out PIN */
16565 sprintf(name, "%s Playback Switch", pfx);
16566 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16567 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16574 /* create playback/capture controls for input pins */
16575 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16576 const struct auto_pin_cfg *cfg)
16578 struct hda_input_mux *imux = &spec->private_imux[0];
16581 for (i = 0; i < AUTO_PIN_LAST; i++) {
16582 if (alc880_is_input_pin(cfg->input_pins[i])) {
16583 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16584 err = new_analog_input(spec, cfg->input_pins[i],
16585 auto_pin_cfg_labels[i],
16589 imux->items[imux->num_items].label =
16590 auto_pin_cfg_labels[i];
16591 imux->items[imux->num_items].index =
16592 alc880_input_pin_idx(cfg->input_pins[i]);
16599 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16600 hda_nid_t nid, int pin_type,
16603 alc_set_pin_output(codec, nid, pin_type);
16604 /* need the manual connection? */
16605 if (alc880_is_multi_pin(nid)) {
16606 struct alc_spec *spec = codec->spec;
16607 int idx = alc880_multi_pin_idx(nid);
16608 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16609 AC_VERB_SET_CONNECT_SEL,
16610 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16614 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16616 struct alc_spec *spec = codec->spec;
16619 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16620 for (i = 0; i <= HDA_SIDE; i++) {
16621 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16622 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16624 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16629 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16631 struct alc_spec *spec = codec->spec;
16634 pin = spec->autocfg.hp_pins[0];
16635 if (pin) /* connect to front */
16637 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16638 pin = spec->autocfg.speaker_pins[0];
16640 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16643 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16644 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16646 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16648 struct alc_spec *spec = codec->spec;
16651 for (i = 0; i < AUTO_PIN_LAST; i++) {
16652 hda_nid_t nid = spec->autocfg.input_pins[i];
16653 if (alc662_is_input_pin(nid)) {
16654 snd_hda_codec_write(codec, nid, 0,
16655 AC_VERB_SET_PIN_WIDGET_CONTROL,
16656 (i <= AUTO_PIN_FRONT_MIC ?
16657 PIN_VREF80 : PIN_IN));
16658 if (nid != ALC662_PIN_CD_NID)
16659 snd_hda_codec_write(codec, nid, 0,
16660 AC_VERB_SET_AMP_GAIN_MUTE,
16666 #define alc662_auto_init_input_src alc882_auto_init_input_src
16668 static int alc662_parse_auto_config(struct hda_codec *codec)
16670 struct alc_spec *spec = codec->spec;
16672 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16674 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16678 if (!spec->autocfg.line_outs)
16679 return 0; /* can't find valid BIOS pin config */
16681 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16684 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16687 err = alc662_auto_create_extra_out(spec,
16688 spec->autocfg.speaker_pins[0],
16692 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16696 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16700 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16702 if (spec->autocfg.dig_outs)
16703 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16705 if (spec->kctls.list)
16706 add_mixer(spec, spec->kctls.list);
16708 spec->num_mux_defs = 1;
16709 spec->input_mux = &spec->private_imux[0];
16711 add_verb(spec, alc662_auto_init_verbs);
16712 if (codec->vendor_id == 0x10ec0663)
16713 add_verb(spec, alc663_auto_init_verbs);
16715 err = alc_auto_add_mic_boost(codec);
16719 store_pin_configs(codec);
16723 /* additional initialization for auto-configuration model */
16724 static void alc662_auto_init(struct hda_codec *codec)
16726 struct alc_spec *spec = codec->spec;
16727 alc662_auto_init_multi_out(codec);
16728 alc662_auto_init_hp_out(codec);
16729 alc662_auto_init_analog_input(codec);
16730 alc662_auto_init_input_src(codec);
16731 if (spec->unsol_event)
16732 alc_inithook(codec);
16735 static int patch_alc662(struct hda_codec *codec)
16737 struct alc_spec *spec;
16738 int err, board_config;
16740 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16744 codec->spec = spec;
16746 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16748 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16751 if (board_config < 0) {
16752 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16753 "trying auto-probe from BIOS...\n");
16754 board_config = ALC662_AUTO;
16757 if (board_config == ALC662_AUTO) {
16758 /* automatic parse from the BIOS config */
16759 err = alc662_parse_auto_config(codec);
16765 "hda_codec: Cannot set up configuration "
16766 "from BIOS. Using base mode...\n");
16767 board_config = ALC662_3ST_2ch_DIG;
16771 err = snd_hda_attach_beep_device(codec, 0x1);
16777 if (board_config != ALC662_AUTO)
16778 setup_preset(spec, &alc662_presets[board_config]);
16780 if (codec->vendor_id == 0x10ec0663) {
16781 spec->stream_name_analog = "ALC663 Analog";
16782 spec->stream_name_digital = "ALC663 Digital";
16783 } else if (codec->vendor_id == 0x10ec0272) {
16784 spec->stream_name_analog = "ALC272 Analog";
16785 spec->stream_name_digital = "ALC272 Digital";
16787 spec->stream_name_analog = "ALC662 Analog";
16788 spec->stream_name_digital = "ALC662 Digital";
16791 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16792 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16794 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16795 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16797 spec->adc_nids = alc662_adc_nids;
16798 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16799 spec->capsrc_nids = alc662_capsrc_nids;
16800 spec->capture_style = CAPT_MIX;
16802 if (!spec->cap_mixer)
16803 set_capture_mixer(spec);
16804 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16806 spec->vmaster_nid = 0x02;
16808 codec->patch_ops = alc_patch_ops;
16809 if (board_config == ALC662_AUTO)
16810 spec->init_hook = alc662_auto_init;
16811 #ifdef CONFIG_SND_HDA_POWER_SAVE
16812 if (!spec->loopback.amplist)
16813 spec->loopback.amplist = alc662_loopbacks;
16815 codec->proc_widget_hook = print_realtek_coef;
16823 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16824 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16825 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16826 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16827 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16828 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16829 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16830 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16831 .patch = patch_alc861 },
16832 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16833 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16834 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16835 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16836 .patch = patch_alc883 },
16837 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16838 .patch = patch_alc662 },
16839 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16840 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16841 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16842 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16843 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16844 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16845 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16846 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16847 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16848 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16849 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16850 .patch = patch_alc883 },
16851 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16852 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16853 {} /* terminator */
16856 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16858 MODULE_LICENSE("GPL");
16859 MODULE_DESCRIPTION("Realtek HD-audio codec");
16861 static struct hda_codec_preset_list realtek_list = {
16862 .preset = snd_hda_preset_realtek,
16863 .owner = THIS_MODULE,
16866 static int __init patch_realtek_init(void)
16868 return snd_hda_add_codec_preset(&realtek_list);
16871 static void __exit patch_realtek_exit(void)
16873 snd_hda_delete_codec_preset(&realtek_list);
16876 module_init(patch_realtek_init)
16877 module_exit(patch_realtek_exit)