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 */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
218 ALC883_TARGA_2ch_DIG,
221 ALC888_ACER_ASPIRE_4930G,
225 ALC883_LENOVO_101E_2ch,
226 ALC883_LENOVO_NB0763,
227 ALC888_LENOVO_MS7195_DIG,
234 ALC883_FUJITSU_PI2515,
235 ALC888_FUJITSU_XA3530,
236 ALC883_3ST_6ch_INTEL,
244 /* styles of capture selection */
246 CAPT_MUX = 0, /* only mux based */
247 CAPT_MIX, /* only mixer based */
248 CAPT_1MUX_MIX, /* first mux and other mixers */
252 #define GPIO_MASK 0x03
255 /* codec parameterization */
256 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
257 unsigned int num_mixers;
258 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
259 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
261 const struct hda_verb *init_verbs[5]; /* initialization verbs
265 unsigned int num_init_verbs;
267 char *stream_name_analog; /* analog PCM stream */
268 struct hda_pcm_stream *stream_analog_playback;
269 struct hda_pcm_stream *stream_analog_capture;
270 struct hda_pcm_stream *stream_analog_alt_playback;
271 struct hda_pcm_stream *stream_analog_alt_capture;
273 char *stream_name_digital; /* digital PCM stream */
274 struct hda_pcm_stream *stream_digital_playback;
275 struct hda_pcm_stream *stream_digital_capture;
278 struct hda_multi_out multiout; /* playback set-up
279 * max_channels, dacs must be set
280 * dig_out_nid and hp_nid are optional
282 hda_nid_t alt_dac_nid;
283 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
287 unsigned int num_adc_nids;
289 hda_nid_t *capsrc_nids;
290 hda_nid_t dig_in_nid; /* digital-in NID; optional */
291 int capture_style; /* capture style (CAPT_*) */
294 unsigned int num_mux_defs;
295 const struct hda_input_mux *input_mux;
296 unsigned int cur_mux[3];
299 const struct hda_channel_mode *channel_mode;
300 int num_channel_mode;
303 /* PCM information */
304 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
306 /* dynamic controls, init_verbs and input_mux */
307 struct auto_pin_cfg autocfg;
308 struct snd_array kctls;
309 struct hda_input_mux private_imux[3];
310 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
313 void (*init_hook)(struct hda_codec *codec);
314 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
316 /* for pin sensing */
317 unsigned int sense_updated: 1;
318 unsigned int jack_present: 1;
319 unsigned int master_sw: 1;
322 unsigned int no_analog :1; /* digital I/O only */
324 /* for virtual master */
325 hda_nid_t vmaster_nid;
326 #ifdef CONFIG_SND_HDA_POWER_SAVE
327 struct hda_loopback_check loopback;
332 unsigned int pll_coef_idx, pll_coef_bit;
336 * configuration template - to be copied to the spec instance
338 struct alc_config_preset {
339 struct snd_kcontrol_new *mixers[5]; /* should be identical size
342 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
343 const struct hda_verb *init_verbs[5];
344 unsigned int num_dacs;
346 hda_nid_t dig_out_nid; /* optional */
347 hda_nid_t hp_nid; /* optional */
348 hda_nid_t *slave_dig_outs;
349 unsigned int num_adc_nids;
351 hda_nid_t *capsrc_nids;
352 hda_nid_t dig_in_nid;
353 unsigned int num_channel_mode;
354 const struct hda_channel_mode *channel_mode;
356 unsigned int num_mux_defs;
357 const struct hda_input_mux *input_mux;
358 void (*unsol_event)(struct hda_codec *, unsigned int);
359 void (*init_hook)(struct hda_codec *);
360 #ifdef CONFIG_SND_HDA_POWER_SAVE
361 struct hda_amp_list *loopbacks;
369 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
370 struct snd_ctl_elem_info *uinfo)
372 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
373 struct alc_spec *spec = codec->spec;
374 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
375 if (mux_idx >= spec->num_mux_defs)
377 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
380 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
381 struct snd_ctl_elem_value *ucontrol)
383 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
384 struct alc_spec *spec = codec->spec;
385 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
387 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
391 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
392 struct snd_ctl_elem_value *ucontrol)
394 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
395 struct alc_spec *spec = codec->spec;
396 const struct hda_input_mux *imux;
397 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
398 unsigned int mux_idx;
399 hda_nid_t nid = spec->capsrc_nids ?
400 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
402 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
403 imux = &spec->input_mux[mux_idx];
405 if (spec->capture_style &&
406 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
407 /* Matrix-mixer style (e.g. ALC882) */
408 unsigned int *cur_val = &spec->cur_mux[adc_idx];
411 idx = ucontrol->value.enumerated.item[0];
412 if (idx >= imux->num_items)
413 idx = imux->num_items - 1;
416 for (i = 0; i < imux->num_items; i++) {
417 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
418 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
419 imux->items[i].index,
425 /* MUX style (e.g. ALC880) */
426 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
427 &spec->cur_mux[adc_idx]);
432 * channel mode setting
434 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_info *uinfo)
437 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
438 struct alc_spec *spec = codec->spec;
439 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
440 spec->num_channel_mode);
443 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
444 struct snd_ctl_elem_value *ucontrol)
446 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
447 struct alc_spec *spec = codec->spec;
448 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
449 spec->num_channel_mode,
450 spec->multiout.max_channels);
453 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
454 struct snd_ctl_elem_value *ucontrol)
456 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
457 struct alc_spec *spec = codec->spec;
458 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
459 spec->num_channel_mode,
460 &spec->multiout.max_channels);
461 if (err >= 0 && spec->need_dac_fix)
462 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
467 * Control the mode of pin widget settings via the mixer. "pc" is used
468 * instead of "%" to avoid consequences of accidently treating the % as
469 * being part of a format specifier. Maximum allowed length of a value is
470 * 63 characters plus NULL terminator.
472 * Note: some retasking pin complexes seem to ignore requests for input
473 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
474 * are requested. Therefore order this list so that this behaviour will not
475 * cause problems when mixer clients move through the enum sequentially.
476 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
479 static char *alc_pin_mode_names[] = {
480 "Mic 50pc bias", "Mic 80pc bias",
481 "Line in", "Line out", "Headphone out",
483 static unsigned char alc_pin_mode_values[] = {
484 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
486 /* The control can present all 5 options, or it can limit the options based
487 * in the pin being assumed to be exclusively an input or an output pin. In
488 * addition, "input" pins may or may not process the mic bias option
489 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
490 * accept requests for bias as of chip versions up to March 2006) and/or
491 * wiring in the computer.
493 #define ALC_PIN_DIR_IN 0x00
494 #define ALC_PIN_DIR_OUT 0x01
495 #define ALC_PIN_DIR_INOUT 0x02
496 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
497 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
499 /* Info about the pin modes supported by the different pin direction modes.
500 * For each direction the minimum and maximum values are given.
502 static signed char alc_pin_mode_dir_info[5][2] = {
503 { 0, 2 }, /* ALC_PIN_DIR_IN */
504 { 3, 4 }, /* ALC_PIN_DIR_OUT */
505 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
506 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
507 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
509 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
510 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
511 #define alc_pin_mode_n_items(_dir) \
512 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
514 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
515 struct snd_ctl_elem_info *uinfo)
517 unsigned int item_num = uinfo->value.enumerated.item;
518 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
520 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
522 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
524 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
525 item_num = alc_pin_mode_min(dir);
526 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
530 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
531 struct snd_ctl_elem_value *ucontrol)
534 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
535 hda_nid_t nid = kcontrol->private_value & 0xffff;
536 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
537 long *valp = ucontrol->value.integer.value;
538 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
539 AC_VERB_GET_PIN_WIDGET_CONTROL,
542 /* Find enumerated value for current pinctl setting */
543 i = alc_pin_mode_min(dir);
544 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
546 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
550 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
551 struct snd_ctl_elem_value *ucontrol)
554 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
555 hda_nid_t nid = kcontrol->private_value & 0xffff;
556 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
557 long val = *ucontrol->value.integer.value;
558 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
559 AC_VERB_GET_PIN_WIDGET_CONTROL,
562 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
563 val = alc_pin_mode_min(dir);
565 change = pinctl != alc_pin_mode_values[val];
567 /* Set pin mode to that requested */
568 snd_hda_codec_write_cache(codec, nid, 0,
569 AC_VERB_SET_PIN_WIDGET_CONTROL,
570 alc_pin_mode_values[val]);
572 /* Also enable the retasking pin's input/output as required
573 * for the requested pin mode. Enum values of 2 or less are
576 * Dynamically switching the input/output buffers probably
577 * reduces noise slightly (particularly on input) so we'll
578 * do it. However, having both input and output buffers
579 * enabled simultaneously doesn't seem to be problematic if
580 * this turns out to be necessary in the future.
583 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
584 HDA_AMP_MUTE, HDA_AMP_MUTE);
585 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
588 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
589 HDA_AMP_MUTE, HDA_AMP_MUTE);
590 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
597 #define ALC_PIN_MODE(xname, nid, dir) \
598 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
599 .info = alc_pin_mode_info, \
600 .get = alc_pin_mode_get, \
601 .put = alc_pin_mode_put, \
602 .private_value = nid | (dir<<16) }
604 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
605 * together using a mask with more than one bit set. This control is
606 * currently used only by the ALC260 test model. At this stage they are not
607 * needed for any "production" models.
609 #ifdef CONFIG_SND_DEBUG
610 #define alc_gpio_data_info snd_ctl_boolean_mono_info
612 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
613 struct snd_ctl_elem_value *ucontrol)
615 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
616 hda_nid_t nid = kcontrol->private_value & 0xffff;
617 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
618 long *valp = ucontrol->value.integer.value;
619 unsigned int val = snd_hda_codec_read(codec, nid, 0,
620 AC_VERB_GET_GPIO_DATA, 0x00);
622 *valp = (val & mask) != 0;
625 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
626 struct snd_ctl_elem_value *ucontrol)
629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
630 hda_nid_t nid = kcontrol->private_value & 0xffff;
631 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
632 long val = *ucontrol->value.integer.value;
633 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
634 AC_VERB_GET_GPIO_DATA,
637 /* Set/unset the masked GPIO bit(s) as needed */
638 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
643 snd_hda_codec_write_cache(codec, nid, 0,
644 AC_VERB_SET_GPIO_DATA, gpio_data);
648 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
649 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
650 .info = alc_gpio_data_info, \
651 .get = alc_gpio_data_get, \
652 .put = alc_gpio_data_put, \
653 .private_value = nid | (mask<<16) }
654 #endif /* CONFIG_SND_DEBUG */
656 /* A switch control to allow the enabling of the digital IO pins on the
657 * ALC260. This is incredibly simplistic; the intention of this control is
658 * to provide something in the test model allowing digital outputs to be
659 * identified if present. If models are found which can utilise these
660 * outputs a more complete mixer control can be devised for those models if
663 #ifdef CONFIG_SND_DEBUG
664 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
666 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
667 struct snd_ctl_elem_value *ucontrol)
669 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
670 hda_nid_t nid = kcontrol->private_value & 0xffff;
671 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
672 long *valp = ucontrol->value.integer.value;
673 unsigned int val = snd_hda_codec_read(codec, nid, 0,
674 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
676 *valp = (val & mask) != 0;
679 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
680 struct snd_ctl_elem_value *ucontrol)
683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
684 hda_nid_t nid = kcontrol->private_value & 0xffff;
685 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
686 long val = *ucontrol->value.integer.value;
687 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
688 AC_VERB_GET_DIGI_CONVERT_1,
691 /* Set/unset the masked control bit(s) as needed */
692 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
697 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
702 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
703 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
704 .info = alc_spdif_ctrl_info, \
705 .get = alc_spdif_ctrl_get, \
706 .put = alc_spdif_ctrl_put, \
707 .private_value = nid | (mask<<16) }
708 #endif /* CONFIG_SND_DEBUG */
710 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
711 * Again, this is only used in the ALC26x test models to help identify when
712 * the EAPD line must be asserted for features to work.
714 #ifdef CONFIG_SND_DEBUG
715 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
717 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
718 struct snd_ctl_elem_value *ucontrol)
720 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
721 hda_nid_t nid = kcontrol->private_value & 0xffff;
722 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
723 long *valp = ucontrol->value.integer.value;
724 unsigned int val = snd_hda_codec_read(codec, nid, 0,
725 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
727 *valp = (val & mask) != 0;
731 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
732 struct snd_ctl_elem_value *ucontrol)
735 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
736 hda_nid_t nid = kcontrol->private_value & 0xffff;
737 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
738 long val = *ucontrol->value.integer.value;
739 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
740 AC_VERB_GET_EAPD_BTLENABLE,
743 /* Set/unset the masked control bit(s) as needed */
744 change = (!val ? 0 : mask) != (ctrl_data & mask);
749 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
755 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
756 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
757 .info = alc_eapd_ctrl_info, \
758 .get = alc_eapd_ctrl_get, \
759 .put = alc_eapd_ctrl_put, \
760 .private_value = nid | (mask<<16) }
761 #endif /* CONFIG_SND_DEBUG */
764 * set up the input pin config (depending on the given auto-pin type)
766 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
769 unsigned int val = PIN_IN;
771 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
773 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
774 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
775 if (pincap & AC_PINCAP_VREF_80)
778 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
783 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
785 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
787 spec->mixers[spec->num_mixers++] = mix;
790 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
792 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
794 spec->init_verbs[spec->num_init_verbs++] = verb;
797 #ifdef CONFIG_PROC_FS
801 static void print_realtek_coef(struct snd_info_buffer *buffer,
802 struct hda_codec *codec, hda_nid_t nid)
808 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
809 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
810 coeff = snd_hda_codec_read(codec, nid, 0,
811 AC_VERB_GET_COEF_INDEX, 0);
812 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
815 #define print_realtek_coef NULL
819 * set up from the preset table
821 static void setup_preset(struct alc_spec *spec,
822 const struct alc_config_preset *preset)
826 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
827 add_mixer(spec, preset->mixers[i]);
828 spec->cap_mixer = preset->cap_mixer;
829 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
831 add_verb(spec, preset->init_verbs[i]);
833 spec->channel_mode = preset->channel_mode;
834 spec->num_channel_mode = preset->num_channel_mode;
835 spec->need_dac_fix = preset->need_dac_fix;
837 spec->multiout.max_channels = spec->channel_mode[0].channels;
839 spec->multiout.num_dacs = preset->num_dacs;
840 spec->multiout.dac_nids = preset->dac_nids;
841 spec->multiout.dig_out_nid = preset->dig_out_nid;
842 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
843 spec->multiout.hp_nid = preset->hp_nid;
845 spec->num_mux_defs = preset->num_mux_defs;
846 if (!spec->num_mux_defs)
847 spec->num_mux_defs = 1;
848 spec->input_mux = preset->input_mux;
850 spec->num_adc_nids = preset->num_adc_nids;
851 spec->adc_nids = preset->adc_nids;
852 spec->capsrc_nids = preset->capsrc_nids;
853 spec->dig_in_nid = preset->dig_in_nid;
855 spec->unsol_event = preset->unsol_event;
856 spec->init_hook = preset->init_hook;
857 #ifdef CONFIG_SND_HDA_POWER_SAVE
858 spec->loopback.amplist = preset->loopbacks;
862 /* Enable GPIO mask and set output */
863 static struct hda_verb alc_gpio1_init_verbs[] = {
864 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
865 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
866 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
870 static struct hda_verb alc_gpio2_init_verbs[] = {
871 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
872 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
873 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
877 static struct hda_verb alc_gpio3_init_verbs[] = {
878 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
879 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
880 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
885 * Fix hardware PLL issue
886 * On some codecs, the analog PLL gating control must be off while
887 * the default value is 1.
889 static void alc_fix_pll(struct hda_codec *codec)
891 struct alc_spec *spec = codec->spec;
896 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
898 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
899 AC_VERB_GET_PROC_COEF, 0);
900 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
902 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
903 val & ~(1 << spec->pll_coef_bit));
906 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
907 unsigned int coef_idx, unsigned int coef_bit)
909 struct alc_spec *spec = codec->spec;
911 spec->pll_coef_idx = coef_idx;
912 spec->pll_coef_bit = coef_bit;
916 static void alc_sku_automute(struct hda_codec *codec)
918 struct alc_spec *spec = codec->spec;
919 unsigned int present;
920 unsigned int hp_nid = spec->autocfg.hp_pins[0];
921 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
923 /* need to execute and sync at first */
924 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
925 present = snd_hda_codec_read(codec, hp_nid, 0,
926 AC_VERB_GET_PIN_SENSE, 0);
927 spec->jack_present = (present & 0x80000000) != 0;
928 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
929 spec->jack_present ? 0 : PIN_OUT);
932 #if 0 /* it's broken in some acses -- temporarily disabled */
933 static void alc_mic_automute(struct hda_codec *codec)
935 struct alc_spec *spec = codec->spec;
936 unsigned int present;
937 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
938 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
939 unsigned int mix_nid = spec->capsrc_nids[0];
940 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
942 capsrc_idx_mic = mic_nid - 0x18;
943 capsrc_idx_fmic = fmic_nid - 0x18;
944 present = snd_hda_codec_read(codec, mic_nid, 0,
945 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
946 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
947 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
948 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
949 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
950 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
951 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
954 #define alc_mic_automute(codec) do {} while(0) /* NOP */
955 #endif /* disabled */
957 /* unsolicited event for HP jack sensing */
958 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
960 if (codec->vendor_id == 0x10ec0880)
964 if (res == ALC880_HP_EVENT)
965 alc_sku_automute(codec);
967 if (res == ALC880_MIC_EVENT)
968 alc_mic_automute(codec);
971 static void alc_inithook(struct hda_codec *codec)
973 alc_sku_automute(codec);
974 alc_mic_automute(codec);
977 /* additional initialization for ALC888 variants */
978 static void alc888_coef_init(struct hda_codec *codec)
982 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
983 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
984 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
985 if ((tmp & 0xf0) == 2)
987 snd_hda_codec_read(codec, 0x20, 0,
988 AC_VERB_SET_PROC_COEF, 0x830);
991 snd_hda_codec_read(codec, 0x20, 0,
992 AC_VERB_SET_PROC_COEF, 0x3030);
995 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
996 * 31 ~ 16 : Manufacture ID
998 * 7 ~ 0 : Assembly ID
999 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1001 static void alc_subsystem_id(struct hda_codec *codec,
1002 unsigned int porta, unsigned int porte,
1005 unsigned int ass, tmp, i;
1007 struct alc_spec *spec = codec->spec;
1009 ass = codec->subsystem_id & 0xffff;
1010 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1014 * 31~30 : port conetcivity
1017 * 19~16 : Check sum (15:1)
1022 if (codec->vendor_id == 0x10ec0260)
1024 ass = snd_hda_codec_get_pincfg(codec, nid);
1025 if (!(ass & 1) && !(ass & 0x100000))
1027 if ((ass >> 30) != 1) /* no physical connection */
1032 for (i = 1; i < 16; i++) {
1036 if (((ass >> 16) & 0xf) != tmp)
1042 * 2 : 0 --> Desktop, 1 --> Laptop
1043 * 3~5 : External Amplifier control
1046 tmp = (ass & 0x38) >> 3; /* external Amp control */
1049 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1052 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1055 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1057 case 5: /* set EAPD output high */
1058 switch (codec->vendor_id) {
1060 snd_hda_codec_write(codec, 0x0f, 0,
1061 AC_VERB_SET_EAPD_BTLENABLE, 2);
1062 snd_hda_codec_write(codec, 0x10, 0,
1063 AC_VERB_SET_EAPD_BTLENABLE, 2);
1075 snd_hda_codec_write(codec, 0x14, 0,
1076 AC_VERB_SET_EAPD_BTLENABLE, 2);
1077 snd_hda_codec_write(codec, 0x15, 0,
1078 AC_VERB_SET_EAPD_BTLENABLE, 2);
1081 switch (codec->vendor_id) {
1083 snd_hda_codec_write(codec, 0x1a, 0,
1084 AC_VERB_SET_COEF_INDEX, 7);
1085 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1086 AC_VERB_GET_PROC_COEF, 0);
1087 snd_hda_codec_write(codec, 0x1a, 0,
1088 AC_VERB_SET_COEF_INDEX, 7);
1089 snd_hda_codec_write(codec, 0x1a, 0,
1090 AC_VERB_SET_PROC_COEF,
1100 snd_hda_codec_write(codec, 0x20, 0,
1101 AC_VERB_SET_COEF_INDEX, 7);
1102 tmp = snd_hda_codec_read(codec, 0x20, 0,
1103 AC_VERB_GET_PROC_COEF, 0);
1104 snd_hda_codec_write(codec, 0x20, 0,
1105 AC_VERB_SET_COEF_INDEX, 7);
1106 snd_hda_codec_write(codec, 0x20, 0,
1107 AC_VERB_SET_PROC_COEF,
1111 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1115 snd_hda_codec_write(codec, 0x20, 0,
1116 AC_VERB_SET_COEF_INDEX, 7);
1117 tmp = snd_hda_codec_read(codec, 0x20, 0,
1118 AC_VERB_GET_PROC_COEF, 0);
1119 snd_hda_codec_write(codec, 0x20, 0,
1120 AC_VERB_SET_COEF_INDEX, 7);
1121 snd_hda_codec_write(codec, 0x20, 0,
1122 AC_VERB_SET_PROC_COEF,
1130 /* is laptop or Desktop and enable the function "Mute internal speaker
1131 * when the external headphone out jack is plugged"
1133 if (!(ass & 0x8000))
1136 * 10~8 : Jack location
1137 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1139 * 15 : 1 --> enable the function "Mute internal speaker
1140 * when the external headphone out jack is plugged"
1142 if (!spec->autocfg.speaker_pins[0]) {
1143 if (spec->autocfg.line_out_pins[0])
1144 spec->autocfg.speaker_pins[0] =
1145 spec->autocfg.line_out_pins[0];
1150 if (!spec->autocfg.hp_pins[0]) {
1151 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1153 spec->autocfg.hp_pins[0] = porta;
1155 spec->autocfg.hp_pins[0] = porte;
1157 spec->autocfg.hp_pins[0] = portd;
1161 if (spec->autocfg.hp_pins[0])
1162 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1163 AC_VERB_SET_UNSOLICITED_ENABLE,
1164 AC_USRSP_EN | ALC880_HP_EVENT);
1166 #if 0 /* it's broken in some acses -- temporarily disabled */
1167 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1168 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1169 snd_hda_codec_write(codec,
1170 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1171 AC_VERB_SET_UNSOLICITED_ENABLE,
1172 AC_USRSP_EN | ALC880_MIC_EVENT);
1173 #endif /* disabled */
1175 spec->unsol_event = alc_sku_unsol_event;
1179 * Fix-up pin default configurations
1187 static void alc_fix_pincfg(struct hda_codec *codec,
1188 const struct snd_pci_quirk *quirk,
1189 const struct alc_pincfg **pinfix)
1191 const struct alc_pincfg *cfg;
1193 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1197 cfg = pinfix[quirk->value];
1198 for (; cfg->nid; cfg++)
1199 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1209 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1210 /* Mic-in jack as mic in */
1211 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1212 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1213 /* Line-in jack as Line in */
1214 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1215 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1216 /* Line-Out as Front */
1217 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1224 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1225 /* Mic-in jack as mic in */
1226 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1227 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1228 /* Line-in jack as Surround */
1229 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1230 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1231 /* Line-Out as Front */
1232 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1239 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1240 /* Mic-in jack as CLFE */
1241 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1242 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1243 /* Line-in jack as Surround */
1244 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1245 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1246 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1247 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1254 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1255 /* Mic-in jack as CLFE */
1256 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1257 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1258 /* Line-in jack as Surround */
1259 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1260 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1261 /* Line-Out as Side */
1262 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1266 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1267 { 2, alc888_4ST_ch2_intel_init },
1268 { 4, alc888_4ST_ch4_intel_init },
1269 { 6, alc888_4ST_ch6_intel_init },
1270 { 8, alc888_4ST_ch8_intel_init },
1274 * ALC888 Fujitsu Siemens Amillo xa3530
1277 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1278 /* Front Mic: set to PIN_IN (empty by default) */
1279 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1280 /* Connect Internal HP to Front */
1281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1282 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1283 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1284 /* Connect Bass HP to Front */
1285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1286 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1287 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1288 /* Connect Line-Out side jack (SPDIF) to Side */
1289 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1290 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1291 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1292 /* Connect Mic jack to CLFE */
1293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1295 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1296 /* Connect Line-in jack to Surround */
1297 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1298 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1299 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1300 /* Connect HP out jack to Front */
1301 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1302 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1303 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1304 /* Enable unsolicited event for HP jack and Line-out jack */
1305 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1306 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1310 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1312 unsigned int present;
1314 /* Line out presence */
1315 present = snd_hda_codec_read(codec, 0x17, 0,
1316 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1317 /* HP out presence */
1318 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1319 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1320 bits = present ? HDA_AMP_MUTE : 0;
1321 /* Toggle internal speakers muting */
1322 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1323 HDA_AMP_MUTE, bits);
1324 /* Toggle internal bass muting */
1325 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1326 HDA_AMP_MUTE, bits);
1329 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1332 if (res >> 26 == ALC880_HP_EVENT)
1333 alc888_fujitsu_xa3530_automute(codec);
1338 * ALC888 Acer Aspire 4930G model
1341 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1342 /* Front Mic: set to PIN_IN (empty by default) */
1343 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1344 /* Unselect Front Mic by default in input mixer 3 */
1345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1346 /* Enable unsolicited event for HP jack */
1347 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1348 /* Connect Internal HP to front */
1349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1350 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1351 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1352 /* Connect HP out to front */
1353 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1354 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1355 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1359 static struct hda_input_mux alc888_2_capture_sources[2] = {
1360 /* Front mic only available on one ADC */
1367 { "Front Mic", 0xb },
1380 static struct snd_kcontrol_new alc888_base_mixer[] = {
1381 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1382 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1383 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1384 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1385 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1387 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1388 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1389 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1390 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1391 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1392 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1393 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1394 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1395 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1397 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1402 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1404 unsigned int present;
1406 present = snd_hda_codec_read(codec, 0x15, 0,
1407 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1408 bits = present ? HDA_AMP_MUTE : 0;
1409 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1410 HDA_AMP_MUTE, bits);
1413 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1416 if (res >> 26 == ALC880_HP_EVENT)
1417 alc888_acer_aspire_4930g_automute(codec);
1421 * ALC880 3-stack model
1423 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1424 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1425 * F-Mic = 0x1b, HP = 0x19
1428 static hda_nid_t alc880_dac_nids[4] = {
1429 /* front, rear, clfe, rear_surr */
1430 0x02, 0x05, 0x04, 0x03
1433 static hda_nid_t alc880_adc_nids[3] = {
1438 /* The datasheet says the node 0x07 is connected from inputs,
1439 * but it shows zero connection in the real implementation on some devices.
1440 * Note: this is a 915GAV bug, fixed on 915GLV
1442 static hda_nid_t alc880_adc_nids_alt[2] = {
1447 #define ALC880_DIGOUT_NID 0x06
1448 #define ALC880_DIGIN_NID 0x0a
1450 static struct hda_input_mux alc880_capture_source = {
1454 { "Front Mic", 0x3 },
1460 /* channel source setting (2/6 channel selection for 3-stack) */
1462 static struct hda_verb alc880_threestack_ch2_init[] = {
1463 /* set line-in to input, mute it */
1464 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1465 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1466 /* set mic-in to input vref 80%, mute it */
1467 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1468 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1473 static struct hda_verb alc880_threestack_ch6_init[] = {
1474 /* set line-in to output, unmute it */
1475 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1476 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1477 /* set mic-in to output, unmute it */
1478 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1479 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1483 static struct hda_channel_mode alc880_threestack_modes[2] = {
1484 { 2, alc880_threestack_ch2_init },
1485 { 6, alc880_threestack_ch6_init },
1488 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1489 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1490 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1491 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1492 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1493 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1494 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1495 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1496 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1497 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1498 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1500 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1508 .name = "Channel Mode",
1509 .info = alc_ch_mode_info,
1510 .get = alc_ch_mode_get,
1511 .put = alc_ch_mode_put,
1516 /* capture mixer elements */
1517 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1518 struct snd_ctl_elem_info *uinfo)
1520 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1521 struct alc_spec *spec = codec->spec;
1524 mutex_lock(&codec->control_mutex);
1525 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1527 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1528 mutex_unlock(&codec->control_mutex);
1532 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1533 unsigned int size, unsigned int __user *tlv)
1535 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1536 struct alc_spec *spec = codec->spec;
1539 mutex_lock(&codec->control_mutex);
1540 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1542 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1543 mutex_unlock(&codec->control_mutex);
1547 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1548 struct snd_ctl_elem_value *ucontrol);
1550 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1551 struct snd_ctl_elem_value *ucontrol,
1554 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1555 struct alc_spec *spec = codec->spec;
1556 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1559 mutex_lock(&codec->control_mutex);
1560 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1562 err = func(kcontrol, ucontrol);
1563 mutex_unlock(&codec->control_mutex);
1567 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1568 struct snd_ctl_elem_value *ucontrol)
1570 return alc_cap_getput_caller(kcontrol, ucontrol,
1571 snd_hda_mixer_amp_volume_get);
1574 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1575 struct snd_ctl_elem_value *ucontrol)
1577 return alc_cap_getput_caller(kcontrol, ucontrol,
1578 snd_hda_mixer_amp_volume_put);
1581 /* capture mixer elements */
1582 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1584 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1585 struct snd_ctl_elem_value *ucontrol)
1587 return alc_cap_getput_caller(kcontrol, ucontrol,
1588 snd_hda_mixer_amp_switch_get);
1591 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1592 struct snd_ctl_elem_value *ucontrol)
1594 return alc_cap_getput_caller(kcontrol, ucontrol,
1595 snd_hda_mixer_amp_switch_put);
1598 #define DEFINE_CAPMIX(num) \
1599 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1601 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1602 .name = "Capture Switch", \
1603 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1605 .info = alc_cap_sw_info, \
1606 .get = alc_cap_sw_get, \
1607 .put = alc_cap_sw_put, \
1610 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1611 .name = "Capture Volume", \
1612 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1613 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1614 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1616 .info = alc_cap_vol_info, \
1617 .get = alc_cap_vol_get, \
1618 .put = alc_cap_vol_put, \
1619 .tlv = { .c = alc_cap_vol_tlv }, \
1622 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1623 /* .name = "Capture Source", */ \
1624 .name = "Input Source", \
1626 .info = alc_mux_enum_info, \
1627 .get = alc_mux_enum_get, \
1628 .put = alc_mux_enum_put, \
1633 /* up to three ADCs */
1640 * ALC880 5-stack model
1642 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1644 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1645 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1648 /* additional mixers to alc880_three_stack_mixer */
1649 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1650 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1651 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1655 /* channel source setting (6/8 channel selection for 5-stack) */
1657 static struct hda_verb alc880_fivestack_ch6_init[] = {
1658 /* set line-in to input, mute it */
1659 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1660 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1665 static struct hda_verb alc880_fivestack_ch8_init[] = {
1666 /* set line-in to output, unmute it */
1667 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1668 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1672 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1673 { 6, alc880_fivestack_ch6_init },
1674 { 8, alc880_fivestack_ch8_init },
1679 * ALC880 6-stack model
1681 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1682 * Side = 0x05 (0x0f)
1683 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1684 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1687 static hda_nid_t alc880_6st_dac_nids[4] = {
1688 /* front, rear, clfe, rear_surr */
1689 0x02, 0x03, 0x04, 0x05
1692 static struct hda_input_mux alc880_6stack_capture_source = {
1696 { "Front Mic", 0x1 },
1702 /* fixed 8-channels */
1703 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1707 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1708 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1709 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1710 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1711 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1712 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1713 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1714 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1715 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1716 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1717 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1718 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1719 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1720 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1721 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1724 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1725 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1727 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1728 .name = "Channel Mode",
1729 .info = alc_ch_mode_info,
1730 .get = alc_ch_mode_get,
1731 .put = alc_ch_mode_put,
1740 * W810 has rear IO for:
1743 * Center/LFE (DAC 04)
1746 * The system also has a pair of internal speakers, and a headphone jack.
1747 * These are both connected to Line2 on the codec, hence to DAC 02.
1749 * There is a variable resistor to control the speaker or headphone
1750 * volume. This is a hardware-only device without a software API.
1752 * Plugging headphones in will disable the internal speakers. This is
1753 * implemented in hardware, not via the driver using jack sense. In
1754 * a similar fashion, plugging into the rear socket marked "front" will
1755 * disable both the speakers and headphones.
1757 * For input, there's a microphone jack, and an "audio in" jack.
1758 * These may not do anything useful with this driver yet, because I
1759 * haven't setup any initialization verbs for these yet...
1762 static hda_nid_t alc880_w810_dac_nids[3] = {
1763 /* front, rear/surround, clfe */
1767 /* fixed 6 channels */
1768 static struct hda_channel_mode alc880_w810_modes[1] = {
1772 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1773 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1774 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1775 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1776 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1777 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1778 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1779 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1780 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1781 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1790 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1791 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1795 static hda_nid_t alc880_z71v_dac_nids[1] = {
1798 #define ALC880_Z71V_HP_DAC 0x03
1800 /* fixed 2 channels */
1801 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1805 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1806 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1807 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1808 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1809 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1810 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1811 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1819 * ALC880 F1734 model
1821 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1822 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1825 static hda_nid_t alc880_f1734_dac_nids[1] = {
1828 #define ALC880_F1734_HP_DAC 0x02
1830 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1831 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1832 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1833 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1834 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1835 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1836 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1842 static struct hda_input_mux alc880_f1734_capture_source = {
1854 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1855 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1856 * Mic = 0x18, Line = 0x1a
1859 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1860 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1862 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1863 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1864 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1865 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1866 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1867 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1868 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1869 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1870 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1871 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1872 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1873 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1874 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1875 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1876 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1878 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1879 .name = "Channel Mode",
1880 .info = alc_ch_mode_info,
1881 .get = alc_ch_mode_get,
1882 .put = alc_ch_mode_put,
1888 * ALC880 ASUS W1V model
1890 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1891 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1892 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1895 /* additional mixers to alc880_asus_mixer */
1896 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1897 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1898 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1903 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1904 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1905 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1906 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1907 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1908 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1910 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1911 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1912 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1917 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1918 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1919 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1920 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1921 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1922 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1923 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1924 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1925 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1931 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1932 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1933 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1936 .name = "Channel Mode",
1937 .info = alc_ch_mode_info,
1938 .get = alc_ch_mode_get,
1939 .put = alc_ch_mode_put,
1944 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1945 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1946 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1947 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1948 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1949 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1950 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1951 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1952 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1953 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1954 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1958 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1959 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1960 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1961 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1962 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1964 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1969 * virtual master controls
1973 * slave controls for virtual master
1975 static const char *alc_slave_vols[] = {
1976 "Front Playback Volume",
1977 "Surround Playback Volume",
1978 "Center Playback Volume",
1979 "LFE Playback Volume",
1980 "Side Playback Volume",
1981 "Headphone Playback Volume",
1982 "Speaker Playback Volume",
1983 "Mono Playback Volume",
1984 "Line-Out Playback Volume",
1985 "PCM Playback Volume",
1989 static const char *alc_slave_sws[] = {
1990 "Front Playback Switch",
1991 "Surround Playback Switch",
1992 "Center Playback Switch",
1993 "LFE Playback Switch",
1994 "Side Playback Switch",
1995 "Headphone Playback Switch",
1996 "Speaker Playback Switch",
1997 "Mono Playback Switch",
1998 "IEC958 Playback Switch",
2003 * build control elements
2006 static void alc_free_kctls(struct hda_codec *codec);
2008 /* additional beep mixers; the actual parameters are overwritten at build */
2009 static struct snd_kcontrol_new alc_beep_mixer[] = {
2010 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2011 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2015 static int alc_build_controls(struct hda_codec *codec)
2017 struct alc_spec *spec = codec->spec;
2021 for (i = 0; i < spec->num_mixers; i++) {
2022 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2026 if (spec->cap_mixer) {
2027 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2031 if (spec->multiout.dig_out_nid) {
2032 err = snd_hda_create_spdif_out_ctls(codec,
2033 spec->multiout.dig_out_nid);
2036 if (!spec->no_analog) {
2037 err = snd_hda_create_spdif_share_sw(codec,
2041 spec->multiout.share_spdif = 1;
2044 if (spec->dig_in_nid) {
2045 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2050 /* create beep controls if needed */
2051 if (spec->beep_amp) {
2052 struct snd_kcontrol_new *knew;
2053 for (knew = alc_beep_mixer; knew->name; knew++) {
2054 struct snd_kcontrol *kctl;
2055 kctl = snd_ctl_new1(knew, codec);
2058 kctl->private_value = spec->beep_amp;
2059 err = snd_hda_ctl_add(codec, kctl);
2065 /* if we have no master control, let's create it */
2066 if (!spec->no_analog &&
2067 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2068 unsigned int vmaster_tlv[4];
2069 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2070 HDA_OUTPUT, vmaster_tlv);
2071 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2072 vmaster_tlv, alc_slave_vols);
2076 if (!spec->no_analog &&
2077 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2078 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2079 NULL, alc_slave_sws);
2084 alc_free_kctls(codec); /* no longer needed */
2090 * initialize the codec volumes, etc
2094 * generic initialization of ADC, input mixers and output mixers
2096 static struct hda_verb alc880_volume_init_verbs[] = {
2098 * Unmute ADC0-2 and set the default input to mic-in
2100 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2101 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2102 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2103 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2104 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2105 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2107 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2109 * Note: PASD motherboards uses the Line In 2 as the input for front
2112 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2122 * Set up output mixers (0x0c - 0x0f)
2124 /* set vol=0 to output mixers */
2125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2126 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2127 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2128 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2129 /* set up input amps for analog loopback */
2130 /* Amp Indices: DAC = 0, mixer = 1 */
2131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2132 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2133 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2134 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2135 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2136 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2137 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2138 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2144 * 3-stack pin configuration:
2145 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2147 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2149 * preset connection lists of input pins
2150 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2152 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2153 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2154 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2157 * Set pin mode and muting
2159 /* set front pin widgets 0x14 for output */
2160 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2161 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2162 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2163 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2164 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2165 /* Mic2 (as headphone out) for HP output */
2166 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2167 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2168 /* Line In pin widget for input */
2169 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2170 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2171 /* Line2 (as front mic) pin widget for input and vref at 80% */
2172 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2173 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2174 /* CD pin widget for input */
2175 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2181 * 5-stack pin configuration:
2182 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2183 * line-in/side = 0x1a, f-mic = 0x1b
2185 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2187 * preset connection lists of input pins
2188 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2190 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2191 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2194 * Set pin mode and muting
2196 /* set pin widgets 0x14-0x17 for output */
2197 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2199 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2200 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2201 /* unmute pins for output (no gain on this amp) */
2202 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2204 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2205 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2207 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2208 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2209 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2210 /* Mic2 (as headphone out) for HP output */
2211 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2212 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2213 /* Line In pin widget for input */
2214 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2215 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2216 /* Line2 (as front mic) pin widget for input and vref at 80% */
2217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2218 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2219 /* CD pin widget for input */
2220 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2226 * W810 pin configuration:
2227 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2229 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2230 /* hphone/speaker input selector: front DAC */
2231 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2233 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2234 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2236 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2237 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2238 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2240 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2241 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2247 * Z71V pin configuration:
2248 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2250 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2252 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2254 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2256 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2257 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2258 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2259 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2265 * 6-stack pin configuration:
2266 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2267 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2269 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2270 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2272 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2273 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2274 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2275 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2276 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2277 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2278 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2279 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2281 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2282 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2283 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2284 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2286 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2287 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2288 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2289 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2295 * Uniwill pin configuration:
2296 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2299 static struct hda_verb alc880_uniwill_init_verbs[] = {
2300 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2306 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2307 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2308 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2309 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2313 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2315 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2317 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2318 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2319 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2320 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2321 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2322 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2323 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2324 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2325 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2327 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2328 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2335 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2337 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2338 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2340 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2341 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2344 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2345 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2350 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2351 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2353 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2354 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2355 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2356 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2360 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2361 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2366 static struct hda_verb alc880_beep_init_verbs[] = {
2367 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2371 /* toggle speaker-output according to the hp-jack state */
2372 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2374 unsigned int present;
2377 present = snd_hda_codec_read(codec, 0x14, 0,
2378 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2379 bits = present ? HDA_AMP_MUTE : 0;
2380 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2381 HDA_AMP_MUTE, bits);
2382 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2383 HDA_AMP_MUTE, bits);
2386 /* auto-toggle front mic */
2387 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2389 unsigned int present;
2392 present = snd_hda_codec_read(codec, 0x18, 0,
2393 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2394 bits = present ? HDA_AMP_MUTE : 0;
2395 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2398 static void alc880_uniwill_automute(struct hda_codec *codec)
2400 alc880_uniwill_hp_automute(codec);
2401 alc880_uniwill_mic_automute(codec);
2404 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2407 /* Looks like the unsol event is incompatible with the standard
2408 * definition. 4bit tag is placed at 28 bit!
2410 switch (res >> 28) {
2411 case ALC880_HP_EVENT:
2412 alc880_uniwill_hp_automute(codec);
2414 case ALC880_MIC_EVENT:
2415 alc880_uniwill_mic_automute(codec);
2420 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2422 unsigned int present;
2425 present = snd_hda_codec_read(codec, 0x14, 0,
2426 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2427 bits = present ? HDA_AMP_MUTE : 0;
2428 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2431 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2433 unsigned int present;
2435 present = snd_hda_codec_read(codec, 0x21, 0,
2436 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2437 present &= HDA_AMP_VOLMASK;
2438 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2439 HDA_AMP_VOLMASK, present);
2440 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2441 HDA_AMP_VOLMASK, present);
2444 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2447 /* Looks like the unsol event is incompatible with the standard
2448 * definition. 4bit tag is placed at 28 bit!
2450 if ((res >> 28) == ALC880_HP_EVENT)
2451 alc880_uniwill_p53_hp_automute(codec);
2452 if ((res >> 28) == ALC880_DCVOL_EVENT)
2453 alc880_uniwill_p53_dcvol_automute(codec);
2457 * F1734 pin configuration:
2458 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2460 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2461 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2462 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2463 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2464 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2465 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2468 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2472 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2473 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2474 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2475 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2476 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2477 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2478 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2479 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2480 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2482 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2483 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2489 * ASUS pin configuration:
2490 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2492 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2493 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2494 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2495 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2496 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2503 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2504 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2507 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2510 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2513 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2515 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2520 /* Enable GPIO mask and set output */
2521 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2522 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2524 /* Clevo m520g init */
2525 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2526 /* headphone output */
2527 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2530 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2532 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2533 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2535 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2536 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2537 /* Mic1 (rear panel) */
2538 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2539 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2540 /* Mic2 (front panel) */
2541 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2542 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2544 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2545 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2546 /* change to EAPD mode */
2547 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2548 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2553 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2554 /* change to EAPD mode */
2555 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2556 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2558 /* Headphone output */
2559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2561 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2562 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2564 /* Line In pin widget for input */
2565 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2566 /* CD pin widget for input */
2567 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2568 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2569 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2571 /* change to EAPD mode */
2572 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2573 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2579 * LG m1 express dual
2582 * Rear Line-In/Out (blue): 0x14
2583 * Build-in Mic-In: 0x15
2585 * HP-Out (green): 0x1b
2586 * Mic-In/Out (red): 0x19
2590 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2591 static hda_nid_t alc880_lg_dac_nids[3] = {
2595 /* seems analog CD is not working */
2596 static struct hda_input_mux alc880_lg_capture_source = {
2601 { "Internal Mic", 0x6 },
2605 /* 2,4,6 channel modes */
2606 static struct hda_verb alc880_lg_ch2_init[] = {
2607 /* set line-in and mic-in to input */
2608 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2609 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2613 static struct hda_verb alc880_lg_ch4_init[] = {
2614 /* set line-in to out and mic-in to input */
2615 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2616 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2620 static struct hda_verb alc880_lg_ch6_init[] = {
2621 /* set line-in and mic-in to output */
2622 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2623 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2627 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2628 { 2, alc880_lg_ch2_init },
2629 { 4, alc880_lg_ch4_init },
2630 { 6, alc880_lg_ch6_init },
2633 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2634 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2635 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2636 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2637 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2638 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2639 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2640 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2641 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2644 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2645 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2646 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2647 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2649 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2650 .name = "Channel Mode",
2651 .info = alc_ch_mode_info,
2652 .get = alc_ch_mode_get,
2653 .put = alc_ch_mode_put,
2658 static struct hda_verb alc880_lg_init_verbs[] = {
2659 /* set capture source to mic-in */
2660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2662 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2663 /* mute all amp mixer inputs */
2664 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2665 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2666 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2667 /* line-in to input */
2668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2671 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2672 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2674 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2675 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2676 /* mic-in to input */
2677 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2678 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2679 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2681 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2682 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2683 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2685 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2689 /* toggle speaker-output according to the hp-jack state */
2690 static void alc880_lg_automute(struct hda_codec *codec)
2692 unsigned int present;
2695 present = snd_hda_codec_read(codec, 0x1b, 0,
2696 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2697 bits = present ? HDA_AMP_MUTE : 0;
2698 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2699 HDA_AMP_MUTE, bits);
2702 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2704 /* Looks like the unsol event is incompatible with the standard
2705 * definition. 4bit tag is placed at 28 bit!
2707 if ((res >> 28) == 0x01)
2708 alc880_lg_automute(codec);
2717 * Built-in Mic-In: 0x19
2723 static struct hda_input_mux alc880_lg_lw_capture_source = {
2727 { "Internal Mic", 0x1 },
2732 #define alc880_lg_lw_modes alc880_threestack_modes
2734 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2735 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2736 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2737 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2738 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2739 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2740 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2741 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2742 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2743 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2744 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2747 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2748 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2750 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2751 .name = "Channel Mode",
2752 .info = alc_ch_mode_info,
2753 .get = alc_ch_mode_get,
2754 .put = alc_ch_mode_put,
2759 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2760 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2761 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2762 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2764 /* set capture source to mic-in */
2765 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2766 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2767 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2768 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2770 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2773 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2774 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2775 /* mic-in to input */
2776 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2779 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2780 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2782 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2786 /* toggle speaker-output according to the hp-jack state */
2787 static void alc880_lg_lw_automute(struct hda_codec *codec)
2789 unsigned int present;
2792 present = snd_hda_codec_read(codec, 0x1b, 0,
2793 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2794 bits = present ? HDA_AMP_MUTE : 0;
2795 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2796 HDA_AMP_MUTE, bits);
2799 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2801 /* Looks like the unsol event is incompatible with the standard
2802 * definition. 4bit tag is placed at 28 bit!
2804 if ((res >> 28) == 0x01)
2805 alc880_lg_lw_automute(codec);
2808 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2809 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2810 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2812 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2813 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2814 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2818 static struct hda_input_mux alc880_medion_rim_capture_source = {
2822 { "Internal Mic", 0x1 },
2826 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2827 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2830 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2832 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2833 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2834 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2835 /* Mic2 (as headphone out) for HP output */
2836 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2837 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2838 /* Internal Speaker */
2839 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2840 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2842 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2843 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2845 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2849 /* toggle speaker-output according to the hp-jack state */
2850 static void alc880_medion_rim_automute(struct hda_codec *codec)
2852 unsigned int present;
2855 present = snd_hda_codec_read(codec, 0x14, 0,
2856 AC_VERB_GET_PIN_SENSE, 0)
2857 & AC_PINSENSE_PRESENCE;
2858 bits = present ? HDA_AMP_MUTE : 0;
2859 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2860 HDA_AMP_MUTE, bits);
2862 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2864 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2867 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2870 /* Looks like the unsol event is incompatible with the standard
2871 * definition. 4bit tag is placed at 28 bit!
2873 if ((res >> 28) == ALC880_HP_EVENT)
2874 alc880_medion_rim_automute(codec);
2877 #ifdef CONFIG_SND_HDA_POWER_SAVE
2878 static struct hda_amp_list alc880_loopbacks[] = {
2879 { 0x0b, HDA_INPUT, 0 },
2880 { 0x0b, HDA_INPUT, 1 },
2881 { 0x0b, HDA_INPUT, 2 },
2882 { 0x0b, HDA_INPUT, 3 },
2883 { 0x0b, HDA_INPUT, 4 },
2887 static struct hda_amp_list alc880_lg_loopbacks[] = {
2888 { 0x0b, HDA_INPUT, 1 },
2889 { 0x0b, HDA_INPUT, 6 },
2890 { 0x0b, HDA_INPUT, 7 },
2899 static int alc_init(struct hda_codec *codec)
2901 struct alc_spec *spec = codec->spec;
2905 if (codec->vendor_id == 0x10ec0888)
2906 alc888_coef_init(codec);
2908 for (i = 0; i < spec->num_init_verbs; i++)
2909 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2911 if (spec->init_hook)
2912 spec->init_hook(codec);
2917 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2919 struct alc_spec *spec = codec->spec;
2921 if (spec->unsol_event)
2922 spec->unsol_event(codec, res);
2925 #ifdef CONFIG_SND_HDA_POWER_SAVE
2926 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2928 struct alc_spec *spec = codec->spec;
2929 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2934 * Analog playback callbacks
2936 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2937 struct hda_codec *codec,
2938 struct snd_pcm_substream *substream)
2940 struct alc_spec *spec = codec->spec;
2941 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2945 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2946 struct hda_codec *codec,
2947 unsigned int stream_tag,
2948 unsigned int format,
2949 struct snd_pcm_substream *substream)
2951 struct alc_spec *spec = codec->spec;
2952 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2953 stream_tag, format, substream);
2956 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2957 struct hda_codec *codec,
2958 struct snd_pcm_substream *substream)
2960 struct alc_spec *spec = codec->spec;
2961 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2967 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2968 struct hda_codec *codec,
2969 struct snd_pcm_substream *substream)
2971 struct alc_spec *spec = codec->spec;
2972 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2975 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2976 struct hda_codec *codec,
2977 unsigned int stream_tag,
2978 unsigned int format,
2979 struct snd_pcm_substream *substream)
2981 struct alc_spec *spec = codec->spec;
2982 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2983 stream_tag, format, substream);
2986 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2987 struct hda_codec *codec,
2988 struct snd_pcm_substream *substream)
2990 struct alc_spec *spec = codec->spec;
2991 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
2994 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2995 struct hda_codec *codec,
2996 struct snd_pcm_substream *substream)
2998 struct alc_spec *spec = codec->spec;
2999 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3005 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3006 struct hda_codec *codec,
3007 unsigned int stream_tag,
3008 unsigned int format,
3009 struct snd_pcm_substream *substream)
3011 struct alc_spec *spec = codec->spec;
3013 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3014 stream_tag, 0, format);
3018 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3019 struct hda_codec *codec,
3020 struct snd_pcm_substream *substream)
3022 struct alc_spec *spec = codec->spec;
3024 snd_hda_codec_cleanup_stream(codec,
3025 spec->adc_nids[substream->number + 1]);
3032 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3036 /* NID is set in alc_build_pcms */
3038 .open = alc880_playback_pcm_open,
3039 .prepare = alc880_playback_pcm_prepare,
3040 .cleanup = alc880_playback_pcm_cleanup
3044 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3048 /* NID is set in alc_build_pcms */
3051 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3055 /* NID is set in alc_build_pcms */
3058 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3059 .substreams = 2, /* can be overridden */
3062 /* NID is set in alc_build_pcms */
3064 .prepare = alc880_alt_capture_pcm_prepare,
3065 .cleanup = alc880_alt_capture_pcm_cleanup
3069 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3073 /* NID is set in alc_build_pcms */
3075 .open = alc880_dig_playback_pcm_open,
3076 .close = alc880_dig_playback_pcm_close,
3077 .prepare = alc880_dig_playback_pcm_prepare,
3078 .cleanup = alc880_dig_playback_pcm_cleanup
3082 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3086 /* NID is set in alc_build_pcms */
3089 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3090 static struct hda_pcm_stream alc_pcm_null_stream = {
3096 static int alc_build_pcms(struct hda_codec *codec)
3098 struct alc_spec *spec = codec->spec;
3099 struct hda_pcm *info = spec->pcm_rec;
3102 codec->num_pcms = 1;
3103 codec->pcm_info = info;
3105 if (spec->no_analog)
3108 info->name = spec->stream_name_analog;
3109 if (spec->stream_analog_playback) {
3110 if (snd_BUG_ON(!spec->multiout.dac_nids))
3112 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3113 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3115 if (spec->stream_analog_capture) {
3116 if (snd_BUG_ON(!spec->adc_nids))
3118 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3119 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3122 if (spec->channel_mode) {
3123 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3124 for (i = 0; i < spec->num_channel_mode; i++) {
3125 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3126 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3132 /* SPDIF for stream index #1 */
3133 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3134 codec->num_pcms = 2;
3135 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3136 info = spec->pcm_rec + 1;
3137 info->name = spec->stream_name_digital;
3138 if (spec->dig_out_type)
3139 info->pcm_type = spec->dig_out_type;
3141 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3142 if (spec->multiout.dig_out_nid &&
3143 spec->stream_digital_playback) {
3144 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3145 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3147 if (spec->dig_in_nid &&
3148 spec->stream_digital_capture) {
3149 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3150 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3152 /* FIXME: do we need this for all Realtek codec models? */
3153 codec->spdif_status_reset = 1;
3156 if (spec->no_analog)
3159 /* If the use of more than one ADC is requested for the current
3160 * model, configure a second analog capture-only PCM.
3162 /* Additional Analaog capture for index #2 */
3163 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3164 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3165 codec->num_pcms = 3;
3166 info = spec->pcm_rec + 2;
3167 info->name = spec->stream_name_analog;
3168 if (spec->alt_dac_nid) {
3169 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3170 *spec->stream_analog_alt_playback;
3171 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3174 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3175 alc_pcm_null_stream;
3176 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3178 if (spec->num_adc_nids > 1) {
3179 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3180 *spec->stream_analog_alt_capture;
3181 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3183 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3184 spec->num_adc_nids - 1;
3186 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3187 alc_pcm_null_stream;
3188 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3195 static void alc_free_kctls(struct hda_codec *codec)
3197 struct alc_spec *spec = codec->spec;
3199 if (spec->kctls.list) {
3200 struct snd_kcontrol_new *kctl = spec->kctls.list;
3202 for (i = 0; i < spec->kctls.used; i++)
3203 kfree(kctl[i].name);
3205 snd_array_free(&spec->kctls);
3208 static void alc_free(struct hda_codec *codec)
3210 struct alc_spec *spec = codec->spec;
3215 alc_free_kctls(codec);
3217 snd_hda_detach_beep_device(codec);
3220 #ifdef SND_HDA_NEEDS_RESUME
3221 static int alc_resume(struct hda_codec *codec)
3223 codec->patch_ops.init(codec);
3224 snd_hda_codec_resume_amp(codec);
3225 snd_hda_codec_resume_cache(codec);
3232 static struct hda_codec_ops alc_patch_ops = {
3233 .build_controls = alc_build_controls,
3234 .build_pcms = alc_build_pcms,
3237 .unsol_event = alc_unsol_event,
3238 #ifdef SND_HDA_NEEDS_RESUME
3239 .resume = alc_resume,
3241 #ifdef CONFIG_SND_HDA_POWER_SAVE
3242 .check_power_status = alc_check_power_status,
3248 * Test configuration for debugging
3250 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3253 #ifdef CONFIG_SND_DEBUG
3254 static hda_nid_t alc880_test_dac_nids[4] = {
3255 0x02, 0x03, 0x04, 0x05
3258 static struct hda_input_mux alc880_test_capture_source = {
3267 { "Surround", 0x6 },
3271 static struct hda_channel_mode alc880_test_modes[4] = {
3278 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3279 struct snd_ctl_elem_info *uinfo)
3281 static char *texts[] = {
3282 "N/A", "Line Out", "HP Out",
3283 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3285 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3287 uinfo->value.enumerated.items = 8;
3288 if (uinfo->value.enumerated.item >= 8)
3289 uinfo->value.enumerated.item = 7;
3290 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3294 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3295 struct snd_ctl_elem_value *ucontrol)
3297 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3298 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3299 unsigned int pin_ctl, item = 0;
3301 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3302 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3303 if (pin_ctl & AC_PINCTL_OUT_EN) {
3304 if (pin_ctl & AC_PINCTL_HP_EN)
3308 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3309 switch (pin_ctl & AC_PINCTL_VREFEN) {
3310 case AC_PINCTL_VREF_HIZ: item = 3; break;
3311 case AC_PINCTL_VREF_50: item = 4; break;
3312 case AC_PINCTL_VREF_GRD: item = 5; break;
3313 case AC_PINCTL_VREF_80: item = 6; break;
3314 case AC_PINCTL_VREF_100: item = 7; break;
3317 ucontrol->value.enumerated.item[0] = item;
3321 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3322 struct snd_ctl_elem_value *ucontrol)
3324 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3325 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3326 static unsigned int ctls[] = {
3327 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3328 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3329 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3330 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3331 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3332 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3334 unsigned int old_ctl, new_ctl;
3336 old_ctl = snd_hda_codec_read(codec, nid, 0,
3337 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3338 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3339 if (old_ctl != new_ctl) {
3341 snd_hda_codec_write_cache(codec, nid, 0,
3342 AC_VERB_SET_PIN_WIDGET_CONTROL,
3344 val = ucontrol->value.enumerated.item[0] >= 3 ?
3346 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3353 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3354 struct snd_ctl_elem_info *uinfo)
3356 static char *texts[] = {
3357 "Front", "Surround", "CLFE", "Side"
3359 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3361 uinfo->value.enumerated.items = 4;
3362 if (uinfo->value.enumerated.item >= 4)
3363 uinfo->value.enumerated.item = 3;
3364 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3368 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3369 struct snd_ctl_elem_value *ucontrol)
3371 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3372 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3375 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3376 ucontrol->value.enumerated.item[0] = sel & 3;
3380 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3381 struct snd_ctl_elem_value *ucontrol)
3383 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3384 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3387 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3388 if (ucontrol->value.enumerated.item[0] != sel) {
3389 sel = ucontrol->value.enumerated.item[0] & 3;
3390 snd_hda_codec_write_cache(codec, nid, 0,
3391 AC_VERB_SET_CONNECT_SEL, sel);
3397 #define PIN_CTL_TEST(xname,nid) { \
3398 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3400 .info = alc_test_pin_ctl_info, \
3401 .get = alc_test_pin_ctl_get, \
3402 .put = alc_test_pin_ctl_put, \
3403 .private_value = nid \
3406 #define PIN_SRC_TEST(xname,nid) { \
3407 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3409 .info = alc_test_pin_src_info, \
3410 .get = alc_test_pin_src_get, \
3411 .put = alc_test_pin_src_put, \
3412 .private_value = nid \
3415 static struct snd_kcontrol_new alc880_test_mixer[] = {
3416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3418 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3419 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3420 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3421 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3422 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3423 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3424 PIN_CTL_TEST("Front Pin Mode", 0x14),
3425 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3426 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3427 PIN_CTL_TEST("Side Pin Mode", 0x17),
3428 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3429 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3430 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3431 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3432 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3433 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3434 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3435 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3436 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3437 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3438 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3439 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3440 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3441 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3442 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3443 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3444 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3445 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3447 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3448 .name = "Channel Mode",
3449 .info = alc_ch_mode_info,
3450 .get = alc_ch_mode_get,
3451 .put = alc_ch_mode_put,
3456 static struct hda_verb alc880_test_init_verbs[] = {
3457 /* Unmute inputs of 0x0c - 0x0f */
3458 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3459 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3460 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3461 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3462 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3463 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3466 /* Vol output for 0x0c-0x0f */
3467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3470 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3471 /* Set output pins 0x14-0x17 */
3472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3473 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3474 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3475 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3476 /* Unmute output pins 0x14-0x17 */
3477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3479 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3480 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3481 /* Set input pins 0x18-0x1c */
3482 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3484 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3485 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3486 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3487 /* Mute input pins 0x18-0x1b */
3488 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3489 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3490 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3491 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3494 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3495 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3496 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3497 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3498 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3499 /* Analog input/passthru */
3500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3512 static const char *alc880_models[ALC880_MODEL_LAST] = {
3513 [ALC880_3ST] = "3stack",
3514 [ALC880_TCL_S700] = "tcl",
3515 [ALC880_3ST_DIG] = "3stack-digout",
3516 [ALC880_CLEVO] = "clevo",
3517 [ALC880_5ST] = "5stack",
3518 [ALC880_5ST_DIG] = "5stack-digout",
3519 [ALC880_W810] = "w810",
3520 [ALC880_Z71V] = "z71v",
3521 [ALC880_6ST] = "6stack",
3522 [ALC880_6ST_DIG] = "6stack-digout",
3523 [ALC880_ASUS] = "asus",
3524 [ALC880_ASUS_W1V] = "asus-w1v",
3525 [ALC880_ASUS_DIG] = "asus-dig",
3526 [ALC880_ASUS_DIG2] = "asus-dig2",
3527 [ALC880_UNIWILL_DIG] = "uniwill",
3528 [ALC880_UNIWILL_P53] = "uniwill-p53",
3529 [ALC880_FUJITSU] = "fujitsu",
3530 [ALC880_F1734] = "F1734",
3532 [ALC880_LG_LW] = "lg-lw",
3533 [ALC880_MEDION_RIM] = "medion",
3534 #ifdef CONFIG_SND_DEBUG
3535 [ALC880_TEST] = "test",
3537 [ALC880_AUTO] = "auto",
3540 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3541 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3542 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3543 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3544 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3545 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3546 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3547 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3548 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3549 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3550 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3551 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3552 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3553 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3554 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3555 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3556 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3557 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3558 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3559 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3560 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3561 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3562 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3563 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3564 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3565 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3566 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3567 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3568 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3569 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3570 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3571 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3572 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3573 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3574 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3575 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3576 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3577 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3578 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3579 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3580 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3581 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3582 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3583 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3584 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3585 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3586 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3587 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3588 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3589 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3590 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3591 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3592 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3593 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3594 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3595 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3596 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3597 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3598 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3599 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3600 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3601 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3602 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3603 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3604 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3605 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3606 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3607 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3608 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3610 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3611 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3612 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3617 * ALC880 codec presets
3619 static struct alc_config_preset alc880_presets[] = {
3621 .mixers = { alc880_three_stack_mixer },
3622 .init_verbs = { alc880_volume_init_verbs,
3623 alc880_pin_3stack_init_verbs },
3624 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3625 .dac_nids = alc880_dac_nids,
3626 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3627 .channel_mode = alc880_threestack_modes,
3629 .input_mux = &alc880_capture_source,
3631 [ALC880_3ST_DIG] = {
3632 .mixers = { alc880_three_stack_mixer },
3633 .init_verbs = { alc880_volume_init_verbs,
3634 alc880_pin_3stack_init_verbs },
3635 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3636 .dac_nids = alc880_dac_nids,
3637 .dig_out_nid = ALC880_DIGOUT_NID,
3638 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3639 .channel_mode = alc880_threestack_modes,
3641 .input_mux = &alc880_capture_source,
3643 [ALC880_TCL_S700] = {
3644 .mixers = { alc880_tcl_s700_mixer },
3645 .init_verbs = { alc880_volume_init_verbs,
3646 alc880_pin_tcl_S700_init_verbs,
3647 alc880_gpio2_init_verbs },
3648 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3649 .dac_nids = alc880_dac_nids,
3650 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3651 .num_adc_nids = 1, /* single ADC */
3653 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3654 .channel_mode = alc880_2_jack_modes,
3655 .input_mux = &alc880_capture_source,
3658 .mixers = { alc880_three_stack_mixer,
3659 alc880_five_stack_mixer},
3660 .init_verbs = { alc880_volume_init_verbs,
3661 alc880_pin_5stack_init_verbs },
3662 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3663 .dac_nids = alc880_dac_nids,
3664 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3665 .channel_mode = alc880_fivestack_modes,
3666 .input_mux = &alc880_capture_source,
3668 [ALC880_5ST_DIG] = {
3669 .mixers = { alc880_three_stack_mixer,
3670 alc880_five_stack_mixer },
3671 .init_verbs = { alc880_volume_init_verbs,
3672 alc880_pin_5stack_init_verbs },
3673 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3674 .dac_nids = alc880_dac_nids,
3675 .dig_out_nid = ALC880_DIGOUT_NID,
3676 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3677 .channel_mode = alc880_fivestack_modes,
3678 .input_mux = &alc880_capture_source,
3681 .mixers = { alc880_six_stack_mixer },
3682 .init_verbs = { alc880_volume_init_verbs,
3683 alc880_pin_6stack_init_verbs },
3684 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3685 .dac_nids = alc880_6st_dac_nids,
3686 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3687 .channel_mode = alc880_sixstack_modes,
3688 .input_mux = &alc880_6stack_capture_source,
3690 [ALC880_6ST_DIG] = {
3691 .mixers = { alc880_six_stack_mixer },
3692 .init_verbs = { alc880_volume_init_verbs,
3693 alc880_pin_6stack_init_verbs },
3694 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3695 .dac_nids = alc880_6st_dac_nids,
3696 .dig_out_nid = ALC880_DIGOUT_NID,
3697 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3698 .channel_mode = alc880_sixstack_modes,
3699 .input_mux = &alc880_6stack_capture_source,
3702 .mixers = { alc880_w810_base_mixer },
3703 .init_verbs = { alc880_volume_init_verbs,
3704 alc880_pin_w810_init_verbs,
3705 alc880_gpio2_init_verbs },
3706 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3707 .dac_nids = alc880_w810_dac_nids,
3708 .dig_out_nid = ALC880_DIGOUT_NID,
3709 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3710 .channel_mode = alc880_w810_modes,
3711 .input_mux = &alc880_capture_source,
3714 .mixers = { alc880_z71v_mixer },
3715 .init_verbs = { alc880_volume_init_verbs,
3716 alc880_pin_z71v_init_verbs },
3717 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3718 .dac_nids = alc880_z71v_dac_nids,
3719 .dig_out_nid = ALC880_DIGOUT_NID,
3721 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3722 .channel_mode = alc880_2_jack_modes,
3723 .input_mux = &alc880_capture_source,
3726 .mixers = { alc880_f1734_mixer },
3727 .init_verbs = { alc880_volume_init_verbs,
3728 alc880_pin_f1734_init_verbs },
3729 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3730 .dac_nids = alc880_f1734_dac_nids,
3732 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3733 .channel_mode = alc880_2_jack_modes,
3734 .input_mux = &alc880_f1734_capture_source,
3735 .unsol_event = alc880_uniwill_p53_unsol_event,
3736 .init_hook = alc880_uniwill_p53_hp_automute,
3739 .mixers = { alc880_asus_mixer },
3740 .init_verbs = { alc880_volume_init_verbs,
3741 alc880_pin_asus_init_verbs,
3742 alc880_gpio1_init_verbs },
3743 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3744 .dac_nids = alc880_asus_dac_nids,
3745 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3746 .channel_mode = alc880_asus_modes,
3748 .input_mux = &alc880_capture_source,
3750 [ALC880_ASUS_DIG] = {
3751 .mixers = { alc880_asus_mixer },
3752 .init_verbs = { alc880_volume_init_verbs,
3753 alc880_pin_asus_init_verbs,
3754 alc880_gpio1_init_verbs },
3755 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3756 .dac_nids = alc880_asus_dac_nids,
3757 .dig_out_nid = ALC880_DIGOUT_NID,
3758 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3759 .channel_mode = alc880_asus_modes,
3761 .input_mux = &alc880_capture_source,
3763 [ALC880_ASUS_DIG2] = {
3764 .mixers = { alc880_asus_mixer },
3765 .init_verbs = { alc880_volume_init_verbs,
3766 alc880_pin_asus_init_verbs,
3767 alc880_gpio2_init_verbs }, /* use GPIO2 */
3768 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3769 .dac_nids = alc880_asus_dac_nids,
3770 .dig_out_nid = ALC880_DIGOUT_NID,
3771 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3772 .channel_mode = alc880_asus_modes,
3774 .input_mux = &alc880_capture_source,
3776 [ALC880_ASUS_W1V] = {
3777 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3778 .init_verbs = { alc880_volume_init_verbs,
3779 alc880_pin_asus_init_verbs,
3780 alc880_gpio1_init_verbs },
3781 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3782 .dac_nids = alc880_asus_dac_nids,
3783 .dig_out_nid = ALC880_DIGOUT_NID,
3784 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3785 .channel_mode = alc880_asus_modes,
3787 .input_mux = &alc880_capture_source,
3789 [ALC880_UNIWILL_DIG] = {
3790 .mixers = { alc880_asus_mixer },
3791 .init_verbs = { alc880_volume_init_verbs,
3792 alc880_pin_asus_init_verbs },
3793 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3794 .dac_nids = alc880_asus_dac_nids,
3795 .dig_out_nid = ALC880_DIGOUT_NID,
3796 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3797 .channel_mode = alc880_asus_modes,
3799 .input_mux = &alc880_capture_source,
3801 [ALC880_UNIWILL] = {
3802 .mixers = { alc880_uniwill_mixer },
3803 .init_verbs = { alc880_volume_init_verbs,
3804 alc880_uniwill_init_verbs },
3805 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3806 .dac_nids = alc880_asus_dac_nids,
3807 .dig_out_nid = ALC880_DIGOUT_NID,
3808 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3809 .channel_mode = alc880_threestack_modes,
3811 .input_mux = &alc880_capture_source,
3812 .unsol_event = alc880_uniwill_unsol_event,
3813 .init_hook = alc880_uniwill_automute,
3815 [ALC880_UNIWILL_P53] = {
3816 .mixers = { alc880_uniwill_p53_mixer },
3817 .init_verbs = { alc880_volume_init_verbs,
3818 alc880_uniwill_p53_init_verbs },
3819 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3820 .dac_nids = alc880_asus_dac_nids,
3821 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3822 .channel_mode = alc880_threestack_modes,
3823 .input_mux = &alc880_capture_source,
3824 .unsol_event = alc880_uniwill_p53_unsol_event,
3825 .init_hook = alc880_uniwill_p53_hp_automute,
3827 [ALC880_FUJITSU] = {
3828 .mixers = { alc880_fujitsu_mixer },
3829 .init_verbs = { alc880_volume_init_verbs,
3830 alc880_uniwill_p53_init_verbs,
3831 alc880_beep_init_verbs },
3832 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3833 .dac_nids = alc880_dac_nids,
3834 .dig_out_nid = ALC880_DIGOUT_NID,
3835 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3836 .channel_mode = alc880_2_jack_modes,
3837 .input_mux = &alc880_capture_source,
3838 .unsol_event = alc880_uniwill_p53_unsol_event,
3839 .init_hook = alc880_uniwill_p53_hp_automute,
3842 .mixers = { alc880_three_stack_mixer },
3843 .init_verbs = { alc880_volume_init_verbs,
3844 alc880_pin_clevo_init_verbs },
3845 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3846 .dac_nids = alc880_dac_nids,
3848 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3849 .channel_mode = alc880_threestack_modes,
3851 .input_mux = &alc880_capture_source,
3854 .mixers = { alc880_lg_mixer },
3855 .init_verbs = { alc880_volume_init_verbs,
3856 alc880_lg_init_verbs },
3857 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3858 .dac_nids = alc880_lg_dac_nids,
3859 .dig_out_nid = ALC880_DIGOUT_NID,
3860 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3861 .channel_mode = alc880_lg_ch_modes,
3863 .input_mux = &alc880_lg_capture_source,
3864 .unsol_event = alc880_lg_unsol_event,
3865 .init_hook = alc880_lg_automute,
3866 #ifdef CONFIG_SND_HDA_POWER_SAVE
3867 .loopbacks = alc880_lg_loopbacks,
3871 .mixers = { alc880_lg_lw_mixer },
3872 .init_verbs = { alc880_volume_init_verbs,
3873 alc880_lg_lw_init_verbs },
3874 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3875 .dac_nids = alc880_dac_nids,
3876 .dig_out_nid = ALC880_DIGOUT_NID,
3877 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3878 .channel_mode = alc880_lg_lw_modes,
3879 .input_mux = &alc880_lg_lw_capture_source,
3880 .unsol_event = alc880_lg_lw_unsol_event,
3881 .init_hook = alc880_lg_lw_automute,
3883 [ALC880_MEDION_RIM] = {
3884 .mixers = { alc880_medion_rim_mixer },
3885 .init_verbs = { alc880_volume_init_verbs,
3886 alc880_medion_rim_init_verbs,
3887 alc_gpio2_init_verbs },
3888 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3889 .dac_nids = alc880_dac_nids,
3890 .dig_out_nid = ALC880_DIGOUT_NID,
3891 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3892 .channel_mode = alc880_2_jack_modes,
3893 .input_mux = &alc880_medion_rim_capture_source,
3894 .unsol_event = alc880_medion_rim_unsol_event,
3895 .init_hook = alc880_medion_rim_automute,
3897 #ifdef CONFIG_SND_DEBUG
3899 .mixers = { alc880_test_mixer },
3900 .init_verbs = { alc880_test_init_verbs },
3901 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3902 .dac_nids = alc880_test_dac_nids,
3903 .dig_out_nid = ALC880_DIGOUT_NID,
3904 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3905 .channel_mode = alc880_test_modes,
3906 .input_mux = &alc880_test_capture_source,
3912 * Automatic parse of I/O pins from the BIOS configuration
3917 ALC_CTL_WIDGET_MUTE,
3920 static struct snd_kcontrol_new alc880_control_templates[] = {
3921 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3922 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3923 HDA_BIND_MUTE(NULL, 0, 0, 0),
3926 /* add dynamic controls */
3927 static int add_control(struct alc_spec *spec, int type, const char *name,
3930 struct snd_kcontrol_new *knew;
3932 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3933 knew = snd_array_new(&spec->kctls);
3936 *knew = alc880_control_templates[type];
3937 knew->name = kstrdup(name, GFP_KERNEL);
3940 knew->private_value = val;
3944 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3945 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3946 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3947 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3948 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3949 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3950 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3951 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3952 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3953 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3954 #define ALC880_PIN_CD_NID 0x1c
3956 /* fill in the dac_nids table from the parsed pin configuration */
3957 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3958 const struct auto_pin_cfg *cfg)
3964 memset(assigned, 0, sizeof(assigned));
3965 spec->multiout.dac_nids = spec->private_dac_nids;
3967 /* check the pins hardwired to audio widget */
3968 for (i = 0; i < cfg->line_outs; i++) {
3969 nid = cfg->line_out_pins[i];
3970 if (alc880_is_fixed_pin(nid)) {
3971 int idx = alc880_fixed_pin_idx(nid);
3972 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3976 /* left pins can be connect to any audio widget */
3977 for (i = 0; i < cfg->line_outs; i++) {
3978 nid = cfg->line_out_pins[i];
3979 if (alc880_is_fixed_pin(nid))
3981 /* search for an empty channel */
3982 for (j = 0; j < cfg->line_outs; j++) {
3984 spec->multiout.dac_nids[i] =
3985 alc880_idx_to_dac(j);
3991 spec->multiout.num_dacs = cfg->line_outs;
3995 /* add playback controls from the parsed DAC table */
3996 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3997 const struct auto_pin_cfg *cfg)
4000 static const char *chname[4] = {
4001 "Front", "Surround", NULL /*CLFE*/, "Side"
4006 for (i = 0; i < cfg->line_outs; i++) {
4007 if (!spec->multiout.dac_nids[i])
4009 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4012 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4013 "Center Playback Volume",
4014 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4018 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4019 "LFE Playback Volume",
4020 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4024 err = add_control(spec, ALC_CTL_BIND_MUTE,
4025 "Center Playback Switch",
4026 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4030 err = add_control(spec, ALC_CTL_BIND_MUTE,
4031 "LFE Playback Switch",
4032 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4037 sprintf(name, "%s Playback Volume", chname[i]);
4038 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4039 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4043 sprintf(name, "%s Playback Switch", chname[i]);
4044 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4045 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4054 /* add playback controls for speaker and HP outputs */
4055 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4065 if (alc880_is_fixed_pin(pin)) {
4066 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4067 /* specify the DAC as the extra output */
4068 if (!spec->multiout.hp_nid)
4069 spec->multiout.hp_nid = nid;
4071 spec->multiout.extra_out_nid[0] = nid;
4072 /* control HP volume/switch on the output mixer amp */
4073 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4074 sprintf(name, "%s Playback Volume", pfx);
4075 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4076 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4079 sprintf(name, "%s Playback Switch", pfx);
4080 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4081 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4084 } else if (alc880_is_multi_pin(pin)) {
4085 /* set manual connection */
4086 /* we have only a switch on HP-out PIN */
4087 sprintf(name, "%s Playback Switch", pfx);
4088 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4089 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4096 /* create input playback/capture controls for the given pin */
4097 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4098 const char *ctlname,
4099 int idx, hda_nid_t mix_nid)
4104 sprintf(name, "%s Playback Volume", ctlname);
4105 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4106 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4109 sprintf(name, "%s Playback Switch", ctlname);
4110 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4111 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4117 /* create playback/capture controls for input pins */
4118 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4119 const struct auto_pin_cfg *cfg)
4121 struct hda_input_mux *imux = &spec->private_imux[0];
4124 for (i = 0; i < AUTO_PIN_LAST; i++) {
4125 if (alc880_is_input_pin(cfg->input_pins[i])) {
4126 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4127 err = new_analog_input(spec, cfg->input_pins[i],
4128 auto_pin_cfg_labels[i],
4132 imux->items[imux->num_items].label =
4133 auto_pin_cfg_labels[i];
4134 imux->items[imux->num_items].index =
4135 alc880_input_pin_idx(cfg->input_pins[i]);
4142 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4143 unsigned int pin_type)
4145 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4148 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4152 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4153 hda_nid_t nid, int pin_type,
4156 alc_set_pin_output(codec, nid, pin_type);
4157 /* need the manual connection? */
4158 if (alc880_is_multi_pin(nid)) {
4159 struct alc_spec *spec = codec->spec;
4160 int idx = alc880_multi_pin_idx(nid);
4161 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4162 AC_VERB_SET_CONNECT_SEL,
4163 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4167 static int get_pin_type(int line_out_type)
4169 if (line_out_type == AUTO_PIN_HP_OUT)
4175 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4177 struct alc_spec *spec = codec->spec;
4180 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4181 for (i = 0; i < spec->autocfg.line_outs; i++) {
4182 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4183 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4184 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4188 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4190 struct alc_spec *spec = codec->spec;
4193 pin = spec->autocfg.speaker_pins[0];
4194 if (pin) /* connect to front */
4195 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4196 pin = spec->autocfg.hp_pins[0];
4197 if (pin) /* connect to front */
4198 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4201 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4203 struct alc_spec *spec = codec->spec;
4206 for (i = 0; i < AUTO_PIN_LAST; i++) {
4207 hda_nid_t nid = spec->autocfg.input_pins[i];
4208 if (alc880_is_input_pin(nid)) {
4209 alc_set_input_pin(codec, nid, i);
4210 if (nid != ALC880_PIN_CD_NID)
4211 snd_hda_codec_write(codec, nid, 0,
4212 AC_VERB_SET_AMP_GAIN_MUTE,
4218 /* parse the BIOS configuration and set up the alc_spec */
4219 /* return 1 if successful, 0 if the proper config is not found,
4220 * or a negative error code
4222 static int alc880_parse_auto_config(struct hda_codec *codec)
4224 struct alc_spec *spec = codec->spec;
4226 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4228 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4232 if (!spec->autocfg.line_outs)
4233 return 0; /* can't find valid BIOS pin config */
4235 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4238 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4241 err = alc880_auto_create_extra_out(spec,
4242 spec->autocfg.speaker_pins[0],
4246 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4250 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4254 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4256 /* check multiple SPDIF-out (for recent codecs) */
4257 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4259 err = snd_hda_get_connections(codec,
4260 spec->autocfg.dig_out_pins[i],
4265 spec->multiout.dig_out_nid = dig_nid;
4267 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4268 spec->slave_dig_outs[i - 1] = dig_nid;
4269 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4273 if (spec->autocfg.dig_in_pin)
4274 spec->dig_in_nid = ALC880_DIGIN_NID;
4276 if (spec->kctls.list)
4277 add_mixer(spec, spec->kctls.list);
4279 add_verb(spec, alc880_volume_init_verbs);
4281 spec->num_mux_defs = 1;
4282 spec->input_mux = &spec->private_imux[0];
4287 /* additional initialization for auto-configuration model */
4288 static void alc880_auto_init(struct hda_codec *codec)
4290 struct alc_spec *spec = codec->spec;
4291 alc880_auto_init_multi_out(codec);
4292 alc880_auto_init_extra_out(codec);
4293 alc880_auto_init_analog_input(codec);
4294 if (spec->unsol_event)
4295 alc_inithook(codec);
4298 static void set_capture_mixer(struct alc_spec *spec)
4300 static struct snd_kcontrol_new *caps[3] = {
4305 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4306 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4309 #define set_beep_amp(spec, nid, idx, dir) \
4310 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4313 * OK, here we have finally the patch for ALC880
4316 static int patch_alc880(struct hda_codec *codec)
4318 struct alc_spec *spec;
4322 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4328 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4331 if (board_config < 0) {
4332 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4333 "trying auto-probe from BIOS...\n");
4334 board_config = ALC880_AUTO;
4337 if (board_config == ALC880_AUTO) {
4338 /* automatic parse from the BIOS config */
4339 err = alc880_parse_auto_config(codec);
4345 "hda_codec: Cannot set up configuration "
4346 "from BIOS. Using 3-stack mode...\n");
4347 board_config = ALC880_3ST;
4351 err = snd_hda_attach_beep_device(codec, 0x1);
4357 if (board_config != ALC880_AUTO)
4358 setup_preset(spec, &alc880_presets[board_config]);
4360 spec->stream_name_analog = "ALC880 Analog";
4361 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4362 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4363 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4365 spec->stream_name_digital = "ALC880 Digital";
4366 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4367 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4369 if (!spec->adc_nids && spec->input_mux) {
4370 /* check whether NID 0x07 is valid */
4371 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4373 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4374 if (wcap != AC_WID_AUD_IN) {
4375 spec->adc_nids = alc880_adc_nids_alt;
4376 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4378 spec->adc_nids = alc880_adc_nids;
4379 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4382 set_capture_mixer(spec);
4383 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4385 spec->vmaster_nid = 0x0c;
4387 codec->patch_ops = alc_patch_ops;
4388 if (board_config == ALC880_AUTO)
4389 spec->init_hook = alc880_auto_init;
4390 #ifdef CONFIG_SND_HDA_POWER_SAVE
4391 if (!spec->loopback.amplist)
4392 spec->loopback.amplist = alc880_loopbacks;
4394 codec->proc_widget_hook = print_realtek_coef;
4404 static hda_nid_t alc260_dac_nids[1] = {
4409 static hda_nid_t alc260_adc_nids[1] = {
4414 static hda_nid_t alc260_adc_nids_alt[1] = {
4419 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4420 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4422 static hda_nid_t alc260_dual_adc_nids[2] = {
4427 #define ALC260_DIGOUT_NID 0x03
4428 #define ALC260_DIGIN_NID 0x06
4430 static struct hda_input_mux alc260_capture_source = {
4434 { "Front Mic", 0x1 },
4440 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4441 * headphone jack and the internal CD lines since these are the only pins at
4442 * which audio can appear. For flexibility, also allow the option of
4443 * recording the mixer output on the second ADC (ADC0 doesn't have a
4444 * connection to the mixer output).
4446 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4450 { "Mic/Line", 0x0 },
4452 { "Headphone", 0x2 },
4458 { "Mic/Line", 0x0 },
4460 { "Headphone", 0x2 },
4467 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4468 * the Fujitsu S702x, but jacks are marked differently.
4470 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4477 { "Headphone", 0x5 },
4486 { "Headphone", 0x6 },
4492 /* Maxdata Favorit 100XS */
4493 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4497 { "Line/Mic", 0x0 },
4504 { "Line/Mic", 0x0 },
4512 * This is just place-holder, so there's something for alc_build_pcms to look
4513 * at when it calculates the maximum number of channels. ALC260 has no mixer
4514 * element which allows changing the channel mode, so the verb list is
4517 static struct hda_channel_mode alc260_modes[1] = {
4522 /* Mixer combinations
4524 * basic: base_output + input + pc_beep + capture
4525 * HP: base_output + input + capture_alt
4526 * HP_3013: hp_3013 + input + capture
4527 * fujitsu: fujitsu + capture
4528 * acer: acer + capture
4531 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4532 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4533 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4534 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4535 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4536 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4537 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4541 static struct snd_kcontrol_new alc260_input_mixer[] = {
4542 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4543 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4544 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4545 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4547 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4548 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4549 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4553 /* update HP, line and mono out pins according to the master switch */
4554 static void alc260_hp_master_update(struct hda_codec *codec,
4555 hda_nid_t hp, hda_nid_t line,
4558 struct alc_spec *spec = codec->spec;
4559 unsigned int val = spec->master_sw ? PIN_HP : 0;
4560 /* change HP and line-out pins */
4561 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4563 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4565 /* mono (speaker) depending on the HP jack sense */
4566 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4567 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4571 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4572 struct snd_ctl_elem_value *ucontrol)
4574 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4575 struct alc_spec *spec = codec->spec;
4576 *ucontrol->value.integer.value = spec->master_sw;
4580 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4581 struct snd_ctl_elem_value *ucontrol)
4583 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4584 struct alc_spec *spec = codec->spec;
4585 int val = !!*ucontrol->value.integer.value;
4586 hda_nid_t hp, line, mono;
4588 if (val == spec->master_sw)
4590 spec->master_sw = val;
4591 hp = (kcontrol->private_value >> 16) & 0xff;
4592 line = (kcontrol->private_value >> 8) & 0xff;
4593 mono = kcontrol->private_value & 0xff;
4594 alc260_hp_master_update(codec, hp, line, mono);
4598 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4600 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4601 .name = "Master Playback Switch",
4602 .info = snd_ctl_boolean_mono_info,
4603 .get = alc260_hp_master_sw_get,
4604 .put = alc260_hp_master_sw_put,
4605 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4607 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4608 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4609 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4610 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4611 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4613 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4617 static struct hda_verb alc260_hp_unsol_verbs[] = {
4618 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4622 static void alc260_hp_automute(struct hda_codec *codec)
4624 struct alc_spec *spec = codec->spec;
4625 unsigned int present;
4627 present = snd_hda_codec_read(codec, 0x10, 0,
4628 AC_VERB_GET_PIN_SENSE, 0);
4629 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4630 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4633 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4635 if ((res >> 26) == ALC880_HP_EVENT)
4636 alc260_hp_automute(codec);
4639 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4641 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4642 .name = "Master Playback Switch",
4643 .info = snd_ctl_boolean_mono_info,
4644 .get = alc260_hp_master_sw_get,
4645 .put = alc260_hp_master_sw_put,
4646 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4648 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4649 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4650 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4651 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4652 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4654 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4655 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4659 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4660 .ops = &snd_hda_bind_vol,
4662 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4663 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4664 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4669 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4670 .ops = &snd_hda_bind_sw,
4672 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4673 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4678 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4679 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4680 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4681 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4686 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4687 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4691 static void alc260_hp_3013_automute(struct hda_codec *codec)
4693 struct alc_spec *spec = codec->spec;
4694 unsigned int present;
4696 present = snd_hda_codec_read(codec, 0x15, 0,
4697 AC_VERB_GET_PIN_SENSE, 0);
4698 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4699 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4702 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4705 if ((res >> 26) == ALC880_HP_EVENT)
4706 alc260_hp_3013_automute(codec);
4709 static void alc260_hp_3012_automute(struct hda_codec *codec)
4711 unsigned int present, bits;
4713 present = snd_hda_codec_read(codec, 0x10, 0,
4714 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4716 bits = present ? 0 : PIN_OUT;
4717 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4719 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4721 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4725 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4728 if ((res >> 26) == ALC880_HP_EVENT)
4729 alc260_hp_3012_automute(codec);
4732 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4733 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4735 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4736 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4737 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4738 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4739 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4740 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4741 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4742 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4743 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4744 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4745 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4749 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4750 * versions of the ALC260 don't act on requests to enable mic bias from NID
4751 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4752 * datasheet doesn't mention this restriction. At this stage it's not clear
4753 * whether this behaviour is intentional or is a hardware bug in chip
4754 * revisions available in early 2006. Therefore for now allow the
4755 * "Headphone Jack Mode" control to span all choices, but if it turns out
4756 * that the lack of mic bias for this NID is intentional we could change the
4757 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4759 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4760 * don't appear to make the mic bias available from the "line" jack, even
4761 * though the NID used for this jack (0x14) can supply it. The theory is
4762 * that perhaps Acer have included blocking capacitors between the ALC260
4763 * and the output jack. If this turns out to be the case for all such
4764 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4765 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4767 * The C20x Tablet series have a mono internal speaker which is controlled
4768 * via the chip's Mono sum widget and pin complex, so include the necessary
4769 * controls for such models. On models without a "mono speaker" the control
4770 * won't do anything.
4772 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4773 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4774 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4775 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4776 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4778 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4780 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4781 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4783 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4784 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4785 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4786 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4787 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4791 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4793 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4794 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4795 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4796 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4797 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4798 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4799 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4803 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4804 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4806 static struct snd_kcontrol_new alc260_will_mixer[] = {
4807 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4808 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4810 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4811 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4812 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4813 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4814 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4815 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4816 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4820 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4821 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4823 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4824 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4825 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4827 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4828 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4829 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4830 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4831 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4832 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4833 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4838 * initialization verbs
4840 static struct hda_verb alc260_init_verbs[] = {
4841 /* Line In pin widget for input */
4842 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4843 /* CD pin widget for input */
4844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4845 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4846 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4847 /* Mic2 (front panel) pin widget for input and vref at 80% */
4848 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4849 /* LINE-2 is used for line-out in rear */
4850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4851 /* select line-out */
4852 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4854 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4856 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4858 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4859 /* mute capture amp left and right */
4860 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4861 /* set connection select to line in (default select for this ADC) */
4862 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4863 /* mute capture amp left and right */
4864 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4865 /* set connection select to line in (default select for this ADC) */
4866 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4867 /* set vol=0 Line-Out mixer amp left and right */
4868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4869 /* unmute pin widget amp left and right (no gain on this amp) */
4870 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4871 /* set vol=0 HP mixer amp left and right */
4872 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4873 /* unmute pin widget amp left and right (no gain on this amp) */
4874 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4875 /* set vol=0 Mono mixer amp left and right */
4876 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4877 /* unmute pin widget amp left and right (no gain on this amp) */
4878 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4879 /* unmute LINE-2 out pin */
4880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4881 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4884 /* mute analog inputs */
4885 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4886 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4888 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4890 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4891 /* mute Front out path */
4892 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4893 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4894 /* mute Headphone out path */
4895 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4896 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4897 /* mute Mono out path */
4898 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4899 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4903 #if 0 /* should be identical with alc260_init_verbs? */
4904 static struct hda_verb alc260_hp_init_verbs[] = {
4905 /* Headphone and output */
4906 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4908 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4909 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4910 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4911 /* Mic2 (front panel) pin widget for input and vref at 80% */
4912 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4913 /* Line In pin widget for input */
4914 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4915 /* Line-2 pin widget for output */
4916 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4917 /* CD pin widget for input */
4918 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4919 /* unmute amp left and right */
4920 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4921 /* set connection select to line in (default select for this ADC) */
4922 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4923 /* unmute Line-Out mixer amp left and right (volume = 0) */
4924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4925 /* mute pin widget amp left and right (no gain on this amp) */
4926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4927 /* unmute HP mixer amp left and right (volume = 0) */
4928 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4929 /* mute pin widget amp left and right (no gain on this amp) */
4930 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4931 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4934 /* mute analog inputs */
4935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4940 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4941 /* Unmute Front out path */
4942 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4943 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4944 /* Unmute Headphone out path */
4945 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4946 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4947 /* Unmute Mono out path */
4948 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4949 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4954 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4955 /* Line out and output */
4956 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4958 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4959 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4960 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4961 /* Mic2 (front panel) pin widget for input and vref at 80% */
4962 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4963 /* Line In pin widget for input */
4964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4965 /* Headphone pin widget for output */
4966 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4967 /* CD pin widget for input */
4968 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4969 /* unmute amp left and right */
4970 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4971 /* set connection select to line in (default select for this ADC) */
4972 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4973 /* unmute Line-Out mixer amp left and right (volume = 0) */
4974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4975 /* mute pin widget amp left and right (no gain on this amp) */
4976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4977 /* unmute HP mixer amp left and right (volume = 0) */
4978 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4979 /* mute pin widget amp left and right (no gain on this amp) */
4980 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4981 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4984 /* mute analog inputs */
4985 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4990 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4991 /* Unmute Front out path */
4992 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4993 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4994 /* Unmute Headphone out path */
4995 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4997 /* Unmute Mono out path */
4998 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4999 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5003 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5004 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5005 * audio = 0x16, internal speaker = 0x10.
5007 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5008 /* Disable all GPIOs */
5009 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5010 /* Internal speaker is connected to headphone pin */
5011 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5012 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5013 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5014 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5015 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5016 /* Ensure all other unused pins are disabled and muted. */
5017 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5018 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5019 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5020 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5021 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5022 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5023 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5024 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5026 /* Disable digital (SPDIF) pins */
5027 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5028 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5030 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5031 * when acting as an output.
5033 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5035 /* Start with output sum widgets muted and their output gains at min */
5036 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5037 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5038 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5039 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5040 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5041 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5042 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5043 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5044 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5046 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5047 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5048 /* Unmute Line1 pin widget output buffer since it starts as an output.
5049 * If the pin mode is changed by the user the pin mode control will
5050 * take care of enabling the pin's input/output buffers as needed.
5051 * Therefore there's no need to enable the input buffer at this
5054 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5055 /* Unmute input buffer of pin widget used for Line-in (no equiv
5058 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5060 /* Mute capture amp left and right */
5061 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5062 /* Set ADC connection select to match default mixer setting - line
5065 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5067 /* Do the same for the second ADC: mute capture input amp and
5068 * set ADC connection to line in (on mic1 pin)
5070 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5071 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5073 /* Mute all inputs to mixer widget (even unconnected ones) */
5074 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5075 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5077 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5078 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5079 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5086 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5087 * similar laptops (adapted from Fujitsu init verbs).
5089 static struct hda_verb alc260_acer_init_verbs[] = {
5090 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5091 * the headphone jack. Turn this on and rely on the standard mute
5092 * methods whenever the user wants to turn these outputs off.
5094 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5095 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5096 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5097 /* Internal speaker/Headphone jack is connected to Line-out pin */
5098 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5099 /* Internal microphone/Mic jack is connected to Mic1 pin */
5100 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5101 /* Line In jack is connected to Line1 pin */
5102 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5103 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5104 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5105 /* Ensure all other unused pins are disabled and muted. */
5106 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5107 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5108 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5109 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5112 /* Disable digital (SPDIF) pins */
5113 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5114 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5116 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5117 * bus when acting as outputs.
5119 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5120 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5122 /* Start with output sum widgets muted and their output gains at min */
5123 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5124 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5125 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5126 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5127 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5128 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5129 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5130 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5131 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5133 /* Unmute Line-out pin widget amp left and right
5134 * (no equiv mixer ctrl)
5136 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5137 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5138 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5139 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5140 * inputs. If the pin mode is changed by the user the pin mode control
5141 * will take care of enabling the pin's input/output buffers as needed.
5142 * Therefore there's no need to enable the input buffer at this
5145 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5146 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5148 /* Mute capture amp left and right */
5149 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5150 /* Set ADC connection select to match default mixer setting - mic
5153 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5155 /* Do similar with the second ADC: mute capture input amp and
5156 * set ADC connection to mic to match ALSA's default state.
5158 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5159 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5161 /* Mute all inputs to mixer widget (even unconnected ones) */
5162 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5164 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5168 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5174 /* Initialisation sequence for Maxdata Favorit 100XS
5175 * (adapted from Acer init verbs).
5177 static struct hda_verb alc260_favorit100_init_verbs[] = {
5178 /* GPIO 0 enables the output jack.
5179 * Turn this on and rely on the standard mute
5180 * methods whenever the user wants to turn these outputs off.
5182 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5183 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5184 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5185 /* Line/Mic input jack is connected to Mic1 pin */
5186 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5187 /* Ensure all other unused pins are disabled and muted. */
5188 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5189 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5190 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5191 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5192 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5193 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5194 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5195 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5196 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5197 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5198 /* Disable digital (SPDIF) pins */
5199 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5200 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5202 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5203 * bus when acting as outputs.
5205 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5206 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5208 /* Start with output sum widgets muted and their output gains at min */
5209 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5210 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5211 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5212 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5213 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5214 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5215 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5216 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5217 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5219 /* Unmute Line-out pin widget amp left and right
5220 * (no equiv mixer ctrl)
5222 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5223 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5224 * inputs. If the pin mode is changed by the user the pin mode control
5225 * will take care of enabling the pin's input/output buffers as needed.
5226 * Therefore there's no need to enable the input buffer at this
5229 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5231 /* Mute capture amp left and right */
5232 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5233 /* Set ADC connection select to match default mixer setting - mic
5236 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5238 /* Do similar with the second ADC: mute capture input amp and
5239 * set ADC connection to mic to match ALSA's default state.
5241 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5242 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5244 /* Mute all inputs to mixer widget (even unconnected ones) */
5245 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5251 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5257 static struct hda_verb alc260_will_verbs[] = {
5258 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5259 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5260 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5261 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5262 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5263 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5267 static struct hda_verb alc260_replacer_672v_verbs[] = {
5268 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5269 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5270 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5272 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5273 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5274 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5276 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5280 /* toggle speaker-output according to the hp-jack state */
5281 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5283 unsigned int present;
5285 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5286 present = snd_hda_codec_read(codec, 0x0f, 0,
5287 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5289 snd_hda_codec_write_cache(codec, 0x01, 0,
5290 AC_VERB_SET_GPIO_DATA, 1);
5291 snd_hda_codec_write_cache(codec, 0x0f, 0,
5292 AC_VERB_SET_PIN_WIDGET_CONTROL,
5295 snd_hda_codec_write_cache(codec, 0x01, 0,
5296 AC_VERB_SET_GPIO_DATA, 0);
5297 snd_hda_codec_write_cache(codec, 0x0f, 0,
5298 AC_VERB_SET_PIN_WIDGET_CONTROL,
5303 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5306 if ((res >> 26) == ALC880_HP_EVENT)
5307 alc260_replacer_672v_automute(codec);
5310 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5311 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5312 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5313 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5314 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5315 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5316 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5317 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5318 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5319 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5320 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5324 /* Test configuration for debugging, modelled after the ALC880 test
5327 #ifdef CONFIG_SND_DEBUG
5328 static hda_nid_t alc260_test_dac_nids[1] = {
5331 static hda_nid_t alc260_test_adc_nids[2] = {
5334 /* For testing the ALC260, each input MUX needs its own definition since
5335 * the signal assignments are different. This assumes that the first ADC
5338 static struct hda_input_mux alc260_test_capture_sources[2] = {
5342 { "MIC1 pin", 0x0 },
5343 { "MIC2 pin", 0x1 },
5344 { "LINE1 pin", 0x2 },
5345 { "LINE2 pin", 0x3 },
5347 { "LINE-OUT pin", 0x5 },
5348 { "HP-OUT pin", 0x6 },
5354 { "MIC1 pin", 0x0 },
5355 { "MIC2 pin", 0x1 },
5356 { "LINE1 pin", 0x2 },
5357 { "LINE2 pin", 0x3 },
5360 { "LINE-OUT pin", 0x6 },
5361 { "HP-OUT pin", 0x7 },
5365 static struct snd_kcontrol_new alc260_test_mixer[] = {
5366 /* Output driver widgets */
5367 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5368 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5369 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5370 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5371 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5372 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5374 /* Modes for retasking pin widgets
5375 * Note: the ALC260 doesn't seem to act on requests to enable mic
5376 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5377 * mention this restriction. At this stage it's not clear whether
5378 * this behaviour is intentional or is a hardware bug in chip
5379 * revisions available at least up until early 2006. Therefore for
5380 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5381 * choices, but if it turns out that the lack of mic bias for these
5382 * NIDs is intentional we could change their modes from
5383 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5385 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5386 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5387 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5388 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5389 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5390 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5392 /* Loopback mixer controls */
5393 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5394 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5395 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5396 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5397 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5398 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5399 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5400 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5401 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5402 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5403 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5404 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5405 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5406 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5408 /* Controls for GPIO pins, assuming they are configured as outputs */
5409 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5410 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5411 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5412 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5414 /* Switches to allow the digital IO pins to be enabled. The datasheet
5415 * is ambigious as to which NID is which; testing on laptops which
5416 * make this output available should provide clarification.
5418 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5419 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5421 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5422 * this output to turn on an external amplifier.
5424 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5425 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5429 static struct hda_verb alc260_test_init_verbs[] = {
5430 /* Enable all GPIOs as outputs with an initial value of 0 */
5431 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5432 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5433 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5435 /* Enable retasking pins as output, initially without power amp */
5436 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5437 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5439 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5440 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5441 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5443 /* Disable digital (SPDIF) pins initially, but users can enable
5444 * them via a mixer switch. In the case of SPDIF-out, this initverb
5445 * payload also sets the generation to 0, output to be in "consumer"
5446 * PCM format, copyright asserted, no pre-emphasis and no validity
5449 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5450 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5452 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5453 * OUT1 sum bus when acting as an output.
5455 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5456 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5457 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5458 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5460 /* Start with output sum widgets muted and their output gains at min */
5461 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5464 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5466 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5467 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5468 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5469 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5471 /* Unmute retasking pin widget output buffers since the default
5472 * state appears to be output. As the pin mode is changed by the
5473 * user the pin mode control will take care of enabling the pin's
5474 * input/output buffers as needed.
5476 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5477 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5480 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5481 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5482 /* Also unmute the mono-out pin widget */
5483 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5485 /* Mute capture amp left and right */
5486 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5487 /* Set ADC connection select to match default mixer setting (mic1
5490 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5492 /* Do the same for the second ADC: mute capture input amp and
5493 * set ADC connection to mic1 pin
5495 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5496 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5498 /* Mute all inputs to mixer widget (even unconnected ones) */
5499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5504 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5505 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5512 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5513 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5515 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5516 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5519 * for BIOS auto-configuration
5522 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5523 const char *pfx, int *vol_bits)
5526 unsigned long vol_val, sw_val;
5530 if (nid >= 0x0f && nid < 0x11) {
5531 nid_vol = nid - 0x7;
5532 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5533 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5534 } else if (nid == 0x11) {
5535 nid_vol = nid - 0x7;
5536 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5537 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5538 } else if (nid >= 0x12 && nid <= 0x15) {
5540 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5541 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5545 if (!(*vol_bits & (1 << nid_vol))) {
5546 /* first control for the volume widget */
5547 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5548 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5551 *vol_bits |= (1 << nid_vol);
5553 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5554 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5560 /* add playback controls from the parsed DAC table */
5561 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5562 const struct auto_pin_cfg *cfg)
5568 spec->multiout.num_dacs = 1;
5569 spec->multiout.dac_nids = spec->private_dac_nids;
5570 spec->multiout.dac_nids[0] = 0x02;
5572 nid = cfg->line_out_pins[0];
5574 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5579 nid = cfg->speaker_pins[0];
5581 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5586 nid = cfg->hp_pins[0];
5588 err = alc260_add_playback_controls(spec, nid, "Headphone",
5596 /* create playback/capture controls for input pins */
5597 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5598 const struct auto_pin_cfg *cfg)
5600 struct hda_input_mux *imux = &spec->private_imux[0];
5603 for (i = 0; i < AUTO_PIN_LAST; i++) {
5604 if (cfg->input_pins[i] >= 0x12) {
5605 idx = cfg->input_pins[i] - 0x12;
5606 err = new_analog_input(spec, cfg->input_pins[i],
5607 auto_pin_cfg_labels[i], idx,
5611 imux->items[imux->num_items].label =
5612 auto_pin_cfg_labels[i];
5613 imux->items[imux->num_items].index = idx;
5616 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5617 idx = cfg->input_pins[i] - 0x09;
5618 err = new_analog_input(spec, cfg->input_pins[i],
5619 auto_pin_cfg_labels[i], idx,
5623 imux->items[imux->num_items].label =
5624 auto_pin_cfg_labels[i];
5625 imux->items[imux->num_items].index = idx;
5632 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5633 hda_nid_t nid, int pin_type,
5636 alc_set_pin_output(codec, nid, pin_type);
5637 /* need the manual connection? */
5639 int idx = nid - 0x12;
5640 snd_hda_codec_write(codec, idx + 0x0b, 0,
5641 AC_VERB_SET_CONNECT_SEL, sel_idx);
5645 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5647 struct alc_spec *spec = codec->spec;
5650 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5651 nid = spec->autocfg.line_out_pins[0];
5653 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5654 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5657 nid = spec->autocfg.speaker_pins[0];
5659 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5661 nid = spec->autocfg.hp_pins[0];
5663 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5666 #define ALC260_PIN_CD_NID 0x16
5667 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5669 struct alc_spec *spec = codec->spec;
5672 for (i = 0; i < AUTO_PIN_LAST; i++) {
5673 hda_nid_t nid = spec->autocfg.input_pins[i];
5675 alc_set_input_pin(codec, nid, i);
5676 if (nid != ALC260_PIN_CD_NID)
5677 snd_hda_codec_write(codec, nid, 0,
5678 AC_VERB_SET_AMP_GAIN_MUTE,
5685 * generic initialization of ADC, input mixers and output mixers
5687 static struct hda_verb alc260_volume_init_verbs[] = {
5689 * Unmute ADC0-1 and set the default input to mic-in
5691 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5692 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5693 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5694 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5696 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5698 * Note: PASD motherboards uses the Line In 2 as the input for
5699 * front panel mic (mic 2)
5701 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5702 /* mute analog inputs */
5703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5704 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5705 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5706 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5707 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5710 * Set up output mixers (0x08 - 0x0a)
5712 /* set vol=0 to output mixers */
5713 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5714 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5715 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5716 /* set up input amps for analog loopback */
5717 /* Amp Indices: DAC = 0, mixer = 1 */
5718 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5719 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5720 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5721 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5722 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5723 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5728 static int alc260_parse_auto_config(struct hda_codec *codec)
5730 struct alc_spec *spec = codec->spec;
5732 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5734 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5738 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5741 if (!spec->kctls.list)
5742 return 0; /* can't find valid BIOS pin config */
5743 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5747 spec->multiout.max_channels = 2;
5749 if (spec->autocfg.dig_outs)
5750 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5751 if (spec->kctls.list)
5752 add_mixer(spec, spec->kctls.list);
5754 add_verb(spec, alc260_volume_init_verbs);
5756 spec->num_mux_defs = 1;
5757 spec->input_mux = &spec->private_imux[0];
5762 /* additional initialization for auto-configuration model */
5763 static void alc260_auto_init(struct hda_codec *codec)
5765 struct alc_spec *spec = codec->spec;
5766 alc260_auto_init_multi_out(codec);
5767 alc260_auto_init_analog_input(codec);
5768 if (spec->unsol_event)
5769 alc_inithook(codec);
5772 #ifdef CONFIG_SND_HDA_POWER_SAVE
5773 static struct hda_amp_list alc260_loopbacks[] = {
5774 { 0x07, HDA_INPUT, 0 },
5775 { 0x07, HDA_INPUT, 1 },
5776 { 0x07, HDA_INPUT, 2 },
5777 { 0x07, HDA_INPUT, 3 },
5778 { 0x07, HDA_INPUT, 4 },
5784 * ALC260 configurations
5786 static const char *alc260_models[ALC260_MODEL_LAST] = {
5787 [ALC260_BASIC] = "basic",
5789 [ALC260_HP_3013] = "hp-3013",
5790 [ALC260_HP_DC7600] = "hp-dc7600",
5791 [ALC260_FUJITSU_S702X] = "fujitsu",
5792 [ALC260_ACER] = "acer",
5793 [ALC260_WILL] = "will",
5794 [ALC260_REPLACER_672V] = "replacer",
5795 [ALC260_FAVORIT100] = "favorit100",
5796 #ifdef CONFIG_SND_DEBUG
5797 [ALC260_TEST] = "test",
5799 [ALC260_AUTO] = "auto",
5802 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5803 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5804 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5805 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5806 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5807 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5808 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5809 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5810 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5811 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5812 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5813 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5814 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5815 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5816 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5817 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5818 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5819 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5820 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5821 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5825 static struct alc_config_preset alc260_presets[] = {
5827 .mixers = { alc260_base_output_mixer,
5828 alc260_input_mixer },
5829 .init_verbs = { alc260_init_verbs },
5830 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5831 .dac_nids = alc260_dac_nids,
5832 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5833 .adc_nids = alc260_adc_nids,
5834 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5835 .channel_mode = alc260_modes,
5836 .input_mux = &alc260_capture_source,
5839 .mixers = { alc260_hp_output_mixer,
5840 alc260_input_mixer },
5841 .init_verbs = { alc260_init_verbs,
5842 alc260_hp_unsol_verbs },
5843 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5844 .dac_nids = alc260_dac_nids,
5845 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5846 .adc_nids = alc260_adc_nids_alt,
5847 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5848 .channel_mode = alc260_modes,
5849 .input_mux = &alc260_capture_source,
5850 .unsol_event = alc260_hp_unsol_event,
5851 .init_hook = alc260_hp_automute,
5853 [ALC260_HP_DC7600] = {
5854 .mixers = { alc260_hp_dc7600_mixer,
5855 alc260_input_mixer },
5856 .init_verbs = { alc260_init_verbs,
5857 alc260_hp_dc7600_verbs },
5858 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5859 .dac_nids = alc260_dac_nids,
5860 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5861 .adc_nids = alc260_adc_nids_alt,
5862 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5863 .channel_mode = alc260_modes,
5864 .input_mux = &alc260_capture_source,
5865 .unsol_event = alc260_hp_3012_unsol_event,
5866 .init_hook = alc260_hp_3012_automute,
5868 [ALC260_HP_3013] = {
5869 .mixers = { alc260_hp_3013_mixer,
5870 alc260_input_mixer },
5871 .init_verbs = { alc260_hp_3013_init_verbs,
5872 alc260_hp_3013_unsol_verbs },
5873 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5874 .dac_nids = alc260_dac_nids,
5875 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5876 .adc_nids = alc260_adc_nids_alt,
5877 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5878 .channel_mode = alc260_modes,
5879 .input_mux = &alc260_capture_source,
5880 .unsol_event = alc260_hp_3013_unsol_event,
5881 .init_hook = alc260_hp_3013_automute,
5883 [ALC260_FUJITSU_S702X] = {
5884 .mixers = { alc260_fujitsu_mixer },
5885 .init_verbs = { alc260_fujitsu_init_verbs },
5886 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5887 .dac_nids = alc260_dac_nids,
5888 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5889 .adc_nids = alc260_dual_adc_nids,
5890 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5891 .channel_mode = alc260_modes,
5892 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5893 .input_mux = alc260_fujitsu_capture_sources,
5896 .mixers = { alc260_acer_mixer },
5897 .init_verbs = { alc260_acer_init_verbs },
5898 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5899 .dac_nids = alc260_dac_nids,
5900 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5901 .adc_nids = alc260_dual_adc_nids,
5902 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5903 .channel_mode = alc260_modes,
5904 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5905 .input_mux = alc260_acer_capture_sources,
5907 [ALC260_FAVORIT100] = {
5908 .mixers = { alc260_favorit100_mixer },
5909 .init_verbs = { alc260_favorit100_init_verbs },
5910 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5911 .dac_nids = alc260_dac_nids,
5912 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5913 .adc_nids = alc260_dual_adc_nids,
5914 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5915 .channel_mode = alc260_modes,
5916 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
5917 .input_mux = alc260_favorit100_capture_sources,
5920 .mixers = { alc260_will_mixer },
5921 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5922 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5923 .dac_nids = alc260_dac_nids,
5924 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5925 .adc_nids = alc260_adc_nids,
5926 .dig_out_nid = ALC260_DIGOUT_NID,
5927 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5928 .channel_mode = alc260_modes,
5929 .input_mux = &alc260_capture_source,
5931 [ALC260_REPLACER_672V] = {
5932 .mixers = { alc260_replacer_672v_mixer },
5933 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5934 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5935 .dac_nids = alc260_dac_nids,
5936 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5937 .adc_nids = alc260_adc_nids,
5938 .dig_out_nid = ALC260_DIGOUT_NID,
5939 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5940 .channel_mode = alc260_modes,
5941 .input_mux = &alc260_capture_source,
5942 .unsol_event = alc260_replacer_672v_unsol_event,
5943 .init_hook = alc260_replacer_672v_automute,
5945 #ifdef CONFIG_SND_DEBUG
5947 .mixers = { alc260_test_mixer },
5948 .init_verbs = { alc260_test_init_verbs },
5949 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5950 .dac_nids = alc260_test_dac_nids,
5951 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5952 .adc_nids = alc260_test_adc_nids,
5953 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5954 .channel_mode = alc260_modes,
5955 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5956 .input_mux = alc260_test_capture_sources,
5961 static int patch_alc260(struct hda_codec *codec)
5963 struct alc_spec *spec;
5964 int err, board_config;
5966 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5972 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5975 if (board_config < 0) {
5976 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5977 "trying auto-probe from BIOS...\n");
5978 board_config = ALC260_AUTO;
5981 if (board_config == ALC260_AUTO) {
5982 /* automatic parse from the BIOS config */
5983 err = alc260_parse_auto_config(codec);
5989 "hda_codec: Cannot set up configuration "
5990 "from BIOS. Using base mode...\n");
5991 board_config = ALC260_BASIC;
5995 err = snd_hda_attach_beep_device(codec, 0x1);
6001 if (board_config != ALC260_AUTO)
6002 setup_preset(spec, &alc260_presets[board_config]);
6004 spec->stream_name_analog = "ALC260 Analog";
6005 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6006 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6008 spec->stream_name_digital = "ALC260 Digital";
6009 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6010 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6012 if (!spec->adc_nids && spec->input_mux) {
6013 /* check whether NID 0x04 is valid */
6014 unsigned int wcap = get_wcaps(codec, 0x04);
6015 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6017 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6018 spec->adc_nids = alc260_adc_nids_alt;
6019 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6021 spec->adc_nids = alc260_adc_nids;
6022 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6025 set_capture_mixer(spec);
6026 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6028 spec->vmaster_nid = 0x08;
6030 codec->patch_ops = alc_patch_ops;
6031 if (board_config == ALC260_AUTO)
6032 spec->init_hook = alc260_auto_init;
6033 #ifdef CONFIG_SND_HDA_POWER_SAVE
6034 if (!spec->loopback.amplist)
6035 spec->loopback.amplist = alc260_loopbacks;
6037 codec->proc_widget_hook = print_realtek_coef;
6046 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6047 * configuration. Each pin widget can choose any input DACs and a mixer.
6048 * Each ADC is connected from a mixer of all inputs. This makes possible
6049 * 6-channel independent captures.
6051 * In addition, an independent DAC for the multi-playback (not used in this
6054 #define ALC882_DIGOUT_NID 0x06
6055 #define ALC882_DIGIN_NID 0x0a
6057 static struct hda_channel_mode alc882_ch_modes[1] = {
6061 static hda_nid_t alc882_dac_nids[4] = {
6062 /* front, rear, clfe, rear_surr */
6063 0x02, 0x03, 0x04, 0x05
6066 /* identical with ALC880 */
6067 #define alc882_adc_nids alc880_adc_nids
6068 #define alc882_adc_nids_alt alc880_adc_nids_alt
6070 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6071 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6074 /* FIXME: should be a matrix-type input source selection */
6076 static struct hda_input_mux alc882_capture_source = {
6080 { "Front Mic", 0x1 },
6088 static struct hda_verb alc882_3ST_ch2_init[] = {
6089 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6090 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6091 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6092 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6099 static struct hda_verb alc882_3ST_ch6_init[] = {
6100 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6101 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6102 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6103 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6104 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6105 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6109 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6110 { 2, alc882_3ST_ch2_init },
6111 { 6, alc882_3ST_ch6_init },
6117 static struct hda_verb alc882_sixstack_ch6_init[] = {
6118 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6119 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6120 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6121 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6128 static struct hda_verb alc882_sixstack_ch8_init[] = {
6129 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6130 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6131 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6132 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6136 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6137 { 6, alc882_sixstack_ch6_init },
6138 { 8, alc882_sixstack_ch8_init },
6142 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6148 static struct hda_verb alc885_mbp_ch2_init[] = {
6149 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6150 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6151 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6158 static struct hda_verb alc885_mbp_ch6_init[] = {
6159 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6160 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6161 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6162 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6163 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6167 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6168 { 2, alc885_mbp_ch2_init },
6169 { 6, alc885_mbp_ch6_init },
6173 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6174 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6176 static struct snd_kcontrol_new alc882_base_mixer[] = {
6177 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6178 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6179 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6180 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6181 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6182 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6183 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6184 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6185 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6186 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6188 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6189 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6190 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6191 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6193 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6195 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6196 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6197 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6201 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6202 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6203 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6204 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6205 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6207 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6209 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6210 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6211 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6214 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6217 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6218 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6219 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6220 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6222 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6223 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6227 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6228 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6229 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6237 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6238 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6239 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6240 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6244 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6245 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6247 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6248 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6249 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6250 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6251 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6252 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6253 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6254 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6255 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6256 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6257 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6260 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6264 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6265 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6266 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6268 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6269 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6278 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6280 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6281 .name = "Channel Mode",
6282 .info = alc_ch_mode_info,
6283 .get = alc_ch_mode_get,
6284 .put = alc_ch_mode_put,
6289 static struct hda_verb alc882_init_verbs[] = {
6290 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6301 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6303 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6304 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6305 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6307 /* Front Pin: output 0 (0x0c) */
6308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6310 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6311 /* Rear Pin: output 1 (0x0d) */
6312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6314 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6315 /* CLFE Pin: output 2 (0x0e) */
6316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6317 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6318 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6319 /* Side Pin: output 3 (0x0f) */
6320 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6321 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6322 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6323 /* Mic (rear) pin: input vref at 80% */
6324 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6325 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6326 /* Front Mic pin: input vref at 80% */
6327 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6328 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6329 /* Line In pin: input */
6330 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6331 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6332 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6333 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6334 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6335 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6336 /* CD pin widget for input */
6337 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6339 /* FIXME: use matrix-type input source selection */
6340 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6341 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6350 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6355 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6356 /* ADC1: mute amp left and right */
6357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6358 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6359 /* ADC2: mute amp left and right */
6360 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6361 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6362 /* ADC3: mute amp left and right */
6363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6364 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6369 static struct hda_verb alc882_eapd_verbs[] = {
6370 /* change to EAPD mode */
6371 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6372 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6377 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6378 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6379 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6380 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6381 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6382 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6383 /* FIXME: this looks suspicious...
6384 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6385 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6390 static struct hda_verb alc882_macpro_init_verbs[] = {
6391 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6395 /* Front Pin: output 0 (0x0c) */
6396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6397 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6399 /* Front Mic pin: input vref at 80% */
6400 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6401 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6402 /* Speaker: output */
6403 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6404 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6405 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6406 /* Headphone output (output 0 - 0x0c) */
6407 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6408 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6409 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6411 /* FIXME: use matrix-type input source selection */
6412 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6413 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6420 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6421 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6422 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6426 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6427 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6428 /* ADC1: mute amp left and right */
6429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6430 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6431 /* ADC2: mute amp left and right */
6432 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6433 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6434 /* ADC3: mute amp left and right */
6435 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6436 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6441 /* Macbook Pro rev3 */
6442 static struct hda_verb alc885_mbp3_init_verbs[] = {
6443 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6444 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6445 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6446 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6448 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6451 /* Front Pin: output 0 (0x0c) */
6452 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6453 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6454 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6455 /* HP Pin: output 0 (0x0d) */
6456 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6457 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6458 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6459 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6460 /* Mic (rear) pin: input vref at 80% */
6461 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6462 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6463 /* Front Mic pin: input vref at 80% */
6464 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6465 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6466 /* Line In pin: use output 1 when in LineOut mode */
6467 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6468 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6469 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6471 /* FIXME: use matrix-type input source selection */
6472 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6473 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6477 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6480 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6481 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6482 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6486 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6487 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6488 /* ADC1: mute amp left and right */
6489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6490 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6491 /* ADC2: mute amp left and right */
6492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6493 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6494 /* ADC3: mute amp left and right */
6495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6496 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6501 /* iMac 24 mixer. */
6502 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6503 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6504 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6508 /* iMac 24 init verbs. */
6509 static struct hda_verb alc885_imac24_init_verbs[] = {
6510 /* Internal speakers: output 0 (0x0c) */
6511 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6513 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6514 /* Internal speakers: output 0 (0x0c) */
6515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6517 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6518 /* Headphone: output 0 (0x0c) */
6519 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6520 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6521 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6522 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6523 /* Front Mic: input vref at 80% */
6524 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6525 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6529 /* Toggle speaker-output according to the hp-jack state */
6530 static void alc885_imac24_automute(struct hda_codec *codec)
6532 unsigned int present;
6534 present = snd_hda_codec_read(codec, 0x14, 0,
6535 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6536 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6537 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6538 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6539 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6542 /* Processes unsolicited events. */
6543 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6546 /* Headphone insertion or removal. */
6547 if ((res >> 26) == ALC880_HP_EVENT)
6548 alc885_imac24_automute(codec);
6551 static void alc885_mbp3_automute(struct hda_codec *codec)
6553 unsigned int present;
6555 present = snd_hda_codec_read(codec, 0x15, 0,
6556 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6557 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6558 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6559 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6560 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6563 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6566 /* Headphone insertion or removal. */
6567 if ((res >> 26) == ALC880_HP_EVENT)
6568 alc885_mbp3_automute(codec);
6572 static struct hda_verb alc882_targa_verbs[] = {
6573 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6574 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6577 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6579 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6580 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6581 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6583 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6584 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6585 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6586 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6590 /* toggle speaker-output according to the hp-jack state */
6591 static void alc882_targa_automute(struct hda_codec *codec)
6593 unsigned int present;
6595 present = snd_hda_codec_read(codec, 0x14, 0,
6596 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6597 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6598 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6599 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6603 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6605 /* Looks like the unsol event is incompatible with the standard
6606 * definition. 4bit tag is placed at 26 bit!
6608 if (((res >> 26) == ALC880_HP_EVENT)) {
6609 alc882_targa_automute(codec);
6613 static struct hda_verb alc882_asus_a7j_verbs[] = {
6614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6617 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6618 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6619 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6621 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6622 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6623 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6625 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6626 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6627 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6631 static struct hda_verb alc882_asus_a7m_verbs[] = {
6632 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6633 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6636 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6637 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6639 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6640 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6641 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6643 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6644 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6645 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6649 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6651 unsigned int gpiostate, gpiomask, gpiodir;
6653 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6654 AC_VERB_GET_GPIO_DATA, 0);
6657 gpiostate |= (1 << pin);
6659 gpiostate &= ~(1 << pin);
6661 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6662 AC_VERB_GET_GPIO_MASK, 0);
6663 gpiomask |= (1 << pin);
6665 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6666 AC_VERB_GET_GPIO_DIRECTION, 0);
6667 gpiodir |= (1 << pin);
6670 snd_hda_codec_write(codec, codec->afg, 0,
6671 AC_VERB_SET_GPIO_MASK, gpiomask);
6672 snd_hda_codec_write(codec, codec->afg, 0,
6673 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6677 snd_hda_codec_write(codec, codec->afg, 0,
6678 AC_VERB_SET_GPIO_DATA, gpiostate);
6681 /* set up GPIO at initialization */
6682 static void alc885_macpro_init_hook(struct hda_codec *codec)
6684 alc882_gpio_mute(codec, 0, 0);
6685 alc882_gpio_mute(codec, 1, 0);
6688 /* set up GPIO and update auto-muting at initialization */
6689 static void alc885_imac24_init_hook(struct hda_codec *codec)
6691 alc885_macpro_init_hook(codec);
6692 alc885_imac24_automute(codec);
6696 * generic initialization of ADC, input mixers and output mixers
6698 static struct hda_verb alc882_auto_init_verbs[] = {
6700 * Unmute ADC0-2 and set the default input to mic-in
6702 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6704 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6705 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6706 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6707 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6709 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6711 * Note: PASD motherboards uses the Line In 2 as the input for
6712 * front panel mic (mic 2)
6714 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6717 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6718 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6719 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6722 * Set up output mixers (0x0c - 0x0f)
6724 /* set vol=0 to output mixers */
6725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6726 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6727 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6728 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6729 /* set up input amps for analog loopback */
6730 /* Amp Indices: DAC = 0, mixer = 1 */
6731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6738 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6739 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6740 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6742 /* FIXME: use matrix-type input source selection */
6743 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6744 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6745 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6746 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6747 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6751 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6753 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6755 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6756 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6757 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6763 #ifdef CONFIG_SND_HDA_POWER_SAVE
6764 #define alc882_loopbacks alc880_loopbacks
6767 /* pcm configuration: identiacal with ALC880 */
6768 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6769 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6770 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6771 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6774 * configuration and preset
6776 static const char *alc882_models[ALC882_MODEL_LAST] = {
6777 [ALC882_3ST_DIG] = "3stack-dig",
6778 [ALC882_6ST_DIG] = "6stack-dig",
6779 [ALC882_ARIMA] = "arima",
6780 [ALC882_W2JC] = "w2jc",
6781 [ALC882_TARGA] = "targa",
6782 [ALC882_ASUS_A7J] = "asus-a7j",
6783 [ALC882_ASUS_A7M] = "asus-a7m",
6784 [ALC885_MACPRO] = "macpro",
6785 [ALC885_MBP3] = "mbp3",
6786 [ALC885_IMAC24] = "imac24",
6787 [ALC882_AUTO] = "auto",
6790 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6791 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6792 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6793 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6794 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6795 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6796 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6797 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6798 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6799 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6800 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6801 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6802 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6806 static struct alc_config_preset alc882_presets[] = {
6807 [ALC882_3ST_DIG] = {
6808 .mixers = { alc882_base_mixer },
6809 .init_verbs = { alc882_init_verbs },
6810 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6811 .dac_nids = alc882_dac_nids,
6812 .dig_out_nid = ALC882_DIGOUT_NID,
6813 .dig_in_nid = ALC882_DIGIN_NID,
6814 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6815 .channel_mode = alc882_ch_modes,
6817 .input_mux = &alc882_capture_source,
6819 [ALC882_6ST_DIG] = {
6820 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6821 .init_verbs = { alc882_init_verbs },
6822 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6823 .dac_nids = alc882_dac_nids,
6824 .dig_out_nid = ALC882_DIGOUT_NID,
6825 .dig_in_nid = ALC882_DIGIN_NID,
6826 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6827 .channel_mode = alc882_sixstack_modes,
6828 .input_mux = &alc882_capture_source,
6831 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6832 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6833 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6834 .dac_nids = alc882_dac_nids,
6835 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6836 .channel_mode = alc882_sixstack_modes,
6837 .input_mux = &alc882_capture_source,
6840 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6841 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6842 alc880_gpio1_init_verbs },
6843 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6844 .dac_nids = alc882_dac_nids,
6845 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6846 .channel_mode = alc880_threestack_modes,
6848 .input_mux = &alc882_capture_source,
6849 .dig_out_nid = ALC882_DIGOUT_NID,
6852 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6853 .init_verbs = { alc885_mbp3_init_verbs,
6854 alc880_gpio1_init_verbs },
6855 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6856 .dac_nids = alc882_dac_nids,
6857 .channel_mode = alc885_mbp_6ch_modes,
6858 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6859 .input_mux = &alc882_capture_source,
6860 .dig_out_nid = ALC882_DIGOUT_NID,
6861 .dig_in_nid = ALC882_DIGIN_NID,
6862 .unsol_event = alc885_mbp3_unsol_event,
6863 .init_hook = alc885_mbp3_automute,
6866 .mixers = { alc882_macpro_mixer },
6867 .init_verbs = { alc882_macpro_init_verbs },
6868 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6869 .dac_nids = alc882_dac_nids,
6870 .dig_out_nid = ALC882_DIGOUT_NID,
6871 .dig_in_nid = ALC882_DIGIN_NID,
6872 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6873 .channel_mode = alc882_ch_modes,
6874 .input_mux = &alc882_capture_source,
6875 .init_hook = alc885_macpro_init_hook,
6878 .mixers = { alc885_imac24_mixer },
6879 .init_verbs = { alc885_imac24_init_verbs },
6880 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6881 .dac_nids = alc882_dac_nids,
6882 .dig_out_nid = ALC882_DIGOUT_NID,
6883 .dig_in_nid = ALC882_DIGIN_NID,
6884 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6885 .channel_mode = alc882_ch_modes,
6886 .input_mux = &alc882_capture_source,
6887 .unsol_event = alc885_imac24_unsol_event,
6888 .init_hook = alc885_imac24_init_hook,
6891 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6892 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6893 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6894 .dac_nids = alc882_dac_nids,
6895 .dig_out_nid = ALC882_DIGOUT_NID,
6896 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6897 .adc_nids = alc882_adc_nids,
6898 .capsrc_nids = alc882_capsrc_nids,
6899 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6900 .channel_mode = alc882_3ST_6ch_modes,
6902 .input_mux = &alc882_capture_source,
6903 .unsol_event = alc882_targa_unsol_event,
6904 .init_hook = alc882_targa_automute,
6906 [ALC882_ASUS_A7J] = {
6907 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6908 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6909 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6910 .dac_nids = alc882_dac_nids,
6911 .dig_out_nid = ALC882_DIGOUT_NID,
6912 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6913 .adc_nids = alc882_adc_nids,
6914 .capsrc_nids = alc882_capsrc_nids,
6915 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6916 .channel_mode = alc882_3ST_6ch_modes,
6918 .input_mux = &alc882_capture_source,
6920 [ALC882_ASUS_A7M] = {
6921 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6922 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6923 alc880_gpio1_init_verbs,
6924 alc882_asus_a7m_verbs },
6925 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6926 .dac_nids = alc882_dac_nids,
6927 .dig_out_nid = ALC882_DIGOUT_NID,
6928 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6929 .channel_mode = alc880_threestack_modes,
6931 .input_mux = &alc882_capture_source,
6940 PINFIX_ABIT_AW9D_MAX
6943 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6944 { 0x15, 0x01080104 }, /* side */
6945 { 0x16, 0x01011012 }, /* rear */
6946 { 0x17, 0x01016011 }, /* clfe */
6950 static const struct alc_pincfg *alc882_pin_fixes[] = {
6951 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6954 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6955 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6960 * BIOS auto configuration
6962 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6963 hda_nid_t nid, int pin_type,
6967 struct alc_spec *spec = codec->spec;
6970 alc_set_pin_output(codec, nid, pin_type);
6971 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6974 idx = spec->multiout.dac_nids[dac_idx] - 2;
6975 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6979 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6981 struct alc_spec *spec = codec->spec;
6984 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6985 for (i = 0; i <= HDA_SIDE; i++) {
6986 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6987 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6989 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6994 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6996 struct alc_spec *spec = codec->spec;
6999 pin = spec->autocfg.hp_pins[0];
7000 if (pin) /* connect to front */
7002 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7003 pin = spec->autocfg.speaker_pins[0];
7005 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7008 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7009 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7011 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7013 struct alc_spec *spec = codec->spec;
7016 for (i = 0; i < AUTO_PIN_LAST; i++) {
7017 hda_nid_t nid = spec->autocfg.input_pins[i];
7021 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7022 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7023 snd_hda_codec_write(codec, nid, 0,
7024 AC_VERB_SET_AMP_GAIN_MUTE,
7029 static void alc882_auto_init_input_src(struct hda_codec *codec)
7031 struct alc_spec *spec = codec->spec;
7034 for (c = 0; c < spec->num_adc_nids; c++) {
7035 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7036 hda_nid_t nid = spec->capsrc_nids[c];
7037 unsigned int mux_idx;
7038 const struct hda_input_mux *imux;
7039 int conns, mute, idx, item;
7041 conns = snd_hda_get_connections(codec, nid, conn_list,
7042 ARRAY_SIZE(conn_list));
7045 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7046 imux = &spec->input_mux[mux_idx];
7047 for (idx = 0; idx < conns; idx++) {
7048 /* if the current connection is the selected one,
7049 * unmute it as default - otherwise mute it
7051 mute = AMP_IN_MUTE(idx);
7052 for (item = 0; item < imux->num_items; item++) {
7053 if (imux->items[item].index == idx) {
7054 if (spec->cur_mux[c] == item)
7055 mute = AMP_IN_UNMUTE(idx);
7059 /* check if we have a selector or mixer
7060 * we could check for the widget type instead, but
7061 * just check for Amp-In presence (in case of mixer
7062 * without amp-in there is something wrong, this
7063 * function shouldn't be used or capsrc nid is wrong)
7065 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7066 snd_hda_codec_write(codec, nid, 0,
7067 AC_VERB_SET_AMP_GAIN_MUTE,
7069 else if (mute != AMP_IN_MUTE(idx))
7070 snd_hda_codec_write(codec, nid, 0,
7071 AC_VERB_SET_CONNECT_SEL,
7077 /* add mic boosts if needed */
7078 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7080 struct alc_spec *spec = codec->spec;
7084 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7085 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7086 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7088 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7092 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7093 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7094 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7096 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7103 /* almost identical with ALC880 parser... */
7104 static int alc882_parse_auto_config(struct hda_codec *codec)
7106 struct alc_spec *spec = codec->spec;
7107 int err = alc880_parse_auto_config(codec);
7112 return 0; /* no config found */
7114 err = alc_auto_add_mic_boost(codec);
7118 /* hack - override the init verbs */
7119 spec->init_verbs[0] = alc882_auto_init_verbs;
7121 return 1; /* config found */
7124 /* additional initialization for auto-configuration model */
7125 static void alc882_auto_init(struct hda_codec *codec)
7127 struct alc_spec *spec = codec->spec;
7128 alc882_auto_init_multi_out(codec);
7129 alc882_auto_init_hp_out(codec);
7130 alc882_auto_init_analog_input(codec);
7131 alc882_auto_init_input_src(codec);
7132 if (spec->unsol_event)
7133 alc_inithook(codec);
7136 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7138 static int patch_alc882(struct hda_codec *codec)
7140 struct alc_spec *spec;
7141 int err, board_config;
7143 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7149 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7153 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7154 /* Pick up systems that don't supply PCI SSID */
7155 switch (codec->subsystem_id) {
7156 case 0x106b0c00: /* Mac Pro */
7157 board_config = ALC885_MACPRO;
7159 case 0x106b1000: /* iMac 24 */
7160 case 0x106b2800: /* AppleTV */
7161 case 0x106b3e00: /* iMac 24 Aluminium */
7162 board_config = ALC885_IMAC24;
7164 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7165 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7166 case 0x106b00a4: /* MacbookPro4,1 */
7167 case 0x106b2c00: /* Macbook Pro rev3 */
7168 case 0x106b3600: /* Macbook 3.1 */
7169 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7170 board_config = ALC885_MBP3;
7173 /* ALC889A is handled better as ALC888-compatible */
7174 if (codec->revision_id == 0x100101 ||
7175 codec->revision_id == 0x100103) {
7177 return patch_alc883(codec);
7179 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7180 "trying auto-probe from BIOS...\n");
7181 board_config = ALC882_AUTO;
7185 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7187 if (board_config == ALC882_AUTO) {
7188 /* automatic parse from the BIOS config */
7189 err = alc882_parse_auto_config(codec);
7195 "hda_codec: Cannot set up configuration "
7196 "from BIOS. Using base mode...\n");
7197 board_config = ALC882_3ST_DIG;
7201 err = snd_hda_attach_beep_device(codec, 0x1);
7207 if (board_config != ALC882_AUTO)
7208 setup_preset(spec, &alc882_presets[board_config]);
7210 if (codec->vendor_id == 0x10ec0885) {
7211 spec->stream_name_analog = "ALC885 Analog";
7212 spec->stream_name_digital = "ALC885 Digital";
7214 spec->stream_name_analog = "ALC882 Analog";
7215 spec->stream_name_digital = "ALC882 Digital";
7218 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7219 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7220 /* FIXME: setup DAC5 */
7221 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7222 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7224 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7225 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7227 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7228 if (!spec->adc_nids && spec->input_mux) {
7229 /* check whether NID 0x07 is valid */
7230 unsigned int wcap = get_wcaps(codec, 0x07);
7232 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7233 if (wcap != AC_WID_AUD_IN) {
7234 spec->adc_nids = alc882_adc_nids_alt;
7235 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7236 spec->capsrc_nids = alc882_capsrc_nids_alt;
7238 spec->adc_nids = alc882_adc_nids;
7239 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7240 spec->capsrc_nids = alc882_capsrc_nids;
7243 set_capture_mixer(spec);
7244 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7246 spec->vmaster_nid = 0x0c;
7248 codec->patch_ops = alc_patch_ops;
7249 if (board_config == ALC882_AUTO)
7250 spec->init_hook = alc882_auto_init;
7251 #ifdef CONFIG_SND_HDA_POWER_SAVE
7252 if (!spec->loopback.amplist)
7253 spec->loopback.amplist = alc882_loopbacks;
7255 codec->proc_widget_hook = print_realtek_coef;
7263 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7264 * configuration. Each pin widget can choose any input DACs and a mixer.
7265 * Each ADC is connected from a mixer of all inputs. This makes possible
7266 * 6-channel independent captures.
7268 * In addition, an independent DAC for the multi-playback (not used in this
7271 #define ALC883_DIGOUT_NID 0x06
7272 #define ALC883_DIGIN_NID 0x0a
7274 #define ALC1200_DIGOUT_NID 0x10
7276 static hda_nid_t alc883_dac_nids[4] = {
7277 /* front, rear, clfe, rear_surr */
7278 0x02, 0x03, 0x04, 0x05
7281 static hda_nid_t alc883_adc_nids[2] = {
7286 static hda_nid_t alc883_adc_nids_alt[1] = {
7291 static hda_nid_t alc883_adc_nids_rev[2] = {
7296 #define alc889_adc_nids alc880_adc_nids
7298 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7300 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7302 #define alc889_capsrc_nids alc882_capsrc_nids
7305 /* FIXME: should be a matrix-type input source selection */
7307 static struct hda_input_mux alc883_capture_source = {
7311 { "Front Mic", 0x1 },
7317 static struct hda_input_mux alc883_3stack_6ch_intel = {
7321 { "Front Mic", 0x0 },
7327 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7335 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7345 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7353 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7357 { "Front Mic", 0x1 },
7362 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7373 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7380 static struct hda_verb alc883_3ST_ch2_init[] = {
7381 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7382 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7383 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7384 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7391 static struct hda_verb alc883_3ST_ch4_init[] = {
7392 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7393 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7394 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7395 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7396 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7403 static struct hda_verb alc883_3ST_ch6_init[] = {
7404 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7405 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7406 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7407 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7408 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7409 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7413 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7414 { 2, alc883_3ST_ch2_init },
7415 { 4, alc883_3ST_ch4_init },
7416 { 6, alc883_3ST_ch6_init },
7422 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7423 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7424 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7425 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7426 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7433 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7434 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7435 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7436 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7437 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7438 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7445 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7446 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7447 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7448 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7449 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7450 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7451 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7455 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7456 { 2, alc883_3ST_ch2_intel_init },
7457 { 4, alc883_3ST_ch4_intel_init },
7458 { 6, alc883_3ST_ch6_intel_init },
7464 static struct hda_verb alc883_sixstack_ch6_init[] = {
7465 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7466 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7467 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7468 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7475 static struct hda_verb alc883_sixstack_ch8_init[] = {
7476 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7477 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7478 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7479 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7483 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7484 { 6, alc883_sixstack_ch6_init },
7485 { 8, alc883_sixstack_ch8_init },
7488 static struct hda_verb alc883_medion_eapd_verbs[] = {
7489 /* eanable EAPD on medion laptop */
7490 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7491 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7495 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7496 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7499 static struct snd_kcontrol_new alc883_base_mixer[] = {
7500 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7501 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7502 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7503 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7504 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7505 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7506 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7507 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7508 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7509 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7511 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7512 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7513 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7514 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7516 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7518 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7519 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7520 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7524 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7525 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7526 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7527 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7528 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7529 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7530 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7531 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7533 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7535 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7537 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7541 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7542 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7543 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7545 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7547 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7548 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7549 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7550 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7551 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7555 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7556 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7557 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7558 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7559 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7561 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7562 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7563 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7564 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7565 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7569 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7570 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7571 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7573 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7574 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7575 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7576 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7579 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7580 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7581 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7582 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7586 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7587 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7588 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7590 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7591 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7592 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7593 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7594 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7595 HDA_CODEC_MUTE("Headphone 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7599 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7600 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7601 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7603 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7604 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7605 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7609 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7610 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7611 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7612 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7613 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7614 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7616 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7617 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7618 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7620 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7621 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7622 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7623 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7625 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7627 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7628 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7629 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7633 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7634 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7635 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7636 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7637 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7638 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7639 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7640 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7641 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7642 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7643 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7644 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7645 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7646 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7648 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7650 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7651 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7656 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7657 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7658 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7659 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7660 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7661 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7662 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7663 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7664 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7665 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7666 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7667 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7669 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7671 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7676 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7677 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7679 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7680 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7681 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7685 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7686 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7687 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7691 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7692 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7693 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7694 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7695 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7697 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7699 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7703 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7704 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7705 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7707 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7708 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7709 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7710 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7711 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7712 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7716 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7717 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7718 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7719 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7720 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7721 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7725 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7729 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7730 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7731 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7733 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7734 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7736 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7737 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7741 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7742 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7743 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7744 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7745 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7746 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7747 0x0d, 1, 0x0, HDA_OUTPUT),
7748 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7749 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7750 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7751 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7752 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7753 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7754 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7755 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7756 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7757 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7758 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7763 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7764 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7768 static struct hda_bind_ctls alc883_bind_cap_vol = {
7769 .ops = &snd_hda_bind_vol,
7771 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7772 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7777 static struct hda_bind_ctls alc883_bind_cap_switch = {
7778 .ops = &snd_hda_bind_sw,
7780 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7781 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7786 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7787 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7788 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7789 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7790 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7791 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7798 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7799 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7800 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7802 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7803 /* .name = "Capture Source", */
7804 .name = "Input Source",
7806 .info = alc_mux_enum_info,
7807 .get = alc_mux_enum_get,
7808 .put = alc_mux_enum_put,
7813 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7815 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7816 .name = "Channel Mode",
7817 .info = alc_ch_mode_info,
7818 .get = alc_ch_mode_get,
7819 .put = alc_ch_mode_put,
7824 static struct hda_verb alc883_init_verbs[] = {
7825 /* ADC1: mute amp left and right */
7826 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7827 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7828 /* ADC2: mute amp left and right */
7829 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7830 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7831 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7833 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7836 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7837 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7838 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7840 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7842 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7844 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7845 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7846 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7848 /* mute analog input loopbacks */
7849 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7850 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7851 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7855 /* Front Pin: output 0 (0x0c) */
7856 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7857 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7858 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7859 /* Rear Pin: output 1 (0x0d) */
7860 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7861 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7862 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7863 /* CLFE Pin: output 2 (0x0e) */
7864 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7865 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7866 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7867 /* Side Pin: output 3 (0x0f) */
7868 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7869 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7870 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7871 /* Mic (rear) pin: input vref at 80% */
7872 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7873 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7874 /* Front Mic pin: input vref at 80% */
7875 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7876 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7877 /* Line In pin: input */
7878 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7879 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7880 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7881 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7882 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7883 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7884 /* CD pin widget for input */
7885 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7887 /* FIXME: use matrix-type input source selection */
7888 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7892 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7893 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7897 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7898 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7902 /* toggle speaker-output according to the hp-jack state */
7903 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7905 unsigned int present;
7907 present = snd_hda_codec_read(codec, 0x15, 0,
7908 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7909 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7910 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7911 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7912 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7915 /* auto-toggle front mic */
7917 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7919 unsigned int present;
7922 present = snd_hda_codec_read(codec, 0x18, 0,
7923 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7924 bits = present ? HDA_AMP_MUTE : 0;
7925 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7929 static void alc883_mitac_automute(struct hda_codec *codec)
7931 alc883_mitac_hp_automute(codec);
7932 /* alc883_mitac_mic_automute(codec); */
7935 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7938 switch (res >> 26) {
7939 case ALC880_HP_EVENT:
7940 alc883_mitac_hp_automute(codec);
7942 case ALC880_MIC_EVENT:
7943 /* alc883_mitac_mic_automute(codec); */
7948 static struct hda_verb alc883_mitac_verbs[] = {
7950 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7951 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7953 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7954 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7956 /* enable unsolicited event */
7957 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7958 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7963 static struct hda_verb alc883_clevo_m720_verbs[] = {
7965 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7966 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7968 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7969 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7971 /* enable unsolicited event */
7972 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7973 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7978 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7980 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7983 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7986 /* enable unsolicited event */
7987 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7992 static struct hda_verb alc883_tagra_verbs[] = {
7993 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7994 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7996 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7999 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8000 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8001 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8003 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8004 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8005 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8006 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8011 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8013 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8014 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8018 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8019 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8020 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8021 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8026 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8027 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8028 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8029 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8030 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8031 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8035 static struct hda_verb alc883_haier_w66_verbs[] = {
8036 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8037 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8039 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8041 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8042 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8043 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8044 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8048 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8052 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8053 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8054 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8055 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8056 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8060 static struct hda_verb alc888_3st_hp_verbs[] = {
8061 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8062 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8063 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8067 static struct hda_verb alc888_6st_dell_verbs[] = {
8068 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8072 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8073 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8074 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8075 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8076 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8080 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8081 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8082 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8083 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8084 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8088 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
8089 { 2, alc888_3st_hp_2ch_init },
8090 { 6, alc888_3st_hp_6ch_init },
8093 /* toggle front-jack and RCA according to the hp-jack state */
8094 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8096 unsigned int present;
8098 present = snd_hda_codec_read(codec, 0x1b, 0,
8099 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8100 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8101 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8102 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8103 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8106 /* toggle RCA according to the front-jack state */
8107 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8109 unsigned int present;
8111 present = snd_hda_codec_read(codec, 0x14, 0,
8112 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8113 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8114 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8117 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8120 if ((res >> 26) == ALC880_HP_EVENT)
8121 alc888_lenovo_ms7195_front_automute(codec);
8122 if ((res >> 26) == ALC880_FRONT_EVENT)
8123 alc888_lenovo_ms7195_rca_automute(codec);
8126 static struct hda_verb alc883_medion_md2_verbs[] = {
8127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8128 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8130 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8132 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8136 /* toggle speaker-output according to the hp-jack state */
8137 static void alc883_medion_md2_automute(struct hda_codec *codec)
8139 unsigned int present;
8141 present = snd_hda_codec_read(codec, 0x14, 0,
8142 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8143 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8144 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8147 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8150 if ((res >> 26) == ALC880_HP_EVENT)
8151 alc883_medion_md2_automute(codec);
8154 /* toggle speaker-output according to the hp-jack state */
8155 static void alc883_tagra_automute(struct hda_codec *codec)
8157 unsigned int present;
8160 present = snd_hda_codec_read(codec, 0x14, 0,
8161 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8162 bits = present ? HDA_AMP_MUTE : 0;
8163 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8164 HDA_AMP_MUTE, bits);
8165 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8169 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8171 if ((res >> 26) == ALC880_HP_EVENT)
8172 alc883_tagra_automute(codec);
8175 /* toggle speaker-output according to the hp-jack state */
8176 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8178 unsigned int present;
8181 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8182 & AC_PINSENSE_PRESENCE;
8183 bits = present ? HDA_AMP_MUTE : 0;
8184 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8185 HDA_AMP_MUTE, bits);
8188 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8190 unsigned int present;
8192 present = snd_hda_codec_read(codec, 0x18, 0,
8193 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8194 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8195 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8198 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8200 alc883_clevo_m720_hp_automute(codec);
8201 alc883_clevo_m720_mic_automute(codec);
8204 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8207 switch (res >> 26) {
8208 case ALC880_HP_EVENT:
8209 alc883_clevo_m720_hp_automute(codec);
8211 case ALC880_MIC_EVENT:
8212 alc883_clevo_m720_mic_automute(codec);
8217 /* toggle speaker-output according to the hp-jack state */
8218 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8220 unsigned int present;
8223 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8224 & AC_PINSENSE_PRESENCE;
8225 bits = present ? HDA_AMP_MUTE : 0;
8226 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8227 HDA_AMP_MUTE, bits);
8230 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8233 if ((res >> 26) == ALC880_HP_EVENT)
8234 alc883_2ch_fujitsu_pi2515_automute(codec);
8237 static void alc883_haier_w66_automute(struct hda_codec *codec)
8239 unsigned int present;
8242 present = snd_hda_codec_read(codec, 0x1b, 0,
8243 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8244 bits = present ? 0x80 : 0;
8245 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8249 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8252 if ((res >> 26) == ALC880_HP_EVENT)
8253 alc883_haier_w66_automute(codec);
8256 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8258 unsigned int present;
8261 present = snd_hda_codec_read(codec, 0x14, 0,
8262 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8263 bits = present ? HDA_AMP_MUTE : 0;
8264 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8265 HDA_AMP_MUTE, bits);
8268 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8270 unsigned int present;
8273 present = snd_hda_codec_read(codec, 0x1b, 0,
8274 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8275 bits = present ? HDA_AMP_MUTE : 0;
8276 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8277 HDA_AMP_MUTE, bits);
8278 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8279 HDA_AMP_MUTE, bits);
8282 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8285 if ((res >> 26) == ALC880_HP_EVENT)
8286 alc883_lenovo_101e_all_automute(codec);
8287 if ((res >> 26) == ALC880_FRONT_EVENT)
8288 alc883_lenovo_101e_ispeaker_automute(codec);
8291 /* toggle speaker-output according to the hp-jack state */
8292 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8294 unsigned int present;
8296 present = snd_hda_codec_read(codec, 0x14, 0,
8297 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8298 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8299 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8300 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8301 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8304 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8307 if ((res >> 26) == ALC880_HP_EVENT)
8308 alc883_acer_aspire_automute(codec);
8311 static struct hda_verb alc883_acer_eapd_verbs[] = {
8312 /* HP Pin: output 0 (0x0c) */
8313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8314 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8315 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8316 /* Front Pin: output 0 (0x0c) */
8317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8318 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8319 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8320 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8321 /* eanable EAPD on medion laptop */
8322 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8323 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8324 /* enable unsolicited event */
8325 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8329 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8331 unsigned int present;
8333 present = snd_hda_codec_read(codec, 0x1b, 0,
8334 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8335 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8336 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8337 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8338 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8339 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8340 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8341 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8342 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8345 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8348 switch (res >> 26) {
8349 case ALC880_HP_EVENT:
8350 /* printk(KERN_DEBUG "hp_event\n"); */
8351 alc888_6st_dell_front_automute(codec);
8356 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8359 unsigned int present;
8361 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8362 present = snd_hda_codec_read(codec, 0x1b, 0,
8363 AC_VERB_GET_PIN_SENSE, 0);
8364 present = (present & 0x80000000) != 0;
8366 /* mute internal speaker */
8367 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8368 HDA_AMP_MUTE, HDA_AMP_MUTE);
8369 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8370 HDA_AMP_MUTE, HDA_AMP_MUTE);
8371 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8372 HDA_AMP_MUTE, HDA_AMP_MUTE);
8373 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8374 HDA_AMP_MUTE, HDA_AMP_MUTE);
8375 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8376 HDA_AMP_MUTE, HDA_AMP_MUTE);
8378 /* unmute internal speaker if necessary */
8379 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8380 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8381 HDA_AMP_MUTE, mute);
8382 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8383 HDA_AMP_MUTE, mute);
8384 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8385 HDA_AMP_MUTE, mute);
8386 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8387 HDA_AMP_MUTE, mute);
8388 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8389 HDA_AMP_MUTE, mute);
8393 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8396 if ((res >> 26) == ALC880_HP_EVENT)
8397 alc888_lenovo_sky_front_automute(codec);
8401 * generic initialization of ADC, input mixers and output mixers
8403 static struct hda_verb alc883_auto_init_verbs[] = {
8405 * Unmute ADC0-2 and set the default input to mic-in
8407 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8408 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8409 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8410 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8412 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8414 * Note: PASD motherboards uses the Line In 2 as the input for
8415 * front panel mic (mic 2)
8417 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8421 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8422 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8425 * Set up output mixers (0x0c - 0x0f)
8427 /* set vol=0 to output mixers */
8428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8431 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8432 /* set up input amps for analog loopback */
8433 /* Amp Indices: DAC = 0, mixer = 1 */
8434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8437 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8439 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8440 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8441 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8442 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8443 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8445 /* FIXME: use matrix-type input source selection */
8446 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8448 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8449 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8450 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8451 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8457 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8463 static struct hda_verb alc888_asus_m90v_verbs[] = {
8464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8467 /* enable unsolicited event */
8468 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8469 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8473 static void alc883_nb_mic_automute(struct hda_codec *codec)
8475 unsigned int present;
8477 present = snd_hda_codec_read(codec, 0x18, 0,
8478 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8479 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8480 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8481 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8482 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8485 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8487 unsigned int present;
8490 present = snd_hda_codec_read(codec, 0x1b, 0,
8491 AC_VERB_GET_PIN_SENSE, 0)
8492 & AC_PINSENSE_PRESENCE;
8493 bits = present ? 0 : PIN_OUT;
8494 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8496 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8498 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8502 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8505 switch (res >> 26) {
8506 case ALC880_HP_EVENT:
8507 alc883_M90V_speaker_automute(codec);
8509 case ALC880_MIC_EVENT:
8510 alc883_nb_mic_automute(codec);
8515 static void alc883_mode2_inithook(struct hda_codec *codec)
8517 alc883_M90V_speaker_automute(codec);
8518 alc883_nb_mic_automute(codec);
8521 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8523 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8527 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8528 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8529 /* enable unsolicited event */
8530 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8534 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8536 unsigned int present;
8539 present = snd_hda_codec_read(codec, 0x14, 0,
8540 AC_VERB_GET_PIN_SENSE, 0)
8541 & AC_PINSENSE_PRESENCE;
8542 bits = present ? 0 : PIN_OUT;
8543 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8547 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8550 switch (res >> 26) {
8551 case ALC880_HP_EVENT:
8552 alc883_eee1601_speaker_automute(codec);
8557 static void alc883_eee1601_inithook(struct hda_codec *codec)
8559 alc883_eee1601_speaker_automute(codec);
8562 #ifdef CONFIG_SND_HDA_POWER_SAVE
8563 #define alc883_loopbacks alc880_loopbacks
8566 /* pcm configuration: identiacal with ALC880 */
8567 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8568 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8569 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8570 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8571 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8574 * configuration and preset
8576 static const char *alc883_models[ALC883_MODEL_LAST] = {
8577 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8578 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8579 [ALC883_3ST_6ch] = "3stack-6ch",
8580 [ALC883_6ST_DIG] = "6stack-dig",
8581 [ALC883_TARGA_DIG] = "targa-dig",
8582 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8583 [ALC883_ACER] = "acer",
8584 [ALC883_ACER_ASPIRE] = "acer-aspire",
8585 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8586 [ALC883_MEDION] = "medion",
8587 [ALC883_MEDION_MD2] = "medion-md2",
8588 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8589 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8590 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8591 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8592 [ALC888_LENOVO_SKY] = "lenovo-sky",
8593 [ALC883_HAIER_W66] = "haier-w66",
8594 [ALC888_3ST_HP] = "3stack-hp",
8595 [ALC888_6ST_DELL] = "6stack-dell",
8596 [ALC883_MITAC] = "mitac",
8597 [ALC883_CLEVO_M720] = "clevo-m720",
8598 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8599 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8600 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8601 [ALC1200_ASUS_P5Q] = "asus-p5q",
8602 [ALC883_AUTO] = "auto",
8605 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8606 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8607 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8608 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8609 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8610 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8611 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8612 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8613 ALC888_ACER_ASPIRE_4930G),
8614 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8615 ALC888_ACER_ASPIRE_4930G),
8616 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8617 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8618 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8619 ALC888_ACER_ASPIRE_4930G),
8620 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8621 ALC888_ACER_ASPIRE_4930G),
8623 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8624 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8625 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8626 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8627 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8628 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8629 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8630 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8631 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8632 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8633 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8634 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8635 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8636 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8637 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8638 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8639 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8640 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8641 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8642 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8643 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8644 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8645 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8646 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8647 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8648 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8649 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8650 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8651 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8652 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8653 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8654 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8655 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8656 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8657 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8658 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8659 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8660 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8661 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8662 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8663 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8664 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8665 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8666 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8667 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8668 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8669 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8670 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8671 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8672 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
8673 ALC883_FUJITSU_PI2515),
8674 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8675 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8676 ALC888_FUJITSU_XA3530),
8677 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8678 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8679 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8680 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8681 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8682 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8683 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8684 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8685 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8686 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8687 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8688 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8689 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8690 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8694 static hda_nid_t alc1200_slave_dig_outs[] = {
8695 ALC883_DIGOUT_NID, 0,
8698 static struct alc_config_preset alc883_presets[] = {
8699 [ALC883_3ST_2ch_DIG] = {
8700 .mixers = { alc883_3ST_2ch_mixer },
8701 .init_verbs = { alc883_init_verbs },
8702 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8703 .dac_nids = alc883_dac_nids,
8704 .dig_out_nid = ALC883_DIGOUT_NID,
8705 .dig_in_nid = ALC883_DIGIN_NID,
8706 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8707 .channel_mode = alc883_3ST_2ch_modes,
8708 .input_mux = &alc883_capture_source,
8710 [ALC883_3ST_6ch_DIG] = {
8711 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8712 .init_verbs = { alc883_init_verbs },
8713 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8714 .dac_nids = alc883_dac_nids,
8715 .dig_out_nid = ALC883_DIGOUT_NID,
8716 .dig_in_nid = ALC883_DIGIN_NID,
8717 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8718 .channel_mode = alc883_3ST_6ch_modes,
8720 .input_mux = &alc883_capture_source,
8722 [ALC883_3ST_6ch] = {
8723 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8724 .init_verbs = { alc883_init_verbs },
8725 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8726 .dac_nids = alc883_dac_nids,
8727 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8728 .channel_mode = alc883_3ST_6ch_modes,
8730 .input_mux = &alc883_capture_source,
8732 [ALC883_3ST_6ch_INTEL] = {
8733 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8734 .init_verbs = { alc883_init_verbs },
8735 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8736 .dac_nids = alc883_dac_nids,
8737 .dig_out_nid = ALC883_DIGOUT_NID,
8738 .dig_in_nid = ALC883_DIGIN_NID,
8739 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8740 .channel_mode = alc883_3ST_6ch_intel_modes,
8742 .input_mux = &alc883_3stack_6ch_intel,
8744 [ALC883_6ST_DIG] = {
8745 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8746 .init_verbs = { alc883_init_verbs },
8747 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8748 .dac_nids = alc883_dac_nids,
8749 .dig_out_nid = ALC883_DIGOUT_NID,
8750 .dig_in_nid = ALC883_DIGIN_NID,
8751 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8752 .channel_mode = alc883_sixstack_modes,
8753 .input_mux = &alc883_capture_source,
8755 [ALC883_TARGA_DIG] = {
8756 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8757 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8759 .dac_nids = alc883_dac_nids,
8760 .dig_out_nid = ALC883_DIGOUT_NID,
8761 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8762 .channel_mode = alc883_3ST_6ch_modes,
8764 .input_mux = &alc883_capture_source,
8765 .unsol_event = alc883_tagra_unsol_event,
8766 .init_hook = alc883_tagra_automute,
8768 [ALC883_TARGA_2ch_DIG] = {
8769 .mixers = { alc883_tagra_2ch_mixer},
8770 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8771 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8772 .dac_nids = alc883_dac_nids,
8773 .adc_nids = alc883_adc_nids_alt,
8774 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8775 .dig_out_nid = ALC883_DIGOUT_NID,
8776 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8777 .channel_mode = alc883_3ST_2ch_modes,
8778 .input_mux = &alc883_capture_source,
8779 .unsol_event = alc883_tagra_unsol_event,
8780 .init_hook = alc883_tagra_automute,
8783 .mixers = { alc883_base_mixer },
8784 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8785 * and the headphone jack. Turn this on and rely on the
8786 * standard mute methods whenever the user wants to turn
8787 * these outputs off.
8789 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8790 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8791 .dac_nids = alc883_dac_nids,
8792 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8793 .channel_mode = alc883_3ST_2ch_modes,
8794 .input_mux = &alc883_capture_source,
8796 [ALC883_ACER_ASPIRE] = {
8797 .mixers = { alc883_acer_aspire_mixer },
8798 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8799 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8800 .dac_nids = alc883_dac_nids,
8801 .dig_out_nid = ALC883_DIGOUT_NID,
8802 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8803 .channel_mode = alc883_3ST_2ch_modes,
8804 .input_mux = &alc883_capture_source,
8805 .unsol_event = alc883_acer_aspire_unsol_event,
8806 .init_hook = alc883_acer_aspire_automute,
8808 [ALC888_ACER_ASPIRE_4930G] = {
8809 .mixers = { alc888_base_mixer,
8810 alc883_chmode_mixer },
8811 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8812 alc888_acer_aspire_4930g_verbs },
8813 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8814 .dac_nids = alc883_dac_nids,
8815 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8816 .adc_nids = alc883_adc_nids_rev,
8817 .capsrc_nids = alc883_capsrc_nids_rev,
8818 .dig_out_nid = ALC883_DIGOUT_NID,
8819 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8820 .channel_mode = alc883_3ST_6ch_modes,
8823 ARRAY_SIZE(alc888_2_capture_sources),
8824 .input_mux = alc888_2_capture_sources,
8825 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8826 .init_hook = alc888_acer_aspire_4930g_automute,
8829 .mixers = { alc883_fivestack_mixer,
8830 alc883_chmode_mixer },
8831 .init_verbs = { alc883_init_verbs,
8832 alc883_medion_eapd_verbs },
8833 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8834 .dac_nids = alc883_dac_nids,
8835 .adc_nids = alc883_adc_nids_alt,
8836 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8837 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8838 .channel_mode = alc883_sixstack_modes,
8839 .input_mux = &alc883_capture_source,
8841 [ALC883_MEDION_MD2] = {
8842 .mixers = { alc883_medion_md2_mixer},
8843 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8844 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8845 .dac_nids = alc883_dac_nids,
8846 .dig_out_nid = ALC883_DIGOUT_NID,
8847 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8848 .channel_mode = alc883_3ST_2ch_modes,
8849 .input_mux = &alc883_capture_source,
8850 .unsol_event = alc883_medion_md2_unsol_event,
8851 .init_hook = alc883_medion_md2_automute,
8853 [ALC883_LAPTOP_EAPD] = {
8854 .mixers = { alc883_base_mixer },
8855 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8856 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8857 .dac_nids = alc883_dac_nids,
8858 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8859 .channel_mode = alc883_3ST_2ch_modes,
8860 .input_mux = &alc883_capture_source,
8862 [ALC883_CLEVO_M720] = {
8863 .mixers = { alc883_clevo_m720_mixer },
8864 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8865 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8866 .dac_nids = alc883_dac_nids,
8867 .dig_out_nid = ALC883_DIGOUT_NID,
8868 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8869 .channel_mode = alc883_3ST_2ch_modes,
8870 .input_mux = &alc883_capture_source,
8871 .unsol_event = alc883_clevo_m720_unsol_event,
8872 .init_hook = alc883_clevo_m720_automute,
8874 [ALC883_LENOVO_101E_2ch] = {
8875 .mixers = { alc883_lenovo_101e_2ch_mixer},
8876 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8877 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8878 .dac_nids = alc883_dac_nids,
8879 .adc_nids = alc883_adc_nids_alt,
8880 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8881 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8882 .channel_mode = alc883_3ST_2ch_modes,
8883 .input_mux = &alc883_lenovo_101e_capture_source,
8884 .unsol_event = alc883_lenovo_101e_unsol_event,
8885 .init_hook = alc883_lenovo_101e_all_automute,
8887 [ALC883_LENOVO_NB0763] = {
8888 .mixers = { alc883_lenovo_nb0763_mixer },
8889 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8890 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8891 .dac_nids = alc883_dac_nids,
8892 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8893 .channel_mode = alc883_3ST_2ch_modes,
8895 .input_mux = &alc883_lenovo_nb0763_capture_source,
8896 .unsol_event = alc883_medion_md2_unsol_event,
8897 .init_hook = alc883_medion_md2_automute,
8899 [ALC888_LENOVO_MS7195_DIG] = {
8900 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8901 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8902 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8903 .dac_nids = alc883_dac_nids,
8904 .dig_out_nid = ALC883_DIGOUT_NID,
8905 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8906 .channel_mode = alc883_3ST_6ch_modes,
8908 .input_mux = &alc883_capture_source,
8909 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8910 .init_hook = alc888_lenovo_ms7195_front_automute,
8912 [ALC883_HAIER_W66] = {
8913 .mixers = { alc883_tagra_2ch_mixer},
8914 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8915 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8916 .dac_nids = alc883_dac_nids,
8917 .dig_out_nid = ALC883_DIGOUT_NID,
8918 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8919 .channel_mode = alc883_3ST_2ch_modes,
8920 .input_mux = &alc883_capture_source,
8921 .unsol_event = alc883_haier_w66_unsol_event,
8922 .init_hook = alc883_haier_w66_automute,
8925 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8926 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8927 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8928 .dac_nids = alc883_dac_nids,
8929 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8930 .channel_mode = alc888_3st_hp_modes,
8932 .input_mux = &alc883_capture_source,
8934 [ALC888_6ST_DELL] = {
8935 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8936 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8937 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8938 .dac_nids = alc883_dac_nids,
8939 .dig_out_nid = ALC883_DIGOUT_NID,
8940 .dig_in_nid = ALC883_DIGIN_NID,
8941 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8942 .channel_mode = alc883_sixstack_modes,
8943 .input_mux = &alc883_capture_source,
8944 .unsol_event = alc888_6st_dell_unsol_event,
8945 .init_hook = alc888_6st_dell_front_automute,
8948 .mixers = { alc883_mitac_mixer },
8949 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8950 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8951 .dac_nids = alc883_dac_nids,
8952 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8953 .channel_mode = alc883_3ST_2ch_modes,
8954 .input_mux = &alc883_capture_source,
8955 .unsol_event = alc883_mitac_unsol_event,
8956 .init_hook = alc883_mitac_automute,
8958 [ALC883_FUJITSU_PI2515] = {
8959 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8960 .init_verbs = { alc883_init_verbs,
8961 alc883_2ch_fujitsu_pi2515_verbs},
8962 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8963 .dac_nids = alc883_dac_nids,
8964 .dig_out_nid = ALC883_DIGOUT_NID,
8965 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8966 .channel_mode = alc883_3ST_2ch_modes,
8967 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8968 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8969 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8971 [ALC888_FUJITSU_XA3530] = {
8972 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8973 .init_verbs = { alc883_init_verbs,
8974 alc888_fujitsu_xa3530_verbs },
8975 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8976 .dac_nids = alc883_dac_nids,
8977 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8978 .adc_nids = alc883_adc_nids_rev,
8979 .capsrc_nids = alc883_capsrc_nids_rev,
8980 .dig_out_nid = ALC883_DIGOUT_NID,
8981 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8982 .channel_mode = alc888_4ST_8ch_intel_modes,
8984 ARRAY_SIZE(alc888_2_capture_sources),
8985 .input_mux = alc888_2_capture_sources,
8986 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8987 .init_hook = alc888_fujitsu_xa3530_automute,
8989 [ALC888_LENOVO_SKY] = {
8990 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8991 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8992 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8993 .dac_nids = alc883_dac_nids,
8994 .dig_out_nid = ALC883_DIGOUT_NID,
8995 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8996 .channel_mode = alc883_sixstack_modes,
8998 .input_mux = &alc883_lenovo_sky_capture_source,
8999 .unsol_event = alc883_lenovo_sky_unsol_event,
9000 .init_hook = alc888_lenovo_sky_front_automute,
9002 [ALC888_ASUS_M90V] = {
9003 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9004 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9005 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9006 .dac_nids = alc883_dac_nids,
9007 .dig_out_nid = ALC883_DIGOUT_NID,
9008 .dig_in_nid = ALC883_DIGIN_NID,
9009 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9010 .channel_mode = alc883_3ST_6ch_modes,
9012 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9013 .unsol_event = alc883_mode2_unsol_event,
9014 .init_hook = alc883_mode2_inithook,
9016 [ALC888_ASUS_EEE1601] = {
9017 .mixers = { alc883_asus_eee1601_mixer },
9018 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9019 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9020 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9021 .dac_nids = alc883_dac_nids,
9022 .dig_out_nid = ALC883_DIGOUT_NID,
9023 .dig_in_nid = ALC883_DIGIN_NID,
9024 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9025 .channel_mode = alc883_3ST_2ch_modes,
9027 .input_mux = &alc883_asus_eee1601_capture_source,
9028 .unsol_event = alc883_eee1601_unsol_event,
9029 .init_hook = alc883_eee1601_inithook,
9031 [ALC1200_ASUS_P5Q] = {
9032 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9033 .init_verbs = { alc883_init_verbs },
9034 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9035 .dac_nids = alc883_dac_nids,
9036 .dig_out_nid = ALC1200_DIGOUT_NID,
9037 .dig_in_nid = ALC883_DIGIN_NID,
9038 .slave_dig_outs = alc1200_slave_dig_outs,
9039 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9040 .channel_mode = alc883_sixstack_modes,
9041 .input_mux = &alc883_capture_source,
9047 * BIOS auto configuration
9049 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9050 hda_nid_t nid, int pin_type,
9054 struct alc_spec *spec = codec->spec;
9057 alc_set_pin_output(codec, nid, pin_type);
9058 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9061 idx = spec->multiout.dac_nids[dac_idx] - 2;
9062 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9066 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9068 struct alc_spec *spec = codec->spec;
9071 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
9072 for (i = 0; i <= HDA_SIDE; i++) {
9073 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9074 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9076 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9081 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9083 struct alc_spec *spec = codec->spec;
9086 pin = spec->autocfg.hp_pins[0];
9087 if (pin) /* connect to front */
9089 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9090 pin = spec->autocfg.speaker_pins[0];
9092 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9095 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9096 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9098 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9100 struct alc_spec *spec = codec->spec;
9103 for (i = 0; i < AUTO_PIN_LAST; i++) {
9104 hda_nid_t nid = spec->autocfg.input_pins[i];
9105 if (alc883_is_input_pin(nid)) {
9106 alc_set_input_pin(codec, nid, i);
9107 if (nid != ALC883_PIN_CD_NID)
9108 snd_hda_codec_write(codec, nid, 0,
9109 AC_VERB_SET_AMP_GAIN_MUTE,
9115 #define alc883_auto_init_input_src alc882_auto_init_input_src
9117 /* almost identical with ALC880 parser... */
9118 static int alc883_parse_auto_config(struct hda_codec *codec)
9120 struct alc_spec *spec = codec->spec;
9121 int err = alc880_parse_auto_config(codec);
9122 struct auto_pin_cfg *cfg = &spec->autocfg;
9128 return 0; /* no config found */
9130 err = alc_auto_add_mic_boost(codec);
9134 /* hack - override the init verbs */
9135 spec->init_verbs[0] = alc883_auto_init_verbs;
9137 /* setup input_mux for ALC889 */
9138 if (codec->vendor_id == 0x10ec0889) {
9139 /* digital-mic input pin is excluded in alc880_auto_create..()
9140 * because it's under 0x18
9142 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9143 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9144 struct hda_input_mux *imux = &spec->private_imux[0];
9145 for (i = 1; i < 3; i++)
9146 memcpy(&spec->private_imux[i],
9147 &spec->private_imux[0],
9148 sizeof(spec->private_imux[0]));
9149 imux->items[imux->num_items].label = "Int DMic";
9150 imux->items[imux->num_items].index = 0x0b;
9152 spec->num_mux_defs = 3;
9153 spec->input_mux = spec->private_imux;
9157 return 1; /* config found */
9160 /* additional initialization for auto-configuration model */
9161 static void alc883_auto_init(struct hda_codec *codec)
9163 struct alc_spec *spec = codec->spec;
9164 alc883_auto_init_multi_out(codec);
9165 alc883_auto_init_hp_out(codec);
9166 alc883_auto_init_analog_input(codec);
9167 alc883_auto_init_input_src(codec);
9168 if (spec->unsol_event)
9169 alc_inithook(codec);
9172 static int patch_alc883(struct hda_codec *codec)
9174 struct alc_spec *spec;
9175 int err, board_config;
9177 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9183 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9185 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9188 if (board_config < 0) {
9189 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9190 "trying auto-probe from BIOS...\n");
9191 board_config = ALC883_AUTO;
9194 if (board_config == ALC883_AUTO) {
9195 /* automatic parse from the BIOS config */
9196 err = alc883_parse_auto_config(codec);
9202 "hda_codec: Cannot set up configuration "
9203 "from BIOS. Using base mode...\n");
9204 board_config = ALC883_3ST_2ch_DIG;
9208 err = snd_hda_attach_beep_device(codec, 0x1);
9214 if (board_config != ALC883_AUTO)
9215 setup_preset(spec, &alc883_presets[board_config]);
9217 switch (codec->vendor_id) {
9219 if (codec->revision_id == 0x100101) {
9220 spec->stream_name_analog = "ALC1200 Analog";
9221 spec->stream_name_digital = "ALC1200 Digital";
9223 spec->stream_name_analog = "ALC888 Analog";
9224 spec->stream_name_digital = "ALC888 Digital";
9226 if (!spec->num_adc_nids) {
9227 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9228 spec->adc_nids = alc883_adc_nids;
9230 if (!spec->capsrc_nids)
9231 spec->capsrc_nids = alc883_capsrc_nids;
9232 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9235 spec->stream_name_analog = "ALC889 Analog";
9236 spec->stream_name_digital = "ALC889 Digital";
9237 if (!spec->num_adc_nids) {
9238 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9239 spec->adc_nids = alc889_adc_nids;
9241 if (!spec->capsrc_nids)
9242 spec->capsrc_nids = alc889_capsrc_nids;
9243 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9247 spec->stream_name_analog = "ALC883 Analog";
9248 spec->stream_name_digital = "ALC883 Digital";
9249 if (!spec->num_adc_nids) {
9250 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9251 spec->adc_nids = alc883_adc_nids;
9253 if (!spec->capsrc_nids)
9254 spec->capsrc_nids = alc883_capsrc_nids;
9255 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9259 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9260 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9261 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9263 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9264 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9266 if (!spec->cap_mixer)
9267 set_capture_mixer(spec);
9268 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9270 spec->vmaster_nid = 0x0c;
9272 codec->patch_ops = alc_patch_ops;
9273 if (board_config == ALC883_AUTO)
9274 spec->init_hook = alc883_auto_init;
9276 #ifdef CONFIG_SND_HDA_POWER_SAVE
9277 if (!spec->loopback.amplist)
9278 spec->loopback.amplist = alc883_loopbacks;
9280 codec->proc_widget_hook = print_realtek_coef;
9289 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9290 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9292 #define alc262_dac_nids alc260_dac_nids
9293 #define alc262_adc_nids alc882_adc_nids
9294 #define alc262_adc_nids_alt alc882_adc_nids_alt
9295 #define alc262_capsrc_nids alc882_capsrc_nids
9296 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9298 #define alc262_modes alc260_modes
9299 #define alc262_capture_source alc882_capture_source
9301 static hda_nid_t alc262_dmic_adc_nids[1] = {
9306 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9308 static struct snd_kcontrol_new alc262_base_mixer[] = {
9309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9310 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9311 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9312 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9313 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9314 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9317 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9318 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9319 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9320 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9321 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9322 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9323 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9324 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9328 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9329 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9330 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9331 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9332 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9333 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9334 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9337 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9338 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9339 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9340 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9341 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9346 /* update HP, line and mono-out pins according to the master switch */
9347 static void alc262_hp_master_update(struct hda_codec *codec)
9349 struct alc_spec *spec = codec->spec;
9350 int val = spec->master_sw;
9353 snd_hda_codec_write_cache(codec, 0x1b, 0,
9354 AC_VERB_SET_PIN_WIDGET_CONTROL,
9356 snd_hda_codec_write_cache(codec, 0x15, 0,
9357 AC_VERB_SET_PIN_WIDGET_CONTROL,
9359 /* mono (speaker) depending on the HP jack sense */
9360 val = val && !spec->jack_present;
9361 snd_hda_codec_write_cache(codec, 0x16, 0,
9362 AC_VERB_SET_PIN_WIDGET_CONTROL,
9366 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9368 struct alc_spec *spec = codec->spec;
9369 unsigned int presence;
9370 presence = snd_hda_codec_read(codec, 0x1b, 0,
9371 AC_VERB_GET_PIN_SENSE, 0);
9372 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9373 alc262_hp_master_update(codec);
9376 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9378 if ((res >> 26) != ALC880_HP_EVENT)
9380 alc262_hp_bpc_automute(codec);
9383 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9385 struct alc_spec *spec = codec->spec;
9386 unsigned int presence;
9387 presence = snd_hda_codec_read(codec, 0x15, 0,
9388 AC_VERB_GET_PIN_SENSE, 0);
9389 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9390 alc262_hp_master_update(codec);
9393 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9396 if ((res >> 26) != ALC880_HP_EVENT)
9398 alc262_hp_wildwest_automute(codec);
9401 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9402 struct snd_ctl_elem_value *ucontrol)
9404 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9405 struct alc_spec *spec = codec->spec;
9406 *ucontrol->value.integer.value = spec->master_sw;
9410 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9411 struct snd_ctl_elem_value *ucontrol)
9413 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9414 struct alc_spec *spec = codec->spec;
9415 int val = !!*ucontrol->value.integer.value;
9417 if (val == spec->master_sw)
9419 spec->master_sw = val;
9420 alc262_hp_master_update(codec);
9424 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9427 .name = "Master Playback Switch",
9428 .info = snd_ctl_boolean_mono_info,
9429 .get = alc262_hp_master_sw_get,
9430 .put = alc262_hp_master_sw_put,
9432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9433 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9434 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9435 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9437 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9441 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9443 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9444 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9447 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9448 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9449 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9450 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9454 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9457 .name = "Master Playback Switch",
9458 .info = snd_ctl_boolean_mono_info,
9459 .get = alc262_hp_master_sw_get,
9460 .put = alc262_hp_master_sw_put,
9462 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9463 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9464 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9466 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9468 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9470 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9471 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9472 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9473 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9474 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9475 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9476 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9480 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9481 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9482 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9483 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9487 /* mute/unmute internal speaker according to the hp jack and mute state */
9488 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9490 struct alc_spec *spec = codec->spec;
9492 if (force || !spec->sense_updated) {
9493 unsigned int present;
9494 present = snd_hda_codec_read(codec, 0x15, 0,
9495 AC_VERB_GET_PIN_SENSE, 0);
9496 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9497 spec->sense_updated = 1;
9499 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9500 spec->jack_present ? HDA_AMP_MUTE : 0);
9503 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9506 if ((res >> 26) != ALC880_HP_EVENT)
9508 alc262_hp_t5735_automute(codec, 1);
9511 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9513 alc262_hp_t5735_automute(codec, 1);
9516 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9517 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9518 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9521 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9522 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9523 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9527 static struct hda_verb alc262_hp_t5735_verbs[] = {
9528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9531 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9535 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9536 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9538 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9539 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9540 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9541 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9545 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9546 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9547 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9548 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9549 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9550 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9551 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9554 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9559 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9566 /* bind hp and internal speaker mute (with plug check) */
9567 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9568 struct snd_ctl_elem_value *ucontrol)
9570 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9571 long *valp = ucontrol->value.integer.value;
9574 /* change hp mute */
9575 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9577 valp[0] ? 0 : HDA_AMP_MUTE);
9578 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9580 valp[1] ? 0 : HDA_AMP_MUTE);
9582 /* change speaker according to HP jack state */
9583 struct alc_spec *spec = codec->spec;
9585 if (spec->jack_present)
9586 mute = HDA_AMP_MUTE;
9588 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9590 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9591 HDA_AMP_MUTE, mute);
9596 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9597 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9599 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9600 .name = "Master Playback Switch",
9601 .info = snd_hda_mixer_amp_switch_info,
9602 .get = snd_hda_mixer_amp_switch_get,
9603 .put = alc262_sony_master_sw_put,
9604 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9607 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9608 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9609 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9613 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9614 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9615 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9619 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9620 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9624 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9625 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9626 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9627 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9628 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9633 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9634 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9635 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9636 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9640 static struct hda_verb alc262_tyan_verbs[] = {
9641 /* Headphone automute */
9642 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9643 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9644 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9646 /* P11 AUX_IN, white 4-pin connector */
9647 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9648 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9649 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9650 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9655 /* unsolicited event for HP jack sensing */
9656 static void alc262_tyan_automute(struct hda_codec *codec)
9659 unsigned int present;
9661 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9662 present = snd_hda_codec_read(codec, 0x1b, 0,
9663 AC_VERB_GET_PIN_SENSE, 0);
9664 present = (present & 0x80000000) != 0;
9666 /* mute line output on ATX panel */
9667 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9668 HDA_AMP_MUTE, HDA_AMP_MUTE);
9670 /* unmute line output if necessary */
9671 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9672 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9673 HDA_AMP_MUTE, mute);
9677 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9680 if ((res >> 26) != ALC880_HP_EVENT)
9682 alc262_tyan_automute(codec);
9685 #define alc262_capture_mixer alc882_capture_mixer
9686 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9689 * generic initialization of ADC, input mixers and output mixers
9691 static struct hda_verb alc262_init_verbs[] = {
9693 * Unmute ADC0-2 and set the default input to mic-in
9695 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9697 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9699 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9702 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9704 * Note: PASD motherboards uses the Line In 2 as the input for
9705 * front panel mic (mic 2)
9707 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9715 * Set up output mixers (0x0c - 0x0e)
9717 /* set vol=0 to output mixers */
9718 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9719 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9720 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9721 /* set up input amps for analog loopback */
9722 /* Amp Indices: DAC = 0, mixer = 1 */
9723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9725 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9726 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9727 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9728 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9732 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9733 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9734 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9735 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9739 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9743 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9744 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9746 /* FIXME: use matrix-type input source selection */
9747 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9748 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9749 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9751 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9752 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9755 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9756 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9757 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9767 static struct hda_verb alc262_eapd_verbs[] = {
9768 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9769 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9773 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9774 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9775 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9779 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9780 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9781 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9782 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9784 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9785 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9789 static struct hda_verb alc262_sony_unsol_verbs[] = {
9790 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9791 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9792 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9794 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9795 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9799 static struct hda_input_mux alc262_dmic_capture_source = {
9802 { "Int DMic", 0x9 },
9807 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9808 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9809 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9810 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9812 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9816 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9817 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9818 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9820 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9821 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9822 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9823 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9824 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9828 static void alc262_dmic_automute(struct hda_codec *codec)
9830 unsigned int present;
9832 present = snd_hda_codec_read(codec, 0x18, 0,
9833 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9834 snd_hda_codec_write(codec, 0x22, 0,
9835 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9838 /* toggle speaker-output according to the hp-jack state */
9839 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9841 unsigned int present;
9844 present = snd_hda_codec_read(codec, 0x15, 0,
9845 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9846 bits = present ? 0 : PIN_OUT;
9847 snd_hda_codec_write(codec, 0x14, 0,
9848 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9853 /* unsolicited event for HP jack sensing */
9854 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9857 if ((res >> 26) == ALC880_HP_EVENT)
9858 alc262_toshiba_s06_speaker_automute(codec);
9859 if ((res >> 26) == ALC880_MIC_EVENT)
9860 alc262_dmic_automute(codec);
9864 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9866 alc262_toshiba_s06_speaker_automute(codec);
9867 alc262_dmic_automute(codec);
9870 /* mute/unmute internal speaker according to the hp jack and mute state */
9871 static void alc262_hippo_automute(struct hda_codec *codec)
9873 struct alc_spec *spec = codec->spec;
9875 unsigned int present;
9877 /* need to execute and sync at first */
9878 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9879 present = snd_hda_codec_read(codec, 0x15, 0,
9880 AC_VERB_GET_PIN_SENSE, 0);
9881 spec->jack_present = (present & 0x80000000) != 0;
9882 if (spec->jack_present) {
9883 /* mute internal speaker */
9884 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9885 HDA_AMP_MUTE, HDA_AMP_MUTE);
9887 /* unmute internal speaker if necessary */
9888 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9889 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9890 HDA_AMP_MUTE, mute);
9894 /* unsolicited event for HP jack sensing */
9895 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9898 if ((res >> 26) != ALC880_HP_EVENT)
9900 alc262_hippo_automute(codec);
9903 static void alc262_hippo1_automute(struct hda_codec *codec)
9906 unsigned int present;
9908 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9909 present = snd_hda_codec_read(codec, 0x1b, 0,
9910 AC_VERB_GET_PIN_SENSE, 0);
9911 present = (present & 0x80000000) != 0;
9913 /* mute internal speaker */
9914 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9915 HDA_AMP_MUTE, HDA_AMP_MUTE);
9917 /* unmute internal speaker if necessary */
9918 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9919 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9920 HDA_AMP_MUTE, mute);
9924 /* unsolicited event for HP jack sensing */
9925 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9928 if ((res >> 26) != ALC880_HP_EVENT)
9930 alc262_hippo1_automute(codec);
9936 * 0x16 = internal speaker
9937 * 0x18 = external mic
9940 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9941 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9942 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9946 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9948 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9949 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9953 static struct hda_verb alc262_nec_verbs[] = {
9954 /* Unmute Speaker */
9955 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9958 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9961 /* External mic to headphone */
9962 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9963 /* External mic to speaker */
9964 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9970 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9971 * 0x1b = port replicator headphone out
9974 #define ALC_HP_EVENT 0x37
9976 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9977 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9978 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9979 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9984 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9985 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9986 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9990 static struct hda_input_mux alc262_fujitsu_capture_source = {
9999 static struct hda_input_mux alc262_HP_capture_source = {
10003 { "Front Mic", 0x1 },
10010 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10014 { "Front Mic", 0x2 },
10020 /* mute/unmute internal speaker according to the hp jacks and mute state */
10021 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10023 struct alc_spec *spec = codec->spec;
10026 if (force || !spec->sense_updated) {
10027 unsigned int present;
10028 /* need to execute and sync at first */
10029 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10030 /* check laptop HP jack */
10031 present = snd_hda_codec_read(codec, 0x14, 0,
10032 AC_VERB_GET_PIN_SENSE, 0);
10033 /* need to execute and sync at first */
10034 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10035 /* check docking HP jack */
10036 present |= snd_hda_codec_read(codec, 0x1b, 0,
10037 AC_VERB_GET_PIN_SENSE, 0);
10038 if (present & AC_PINSENSE_PRESENCE)
10039 spec->jack_present = 1;
10041 spec->jack_present = 0;
10042 spec->sense_updated = 1;
10044 /* unmute internal speaker only if both HPs are unplugged and
10045 * master switch is on
10047 if (spec->jack_present)
10048 mute = HDA_AMP_MUTE;
10050 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10051 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10052 HDA_AMP_MUTE, mute);
10055 /* unsolicited event for HP jack sensing */
10056 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10059 if ((res >> 26) != ALC_HP_EVENT)
10061 alc262_fujitsu_automute(codec, 1);
10064 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10066 alc262_fujitsu_automute(codec, 1);
10069 /* bind volumes of both NID 0x0c and 0x0d */
10070 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10071 .ops = &snd_hda_bind_vol,
10073 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10074 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10079 /* mute/unmute internal speaker according to the hp jack and mute state */
10080 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10082 struct alc_spec *spec = codec->spec;
10085 if (force || !spec->sense_updated) {
10086 unsigned int present_int_hp;
10087 /* need to execute and sync at first */
10088 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10089 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10090 AC_VERB_GET_PIN_SENSE, 0);
10091 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10092 spec->sense_updated = 1;
10094 if (spec->jack_present) {
10095 /* mute internal speaker */
10096 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10097 HDA_AMP_MUTE, HDA_AMP_MUTE);
10098 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10099 HDA_AMP_MUTE, HDA_AMP_MUTE);
10101 /* unmute internal speaker if necessary */
10102 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10103 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10104 HDA_AMP_MUTE, mute);
10105 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10106 HDA_AMP_MUTE, mute);
10110 /* unsolicited event for HP jack sensing */
10111 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10114 if ((res >> 26) != ALC_HP_EVENT)
10116 alc262_lenovo_3000_automute(codec, 1);
10119 /* bind hp and internal speaker mute (with plug check) */
10120 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10121 struct snd_ctl_elem_value *ucontrol)
10123 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10124 long *valp = ucontrol->value.integer.value;
10127 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10129 valp ? 0 : HDA_AMP_MUTE);
10130 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10132 valp ? 0 : HDA_AMP_MUTE);
10135 alc262_fujitsu_automute(codec, 0);
10139 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10140 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10142 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10143 .name = "Master Playback Switch",
10144 .info = snd_hda_mixer_amp_switch_info,
10145 .get = snd_hda_mixer_amp_switch_get,
10146 .put = alc262_fujitsu_master_sw_put,
10147 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10149 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10150 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10151 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10154 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10155 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10156 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10160 /* bind hp and internal speaker mute (with plug check) */
10161 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10162 struct snd_ctl_elem_value *ucontrol)
10164 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10165 long *valp = ucontrol->value.integer.value;
10168 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10170 valp ? 0 : HDA_AMP_MUTE);
10173 alc262_lenovo_3000_automute(codec, 0);
10177 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10178 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10181 .name = "Master Playback Switch",
10182 .info = snd_hda_mixer_amp_switch_info,
10183 .get = snd_hda_mixer_amp_switch_get,
10184 .put = alc262_lenovo_3000_master_sw_put,
10185 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10187 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10188 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10189 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10192 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10193 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10194 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10198 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10199 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10201 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10202 .name = "Master Playback Switch",
10203 .info = snd_hda_mixer_amp_switch_info,
10204 .get = snd_hda_mixer_amp_switch_get,
10205 .put = alc262_sony_master_sw_put,
10206 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10210 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10211 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10212 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10213 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10217 /* additional init verbs for Benq laptops */
10218 static struct hda_verb alc262_EAPD_verbs[] = {
10219 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10220 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10224 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10225 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10226 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10228 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10229 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10233 /* Samsung Q1 Ultra Vista model setup */
10234 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10235 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10236 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10239 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10240 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10244 static struct hda_verb alc262_ultra_verbs[] = {
10246 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10247 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10250 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10251 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10252 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10253 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10258 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10259 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10261 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10263 /* ADC, choose mic */
10264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10265 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10267 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10270 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10271 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10272 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10273 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10277 /* mute/unmute internal speaker according to the hp jack and mute state */
10278 static void alc262_ultra_automute(struct hda_codec *codec)
10280 struct alc_spec *spec = codec->spec;
10284 /* auto-mute only when HP is used as HP */
10285 if (!spec->cur_mux[0]) {
10286 unsigned int present;
10287 /* need to execute and sync at first */
10288 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10289 present = snd_hda_codec_read(codec, 0x15, 0,
10290 AC_VERB_GET_PIN_SENSE, 0);
10291 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10292 if (spec->jack_present)
10293 mute = HDA_AMP_MUTE;
10295 /* mute/unmute internal speaker */
10296 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10297 HDA_AMP_MUTE, mute);
10298 /* mute/unmute HP */
10299 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10300 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10303 /* unsolicited event for HP jack sensing */
10304 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10307 if ((res >> 26) != ALC880_HP_EVENT)
10309 alc262_ultra_automute(codec);
10312 static struct hda_input_mux alc262_ultra_capture_source = {
10316 { "Headphone", 0x7 },
10320 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10321 struct snd_ctl_elem_value *ucontrol)
10323 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10324 struct alc_spec *spec = codec->spec;
10327 ret = alc_mux_enum_put(kcontrol, ucontrol);
10330 /* reprogram the HP pin as mic or HP according to the input source */
10331 snd_hda_codec_write_cache(codec, 0x15, 0,
10332 AC_VERB_SET_PIN_WIDGET_CONTROL,
10333 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10334 alc262_ultra_automute(codec); /* mute/unmute HP */
10338 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10339 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10340 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10342 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10343 .name = "Capture Source",
10344 .info = alc_mux_enum_info,
10345 .get = alc_mux_enum_get,
10346 .put = alc262_ultra_mux_enum_put,
10351 /* add playback controls from the parsed DAC table */
10352 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10353 const struct auto_pin_cfg *cfg)
10358 spec->multiout.num_dacs = 1; /* only use one dac */
10359 spec->multiout.dac_nids = spec->private_dac_nids;
10360 spec->multiout.dac_nids[0] = 2;
10362 nid = cfg->line_out_pins[0];
10364 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10365 "Front Playback Volume",
10366 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10369 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10370 "Front Playback Switch",
10371 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10376 nid = cfg->speaker_pins[0];
10379 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10380 "Speaker Playback Volume",
10381 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10385 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10386 "Speaker Playback Switch",
10387 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10392 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10393 "Speaker Playback Switch",
10394 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10400 nid = cfg->hp_pins[0];
10402 /* spec->multiout.hp_nid = 2; */
10404 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10405 "Headphone Playback Volume",
10406 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10410 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10411 "Headphone Playback Switch",
10412 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10417 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10418 "Headphone Playback Switch",
10419 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10428 /* identical with ALC880 */
10429 #define alc262_auto_create_analog_input_ctls \
10430 alc880_auto_create_analog_input_ctls
10433 * generic initialization of ADC, input mixers and output mixers
10435 static struct hda_verb alc262_volume_init_verbs[] = {
10437 * Unmute ADC0-2 and set the default input to mic-in
10439 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10441 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10442 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10443 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10444 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10446 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10448 * Note: PASD motherboards uses the Line In 2 as the input for
10449 * front panel mic (mic 2)
10451 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10459 * Set up output mixers (0x0c - 0x0f)
10461 /* set vol=0 to output mixers */
10462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10466 /* set up input amps for analog loopback */
10467 /* Amp Indices: DAC = 0, mixer = 1 */
10468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10471 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10472 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10475 /* FIXME: use matrix-type input source selection */
10476 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10477 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10478 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10480 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10483 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10496 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10498 * Unmute ADC0-2 and set the default input to mic-in
10500 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10502 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10504 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10505 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10507 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10509 * Note: PASD motherboards uses the Line In 2 as the input for
10510 * front panel mic (mic 2)
10512 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10522 * Set up output mixers (0x0c - 0x0e)
10524 /* set vol=0 to output mixers */
10525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10526 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10529 /* set up input amps for analog loopback */
10530 /* Amp Indices: DAC = 0, mixer = 1 */
10531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10533 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10535 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10536 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10538 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10539 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10540 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10542 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10543 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10545 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10546 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10550 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10551 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10552 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10554 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10555 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10556 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10557 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10558 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10559 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10562 /* FIXME: use matrix-type input source selection */
10563 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10564 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10565 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10566 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10567 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10568 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10570 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10571 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10572 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10573 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10575 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10580 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10585 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10587 * Unmute ADC0-2 and set the default input to mic-in
10589 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10590 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10591 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10592 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10593 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10594 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10596 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10598 * Note: PASD motherboards uses the Line In 2 as the input for front
10599 * panel mic (mic 2)
10601 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10606 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10611 * Set up output mixers (0x0c - 0x0e)
10613 /* set vol=0 to output mixers */
10614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10616 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10618 /* set up input amps for analog loopback */
10619 /* Amp Indices: DAC = 0, mixer = 1 */
10620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10624 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10629 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10630 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10631 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10632 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10633 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10634 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10636 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10639 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10640 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10642 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10644 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10645 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10646 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10647 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10649 /* FIXME: use matrix-type input source selection */
10650 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10651 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10652 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10653 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10657 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10665 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10673 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10676 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10681 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10684 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10685 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10687 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10688 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10689 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10690 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10693 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10694 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10699 #ifdef CONFIG_SND_HDA_POWER_SAVE
10700 #define alc262_loopbacks alc880_loopbacks
10703 /* pcm configuration: identiacal with ALC880 */
10704 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10705 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10706 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10707 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10710 * BIOS auto configuration
10712 static int alc262_parse_auto_config(struct hda_codec *codec)
10714 struct alc_spec *spec = codec->spec;
10716 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10718 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10722 if (!spec->autocfg.line_outs) {
10723 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10724 spec->multiout.max_channels = 2;
10725 spec->no_analog = 1;
10728 return 0; /* can't find valid BIOS pin config */
10730 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10733 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10737 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10740 if (spec->autocfg.dig_outs) {
10741 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10742 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10744 if (spec->autocfg.dig_in_pin)
10745 spec->dig_in_nid = ALC262_DIGIN_NID;
10747 if (spec->kctls.list)
10748 add_mixer(spec, spec->kctls.list);
10750 add_verb(spec, alc262_volume_init_verbs);
10751 spec->num_mux_defs = 1;
10752 spec->input_mux = &spec->private_imux[0];
10754 err = alc_auto_add_mic_boost(codec);
10761 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10762 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10763 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10764 #define alc262_auto_init_input_src alc882_auto_init_input_src
10767 /* init callback for auto-configuration model -- overriding the default init */
10768 static void alc262_auto_init(struct hda_codec *codec)
10770 struct alc_spec *spec = codec->spec;
10771 alc262_auto_init_multi_out(codec);
10772 alc262_auto_init_hp_out(codec);
10773 alc262_auto_init_analog_input(codec);
10774 alc262_auto_init_input_src(codec);
10775 if (spec->unsol_event)
10776 alc_inithook(codec);
10780 * configuration and preset
10782 static const char *alc262_models[ALC262_MODEL_LAST] = {
10783 [ALC262_BASIC] = "basic",
10784 [ALC262_HIPPO] = "hippo",
10785 [ALC262_HIPPO_1] = "hippo_1",
10786 [ALC262_FUJITSU] = "fujitsu",
10787 [ALC262_HP_BPC] = "hp-bpc",
10788 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10789 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10790 [ALC262_HP_RP5700] = "hp-rp5700",
10791 [ALC262_BENQ_ED8] = "benq",
10792 [ALC262_BENQ_T31] = "benq-t31",
10793 [ALC262_SONY_ASSAMD] = "sony-assamd",
10794 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10795 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10796 [ALC262_ULTRA] = "ultra",
10797 [ALC262_LENOVO_3000] = "lenovo-3000",
10798 [ALC262_NEC] = "nec",
10799 [ALC262_TYAN] = "tyan",
10800 [ALC262_AUTO] = "auto",
10803 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10804 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10805 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10806 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10808 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10810 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10811 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10812 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10813 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10814 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10815 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10816 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10817 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10818 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10819 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10820 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10821 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10822 ALC262_HP_TC_T5735),
10823 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10824 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10825 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10826 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10827 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10828 ALC262_SONY_ASSAMD),
10829 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10830 ALC262_TOSHIBA_RX1),
10831 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10832 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10833 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10834 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10835 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10837 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10838 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10839 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10840 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10841 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10845 static struct alc_config_preset alc262_presets[] = {
10847 .mixers = { alc262_base_mixer },
10848 .init_verbs = { alc262_init_verbs },
10849 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10850 .dac_nids = alc262_dac_nids,
10852 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10853 .channel_mode = alc262_modes,
10854 .input_mux = &alc262_capture_source,
10857 .mixers = { alc262_base_mixer },
10858 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10859 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10860 .dac_nids = alc262_dac_nids,
10862 .dig_out_nid = ALC262_DIGOUT_NID,
10863 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10864 .channel_mode = alc262_modes,
10865 .input_mux = &alc262_capture_source,
10866 .unsol_event = alc262_hippo_unsol_event,
10867 .init_hook = alc262_hippo_automute,
10869 [ALC262_HIPPO_1] = {
10870 .mixers = { alc262_hippo1_mixer },
10871 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10872 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10873 .dac_nids = alc262_dac_nids,
10875 .dig_out_nid = ALC262_DIGOUT_NID,
10876 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10877 .channel_mode = alc262_modes,
10878 .input_mux = &alc262_capture_source,
10879 .unsol_event = alc262_hippo1_unsol_event,
10880 .init_hook = alc262_hippo1_automute,
10882 [ALC262_FUJITSU] = {
10883 .mixers = { alc262_fujitsu_mixer },
10884 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10885 alc262_fujitsu_unsol_verbs },
10886 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10887 .dac_nids = alc262_dac_nids,
10889 .dig_out_nid = ALC262_DIGOUT_NID,
10890 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10891 .channel_mode = alc262_modes,
10892 .input_mux = &alc262_fujitsu_capture_source,
10893 .unsol_event = alc262_fujitsu_unsol_event,
10894 .init_hook = alc262_fujitsu_init_hook,
10896 [ALC262_HP_BPC] = {
10897 .mixers = { alc262_HP_BPC_mixer },
10898 .init_verbs = { alc262_HP_BPC_init_verbs },
10899 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10900 .dac_nids = alc262_dac_nids,
10902 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10903 .channel_mode = alc262_modes,
10904 .input_mux = &alc262_HP_capture_source,
10905 .unsol_event = alc262_hp_bpc_unsol_event,
10906 .init_hook = alc262_hp_bpc_automute,
10908 [ALC262_HP_BPC_D7000_WF] = {
10909 .mixers = { alc262_HP_BPC_WildWest_mixer },
10910 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10911 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10912 .dac_nids = alc262_dac_nids,
10914 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10915 .channel_mode = alc262_modes,
10916 .input_mux = &alc262_HP_D7000_capture_source,
10917 .unsol_event = alc262_hp_wildwest_unsol_event,
10918 .init_hook = alc262_hp_wildwest_automute,
10920 [ALC262_HP_BPC_D7000_WL] = {
10921 .mixers = { alc262_HP_BPC_WildWest_mixer,
10922 alc262_HP_BPC_WildWest_option_mixer },
10923 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10924 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10925 .dac_nids = alc262_dac_nids,
10927 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10928 .channel_mode = alc262_modes,
10929 .input_mux = &alc262_HP_D7000_capture_source,
10930 .unsol_event = alc262_hp_wildwest_unsol_event,
10931 .init_hook = alc262_hp_wildwest_automute,
10933 [ALC262_HP_TC_T5735] = {
10934 .mixers = { alc262_hp_t5735_mixer },
10935 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10936 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10937 .dac_nids = alc262_dac_nids,
10939 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10940 .channel_mode = alc262_modes,
10941 .input_mux = &alc262_capture_source,
10942 .unsol_event = alc262_hp_t5735_unsol_event,
10943 .init_hook = alc262_hp_t5735_init_hook,
10945 [ALC262_HP_RP5700] = {
10946 .mixers = { alc262_hp_rp5700_mixer },
10947 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10948 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10949 .dac_nids = alc262_dac_nids,
10950 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10951 .channel_mode = alc262_modes,
10952 .input_mux = &alc262_hp_rp5700_capture_source,
10954 [ALC262_BENQ_ED8] = {
10955 .mixers = { alc262_base_mixer },
10956 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10957 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10958 .dac_nids = alc262_dac_nids,
10960 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10961 .channel_mode = alc262_modes,
10962 .input_mux = &alc262_capture_source,
10964 [ALC262_SONY_ASSAMD] = {
10965 .mixers = { alc262_sony_mixer },
10966 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10967 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10968 .dac_nids = alc262_dac_nids,
10970 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10971 .channel_mode = alc262_modes,
10972 .input_mux = &alc262_capture_source,
10973 .unsol_event = alc262_hippo_unsol_event,
10974 .init_hook = alc262_hippo_automute,
10976 [ALC262_BENQ_T31] = {
10977 .mixers = { alc262_benq_t31_mixer },
10978 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10979 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10980 .dac_nids = alc262_dac_nids,
10982 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10983 .channel_mode = alc262_modes,
10984 .input_mux = &alc262_capture_source,
10985 .unsol_event = alc262_hippo_unsol_event,
10986 .init_hook = alc262_hippo_automute,
10989 .mixers = { alc262_ultra_mixer },
10990 .cap_mixer = alc262_ultra_capture_mixer,
10991 .init_verbs = { alc262_ultra_verbs },
10992 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10993 .dac_nids = alc262_dac_nids,
10994 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10995 .channel_mode = alc262_modes,
10996 .input_mux = &alc262_ultra_capture_source,
10997 .adc_nids = alc262_adc_nids, /* ADC0 */
10998 .capsrc_nids = alc262_capsrc_nids,
10999 .num_adc_nids = 1, /* single ADC */
11000 .unsol_event = alc262_ultra_unsol_event,
11001 .init_hook = alc262_ultra_automute,
11003 [ALC262_LENOVO_3000] = {
11004 .mixers = { alc262_lenovo_3000_mixer },
11005 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11006 alc262_lenovo_3000_unsol_verbs },
11007 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11008 .dac_nids = alc262_dac_nids,
11010 .dig_out_nid = ALC262_DIGOUT_NID,
11011 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11012 .channel_mode = alc262_modes,
11013 .input_mux = &alc262_fujitsu_capture_source,
11014 .unsol_event = alc262_lenovo_3000_unsol_event,
11017 .mixers = { alc262_nec_mixer },
11018 .init_verbs = { alc262_nec_verbs },
11019 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11020 .dac_nids = alc262_dac_nids,
11022 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11023 .channel_mode = alc262_modes,
11024 .input_mux = &alc262_capture_source,
11026 [ALC262_TOSHIBA_S06] = {
11027 .mixers = { alc262_toshiba_s06_mixer },
11028 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11029 alc262_eapd_verbs },
11030 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11031 .capsrc_nids = alc262_dmic_capsrc_nids,
11032 .dac_nids = alc262_dac_nids,
11033 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11034 .dig_out_nid = ALC262_DIGOUT_NID,
11035 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11036 .channel_mode = alc262_modes,
11037 .input_mux = &alc262_dmic_capture_source,
11038 .unsol_event = alc262_toshiba_s06_unsol_event,
11039 .init_hook = alc262_toshiba_s06_init_hook,
11041 [ALC262_TOSHIBA_RX1] = {
11042 .mixers = { alc262_toshiba_rx1_mixer },
11043 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11044 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11045 .dac_nids = alc262_dac_nids,
11047 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11048 .channel_mode = alc262_modes,
11049 .input_mux = &alc262_capture_source,
11050 .unsol_event = alc262_hippo_unsol_event,
11051 .init_hook = alc262_hippo_automute,
11054 .mixers = { alc262_tyan_mixer },
11055 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11056 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11057 .dac_nids = alc262_dac_nids,
11059 .dig_out_nid = ALC262_DIGOUT_NID,
11060 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11061 .channel_mode = alc262_modes,
11062 .input_mux = &alc262_capture_source,
11063 .unsol_event = alc262_tyan_unsol_event,
11064 .init_hook = alc262_tyan_automute,
11068 static int patch_alc262(struct hda_codec *codec)
11070 struct alc_spec *spec;
11074 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11078 codec->spec = spec;
11080 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11085 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11086 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11087 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11088 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11092 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11094 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11098 if (board_config < 0) {
11099 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11100 "trying auto-probe from BIOS...\n");
11101 board_config = ALC262_AUTO;
11104 if (board_config == ALC262_AUTO) {
11105 /* automatic parse from the BIOS config */
11106 err = alc262_parse_auto_config(codec);
11112 "hda_codec: Cannot set up configuration "
11113 "from BIOS. Using base mode...\n");
11114 board_config = ALC262_BASIC;
11118 if (!spec->no_analog) {
11119 err = snd_hda_attach_beep_device(codec, 0x1);
11126 if (board_config != ALC262_AUTO)
11127 setup_preset(spec, &alc262_presets[board_config]);
11129 spec->stream_name_analog = "ALC262 Analog";
11130 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11131 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11133 spec->stream_name_digital = "ALC262 Digital";
11134 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11135 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11137 spec->capture_style = CAPT_MIX;
11138 if (!spec->adc_nids && spec->input_mux) {
11139 /* check whether NID 0x07 is valid */
11140 unsigned int wcap = get_wcaps(codec, 0x07);
11143 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11144 if (wcap != AC_WID_AUD_IN) {
11145 spec->adc_nids = alc262_adc_nids_alt;
11146 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11147 spec->capsrc_nids = alc262_capsrc_nids_alt;
11149 spec->adc_nids = alc262_adc_nids;
11150 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11151 spec->capsrc_nids = alc262_capsrc_nids;
11154 if (!spec->cap_mixer && !spec->no_analog)
11155 set_capture_mixer(spec);
11156 if (!spec->no_analog)
11157 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11159 spec->vmaster_nid = 0x0c;
11161 codec->patch_ops = alc_patch_ops;
11162 if (board_config == ALC262_AUTO)
11163 spec->init_hook = alc262_auto_init;
11164 #ifdef CONFIG_SND_HDA_POWER_SAVE
11165 if (!spec->loopback.amplist)
11166 spec->loopback.amplist = alc262_loopbacks;
11168 codec->proc_widget_hook = print_realtek_coef;
11174 * ALC268 channel source setting (2 channel)
11176 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11177 #define alc268_modes alc260_modes
11179 static hda_nid_t alc268_dac_nids[2] = {
11184 static hda_nid_t alc268_adc_nids[2] = {
11189 static hda_nid_t alc268_adc_nids_alt[1] = {
11194 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11196 static struct snd_kcontrol_new alc268_base_mixer[] = {
11197 /* output mixer control */
11198 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11199 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11200 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11201 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11202 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11203 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11204 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11208 /* bind Beep switches of both NID 0x0f and 0x10 */
11209 static struct hda_bind_ctls alc268_bind_beep_sw = {
11210 .ops = &snd_hda_bind_sw,
11212 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11213 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11218 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11219 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11220 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11224 static struct hda_verb alc268_eapd_verbs[] = {
11225 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11226 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11230 /* Toshiba specific */
11231 #define alc268_toshiba_automute alc262_hippo_automute
11233 static struct hda_verb alc268_toshiba_verbs[] = {
11234 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11238 static struct hda_input_mux alc268_acer_lc_capture_source = {
11246 /* Acer specific */
11247 /* bind volumes of both NID 0x02 and 0x03 */
11248 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11249 .ops = &snd_hda_bind_vol,
11251 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11252 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11257 /* mute/unmute internal speaker according to the hp jack and mute state */
11258 static void alc268_acer_automute(struct hda_codec *codec, int force)
11260 struct alc_spec *spec = codec->spec;
11263 if (force || !spec->sense_updated) {
11264 unsigned int present;
11265 present = snd_hda_codec_read(codec, 0x14, 0,
11266 AC_VERB_GET_PIN_SENSE, 0);
11267 spec->jack_present = (present & 0x80000000) != 0;
11268 spec->sense_updated = 1;
11270 if (spec->jack_present)
11271 mute = HDA_AMP_MUTE; /* mute internal speaker */
11272 else /* unmute internal speaker if necessary */
11273 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11274 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11275 HDA_AMP_MUTE, mute);
11279 /* bind hp and internal speaker mute (with plug check) */
11280 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11281 struct snd_ctl_elem_value *ucontrol)
11283 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11284 long *valp = ucontrol->value.integer.value;
11287 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11289 valp[0] ? 0 : HDA_AMP_MUTE);
11290 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11292 valp[1] ? 0 : HDA_AMP_MUTE);
11294 alc268_acer_automute(codec, 0);
11298 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11299 /* output mixer control */
11300 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11302 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11303 .name = "Master Playback Switch",
11304 .info = snd_hda_mixer_amp_switch_info,
11305 .get = snd_hda_mixer_amp_switch_get,
11306 .put = alc268_acer_master_sw_put,
11307 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11309 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11313 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11314 /* output mixer control */
11315 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11317 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11318 .name = "Master Playback Switch",
11319 .info = snd_hda_mixer_amp_switch_info,
11320 .get = snd_hda_mixer_amp_switch_get,
11321 .put = alc268_acer_master_sw_put,
11322 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11324 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11325 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11326 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11330 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11331 /* output mixer control */
11332 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11335 .name = "Master Playback Switch",
11336 .info = snd_hda_mixer_amp_switch_info,
11337 .get = snd_hda_mixer_amp_switch_get,
11338 .put = alc268_acer_master_sw_put,
11339 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11341 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11342 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11346 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11347 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11348 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11350 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11351 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11352 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11356 static struct hda_verb alc268_acer_verbs[] = {
11357 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11358 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11359 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11361 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11362 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11363 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11367 /* unsolicited event for HP jack sensing */
11368 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11371 if ((res >> 26) != ALC880_HP_EVENT)
11373 alc268_toshiba_automute(codec);
11376 static void alc268_acer_unsol_event(struct hda_codec *codec,
11379 if ((res >> 26) != ALC880_HP_EVENT)
11381 alc268_acer_automute(codec, 1);
11384 static void alc268_acer_init_hook(struct hda_codec *codec)
11386 alc268_acer_automute(codec, 1);
11389 /* toggle speaker-output according to the hp-jack state */
11390 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11392 unsigned int present;
11393 unsigned char bits;
11395 present = snd_hda_codec_read(codec, 0x15, 0,
11396 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11397 bits = present ? AMP_IN_MUTE(0) : 0;
11398 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11399 AMP_IN_MUTE(0), bits);
11400 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11401 AMP_IN_MUTE(0), bits);
11405 static void alc268_acer_mic_automute(struct hda_codec *codec)
11407 unsigned int present;
11409 present = snd_hda_codec_read(codec, 0x18, 0,
11410 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11411 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11412 present ? 0x0 : 0x6);
11415 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11418 if ((res >> 26) == ALC880_HP_EVENT)
11419 alc268_aspire_one_speaker_automute(codec);
11420 if ((res >> 26) == ALC880_MIC_EVENT)
11421 alc268_acer_mic_automute(codec);
11424 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11426 alc268_aspire_one_speaker_automute(codec);
11427 alc268_acer_mic_automute(codec);
11430 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11431 /* output mixer control */
11432 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11433 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11434 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11435 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11436 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11437 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11441 static struct hda_verb alc268_dell_verbs[] = {
11442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11448 /* mute/unmute internal speaker according to the hp jack and mute state */
11449 static void alc268_dell_automute(struct hda_codec *codec)
11451 unsigned int present;
11454 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11455 if (present & 0x80000000)
11456 mute = HDA_AMP_MUTE;
11458 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11459 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11460 HDA_AMP_MUTE, mute);
11463 static void alc268_dell_unsol_event(struct hda_codec *codec,
11466 if ((res >> 26) != ALC880_HP_EVENT)
11468 alc268_dell_automute(codec);
11471 #define alc268_dell_init_hook alc268_dell_automute
11473 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11474 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11475 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11476 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11478 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11479 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11480 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11481 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11485 static struct hda_verb alc267_quanta_il1_verbs[] = {
11486 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11487 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11491 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11493 unsigned int present;
11495 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11496 & AC_PINSENSE_PRESENCE;
11497 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11498 present ? 0 : PIN_OUT);
11501 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11503 unsigned int present;
11505 present = snd_hda_codec_read(codec, 0x18, 0,
11506 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11507 snd_hda_codec_write(codec, 0x23, 0,
11508 AC_VERB_SET_CONNECT_SEL,
11509 present ? 0x00 : 0x01);
11512 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11514 alc267_quanta_il1_hp_automute(codec);
11515 alc267_quanta_il1_mic_automute(codec);
11518 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11521 switch (res >> 26) {
11522 case ALC880_HP_EVENT:
11523 alc267_quanta_il1_hp_automute(codec);
11525 case ALC880_MIC_EVENT:
11526 alc267_quanta_il1_mic_automute(codec);
11532 * generic initialization of ADC, input mixers and output mixers
11534 static struct hda_verb alc268_base_init_verbs[] = {
11535 /* Unmute DAC0-1 and set vol = 0 */
11536 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11537 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11540 * Set up output mixers (0x0c - 0x0e)
11542 /* set vol=0 to output mixers */
11543 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11544 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11546 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11547 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11551 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11555 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11556 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11560 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11561 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11562 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11564 /* set PCBEEP vol = 0, mute connections */
11565 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11566 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11567 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11569 /* Unmute Selector 23h,24h and set the default input to mic-in */
11571 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11572 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11573 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11580 * generic initialization of ADC, input mixers and output mixers
11582 static struct hda_verb alc268_volume_init_verbs[] = {
11583 /* set output DAC */
11584 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11585 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11587 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11588 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11589 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11590 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11591 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11594 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11595 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11597 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11598 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11600 /* set PCBEEP vol = 0, mute connections */
11601 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11602 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11603 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11608 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11609 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11610 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11613 /* The multiple "Capture Source" controls confuse alsamixer
11614 * So call somewhat different..
11616 /* .name = "Capture Source", */
11617 .name = "Input Source",
11619 .info = alc_mux_enum_info,
11620 .get = alc_mux_enum_get,
11621 .put = alc_mux_enum_put,
11626 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11627 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11628 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11629 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11630 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11632 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11633 /* The multiple "Capture Source" controls confuse alsamixer
11634 * So call somewhat different..
11636 /* .name = "Capture Source", */
11637 .name = "Input Source",
11639 .info = alc_mux_enum_info,
11640 .get = alc_mux_enum_get,
11641 .put = alc_mux_enum_put,
11646 static struct hda_input_mux alc268_capture_source = {
11650 { "Front Mic", 0x1 },
11656 static struct hda_input_mux alc268_acer_capture_source = {
11660 { "Internal Mic", 0x1 },
11665 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11669 { "Internal Mic", 0x6 },
11674 #ifdef CONFIG_SND_DEBUG
11675 static struct snd_kcontrol_new alc268_test_mixer[] = {
11676 /* Volume widgets */
11677 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11678 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11679 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11680 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11681 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11682 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11683 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11684 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11685 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11686 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11687 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11688 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11689 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11690 /* The below appears problematic on some hardwares */
11691 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11692 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11693 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11694 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11695 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11697 /* Modes for retasking pin widgets */
11698 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11699 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11700 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11701 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11703 /* Controls for GPIO pins, assuming they are configured as outputs */
11704 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11705 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11706 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11707 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11709 /* Switches to allow the digital SPDIF output pin to be enabled.
11710 * The ALC268 does not have an SPDIF input.
11712 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11714 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11715 * this output to turn on an external amplifier.
11717 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11718 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11724 /* create input playback/capture controls for the given pin */
11725 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11726 const char *ctlname, int idx)
11731 sprintf(name, "%s Playback Volume", ctlname);
11733 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11734 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11738 } else if (nid == 0x15) {
11739 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11740 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11746 sprintf(name, "%s Playback Switch", ctlname);
11747 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11748 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11754 /* add playback controls from the parsed DAC table */
11755 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11756 const struct auto_pin_cfg *cfg)
11761 spec->multiout.num_dacs = 2; /* only use one dac */
11762 spec->multiout.dac_nids = spec->private_dac_nids;
11763 spec->multiout.dac_nids[0] = 2;
11764 spec->multiout.dac_nids[1] = 3;
11766 nid = cfg->line_out_pins[0];
11768 alc268_new_analog_output(spec, nid, "Front", 0);
11770 nid = cfg->speaker_pins[0];
11772 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11773 "Speaker Playback Volume",
11774 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11778 nid = cfg->hp_pins[0];
11780 alc268_new_analog_output(spec, nid, "Headphone", 0);
11782 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11784 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11785 "Mono Playback Switch",
11786 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11793 /* create playback/capture controls for input pins */
11794 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11795 const struct auto_pin_cfg *cfg)
11797 struct hda_input_mux *imux = &spec->private_imux[0];
11800 for (i = 0; i < AUTO_PIN_LAST; i++) {
11801 switch(cfg->input_pins[i]) {
11803 idx1 = 0; /* Mic 1 */
11806 idx1 = 1; /* Mic 2 */
11809 idx1 = 2; /* Line In */
11816 idx1 = 6; /* digital mics */
11821 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11822 imux->items[imux->num_items].index = idx1;
11828 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11830 struct alc_spec *spec = codec->spec;
11831 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11832 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11833 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11834 unsigned int dac_vol1, dac_vol2;
11837 snd_hda_codec_write(codec, speaker_nid, 0,
11838 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11839 snd_hda_codec_write(codec, 0x0f, 0,
11840 AC_VERB_SET_AMP_GAIN_MUTE,
11842 snd_hda_codec_write(codec, 0x10, 0,
11843 AC_VERB_SET_AMP_GAIN_MUTE,
11846 snd_hda_codec_write(codec, 0x0f, 0,
11847 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11848 snd_hda_codec_write(codec, 0x10, 0,
11849 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11852 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11853 if (line_nid == 0x14)
11854 dac_vol2 = AMP_OUT_ZERO;
11855 else if (line_nid == 0x15)
11856 dac_vol1 = AMP_OUT_ZERO;
11857 if (hp_nid == 0x14)
11858 dac_vol2 = AMP_OUT_ZERO;
11859 else if (hp_nid == 0x15)
11860 dac_vol1 = AMP_OUT_ZERO;
11861 if (line_nid != 0x16 || hp_nid != 0x16 ||
11862 spec->autocfg.line_out_pins[1] != 0x16 ||
11863 spec->autocfg.line_out_pins[2] != 0x16)
11864 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11866 snd_hda_codec_write(codec, 0x02, 0,
11867 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11868 snd_hda_codec_write(codec, 0x03, 0,
11869 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11872 /* pcm configuration: identiacal with ALC880 */
11873 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11874 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11875 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11876 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11879 * BIOS auto configuration
11881 static int alc268_parse_auto_config(struct hda_codec *codec)
11883 struct alc_spec *spec = codec->spec;
11885 static hda_nid_t alc268_ignore[] = { 0 };
11887 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11891 if (!spec->autocfg.line_outs) {
11892 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11893 spec->multiout.max_channels = 2;
11894 spec->no_analog = 1;
11897 return 0; /* can't find valid BIOS pin config */
11899 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11902 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11906 spec->multiout.max_channels = 2;
11909 /* digital only support output */
11910 if (spec->autocfg.dig_outs) {
11911 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11912 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11914 if (spec->kctls.list)
11915 add_mixer(spec, spec->kctls.list);
11917 if (spec->autocfg.speaker_pins[0] != 0x1d)
11918 add_mixer(spec, alc268_beep_mixer);
11920 add_verb(spec, alc268_volume_init_verbs);
11921 spec->num_mux_defs = 1;
11922 spec->input_mux = &spec->private_imux[0];
11924 err = alc_auto_add_mic_boost(codec);
11931 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11932 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11933 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11935 /* init callback for auto-configuration model -- overriding the default init */
11936 static void alc268_auto_init(struct hda_codec *codec)
11938 struct alc_spec *spec = codec->spec;
11939 alc268_auto_init_multi_out(codec);
11940 alc268_auto_init_hp_out(codec);
11941 alc268_auto_init_mono_speaker_out(codec);
11942 alc268_auto_init_analog_input(codec);
11943 if (spec->unsol_event)
11944 alc_inithook(codec);
11948 * configuration and preset
11950 static const char *alc268_models[ALC268_MODEL_LAST] = {
11951 [ALC267_QUANTA_IL1] = "quanta-il1",
11952 [ALC268_3ST] = "3stack",
11953 [ALC268_TOSHIBA] = "toshiba",
11954 [ALC268_ACER] = "acer",
11955 [ALC268_ACER_DMIC] = "acer-dmic",
11956 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11957 [ALC268_DELL] = "dell",
11958 [ALC268_ZEPTO] = "zepto",
11959 #ifdef CONFIG_SND_DEBUG
11960 [ALC268_TEST] = "test",
11962 [ALC268_AUTO] = "auto",
11965 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11966 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11967 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11968 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11969 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11970 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11971 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11972 ALC268_ACER_ASPIRE_ONE),
11973 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11974 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11975 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11976 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11977 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11978 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11979 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11980 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11981 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11982 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11983 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11987 static struct alc_config_preset alc268_presets[] = {
11988 [ALC267_QUANTA_IL1] = {
11989 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
11990 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11991 alc267_quanta_il1_verbs },
11992 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11993 .dac_nids = alc268_dac_nids,
11994 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11995 .adc_nids = alc268_adc_nids_alt,
11997 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11998 .channel_mode = alc268_modes,
11999 .input_mux = &alc268_capture_source,
12000 .unsol_event = alc267_quanta_il1_unsol_event,
12001 .init_hook = alc267_quanta_il1_automute,
12004 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12005 alc268_beep_mixer },
12006 .init_verbs = { alc268_base_init_verbs },
12007 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12008 .dac_nids = alc268_dac_nids,
12009 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12010 .adc_nids = alc268_adc_nids_alt,
12011 .capsrc_nids = alc268_capsrc_nids,
12013 .dig_out_nid = ALC268_DIGOUT_NID,
12014 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12015 .channel_mode = alc268_modes,
12016 .input_mux = &alc268_capture_source,
12018 [ALC268_TOSHIBA] = {
12019 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12020 alc268_beep_mixer },
12021 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12022 alc268_toshiba_verbs },
12023 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12024 .dac_nids = alc268_dac_nids,
12025 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12026 .adc_nids = alc268_adc_nids_alt,
12027 .capsrc_nids = alc268_capsrc_nids,
12029 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12030 .channel_mode = alc268_modes,
12031 .input_mux = &alc268_capture_source,
12032 .unsol_event = alc268_toshiba_unsol_event,
12033 .init_hook = alc268_toshiba_automute,
12036 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12037 alc268_beep_mixer },
12038 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12039 alc268_acer_verbs },
12040 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12041 .dac_nids = alc268_dac_nids,
12042 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12043 .adc_nids = alc268_adc_nids_alt,
12044 .capsrc_nids = alc268_capsrc_nids,
12046 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12047 .channel_mode = alc268_modes,
12048 .input_mux = &alc268_acer_capture_source,
12049 .unsol_event = alc268_acer_unsol_event,
12050 .init_hook = alc268_acer_init_hook,
12052 [ALC268_ACER_DMIC] = {
12053 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12054 alc268_beep_mixer },
12055 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12056 alc268_acer_verbs },
12057 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12058 .dac_nids = alc268_dac_nids,
12059 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12060 .adc_nids = alc268_adc_nids_alt,
12061 .capsrc_nids = alc268_capsrc_nids,
12063 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12064 .channel_mode = alc268_modes,
12065 .input_mux = &alc268_acer_dmic_capture_source,
12066 .unsol_event = alc268_acer_unsol_event,
12067 .init_hook = alc268_acer_init_hook,
12069 [ALC268_ACER_ASPIRE_ONE] = {
12070 .mixers = { alc268_acer_aspire_one_mixer,
12072 alc268_capture_alt_mixer },
12073 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12074 alc268_acer_aspire_one_verbs },
12075 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12076 .dac_nids = alc268_dac_nids,
12077 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12078 .adc_nids = alc268_adc_nids_alt,
12079 .capsrc_nids = alc268_capsrc_nids,
12081 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12082 .channel_mode = alc268_modes,
12083 .input_mux = &alc268_acer_lc_capture_source,
12084 .unsol_event = alc268_acer_lc_unsol_event,
12085 .init_hook = alc268_acer_lc_init_hook,
12088 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12089 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12090 alc268_dell_verbs },
12091 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12092 .dac_nids = alc268_dac_nids,
12094 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12095 .channel_mode = alc268_modes,
12096 .unsol_event = alc268_dell_unsol_event,
12097 .init_hook = alc268_dell_init_hook,
12098 .input_mux = &alc268_capture_source,
12101 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12102 alc268_beep_mixer },
12103 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12104 alc268_toshiba_verbs },
12105 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12106 .dac_nids = alc268_dac_nids,
12107 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12108 .adc_nids = alc268_adc_nids_alt,
12109 .capsrc_nids = alc268_capsrc_nids,
12111 .dig_out_nid = ALC268_DIGOUT_NID,
12112 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12113 .channel_mode = alc268_modes,
12114 .input_mux = &alc268_capture_source,
12115 .unsol_event = alc268_toshiba_unsol_event,
12116 .init_hook = alc268_toshiba_automute
12118 #ifdef CONFIG_SND_DEBUG
12120 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12121 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12122 alc268_volume_init_verbs },
12123 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12124 .dac_nids = alc268_dac_nids,
12125 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12126 .adc_nids = alc268_adc_nids_alt,
12127 .capsrc_nids = alc268_capsrc_nids,
12129 .dig_out_nid = ALC268_DIGOUT_NID,
12130 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12131 .channel_mode = alc268_modes,
12132 .input_mux = &alc268_capture_source,
12137 static int patch_alc268(struct hda_codec *codec)
12139 struct alc_spec *spec;
12141 int i, has_beep, err;
12143 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12147 codec->spec = spec;
12149 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12153 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12154 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12155 "trying auto-probe from BIOS...\n");
12156 board_config = ALC268_AUTO;
12159 if (board_config == ALC268_AUTO) {
12160 /* automatic parse from the BIOS config */
12161 err = alc268_parse_auto_config(codec);
12167 "hda_codec: Cannot set up configuration "
12168 "from BIOS. Using base mode...\n");
12169 board_config = ALC268_3ST;
12173 if (board_config != ALC268_AUTO)
12174 setup_preset(spec, &alc268_presets[board_config]);
12176 if (codec->vendor_id == 0x10ec0267) {
12177 spec->stream_name_analog = "ALC267 Analog";
12178 spec->stream_name_digital = "ALC267 Digital";
12180 spec->stream_name_analog = "ALC268 Analog";
12181 spec->stream_name_digital = "ALC268 Digital";
12184 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12185 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12186 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12188 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12191 for (i = 0; i < spec->num_mixers; i++) {
12192 if (spec->mixers[i] == alc268_beep_mixer) {
12199 err = snd_hda_attach_beep_device(codec, 0x1);
12204 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12205 /* override the amp caps for beep generator */
12206 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12207 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12208 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12209 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12210 (0 << AC_AMPCAP_MUTE_SHIFT));
12213 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12214 /* check whether NID 0x07 is valid */
12215 unsigned int wcap = get_wcaps(codec, 0x07);
12219 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12220 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12221 spec->adc_nids = alc268_adc_nids_alt;
12222 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12223 add_mixer(spec, alc268_capture_alt_mixer);
12225 spec->adc_nids = alc268_adc_nids;
12226 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12227 add_mixer(spec, alc268_capture_mixer);
12229 spec->capsrc_nids = alc268_capsrc_nids;
12230 /* set default input source */
12231 for (i = 0; i < spec->num_adc_nids; i++)
12232 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12233 0, AC_VERB_SET_CONNECT_SEL,
12234 spec->input_mux->items[0].index);
12237 spec->vmaster_nid = 0x02;
12239 codec->patch_ops = alc_patch_ops;
12240 if (board_config == ALC268_AUTO)
12241 spec->init_hook = alc268_auto_init;
12243 codec->proc_widget_hook = print_realtek_coef;
12249 * ALC269 channel source setting (2 channel)
12251 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12253 #define alc269_dac_nids alc260_dac_nids
12255 static hda_nid_t alc269_adc_nids[1] = {
12260 static hda_nid_t alc269_capsrc_nids[1] = {
12264 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12268 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12276 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12284 #define alc269_modes alc260_modes
12285 #define alc269_capture_source alc880_lg_lw_capture_source
12287 static struct snd_kcontrol_new alc269_base_mixer[] = {
12288 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12289 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12290 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12291 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12293 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12294 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12295 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12296 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12297 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12299 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12303 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12304 /* output mixer control */
12305 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12307 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12308 .name = "Master Playback Switch",
12309 .info = snd_hda_mixer_amp_switch_info,
12310 .get = snd_hda_mixer_amp_switch_get,
12311 .put = alc268_acer_master_sw_put,
12312 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12316 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12317 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12318 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12319 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12323 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12324 /* output mixer control */
12325 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12327 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12328 .name = "Master Playback Switch",
12329 .info = snd_hda_mixer_amp_switch_info,
12330 .get = snd_hda_mixer_amp_switch_get,
12331 .put = alc268_acer_master_sw_put,
12332 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12336 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12337 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12338 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12339 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12340 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12341 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12342 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12346 /* bind volumes of both NID 0x0c and 0x0d */
12347 static struct hda_bind_ctls alc269_epc_bind_vol = {
12348 .ops = &snd_hda_bind_vol,
12350 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12351 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12356 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12357 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12358 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12359 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12363 /* capture mixer elements */
12364 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12365 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12366 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12367 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12372 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12373 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12375 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12379 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12380 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12381 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12383 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12384 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12385 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12389 static struct hda_verb alc269_lifebook_verbs[] = {
12390 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12391 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12392 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12394 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12395 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12396 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12397 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12398 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12399 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12403 /* toggle speaker-output according to the hp-jack state */
12404 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12406 unsigned int present;
12407 unsigned char bits;
12409 present = snd_hda_codec_read(codec, 0x15, 0,
12410 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12411 bits = present ? AMP_IN_MUTE(0) : 0;
12412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12413 AMP_IN_MUTE(0), bits);
12414 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12415 AMP_IN_MUTE(0), bits);
12417 snd_hda_codec_write(codec, 0x20, 0,
12418 AC_VERB_SET_COEF_INDEX, 0x0c);
12419 snd_hda_codec_write(codec, 0x20, 0,
12420 AC_VERB_SET_PROC_COEF, 0x680);
12422 snd_hda_codec_write(codec, 0x20, 0,
12423 AC_VERB_SET_COEF_INDEX, 0x0c);
12424 snd_hda_codec_write(codec, 0x20, 0,
12425 AC_VERB_SET_PROC_COEF, 0x480);
12428 /* toggle speaker-output according to the hp-jacks state */
12429 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12431 unsigned int present;
12432 unsigned char bits;
12434 /* Check laptop headphone socket */
12435 present = snd_hda_codec_read(codec, 0x15, 0,
12436 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12438 /* Check port replicator headphone socket */
12439 present |= snd_hda_codec_read(codec, 0x1a, 0,
12440 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12442 bits = present ? AMP_IN_MUTE(0) : 0;
12443 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12444 AMP_IN_MUTE(0), bits);
12445 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12446 AMP_IN_MUTE(0), bits);
12448 snd_hda_codec_write(codec, 0x20, 0,
12449 AC_VERB_SET_COEF_INDEX, 0x0c);
12450 snd_hda_codec_write(codec, 0x20, 0,
12451 AC_VERB_SET_PROC_COEF, 0x680);
12453 snd_hda_codec_write(codec, 0x20, 0,
12454 AC_VERB_SET_COEF_INDEX, 0x0c);
12455 snd_hda_codec_write(codec, 0x20, 0,
12456 AC_VERB_SET_PROC_COEF, 0x480);
12459 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12461 unsigned int present;
12463 present = snd_hda_codec_read(codec, 0x18, 0,
12464 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12465 snd_hda_codec_write(codec, 0x23, 0,
12466 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12469 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12471 unsigned int present_laptop;
12472 unsigned int present_dock;
12474 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12475 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12477 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12478 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12480 /* Laptop mic port overrides dock mic port, design decision */
12482 snd_hda_codec_write(codec, 0x23, 0,
12483 AC_VERB_SET_CONNECT_SEL, 0x3);
12484 if (present_laptop)
12485 snd_hda_codec_write(codec, 0x23, 0,
12486 AC_VERB_SET_CONNECT_SEL, 0x0);
12487 if (!present_dock && !present_laptop)
12488 snd_hda_codec_write(codec, 0x23, 0,
12489 AC_VERB_SET_CONNECT_SEL, 0x1);
12492 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12495 if ((res >> 26) == ALC880_HP_EVENT)
12496 alc269_quanta_fl1_speaker_automute(codec);
12497 if ((res >> 26) == ALC880_MIC_EVENT)
12498 alc269_quanta_fl1_mic_automute(codec);
12501 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12504 if ((res >> 26) == ALC880_HP_EVENT)
12505 alc269_lifebook_speaker_automute(codec);
12506 if ((res >> 26) == ALC880_MIC_EVENT)
12507 alc269_lifebook_mic_autoswitch(codec);
12510 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12512 alc269_quanta_fl1_speaker_automute(codec);
12513 alc269_quanta_fl1_mic_automute(codec);
12516 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12518 alc269_lifebook_speaker_automute(codec);
12519 alc269_lifebook_mic_autoswitch(codec);
12522 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12523 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12524 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12525 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12526 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12527 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12528 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12529 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12533 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12534 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12535 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12536 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12538 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12539 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12543 /* toggle speaker-output according to the hp-jack state */
12544 static void alc269_speaker_automute(struct hda_codec *codec)
12546 unsigned int present;
12547 unsigned char bits;
12549 present = snd_hda_codec_read(codec, 0x15, 0,
12550 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12551 bits = present ? AMP_IN_MUTE(0) : 0;
12552 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12553 AMP_IN_MUTE(0), bits);
12554 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12555 AMP_IN_MUTE(0), bits);
12558 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12560 unsigned int present;
12562 present = snd_hda_codec_read(codec, 0x18, 0,
12563 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12564 snd_hda_codec_write(codec, 0x23, 0,
12565 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12568 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12570 unsigned int present;
12572 present = snd_hda_codec_read(codec, 0x18, 0,
12573 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12574 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12575 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12576 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12577 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12580 /* unsolicited event for HP jack sensing */
12581 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12584 if ((res >> 26) == ALC880_HP_EVENT)
12585 alc269_speaker_automute(codec);
12587 if ((res >> 26) == ALC880_MIC_EVENT)
12588 alc269_eeepc_dmic_automute(codec);
12591 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12593 alc269_speaker_automute(codec);
12594 alc269_eeepc_dmic_automute(codec);
12597 /* unsolicited event for HP jack sensing */
12598 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12601 if ((res >> 26) == ALC880_HP_EVENT)
12602 alc269_speaker_automute(codec);
12604 if ((res >> 26) == ALC880_MIC_EVENT)
12605 alc269_eeepc_amic_automute(codec);
12608 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12610 alc269_speaker_automute(codec);
12611 alc269_eeepc_amic_automute(codec);
12615 * generic initialization of ADC, input mixers and output mixers
12617 static struct hda_verb alc269_init_verbs[] = {
12619 * Unmute ADC0 and set the default input to mic-in
12621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12623 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12624 * analog-loopback mixer widget
12625 * Note: PASD motherboards uses the Line In 2 as the input for
12626 * front panel mic (mic 2)
12628 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12630 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12636 * Set up output mixers (0x0c - 0x0e)
12638 /* set vol=0 to output mixers */
12639 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12640 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12642 /* set up input amps for analog loopback */
12643 /* Amp Indices: DAC = 0, mixer = 1 */
12644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12649 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12651 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12654 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12655 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12656 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12661 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12662 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12663 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12664 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12665 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12667 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12668 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12670 /* FIXME: use matrix-type input source selection */
12671 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12672 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12676 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12679 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12680 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12684 /* add playback controls from the parsed DAC table */
12685 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12686 const struct auto_pin_cfg *cfg)
12691 spec->multiout.num_dacs = 1; /* only use one dac */
12692 spec->multiout.dac_nids = spec->private_dac_nids;
12693 spec->multiout.dac_nids[0] = 2;
12695 nid = cfg->line_out_pins[0];
12697 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12698 "Front Playback Volume",
12699 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12702 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12703 "Front Playback Switch",
12704 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12709 nid = cfg->speaker_pins[0];
12711 if (!cfg->line_out_pins[0]) {
12712 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12713 "Speaker Playback Volume",
12714 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12720 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12721 "Speaker Playback Switch",
12722 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12727 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12728 "Speaker Playback Switch",
12729 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12735 nid = cfg->hp_pins[0];
12737 /* spec->multiout.hp_nid = 2; */
12738 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12739 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12740 "Headphone Playback Volume",
12741 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12747 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12748 "Headphone Playback Switch",
12749 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12754 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12755 "Headphone Playback Switch",
12756 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12765 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12766 const struct auto_pin_cfg *cfg)
12770 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12773 /* digital-mic input pin is excluded in alc880_auto_create..()
12774 * because it's under 0x18
12776 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12777 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12778 struct hda_input_mux *imux = &spec->private_imux[0];
12779 imux->items[imux->num_items].label = "Int Mic";
12780 imux->items[imux->num_items].index = 0x05;
12786 #ifdef CONFIG_SND_HDA_POWER_SAVE
12787 #define alc269_loopbacks alc880_loopbacks
12790 /* pcm configuration: identiacal with ALC880 */
12791 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12792 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12793 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12794 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12797 * BIOS auto configuration
12799 static int alc269_parse_auto_config(struct hda_codec *codec)
12801 struct alc_spec *spec = codec->spec;
12803 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12805 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12810 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12813 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12817 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12819 if (spec->autocfg.dig_outs)
12820 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12822 if (spec->kctls.list)
12823 add_mixer(spec, spec->kctls.list);
12825 add_verb(spec, alc269_init_verbs);
12826 spec->num_mux_defs = 1;
12827 spec->input_mux = &spec->private_imux[0];
12828 /* set default input source */
12829 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12830 0, AC_VERB_SET_CONNECT_SEL,
12831 spec->input_mux->items[0].index);
12833 err = alc_auto_add_mic_boost(codec);
12837 if (!spec->cap_mixer && !spec->no_analog)
12838 set_capture_mixer(spec);
12843 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12844 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12845 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12848 /* init callback for auto-configuration model -- overriding the default init */
12849 static void alc269_auto_init(struct hda_codec *codec)
12851 struct alc_spec *spec = codec->spec;
12852 alc269_auto_init_multi_out(codec);
12853 alc269_auto_init_hp_out(codec);
12854 alc269_auto_init_analog_input(codec);
12855 if (spec->unsol_event)
12856 alc_inithook(codec);
12860 * configuration and preset
12862 static const char *alc269_models[ALC269_MODEL_LAST] = {
12863 [ALC269_BASIC] = "basic",
12864 [ALC269_QUANTA_FL1] = "quanta",
12865 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12866 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12867 [ALC269_FUJITSU] = "fujitsu",
12868 [ALC269_LIFEBOOK] = "lifebook"
12871 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12872 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12873 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12874 ALC269_ASUS_EEEPC_P703),
12875 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12876 ALC269_ASUS_EEEPC_P901),
12877 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12878 ALC269_ASUS_EEEPC_P901),
12879 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12880 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12884 static struct alc_config_preset alc269_presets[] = {
12886 .mixers = { alc269_base_mixer },
12887 .init_verbs = { alc269_init_verbs },
12888 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12889 .dac_nids = alc269_dac_nids,
12891 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12892 .channel_mode = alc269_modes,
12893 .input_mux = &alc269_capture_source,
12895 [ALC269_QUANTA_FL1] = {
12896 .mixers = { alc269_quanta_fl1_mixer },
12897 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12898 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12899 .dac_nids = alc269_dac_nids,
12901 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12902 .channel_mode = alc269_modes,
12903 .input_mux = &alc269_capture_source,
12904 .unsol_event = alc269_quanta_fl1_unsol_event,
12905 .init_hook = alc269_quanta_fl1_init_hook,
12907 [ALC269_ASUS_EEEPC_P703] = {
12908 .mixers = { alc269_eeepc_mixer },
12909 .cap_mixer = alc269_epc_capture_mixer,
12910 .init_verbs = { alc269_init_verbs,
12911 alc269_eeepc_amic_init_verbs },
12912 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12913 .dac_nids = alc269_dac_nids,
12915 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12916 .channel_mode = alc269_modes,
12917 .input_mux = &alc269_eeepc_amic_capture_source,
12918 .unsol_event = alc269_eeepc_amic_unsol_event,
12919 .init_hook = alc269_eeepc_amic_inithook,
12921 [ALC269_ASUS_EEEPC_P901] = {
12922 .mixers = { alc269_eeepc_mixer },
12923 .cap_mixer = alc269_epc_capture_mixer,
12924 .init_verbs = { alc269_init_verbs,
12925 alc269_eeepc_dmic_init_verbs },
12926 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12927 .dac_nids = alc269_dac_nids,
12929 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12930 .channel_mode = alc269_modes,
12931 .input_mux = &alc269_eeepc_dmic_capture_source,
12932 .unsol_event = alc269_eeepc_dmic_unsol_event,
12933 .init_hook = alc269_eeepc_dmic_inithook,
12935 [ALC269_FUJITSU] = {
12936 .mixers = { alc269_fujitsu_mixer },
12937 .cap_mixer = alc269_epc_capture_mixer,
12938 .init_verbs = { alc269_init_verbs,
12939 alc269_eeepc_dmic_init_verbs },
12940 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12941 .dac_nids = alc269_dac_nids,
12943 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12944 .channel_mode = alc269_modes,
12945 .input_mux = &alc269_eeepc_dmic_capture_source,
12946 .unsol_event = alc269_eeepc_dmic_unsol_event,
12947 .init_hook = alc269_eeepc_dmic_inithook,
12949 [ALC269_LIFEBOOK] = {
12950 .mixers = { alc269_lifebook_mixer },
12951 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12952 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12953 .dac_nids = alc269_dac_nids,
12955 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12956 .channel_mode = alc269_modes,
12957 .input_mux = &alc269_capture_source,
12958 .unsol_event = alc269_lifebook_unsol_event,
12959 .init_hook = alc269_lifebook_init_hook,
12963 static int patch_alc269(struct hda_codec *codec)
12965 struct alc_spec *spec;
12969 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12973 codec->spec = spec;
12975 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12977 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12981 if (board_config < 0) {
12982 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12983 "trying auto-probe from BIOS...\n");
12984 board_config = ALC269_AUTO;
12987 if (board_config == ALC269_AUTO) {
12988 /* automatic parse from the BIOS config */
12989 err = alc269_parse_auto_config(codec);
12995 "hda_codec: Cannot set up configuration "
12996 "from BIOS. Using base mode...\n");
12997 board_config = ALC269_BASIC;
13001 err = snd_hda_attach_beep_device(codec, 0x1);
13007 if (board_config != ALC269_AUTO)
13008 setup_preset(spec, &alc269_presets[board_config]);
13010 spec->stream_name_analog = "ALC269 Analog";
13011 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13012 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13014 spec->stream_name_digital = "ALC269 Digital";
13015 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13016 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13018 spec->adc_nids = alc269_adc_nids;
13019 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13020 spec->capsrc_nids = alc269_capsrc_nids;
13021 if (!spec->cap_mixer)
13022 set_capture_mixer(spec);
13023 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13025 codec->patch_ops = alc_patch_ops;
13026 if (board_config == ALC269_AUTO)
13027 spec->init_hook = alc269_auto_init;
13028 #ifdef CONFIG_SND_HDA_POWER_SAVE
13029 if (!spec->loopback.amplist)
13030 spec->loopback.amplist = alc269_loopbacks;
13032 codec->proc_widget_hook = print_realtek_coef;
13038 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13042 * set the path ways for 2 channel output
13043 * need to set the codec line out and mic 1 pin widgets to inputs
13045 static struct hda_verb alc861_threestack_ch2_init[] = {
13046 /* set pin widget 1Ah (line in) for input */
13047 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13048 /* set pin widget 18h (mic1/2) for input, for mic also enable
13051 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13053 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13055 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13056 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13062 * need to set the codec line out and mic 1 pin widgets to outputs
13064 static struct hda_verb alc861_threestack_ch6_init[] = {
13065 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13066 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13067 /* set pin widget 18h (mic1) for output (CLFE)*/
13068 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13070 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13071 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13073 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13075 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13076 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13081 static struct hda_channel_mode alc861_threestack_modes[2] = {
13082 { 2, alc861_threestack_ch2_init },
13083 { 6, alc861_threestack_ch6_init },
13085 /* Set mic1 as input and unmute the mixer */
13086 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13087 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13088 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13091 /* Set mic1 as output and mute mixer */
13092 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13093 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13094 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13098 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13099 { 2, alc861_uniwill_m31_ch2_init },
13100 { 4, alc861_uniwill_m31_ch4_init },
13103 /* Set mic1 and line-in as input and unmute the mixer */
13104 static struct hda_verb alc861_asus_ch2_init[] = {
13105 /* set pin widget 1Ah (line in) for input */
13106 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13107 /* set pin widget 18h (mic1/2) for input, for mic also enable
13110 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13112 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13114 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13115 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13119 /* Set mic1 nad line-in as output and mute mixer */
13120 static struct hda_verb alc861_asus_ch6_init[] = {
13121 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13122 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13123 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13124 /* set pin widget 18h (mic1) for output (CLFE)*/
13125 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13126 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13127 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13128 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13130 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13132 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13133 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13138 static struct hda_channel_mode alc861_asus_modes[2] = {
13139 { 2, alc861_asus_ch2_init },
13140 { 6, alc861_asus_ch6_init },
13145 static struct snd_kcontrol_new alc861_base_mixer[] = {
13146 /* output mixer control */
13147 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13148 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13149 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13150 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13151 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13153 /*Input mixer control */
13154 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13155 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13156 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13157 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13158 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13159 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13161 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13162 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13163 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13168 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13169 /* output mixer control */
13170 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13171 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13172 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13173 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13174 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13176 /* Input mixer control */
13177 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13178 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13179 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13180 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13181 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13182 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13184 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13185 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13189 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13190 .name = "Channel Mode",
13191 .info = alc_ch_mode_info,
13192 .get = alc_ch_mode_get,
13193 .put = alc_ch_mode_put,
13194 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13199 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13200 /* output mixer control */
13201 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13203 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13208 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13209 /* output mixer control */
13210 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13211 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13212 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13213 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13214 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13216 /* Input mixer control */
13217 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13218 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13219 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13220 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13221 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13222 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13224 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13225 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13226 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13229 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13230 .name = "Channel Mode",
13231 .info = alc_ch_mode_info,
13232 .get = alc_ch_mode_get,
13233 .put = alc_ch_mode_put,
13234 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13239 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13240 /* output mixer control */
13241 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13242 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13243 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13244 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13245 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13247 /* Input mixer control */
13248 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13249 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13250 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13251 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13252 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13253 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13255 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13256 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13257 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13260 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13261 .name = "Channel Mode",
13262 .info = alc_ch_mode_info,
13263 .get = alc_ch_mode_get,
13264 .put = alc_ch_mode_put,
13265 .private_value = ARRAY_SIZE(alc861_asus_modes),
13270 /* additional mixer */
13271 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13272 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13273 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13278 * generic initialization of ADC, input mixers and output mixers
13280 static struct hda_verb alc861_base_init_verbs[] = {
13282 * Unmute ADC0 and set the default input to mic-in
13284 /* port-A for surround (rear panel) */
13285 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13286 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13287 /* port-B for mic-in (rear panel) with vref */
13288 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13289 /* port-C for line-in (rear panel) */
13290 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13291 /* port-D for Front */
13292 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13293 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13294 /* port-E for HP out (front panel) */
13295 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13296 /* route front PCM to HP */
13297 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13298 /* port-F for mic-in (front panel) with vref */
13299 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13300 /* port-G for CLFE (rear panel) */
13301 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13302 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13303 /* port-H for side (rear panel) */
13304 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13305 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13307 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13308 /* route front mic to ADC1*/
13309 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13310 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13312 /* Unmute DAC0~3 & spdif out*/
13313 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13314 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13315 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13316 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13319 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13320 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13321 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13322 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13323 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13325 /* Unmute Stereo Mixer 15 */
13326 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13328 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13329 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13331 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13332 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13333 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13334 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13335 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13336 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13337 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13338 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13339 /* hp used DAC 3 (Front) */
13340 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13346 static struct hda_verb alc861_threestack_init_verbs[] = {
13348 * Unmute ADC0 and set the default input to mic-in
13350 /* port-A for surround (rear panel) */
13351 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13352 /* port-B for mic-in (rear panel) with vref */
13353 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13354 /* port-C for line-in (rear panel) */
13355 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13356 /* port-D for Front */
13357 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13358 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13359 /* port-E for HP out (front panel) */
13360 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13361 /* route front PCM to HP */
13362 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13363 /* port-F for mic-in (front panel) with vref */
13364 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13365 /* port-G for CLFE (rear panel) */
13366 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13367 /* port-H for side (rear panel) */
13368 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13370 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13371 /* route front mic to ADC1*/
13372 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13373 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13374 /* Unmute DAC0~3 & spdif out*/
13375 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13376 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13377 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13378 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13381 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13382 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13383 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13384 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13385 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13387 /* Unmute Stereo Mixer 15 */
13388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13389 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13390 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13391 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13393 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13394 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13395 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13396 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13397 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13398 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13399 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13400 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13401 /* hp used DAC 3 (Front) */
13402 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13403 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13407 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13409 * Unmute ADC0 and set the default input to mic-in
13411 /* port-A for surround (rear panel) */
13412 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13413 /* port-B for mic-in (rear panel) with vref */
13414 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13415 /* port-C for line-in (rear panel) */
13416 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13417 /* port-D for Front */
13418 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13419 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13420 /* port-E for HP out (front panel) */
13421 /* this has to be set to VREF80 */
13422 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13423 /* route front PCM to HP */
13424 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13425 /* port-F for mic-in (front panel) with vref */
13426 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13427 /* port-G for CLFE (rear panel) */
13428 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13429 /* port-H for side (rear panel) */
13430 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13432 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13433 /* route front mic to ADC1*/
13434 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13435 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13436 /* Unmute DAC0~3 & spdif out*/
13437 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13438 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13439 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13440 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13441 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13443 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13444 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13445 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13446 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13447 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13449 /* Unmute Stereo Mixer 15 */
13450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13451 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13452 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13453 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13455 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13456 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13457 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13458 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13459 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13460 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13461 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13462 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13463 /* hp used DAC 3 (Front) */
13464 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13465 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13469 static struct hda_verb alc861_asus_init_verbs[] = {
13471 * Unmute ADC0 and set the default input to mic-in
13473 /* port-A for surround (rear panel)
13474 * according to codec#0 this is the HP jack
13476 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13477 /* route front PCM to HP */
13478 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13479 /* port-B for mic-in (rear panel) with vref */
13480 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13481 /* port-C for line-in (rear panel) */
13482 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13483 /* port-D for Front */
13484 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13485 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13486 /* port-E for HP out (front panel) */
13487 /* this has to be set to VREF80 */
13488 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13489 /* route front PCM to HP */
13490 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13491 /* port-F for mic-in (front panel) with vref */
13492 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13493 /* port-G for CLFE (rear panel) */
13494 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13495 /* port-H for side (rear panel) */
13496 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13498 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13499 /* route front mic to ADC1*/
13500 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13502 /* Unmute DAC0~3 & spdif out*/
13503 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13504 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13505 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13506 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13508 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13509 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13510 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13511 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13512 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13514 /* Unmute Stereo Mixer 15 */
13515 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13520 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13521 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13522 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13523 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13524 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13525 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13526 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13527 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13528 /* hp used DAC 3 (Front) */
13529 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13530 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13534 /* additional init verbs for ASUS laptops */
13535 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13536 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13537 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13542 * generic initialization of ADC, input mixers and output mixers
13544 static struct hda_verb alc861_auto_init_verbs[] = {
13546 * Unmute ADC0 and set the default input to mic-in
13548 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13551 /* Unmute DAC0~3 & spdif out*/
13552 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13553 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13554 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13555 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13558 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13559 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13560 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13561 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13562 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13564 /* Unmute Stereo Mixer 15 */
13565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13566 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13568 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13570 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13571 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13572 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13573 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13574 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13576 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13577 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13579 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13580 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13582 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13583 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13584 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13585 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13586 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13588 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13593 static struct hda_verb alc861_toshiba_init_verbs[] = {
13594 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13599 /* toggle speaker-output according to the hp-jack state */
13600 static void alc861_toshiba_automute(struct hda_codec *codec)
13602 unsigned int present;
13604 present = snd_hda_codec_read(codec, 0x0f, 0,
13605 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13606 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13607 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13608 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13609 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13612 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13615 if ((res >> 26) == ALC880_HP_EVENT)
13616 alc861_toshiba_automute(codec);
13619 /* pcm configuration: identiacal with ALC880 */
13620 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13621 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13622 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13623 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13626 #define ALC861_DIGOUT_NID 0x07
13628 static struct hda_channel_mode alc861_8ch_modes[1] = {
13632 static hda_nid_t alc861_dac_nids[4] = {
13633 /* front, surround, clfe, side */
13634 0x03, 0x06, 0x05, 0x04
13637 static hda_nid_t alc660_dac_nids[3] = {
13638 /* front, clfe, surround */
13642 static hda_nid_t alc861_adc_nids[1] = {
13647 static struct hda_input_mux alc861_capture_source = {
13651 { "Front Mic", 0x3 },
13658 /* fill in the dac_nids table from the parsed pin configuration */
13659 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13660 const struct auto_pin_cfg *cfg)
13665 spec->multiout.dac_nids = spec->private_dac_nids;
13666 for (i = 0; i < cfg->line_outs; i++) {
13667 nid = cfg->line_out_pins[i];
13669 if (i >= ARRAY_SIZE(alc861_dac_nids))
13671 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13674 spec->multiout.num_dacs = cfg->line_outs;
13678 /* add playback controls from the parsed DAC table */
13679 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13680 const struct auto_pin_cfg *cfg)
13683 static const char *chname[4] = {
13684 "Front", "Surround", NULL /*CLFE*/, "Side"
13689 for (i = 0; i < cfg->line_outs; i++) {
13690 nid = spec->multiout.dac_nids[i];
13695 err = add_control(spec, ALC_CTL_BIND_MUTE,
13696 "Center Playback Switch",
13697 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13701 err = add_control(spec, ALC_CTL_BIND_MUTE,
13702 "LFE Playback Switch",
13703 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13708 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13710 if (nid == alc861_dac_nids[idx])
13712 sprintf(name, "%s Playback Switch", chname[idx]);
13713 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13714 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13723 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13731 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13733 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13734 "Headphone Playback Switch",
13735 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13738 spec->multiout.hp_nid = nid;
13743 /* create playback/capture controls for input pins */
13744 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13745 const struct auto_pin_cfg *cfg)
13747 struct hda_input_mux *imux = &spec->private_imux[0];
13748 int i, err, idx, idx1;
13750 for (i = 0; i < AUTO_PIN_LAST; i++) {
13751 switch (cfg->input_pins[i]) {
13754 idx = 2; /* Line In */
13758 idx = 2; /* Line In */
13762 idx = 1; /* Mic In */
13766 idx = 1; /* Mic In */
13776 err = new_analog_input(spec, cfg->input_pins[i],
13777 auto_pin_cfg_labels[i], idx, 0x15);
13781 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13782 imux->items[imux->num_items].index = idx1;
13788 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13790 int pin_type, int dac_idx)
13792 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13794 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13798 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13800 struct alc_spec *spec = codec->spec;
13803 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13804 for (i = 0; i < spec->autocfg.line_outs; i++) {
13805 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13806 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13808 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13809 spec->multiout.dac_nids[i]);
13813 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13815 struct alc_spec *spec = codec->spec;
13818 pin = spec->autocfg.hp_pins[0];
13819 if (pin) /* connect to front */
13820 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13821 spec->multiout.dac_nids[0]);
13822 pin = spec->autocfg.speaker_pins[0];
13824 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13827 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13829 struct alc_spec *spec = codec->spec;
13832 for (i = 0; i < AUTO_PIN_LAST; i++) {
13833 hda_nid_t nid = spec->autocfg.input_pins[i];
13834 if (nid >= 0x0c && nid <= 0x11)
13835 alc_set_input_pin(codec, nid, i);
13839 /* parse the BIOS configuration and set up the alc_spec */
13840 /* return 1 if successful, 0 if the proper config is not found,
13841 * or a negative error code
13843 static int alc861_parse_auto_config(struct hda_codec *codec)
13845 struct alc_spec *spec = codec->spec;
13847 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13849 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13853 if (!spec->autocfg.line_outs)
13854 return 0; /* can't find valid BIOS pin config */
13856 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13859 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13862 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13865 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13869 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13871 if (spec->autocfg.dig_outs)
13872 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13874 if (spec->kctls.list)
13875 add_mixer(spec, spec->kctls.list);
13877 add_verb(spec, alc861_auto_init_verbs);
13879 spec->num_mux_defs = 1;
13880 spec->input_mux = &spec->private_imux[0];
13882 spec->adc_nids = alc861_adc_nids;
13883 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13884 set_capture_mixer(spec);
13889 /* additional initialization for auto-configuration model */
13890 static void alc861_auto_init(struct hda_codec *codec)
13892 struct alc_spec *spec = codec->spec;
13893 alc861_auto_init_multi_out(codec);
13894 alc861_auto_init_hp_out(codec);
13895 alc861_auto_init_analog_input(codec);
13896 if (spec->unsol_event)
13897 alc_inithook(codec);
13900 #ifdef CONFIG_SND_HDA_POWER_SAVE
13901 static struct hda_amp_list alc861_loopbacks[] = {
13902 { 0x15, HDA_INPUT, 0 },
13903 { 0x15, HDA_INPUT, 1 },
13904 { 0x15, HDA_INPUT, 2 },
13905 { 0x15, HDA_INPUT, 3 },
13912 * configuration and preset
13914 static const char *alc861_models[ALC861_MODEL_LAST] = {
13915 [ALC861_3ST] = "3stack",
13916 [ALC660_3ST] = "3stack-660",
13917 [ALC861_3ST_DIG] = "3stack-dig",
13918 [ALC861_6ST_DIG] = "6stack-dig",
13919 [ALC861_UNIWILL_M31] = "uniwill-m31",
13920 [ALC861_TOSHIBA] = "toshiba",
13921 [ALC861_ASUS] = "asus",
13922 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13923 [ALC861_AUTO] = "auto",
13926 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13927 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13928 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13929 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13930 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13931 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13932 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13933 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13934 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13935 * Any other models that need this preset?
13937 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13938 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13939 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13940 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13941 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13942 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13943 /* FIXME: the below seems conflict */
13944 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13945 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13946 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13950 static struct alc_config_preset alc861_presets[] = {
13952 .mixers = { alc861_3ST_mixer },
13953 .init_verbs = { alc861_threestack_init_verbs },
13954 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13955 .dac_nids = alc861_dac_nids,
13956 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13957 .channel_mode = alc861_threestack_modes,
13959 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13960 .adc_nids = alc861_adc_nids,
13961 .input_mux = &alc861_capture_source,
13963 [ALC861_3ST_DIG] = {
13964 .mixers = { alc861_base_mixer },
13965 .init_verbs = { alc861_threestack_init_verbs },
13966 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13967 .dac_nids = alc861_dac_nids,
13968 .dig_out_nid = ALC861_DIGOUT_NID,
13969 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13970 .channel_mode = alc861_threestack_modes,
13972 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13973 .adc_nids = alc861_adc_nids,
13974 .input_mux = &alc861_capture_source,
13976 [ALC861_6ST_DIG] = {
13977 .mixers = { alc861_base_mixer },
13978 .init_verbs = { alc861_base_init_verbs },
13979 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13980 .dac_nids = alc861_dac_nids,
13981 .dig_out_nid = ALC861_DIGOUT_NID,
13982 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13983 .channel_mode = alc861_8ch_modes,
13984 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13985 .adc_nids = alc861_adc_nids,
13986 .input_mux = &alc861_capture_source,
13989 .mixers = { alc861_3ST_mixer },
13990 .init_verbs = { alc861_threestack_init_verbs },
13991 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13992 .dac_nids = alc660_dac_nids,
13993 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13994 .channel_mode = alc861_threestack_modes,
13996 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13997 .adc_nids = alc861_adc_nids,
13998 .input_mux = &alc861_capture_source,
14000 [ALC861_UNIWILL_M31] = {
14001 .mixers = { alc861_uniwill_m31_mixer },
14002 .init_verbs = { alc861_uniwill_m31_init_verbs },
14003 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14004 .dac_nids = alc861_dac_nids,
14005 .dig_out_nid = ALC861_DIGOUT_NID,
14006 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14007 .channel_mode = alc861_uniwill_m31_modes,
14009 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14010 .adc_nids = alc861_adc_nids,
14011 .input_mux = &alc861_capture_source,
14013 [ALC861_TOSHIBA] = {
14014 .mixers = { alc861_toshiba_mixer },
14015 .init_verbs = { alc861_base_init_verbs,
14016 alc861_toshiba_init_verbs },
14017 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14018 .dac_nids = alc861_dac_nids,
14019 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14020 .channel_mode = alc883_3ST_2ch_modes,
14021 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14022 .adc_nids = alc861_adc_nids,
14023 .input_mux = &alc861_capture_source,
14024 .unsol_event = alc861_toshiba_unsol_event,
14025 .init_hook = alc861_toshiba_automute,
14028 .mixers = { alc861_asus_mixer },
14029 .init_verbs = { alc861_asus_init_verbs },
14030 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14031 .dac_nids = alc861_dac_nids,
14032 .dig_out_nid = ALC861_DIGOUT_NID,
14033 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14034 .channel_mode = alc861_asus_modes,
14037 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14038 .adc_nids = alc861_adc_nids,
14039 .input_mux = &alc861_capture_source,
14041 [ALC861_ASUS_LAPTOP] = {
14042 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14043 .init_verbs = { alc861_asus_init_verbs,
14044 alc861_asus_laptop_init_verbs },
14045 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14046 .dac_nids = alc861_dac_nids,
14047 .dig_out_nid = ALC861_DIGOUT_NID,
14048 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14049 .channel_mode = alc883_3ST_2ch_modes,
14051 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14052 .adc_nids = alc861_adc_nids,
14053 .input_mux = &alc861_capture_source,
14058 static int patch_alc861(struct hda_codec *codec)
14060 struct alc_spec *spec;
14064 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14068 codec->spec = spec;
14070 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14074 if (board_config < 0) {
14075 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14076 "trying auto-probe from BIOS...\n");
14077 board_config = ALC861_AUTO;
14080 if (board_config == ALC861_AUTO) {
14081 /* automatic parse from the BIOS config */
14082 err = alc861_parse_auto_config(codec);
14088 "hda_codec: Cannot set up configuration "
14089 "from BIOS. Using base mode...\n");
14090 board_config = ALC861_3ST_DIG;
14094 err = snd_hda_attach_beep_device(codec, 0x23);
14100 if (board_config != ALC861_AUTO)
14101 setup_preset(spec, &alc861_presets[board_config]);
14103 spec->stream_name_analog = "ALC861 Analog";
14104 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14105 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14107 spec->stream_name_digital = "ALC861 Digital";
14108 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14109 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14111 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14113 spec->vmaster_nid = 0x03;
14115 codec->patch_ops = alc_patch_ops;
14116 if (board_config == ALC861_AUTO)
14117 spec->init_hook = alc861_auto_init;
14118 #ifdef CONFIG_SND_HDA_POWER_SAVE
14119 if (!spec->loopback.amplist)
14120 spec->loopback.amplist = alc861_loopbacks;
14122 codec->proc_widget_hook = print_realtek_coef;
14128 * ALC861-VD support
14132 * In addition, an independent DAC
14134 #define ALC861VD_DIGOUT_NID 0x06
14136 static hda_nid_t alc861vd_dac_nids[4] = {
14137 /* front, surr, clfe, side surr */
14138 0x02, 0x03, 0x04, 0x05
14141 /* dac_nids for ALC660vd are in a different order - according to
14142 * Realtek's driver.
14143 * This should probably tesult in a different mixer for 6stack models
14144 * of ALC660vd codecs, but for now there is only 3stack mixer
14145 * - and it is the same as in 861vd.
14146 * adc_nids in ALC660vd are (is) the same as in 861vd
14148 static hda_nid_t alc660vd_dac_nids[3] = {
14149 /* front, rear, clfe, rear_surr */
14153 static hda_nid_t alc861vd_adc_nids[1] = {
14158 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14161 /* FIXME: should be a matrix-type input source selection */
14162 static struct hda_input_mux alc861vd_capture_source = {
14166 { "Front Mic", 0x1 },
14172 static struct hda_input_mux alc861vd_dallas_capture_source = {
14175 { "Ext Mic", 0x0 },
14176 { "Int Mic", 0x1 },
14180 static struct hda_input_mux alc861vd_hp_capture_source = {
14183 { "Front Mic", 0x0 },
14184 { "ATAPI Mic", 0x1 },
14191 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14198 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14199 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14200 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14201 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14202 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14209 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14210 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14211 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14212 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14213 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14217 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14218 { 6, alc861vd_6stack_ch6_init },
14219 { 8, alc861vd_6stack_ch8_init },
14222 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14225 .name = "Channel Mode",
14226 .info = alc_ch_mode_info,
14227 .get = alc_ch_mode_get,
14228 .put = alc_ch_mode_put,
14233 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14234 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14236 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14237 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14238 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14240 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14241 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14243 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14245 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14247 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14248 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14250 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14251 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14253 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14255 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14259 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14260 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14261 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14264 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14266 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14267 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14272 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14273 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14274 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14276 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14278 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14282 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14283 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14284 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14286 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14287 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14289 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14290 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14295 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14296 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14297 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14298 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14300 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14302 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14306 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14307 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14308 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14310 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14311 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14316 /* Pin assignment: Speaker=0x14, HP = 0x15,
14317 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14319 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14320 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14321 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14322 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14323 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14324 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14325 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14326 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14327 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14328 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14329 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14333 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14334 * Front Mic=0x18, ATAPI Mic = 0x19,
14336 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14337 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14339 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14340 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14341 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14342 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14343 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14344 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14350 * generic initialization of ADC, input mixers and output mixers
14352 static struct hda_verb alc861vd_volume_init_verbs[] = {
14354 * Unmute ADC0 and set the default input to mic-in
14356 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14357 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14359 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14360 * the analog-loopback mixer widget
14362 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14363 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14364 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14369 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14376 * Set up output mixers (0x02 - 0x05)
14378 /* set vol=0 to output mixers */
14379 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14380 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14381 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14382 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14384 /* set up input amps for analog loopback */
14385 /* Amp Indices: DAC = 0, mixer = 1 */
14386 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14389 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14390 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14391 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14392 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14393 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14399 * 3-stack pin configuration:
14400 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14402 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14404 * Set pin mode and muting
14406 /* set front pin widgets 0x14 for output */
14407 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14408 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14409 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14411 /* Mic (rear) pin: input vref at 80% */
14412 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14413 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14414 /* Front Mic pin: input vref at 80% */
14415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14416 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14417 /* Line In pin: input */
14418 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14419 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14420 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14421 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14422 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14423 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14424 /* CD pin widget for input */
14425 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14431 * 6-stack pin configuration:
14433 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14435 * Set pin mode and muting
14437 /* set front pin widgets 0x14 for output */
14438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14439 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14440 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14442 /* Rear Pin: output 1 (0x0d) */
14443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14444 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14446 /* CLFE Pin: output 2 (0x0e) */
14447 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14448 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14449 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14450 /* Side Pin: output 3 (0x0f) */
14451 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14452 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14453 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14455 /* Mic (rear) pin: input vref at 80% */
14456 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14457 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14458 /* Front Mic pin: input vref at 80% */
14459 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14460 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14461 /* Line In pin: input */
14462 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14463 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14464 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14465 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14466 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14467 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14468 /* CD pin widget for input */
14469 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14474 static struct hda_verb alc861vd_eapd_verbs[] = {
14475 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14479 static struct hda_verb alc660vd_eapd_verbs[] = {
14480 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14481 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14485 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14486 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14487 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14489 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14490 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14494 /* toggle speaker-output according to the hp-jack state */
14495 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14497 unsigned int present;
14498 unsigned char bits;
14500 present = snd_hda_codec_read(codec, 0x1b, 0,
14501 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14502 bits = present ? HDA_AMP_MUTE : 0;
14503 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14504 HDA_AMP_MUTE, bits);
14507 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14509 unsigned int present;
14510 unsigned char bits;
14512 present = snd_hda_codec_read(codec, 0x18, 0,
14513 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14514 bits = present ? HDA_AMP_MUTE : 0;
14515 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14516 HDA_AMP_MUTE, bits);
14519 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14521 alc861vd_lenovo_hp_automute(codec);
14522 alc861vd_lenovo_mic_automute(codec);
14525 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14528 switch (res >> 26) {
14529 case ALC880_HP_EVENT:
14530 alc861vd_lenovo_hp_automute(codec);
14532 case ALC880_MIC_EVENT:
14533 alc861vd_lenovo_mic_automute(codec);
14538 static struct hda_verb alc861vd_dallas_verbs[] = {
14539 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14540 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14541 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14542 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14546 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14547 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14548 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14549 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14550 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14551 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14554 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14556 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14557 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14558 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14559 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14560 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14562 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14563 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14564 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14565 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14566 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14567 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14568 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14569 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14574 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14576 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14577 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14578 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14583 /* toggle speaker-output according to the hp-jack state */
14584 static void alc861vd_dallas_automute(struct hda_codec *codec)
14586 unsigned int present;
14588 present = snd_hda_codec_read(codec, 0x15, 0,
14589 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14590 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14591 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14594 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14596 if ((res >> 26) == ALC880_HP_EVENT)
14597 alc861vd_dallas_automute(codec);
14600 #ifdef CONFIG_SND_HDA_POWER_SAVE
14601 #define alc861vd_loopbacks alc880_loopbacks
14604 /* pcm configuration: identiacal with ALC880 */
14605 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14606 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14607 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14608 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14611 * configuration and preset
14613 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14614 [ALC660VD_3ST] = "3stack-660",
14615 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14616 [ALC660VD_ASUS_V1S] = "asus-v1s",
14617 [ALC861VD_3ST] = "3stack",
14618 [ALC861VD_3ST_DIG] = "3stack-digout",
14619 [ALC861VD_6ST_DIG] = "6stack-digout",
14620 [ALC861VD_LENOVO] = "lenovo",
14621 [ALC861VD_DALLAS] = "dallas",
14622 [ALC861VD_HP] = "hp",
14623 [ALC861VD_AUTO] = "auto",
14626 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14627 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14628 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14629 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14630 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14631 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14632 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14633 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14634 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14635 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14636 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14637 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14638 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14639 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14640 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14641 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14645 static struct alc_config_preset alc861vd_presets[] = {
14647 .mixers = { alc861vd_3st_mixer },
14648 .init_verbs = { alc861vd_volume_init_verbs,
14649 alc861vd_3stack_init_verbs },
14650 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14651 .dac_nids = alc660vd_dac_nids,
14652 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14653 .channel_mode = alc861vd_3stack_2ch_modes,
14654 .input_mux = &alc861vd_capture_source,
14656 [ALC660VD_3ST_DIG] = {
14657 .mixers = { alc861vd_3st_mixer },
14658 .init_verbs = { alc861vd_volume_init_verbs,
14659 alc861vd_3stack_init_verbs },
14660 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14661 .dac_nids = alc660vd_dac_nids,
14662 .dig_out_nid = ALC861VD_DIGOUT_NID,
14663 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14664 .channel_mode = alc861vd_3stack_2ch_modes,
14665 .input_mux = &alc861vd_capture_source,
14668 .mixers = { alc861vd_3st_mixer },
14669 .init_verbs = { alc861vd_volume_init_verbs,
14670 alc861vd_3stack_init_verbs },
14671 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14672 .dac_nids = alc861vd_dac_nids,
14673 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14674 .channel_mode = alc861vd_3stack_2ch_modes,
14675 .input_mux = &alc861vd_capture_source,
14677 [ALC861VD_3ST_DIG] = {
14678 .mixers = { alc861vd_3st_mixer },
14679 .init_verbs = { alc861vd_volume_init_verbs,
14680 alc861vd_3stack_init_verbs },
14681 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14682 .dac_nids = alc861vd_dac_nids,
14683 .dig_out_nid = ALC861VD_DIGOUT_NID,
14684 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14685 .channel_mode = alc861vd_3stack_2ch_modes,
14686 .input_mux = &alc861vd_capture_source,
14688 [ALC861VD_6ST_DIG] = {
14689 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14690 .init_verbs = { alc861vd_volume_init_verbs,
14691 alc861vd_6stack_init_verbs },
14692 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14693 .dac_nids = alc861vd_dac_nids,
14694 .dig_out_nid = ALC861VD_DIGOUT_NID,
14695 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14696 .channel_mode = alc861vd_6stack_modes,
14697 .input_mux = &alc861vd_capture_source,
14699 [ALC861VD_LENOVO] = {
14700 .mixers = { alc861vd_lenovo_mixer },
14701 .init_verbs = { alc861vd_volume_init_verbs,
14702 alc861vd_3stack_init_verbs,
14703 alc861vd_eapd_verbs,
14704 alc861vd_lenovo_unsol_verbs },
14705 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14706 .dac_nids = alc660vd_dac_nids,
14707 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14708 .channel_mode = alc861vd_3stack_2ch_modes,
14709 .input_mux = &alc861vd_capture_source,
14710 .unsol_event = alc861vd_lenovo_unsol_event,
14711 .init_hook = alc861vd_lenovo_automute,
14713 [ALC861VD_DALLAS] = {
14714 .mixers = { alc861vd_dallas_mixer },
14715 .init_verbs = { alc861vd_dallas_verbs },
14716 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14717 .dac_nids = alc861vd_dac_nids,
14718 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14719 .channel_mode = alc861vd_3stack_2ch_modes,
14720 .input_mux = &alc861vd_dallas_capture_source,
14721 .unsol_event = alc861vd_dallas_unsol_event,
14722 .init_hook = alc861vd_dallas_automute,
14725 .mixers = { alc861vd_hp_mixer },
14726 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14727 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14728 .dac_nids = alc861vd_dac_nids,
14729 .dig_out_nid = ALC861VD_DIGOUT_NID,
14730 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14731 .channel_mode = alc861vd_3stack_2ch_modes,
14732 .input_mux = &alc861vd_hp_capture_source,
14733 .unsol_event = alc861vd_dallas_unsol_event,
14734 .init_hook = alc861vd_dallas_automute,
14736 [ALC660VD_ASUS_V1S] = {
14737 .mixers = { alc861vd_lenovo_mixer },
14738 .init_verbs = { alc861vd_volume_init_verbs,
14739 alc861vd_3stack_init_verbs,
14740 alc861vd_eapd_verbs,
14741 alc861vd_lenovo_unsol_verbs },
14742 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14743 .dac_nids = alc660vd_dac_nids,
14744 .dig_out_nid = ALC861VD_DIGOUT_NID,
14745 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14746 .channel_mode = alc861vd_3stack_2ch_modes,
14747 .input_mux = &alc861vd_capture_source,
14748 .unsol_event = alc861vd_lenovo_unsol_event,
14749 .init_hook = alc861vd_lenovo_automute,
14754 * BIOS auto configuration
14756 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14757 hda_nid_t nid, int pin_type, int dac_idx)
14759 alc_set_pin_output(codec, nid, pin_type);
14762 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14764 struct alc_spec *spec = codec->spec;
14767 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14768 for (i = 0; i <= HDA_SIDE; i++) {
14769 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14770 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14772 alc861vd_auto_set_output_and_unmute(codec, nid,
14778 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14780 struct alc_spec *spec = codec->spec;
14783 pin = spec->autocfg.hp_pins[0];
14784 if (pin) /* connect to front and use dac 0 */
14785 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14786 pin = spec->autocfg.speaker_pins[0];
14788 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14791 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14792 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14794 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14796 struct alc_spec *spec = codec->spec;
14799 for (i = 0; i < AUTO_PIN_LAST; i++) {
14800 hda_nid_t nid = spec->autocfg.input_pins[i];
14801 if (alc861vd_is_input_pin(nid)) {
14802 alc_set_input_pin(codec, nid, i);
14803 if (nid != ALC861VD_PIN_CD_NID)
14804 snd_hda_codec_write(codec, nid, 0,
14805 AC_VERB_SET_AMP_GAIN_MUTE,
14811 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14813 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14814 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14816 /* add playback controls from the parsed DAC table */
14817 /* Based on ALC880 version. But ALC861VD has separate,
14818 * different NIDs for mute/unmute switch and volume control */
14819 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14820 const struct auto_pin_cfg *cfg)
14823 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14824 hda_nid_t nid_v, nid_s;
14827 for (i = 0; i < cfg->line_outs; i++) {
14828 if (!spec->multiout.dac_nids[i])
14830 nid_v = alc861vd_idx_to_mixer_vol(
14832 spec->multiout.dac_nids[i]));
14833 nid_s = alc861vd_idx_to_mixer_switch(
14835 spec->multiout.dac_nids[i]));
14839 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14840 "Center Playback Volume",
14841 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14845 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14846 "LFE Playback Volume",
14847 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14851 err = add_control(spec, ALC_CTL_BIND_MUTE,
14852 "Center Playback Switch",
14853 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14857 err = add_control(spec, ALC_CTL_BIND_MUTE,
14858 "LFE Playback Switch",
14859 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14864 sprintf(name, "%s Playback Volume", chname[i]);
14865 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14866 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14870 sprintf(name, "%s Playback Switch", chname[i]);
14871 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14872 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14881 /* add playback controls for speaker and HP outputs */
14882 /* Based on ALC880 version. But ALC861VD has separate,
14883 * different NIDs for mute/unmute switch and volume control */
14884 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14885 hda_nid_t pin, const char *pfx)
14887 hda_nid_t nid_v, nid_s;
14894 if (alc880_is_fixed_pin(pin)) {
14895 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14896 /* specify the DAC as the extra output */
14897 if (!spec->multiout.hp_nid)
14898 spec->multiout.hp_nid = nid_v;
14900 spec->multiout.extra_out_nid[0] = nid_v;
14901 /* control HP volume/switch on the output mixer amp */
14902 nid_v = alc861vd_idx_to_mixer_vol(
14903 alc880_fixed_pin_idx(pin));
14904 nid_s = alc861vd_idx_to_mixer_switch(
14905 alc880_fixed_pin_idx(pin));
14907 sprintf(name, "%s Playback Volume", pfx);
14908 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14909 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14912 sprintf(name, "%s Playback Switch", pfx);
14913 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14914 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14917 } else if (alc880_is_multi_pin(pin)) {
14918 /* set manual connection */
14919 /* we have only a switch on HP-out PIN */
14920 sprintf(name, "%s Playback Switch", pfx);
14921 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14922 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14929 /* parse the BIOS configuration and set up the alc_spec
14930 * return 1 if successful, 0 if the proper config is not found,
14931 * or a negative error code
14932 * Based on ALC880 version - had to change it to override
14933 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14934 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14936 struct alc_spec *spec = codec->spec;
14938 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14940 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14944 if (!spec->autocfg.line_outs)
14945 return 0; /* can't find valid BIOS pin config */
14947 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14950 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14953 err = alc861vd_auto_create_extra_out(spec,
14954 spec->autocfg.speaker_pins[0],
14958 err = alc861vd_auto_create_extra_out(spec,
14959 spec->autocfg.hp_pins[0],
14963 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14967 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14969 if (spec->autocfg.dig_outs)
14970 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14972 if (spec->kctls.list)
14973 add_mixer(spec, spec->kctls.list);
14975 add_verb(spec, alc861vd_volume_init_verbs);
14977 spec->num_mux_defs = 1;
14978 spec->input_mux = &spec->private_imux[0];
14980 err = alc_auto_add_mic_boost(codec);
14987 /* additional initialization for auto-configuration model */
14988 static void alc861vd_auto_init(struct hda_codec *codec)
14990 struct alc_spec *spec = codec->spec;
14991 alc861vd_auto_init_multi_out(codec);
14992 alc861vd_auto_init_hp_out(codec);
14993 alc861vd_auto_init_analog_input(codec);
14994 alc861vd_auto_init_input_src(codec);
14995 if (spec->unsol_event)
14996 alc_inithook(codec);
14999 static int patch_alc861vd(struct hda_codec *codec)
15001 struct alc_spec *spec;
15002 int err, board_config;
15004 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15008 codec->spec = spec;
15010 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15014 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15015 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
15016 "ALC861VD, trying auto-probe from BIOS...\n");
15017 board_config = ALC861VD_AUTO;
15020 if (board_config == ALC861VD_AUTO) {
15021 /* automatic parse from the BIOS config */
15022 err = alc861vd_parse_auto_config(codec);
15028 "hda_codec: Cannot set up configuration "
15029 "from BIOS. Using base mode...\n");
15030 board_config = ALC861VD_3ST;
15034 err = snd_hda_attach_beep_device(codec, 0x23);
15040 if (board_config != ALC861VD_AUTO)
15041 setup_preset(spec, &alc861vd_presets[board_config]);
15043 if (codec->vendor_id == 0x10ec0660) {
15044 spec->stream_name_analog = "ALC660-VD Analog";
15045 spec->stream_name_digital = "ALC660-VD Digital";
15046 /* always turn on EAPD */
15047 add_verb(spec, alc660vd_eapd_verbs);
15049 spec->stream_name_analog = "ALC861VD Analog";
15050 spec->stream_name_digital = "ALC861VD Digital";
15053 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15054 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15056 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15057 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15059 spec->adc_nids = alc861vd_adc_nids;
15060 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15061 spec->capsrc_nids = alc861vd_capsrc_nids;
15062 spec->capture_style = CAPT_MIX;
15064 set_capture_mixer(spec);
15065 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15067 spec->vmaster_nid = 0x02;
15069 codec->patch_ops = alc_patch_ops;
15071 if (board_config == ALC861VD_AUTO)
15072 spec->init_hook = alc861vd_auto_init;
15073 #ifdef CONFIG_SND_HDA_POWER_SAVE
15074 if (!spec->loopback.amplist)
15075 spec->loopback.amplist = alc861vd_loopbacks;
15077 codec->proc_widget_hook = print_realtek_coef;
15085 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15086 * configuration. Each pin widget can choose any input DACs and a mixer.
15087 * Each ADC is connected from a mixer of all inputs. This makes possible
15088 * 6-channel independent captures.
15090 * In addition, an independent DAC for the multi-playback (not used in this
15093 #define ALC662_DIGOUT_NID 0x06
15094 #define ALC662_DIGIN_NID 0x0a
15096 static hda_nid_t alc662_dac_nids[4] = {
15097 /* front, rear, clfe, rear_surr */
15101 static hda_nid_t alc662_adc_nids[1] = {
15106 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15109 /* FIXME: should be a matrix-type input source selection */
15110 static struct hda_input_mux alc662_capture_source = {
15114 { "Front Mic", 0x1 },
15120 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15128 static struct hda_input_mux alc662_eeepc_capture_source = {
15136 static struct hda_input_mux alc663_capture_source = {
15140 { "Front Mic", 0x1 },
15145 static struct hda_input_mux alc663_m51va_capture_source = {
15148 { "Ext-Mic", 0x0 },
15156 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15163 static struct hda_verb alc662_3ST_ch2_init[] = {
15164 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15165 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15166 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15167 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15174 static struct hda_verb alc662_3ST_ch6_init[] = {
15175 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15176 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15177 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15178 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15179 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15180 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15184 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15185 { 2, alc662_3ST_ch2_init },
15186 { 6, alc662_3ST_ch6_init },
15192 static struct hda_verb alc662_sixstack_ch6_init[] = {
15193 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15194 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15195 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15202 static struct hda_verb alc662_sixstack_ch8_init[] = {
15203 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15204 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15205 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15209 static struct hda_channel_mode alc662_5stack_modes[2] = {
15210 { 2, alc662_sixstack_ch6_init },
15211 { 6, alc662_sixstack_ch8_init },
15214 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15215 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15218 static struct snd_kcontrol_new alc662_base_mixer[] = {
15219 /* output mixer control */
15220 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15221 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15222 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15223 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15225 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15226 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15227 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15228 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15230 /*Input mixer control */
15231 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15232 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15233 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15234 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15235 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15236 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15237 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15238 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15242 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15243 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15244 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15245 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15246 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15247 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15248 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15249 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15252 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15253 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15257 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15258 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15259 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15260 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15261 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15262 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15264 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15265 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15267 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15268 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15273 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15274 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15278 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15279 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15280 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15281 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15282 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15283 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15286 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15287 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15291 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15292 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15294 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15295 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15297 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15298 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15299 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15301 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15302 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15303 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15307 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15308 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15309 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15310 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15311 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15312 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15313 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15314 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15315 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15316 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15317 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15325 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15326 .ops = &snd_hda_bind_vol,
15328 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15329 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15334 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15335 .ops = &snd_hda_bind_sw,
15337 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15338 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15343 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15344 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15345 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15351 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15352 .ops = &snd_hda_bind_sw,
15354 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15355 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15356 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15361 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15362 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15363 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15366 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15367 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15372 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15373 .ops = &snd_hda_bind_sw,
15375 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15376 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15377 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15382 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15383 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15384 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15387 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15388 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15392 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15393 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15394 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15395 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15397 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15398 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15399 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15403 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15404 .ops = &snd_hda_bind_vol,
15406 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15407 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15412 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15413 .ops = &snd_hda_bind_sw,
15415 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15416 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15421 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15422 HDA_BIND_VOL("Master Playback Volume",
15423 &alc663_asus_two_bind_master_vol),
15424 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15425 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15426 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15427 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15428 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15432 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15433 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15434 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15435 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15436 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15438 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15442 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15443 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15444 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15445 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15446 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15447 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15451 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15452 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15456 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15457 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15458 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15463 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15464 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15465 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15466 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15470 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15472 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15473 .name = "Channel Mode",
15474 .info = alc_ch_mode_info,
15475 .get = alc_ch_mode_get,
15476 .put = alc_ch_mode_put,
15481 static struct hda_verb alc662_init_verbs[] = {
15482 /* ADC: mute amp left and right */
15483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15484 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15485 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15491 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15495 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15496 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15497 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15498 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15500 /* Front Pin: output 0 (0x0c) */
15501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15504 /* Rear Pin: output 1 (0x0d) */
15505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15506 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15508 /* CLFE Pin: output 2 (0x0e) */
15509 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15510 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15512 /* Mic (rear) pin: input vref at 80% */
15513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15514 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15515 /* Front Mic pin: input vref at 80% */
15516 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15517 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15518 /* Line In pin: input */
15519 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15520 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15521 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15522 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15523 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15524 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15525 /* CD pin widget for input */
15526 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15528 /* FIXME: use matrix-type input source selection */
15529 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15536 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15537 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15538 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15541 /* always trun on EAPD */
15542 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15543 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15548 static struct hda_verb alc662_sue_init_verbs[] = {
15549 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15550 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15554 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15555 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15556 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15560 /* Set Unsolicited Event*/
15561 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15563 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15568 * generic initialization of ADC, input mixers and output mixers
15570 static struct hda_verb alc662_auto_init_verbs[] = {
15572 * Unmute ADC and set the default input to mic-in
15574 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15577 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15579 * Note: PASD motherboards uses the Line In 2 as the input for front
15580 * panel mic (mic 2)
15582 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15586 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15587 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15590 * Set up output mixers (0x0c - 0x0f)
15592 /* set vol=0 to output mixers */
15593 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15594 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15595 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15597 /* set up input amps for analog loopback */
15598 /* Amp Indices: DAC = 0, mixer = 1 */
15599 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15601 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15603 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15604 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15607 /* FIXME: use matrix-type input source selection */
15608 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15611 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15615 /* additional verbs for ALC663 */
15616 static struct hda_verb alc663_auto_init_verbs[] = {
15617 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15618 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15622 static struct hda_verb alc663_m51va_init_verbs[] = {
15623 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15624 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15625 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15626 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15627 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15628 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15629 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15630 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15631 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15635 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15636 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15637 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15638 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15641 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15642 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15646 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15647 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15648 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15649 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15650 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15653 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15654 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15658 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15659 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15661 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15663 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15664 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15665 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15669 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15670 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15671 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15672 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15673 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15678 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15679 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15680 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15681 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15685 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15686 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15687 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15688 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15689 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15692 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15693 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15694 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15695 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15696 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15697 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15701 static struct hda_verb alc663_g71v_init_verbs[] = {
15702 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15703 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15704 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15706 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15707 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15708 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15710 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15711 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15712 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15716 static struct hda_verb alc663_g50v_init_verbs[] = {
15717 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15718 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15719 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15721 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15722 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15726 static struct hda_verb alc662_ecs_init_verbs[] = {
15727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15729 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15730 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15734 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15735 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15736 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15740 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15742 unsigned int present;
15743 unsigned char bits;
15745 present = snd_hda_codec_read(codec, 0x14, 0,
15746 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15747 bits = present ? HDA_AMP_MUTE : 0;
15748 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15749 HDA_AMP_MUTE, bits);
15752 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15754 unsigned int present;
15755 unsigned char bits;
15757 present = snd_hda_codec_read(codec, 0x1b, 0,
15758 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15759 bits = present ? HDA_AMP_MUTE : 0;
15760 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15761 HDA_AMP_MUTE, bits);
15762 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15763 HDA_AMP_MUTE, bits);
15766 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15769 if ((res >> 26) == ALC880_HP_EVENT)
15770 alc662_lenovo_101e_all_automute(codec);
15771 if ((res >> 26) == ALC880_FRONT_EVENT)
15772 alc662_lenovo_101e_ispeaker_automute(codec);
15775 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15777 unsigned int present;
15779 present = snd_hda_codec_read(codec, 0x18, 0,
15780 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15781 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15782 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15783 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15784 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15785 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15786 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15787 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15788 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15791 /* unsolicited event for HP jack sensing */
15792 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15795 if ((res >> 26) == ALC880_HP_EVENT)
15796 alc262_hippo1_automute( codec );
15798 if ((res >> 26) == ALC880_MIC_EVENT)
15799 alc662_eeepc_mic_automute(codec);
15802 static void alc662_eeepc_inithook(struct hda_codec *codec)
15804 alc262_hippo1_automute( codec );
15805 alc662_eeepc_mic_automute(codec);
15808 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15811 unsigned int present;
15813 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15814 present = snd_hda_codec_read(codec, 0x14, 0,
15815 AC_VERB_GET_PIN_SENSE, 0);
15816 present = (present & 0x80000000) != 0;
15818 /* mute internal speaker */
15819 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15820 HDA_AMP_MUTE, HDA_AMP_MUTE);
15822 /* unmute internal speaker if necessary */
15823 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15824 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15825 HDA_AMP_MUTE, mute);
15829 /* unsolicited event for HP jack sensing */
15830 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15833 if ((res >> 26) == ALC880_HP_EVENT)
15834 alc662_eeepc_ep20_automute(codec);
15837 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15839 alc662_eeepc_ep20_automute(codec);
15842 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15844 unsigned int present;
15845 unsigned char bits;
15847 present = snd_hda_codec_read(codec, 0x21, 0,
15848 AC_VERB_GET_PIN_SENSE, 0)
15849 & AC_PINSENSE_PRESENCE;
15850 bits = present ? HDA_AMP_MUTE : 0;
15851 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15852 AMP_IN_MUTE(0), bits);
15853 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15854 AMP_IN_MUTE(0), bits);
15857 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15859 unsigned int present;
15860 unsigned char bits;
15862 present = snd_hda_codec_read(codec, 0x21, 0,
15863 AC_VERB_GET_PIN_SENSE, 0)
15864 & AC_PINSENSE_PRESENCE;
15865 bits = present ? HDA_AMP_MUTE : 0;
15866 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15867 AMP_IN_MUTE(0), bits);
15868 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15869 AMP_IN_MUTE(0), bits);
15870 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15871 AMP_IN_MUTE(0), bits);
15872 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15873 AMP_IN_MUTE(0), bits);
15876 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15878 unsigned int present;
15879 unsigned char bits;
15881 present = snd_hda_codec_read(codec, 0x15, 0,
15882 AC_VERB_GET_PIN_SENSE, 0)
15883 & AC_PINSENSE_PRESENCE;
15884 bits = present ? HDA_AMP_MUTE : 0;
15885 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15886 AMP_IN_MUTE(0), bits);
15887 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15888 AMP_IN_MUTE(0), bits);
15889 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15890 AMP_IN_MUTE(0), bits);
15891 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15892 AMP_IN_MUTE(0), bits);
15895 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15897 unsigned int present;
15898 unsigned char bits;
15900 present = snd_hda_codec_read(codec, 0x1b, 0,
15901 AC_VERB_GET_PIN_SENSE, 0)
15902 & AC_PINSENSE_PRESENCE;
15903 bits = present ? 0 : PIN_OUT;
15904 snd_hda_codec_write(codec, 0x14, 0,
15905 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15908 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15910 unsigned int present1, present2;
15912 present1 = snd_hda_codec_read(codec, 0x21, 0,
15913 AC_VERB_GET_PIN_SENSE, 0)
15914 & AC_PINSENSE_PRESENCE;
15915 present2 = snd_hda_codec_read(codec, 0x15, 0,
15916 AC_VERB_GET_PIN_SENSE, 0)
15917 & AC_PINSENSE_PRESENCE;
15919 if (present1 || present2) {
15920 snd_hda_codec_write_cache(codec, 0x14, 0,
15921 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15923 snd_hda_codec_write_cache(codec, 0x14, 0,
15924 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15928 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15930 unsigned int present1, present2;
15932 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15933 AC_VERB_GET_PIN_SENSE, 0)
15934 & AC_PINSENSE_PRESENCE;
15935 present2 = snd_hda_codec_read(codec, 0x15, 0,
15936 AC_VERB_GET_PIN_SENSE, 0)
15937 & AC_PINSENSE_PRESENCE;
15939 if (present1 || present2) {
15940 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15941 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15942 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15943 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15945 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15946 AMP_IN_MUTE(0), 0);
15947 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15948 AMP_IN_MUTE(0), 0);
15952 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15954 unsigned int present;
15956 present = snd_hda_codec_read(codec, 0x18, 0,
15957 AC_VERB_GET_PIN_SENSE, 0)
15958 & AC_PINSENSE_PRESENCE;
15959 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15960 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15961 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15962 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15963 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15964 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15965 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15966 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15969 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15972 switch (res >> 26) {
15973 case ALC880_HP_EVENT:
15974 alc663_m51va_speaker_automute(codec);
15976 case ALC880_MIC_EVENT:
15977 alc663_m51va_mic_automute(codec);
15982 static void alc663_m51va_inithook(struct hda_codec *codec)
15984 alc663_m51va_speaker_automute(codec);
15985 alc663_m51va_mic_automute(codec);
15988 /* ***************** Mode1 ******************************/
15989 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15992 switch (res >> 26) {
15993 case ALC880_HP_EVENT:
15994 alc663_m51va_speaker_automute(codec);
15996 case ALC880_MIC_EVENT:
15997 alc662_eeepc_mic_automute(codec);
16002 static void alc663_mode1_inithook(struct hda_codec *codec)
16004 alc663_m51va_speaker_automute(codec);
16005 alc662_eeepc_mic_automute(codec);
16007 /* ***************** Mode2 ******************************/
16008 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16011 switch (res >> 26) {
16012 case ALC880_HP_EVENT:
16013 alc662_f5z_speaker_automute(codec);
16015 case ALC880_MIC_EVENT:
16016 alc662_eeepc_mic_automute(codec);
16021 static void alc662_mode2_inithook(struct hda_codec *codec)
16023 alc662_f5z_speaker_automute(codec);
16024 alc662_eeepc_mic_automute(codec);
16026 /* ***************** Mode3 ******************************/
16027 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16030 switch (res >> 26) {
16031 case ALC880_HP_EVENT:
16032 alc663_two_hp_m1_speaker_automute(codec);
16034 case ALC880_MIC_EVENT:
16035 alc662_eeepc_mic_automute(codec);
16040 static void alc663_mode3_inithook(struct hda_codec *codec)
16042 alc663_two_hp_m1_speaker_automute(codec);
16043 alc662_eeepc_mic_automute(codec);
16045 /* ***************** Mode4 ******************************/
16046 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16049 switch (res >> 26) {
16050 case ALC880_HP_EVENT:
16051 alc663_21jd_two_speaker_automute(codec);
16053 case ALC880_MIC_EVENT:
16054 alc662_eeepc_mic_automute(codec);
16059 static void alc663_mode4_inithook(struct hda_codec *codec)
16061 alc663_21jd_two_speaker_automute(codec);
16062 alc662_eeepc_mic_automute(codec);
16064 /* ***************** Mode5 ******************************/
16065 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16068 switch (res >> 26) {
16069 case ALC880_HP_EVENT:
16070 alc663_15jd_two_speaker_automute(codec);
16072 case ALC880_MIC_EVENT:
16073 alc662_eeepc_mic_automute(codec);
16078 static void alc663_mode5_inithook(struct hda_codec *codec)
16080 alc663_15jd_two_speaker_automute(codec);
16081 alc662_eeepc_mic_automute(codec);
16083 /* ***************** Mode6 ******************************/
16084 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16087 switch (res >> 26) {
16088 case ALC880_HP_EVENT:
16089 alc663_two_hp_m2_speaker_automute(codec);
16091 case ALC880_MIC_EVENT:
16092 alc662_eeepc_mic_automute(codec);
16097 static void alc663_mode6_inithook(struct hda_codec *codec)
16099 alc663_two_hp_m2_speaker_automute(codec);
16100 alc662_eeepc_mic_automute(codec);
16103 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16105 unsigned int present;
16106 unsigned char bits;
16108 present = snd_hda_codec_read(codec, 0x21, 0,
16109 AC_VERB_GET_PIN_SENSE, 0)
16110 & AC_PINSENSE_PRESENCE;
16111 bits = present ? HDA_AMP_MUTE : 0;
16112 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16113 HDA_AMP_MUTE, bits);
16114 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16115 HDA_AMP_MUTE, bits);
16118 static void alc663_g71v_front_automute(struct hda_codec *codec)
16120 unsigned int present;
16121 unsigned char bits;
16123 present = snd_hda_codec_read(codec, 0x15, 0,
16124 AC_VERB_GET_PIN_SENSE, 0)
16125 & AC_PINSENSE_PRESENCE;
16126 bits = present ? HDA_AMP_MUTE : 0;
16127 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16128 HDA_AMP_MUTE, bits);
16131 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16134 switch (res >> 26) {
16135 case ALC880_HP_EVENT:
16136 alc663_g71v_hp_automute(codec);
16138 case ALC880_FRONT_EVENT:
16139 alc663_g71v_front_automute(codec);
16141 case ALC880_MIC_EVENT:
16142 alc662_eeepc_mic_automute(codec);
16147 static void alc663_g71v_inithook(struct hda_codec *codec)
16149 alc663_g71v_front_automute(codec);
16150 alc663_g71v_hp_automute(codec);
16151 alc662_eeepc_mic_automute(codec);
16154 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16157 switch (res >> 26) {
16158 case ALC880_HP_EVENT:
16159 alc663_m51va_speaker_automute(codec);
16161 case ALC880_MIC_EVENT:
16162 alc662_eeepc_mic_automute(codec);
16167 static void alc663_g50v_inithook(struct hda_codec *codec)
16169 alc663_m51va_speaker_automute(codec);
16170 alc662_eeepc_mic_automute(codec);
16173 /* bind hp and internal speaker mute (with plug check) */
16174 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16175 struct snd_ctl_elem_value *ucontrol)
16177 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16178 long *valp = ucontrol->value.integer.value;
16181 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16183 valp[0] ? 0 : HDA_AMP_MUTE);
16184 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16186 valp[1] ? 0 : HDA_AMP_MUTE);
16188 alc262_hippo1_automute(codec);
16192 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16193 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16195 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16196 .name = "Master Playback Switch",
16197 .info = snd_hda_mixer_amp_switch_info,
16198 .get = snd_hda_mixer_amp_switch_get,
16199 .put = alc662_ecs_master_sw_put,
16200 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16203 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16204 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16205 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16207 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16208 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16209 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16213 #ifdef CONFIG_SND_HDA_POWER_SAVE
16214 #define alc662_loopbacks alc880_loopbacks
16218 /* pcm configuration: identiacal with ALC880 */
16219 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16220 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16221 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16222 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16225 * configuration and preset
16227 static const char *alc662_models[ALC662_MODEL_LAST] = {
16228 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16229 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16230 [ALC662_3ST_6ch] = "3stack-6ch",
16231 [ALC662_5ST_DIG] = "6stack-dig",
16232 [ALC662_LENOVO_101E] = "lenovo-101e",
16233 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16234 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16235 [ALC662_ECS] = "ecs",
16236 [ALC663_ASUS_M51VA] = "m51va",
16237 [ALC663_ASUS_G71V] = "g71v",
16238 [ALC663_ASUS_H13] = "h13",
16239 [ALC663_ASUS_G50V] = "g50v",
16240 [ALC663_ASUS_MODE1] = "asus-mode1",
16241 [ALC662_ASUS_MODE2] = "asus-mode2",
16242 [ALC663_ASUS_MODE3] = "asus-mode3",
16243 [ALC663_ASUS_MODE4] = "asus-mode4",
16244 [ALC663_ASUS_MODE5] = "asus-mode5",
16245 [ALC663_ASUS_MODE6] = "asus-mode6",
16246 [ALC662_AUTO] = "auto",
16249 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16250 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16251 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16252 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16253 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16254 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16255 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16256 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16257 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16258 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16259 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16260 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16261 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16262 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16263 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16264 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16265 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16266 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16267 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16268 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16269 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16270 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16271 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16272 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16273 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16274 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16275 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16276 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16277 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16278 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16279 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16280 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16281 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16282 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16283 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16284 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16285 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16286 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16287 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16288 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16289 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16290 ALC662_3ST_6ch_DIG),
16291 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16292 ALC662_3ST_6ch_DIG),
16293 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16294 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16295 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16296 ALC662_3ST_6ch_DIG),
16297 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16302 static struct alc_config_preset alc662_presets[] = {
16303 [ALC662_3ST_2ch_DIG] = {
16304 .mixers = { alc662_3ST_2ch_mixer },
16305 .init_verbs = { alc662_init_verbs },
16306 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16307 .dac_nids = alc662_dac_nids,
16308 .dig_out_nid = ALC662_DIGOUT_NID,
16309 .dig_in_nid = ALC662_DIGIN_NID,
16310 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16311 .channel_mode = alc662_3ST_2ch_modes,
16312 .input_mux = &alc662_capture_source,
16314 [ALC662_3ST_6ch_DIG] = {
16315 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16316 .init_verbs = { alc662_init_verbs },
16317 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16318 .dac_nids = alc662_dac_nids,
16319 .dig_out_nid = ALC662_DIGOUT_NID,
16320 .dig_in_nid = ALC662_DIGIN_NID,
16321 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16322 .channel_mode = alc662_3ST_6ch_modes,
16324 .input_mux = &alc662_capture_source,
16326 [ALC662_3ST_6ch] = {
16327 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16328 .init_verbs = { alc662_init_verbs },
16329 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16330 .dac_nids = alc662_dac_nids,
16331 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16332 .channel_mode = alc662_3ST_6ch_modes,
16334 .input_mux = &alc662_capture_source,
16336 [ALC662_5ST_DIG] = {
16337 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16338 .init_verbs = { alc662_init_verbs },
16339 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16340 .dac_nids = alc662_dac_nids,
16341 .dig_out_nid = ALC662_DIGOUT_NID,
16342 .dig_in_nid = ALC662_DIGIN_NID,
16343 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16344 .channel_mode = alc662_5stack_modes,
16345 .input_mux = &alc662_capture_source,
16347 [ALC662_LENOVO_101E] = {
16348 .mixers = { alc662_lenovo_101e_mixer },
16349 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16350 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16351 .dac_nids = alc662_dac_nids,
16352 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16353 .channel_mode = alc662_3ST_2ch_modes,
16354 .input_mux = &alc662_lenovo_101e_capture_source,
16355 .unsol_event = alc662_lenovo_101e_unsol_event,
16356 .init_hook = alc662_lenovo_101e_all_automute,
16358 [ALC662_ASUS_EEEPC_P701] = {
16359 .mixers = { alc662_eeepc_p701_mixer },
16360 .init_verbs = { alc662_init_verbs,
16361 alc662_eeepc_sue_init_verbs },
16362 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16363 .dac_nids = alc662_dac_nids,
16364 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16365 .channel_mode = alc662_3ST_2ch_modes,
16366 .input_mux = &alc662_eeepc_capture_source,
16367 .unsol_event = alc662_eeepc_unsol_event,
16368 .init_hook = alc662_eeepc_inithook,
16370 [ALC662_ASUS_EEEPC_EP20] = {
16371 .mixers = { alc662_eeepc_ep20_mixer,
16372 alc662_chmode_mixer },
16373 .init_verbs = { alc662_init_verbs,
16374 alc662_eeepc_ep20_sue_init_verbs },
16375 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16376 .dac_nids = alc662_dac_nids,
16377 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16378 .channel_mode = alc662_3ST_6ch_modes,
16379 .input_mux = &alc662_lenovo_101e_capture_source,
16380 .unsol_event = alc662_eeepc_ep20_unsol_event,
16381 .init_hook = alc662_eeepc_ep20_inithook,
16384 .mixers = { alc662_ecs_mixer },
16385 .init_verbs = { alc662_init_verbs,
16386 alc662_ecs_init_verbs },
16387 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16388 .dac_nids = alc662_dac_nids,
16389 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16390 .channel_mode = alc662_3ST_2ch_modes,
16391 .input_mux = &alc662_eeepc_capture_source,
16392 .unsol_event = alc662_eeepc_unsol_event,
16393 .init_hook = alc662_eeepc_inithook,
16395 [ALC663_ASUS_M51VA] = {
16396 .mixers = { alc663_m51va_mixer },
16397 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16398 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16399 .dac_nids = alc662_dac_nids,
16400 .dig_out_nid = ALC662_DIGOUT_NID,
16401 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16402 .channel_mode = alc662_3ST_2ch_modes,
16403 .input_mux = &alc663_m51va_capture_source,
16404 .unsol_event = alc663_m51va_unsol_event,
16405 .init_hook = alc663_m51va_inithook,
16407 [ALC663_ASUS_G71V] = {
16408 .mixers = { alc663_g71v_mixer },
16409 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16410 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16411 .dac_nids = alc662_dac_nids,
16412 .dig_out_nid = ALC662_DIGOUT_NID,
16413 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16414 .channel_mode = alc662_3ST_2ch_modes,
16415 .input_mux = &alc662_eeepc_capture_source,
16416 .unsol_event = alc663_g71v_unsol_event,
16417 .init_hook = alc663_g71v_inithook,
16419 [ALC663_ASUS_H13] = {
16420 .mixers = { alc663_m51va_mixer },
16421 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16422 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16423 .dac_nids = alc662_dac_nids,
16424 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16425 .channel_mode = alc662_3ST_2ch_modes,
16426 .input_mux = &alc663_m51va_capture_source,
16427 .unsol_event = alc663_m51va_unsol_event,
16428 .init_hook = alc663_m51va_inithook,
16430 [ALC663_ASUS_G50V] = {
16431 .mixers = { alc663_g50v_mixer },
16432 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16433 .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_6ch_modes),
16437 .channel_mode = alc662_3ST_6ch_modes,
16438 .input_mux = &alc663_capture_source,
16439 .unsol_event = alc663_g50v_unsol_event,
16440 .init_hook = alc663_g50v_inithook,
16442 [ALC663_ASUS_MODE1] = {
16443 .mixers = { alc663_m51va_mixer },
16444 .cap_mixer = alc662_auto_capture_mixer,
16445 .init_verbs = { alc662_init_verbs,
16446 alc663_21jd_amic_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_mode1_unsol_event,
16455 .init_hook = alc663_mode1_inithook,
16457 [ALC662_ASUS_MODE2] = {
16458 .mixers = { alc662_1bjd_mixer },
16459 .cap_mixer = alc662_auto_capture_mixer,
16460 .init_verbs = { alc662_init_verbs,
16461 alc662_1bjd_amic_init_verbs },
16462 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16463 .dac_nids = alc662_dac_nids,
16464 .dig_out_nid = ALC662_DIGOUT_NID,
16465 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16466 .channel_mode = alc662_3ST_2ch_modes,
16467 .input_mux = &alc662_eeepc_capture_source,
16468 .unsol_event = alc662_mode2_unsol_event,
16469 .init_hook = alc662_mode2_inithook,
16471 [ALC663_ASUS_MODE3] = {
16472 .mixers = { alc663_two_hp_m1_mixer },
16473 .cap_mixer = alc662_auto_capture_mixer,
16474 .init_verbs = { alc662_init_verbs,
16475 alc663_two_hp_amic_m1_init_verbs },
16476 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16478 .dac_nids = alc662_dac_nids,
16479 .dig_out_nid = ALC662_DIGOUT_NID,
16480 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16481 .channel_mode = alc662_3ST_2ch_modes,
16482 .input_mux = &alc662_eeepc_capture_source,
16483 .unsol_event = alc663_mode3_unsol_event,
16484 .init_hook = alc663_mode3_inithook,
16486 [ALC663_ASUS_MODE4] = {
16487 .mixers = { alc663_asus_21jd_clfe_mixer },
16488 .cap_mixer = alc662_auto_capture_mixer,
16489 .init_verbs = { alc662_init_verbs,
16490 alc663_21jd_amic_init_verbs},
16491 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16493 .dac_nids = alc662_dac_nids,
16494 .dig_out_nid = ALC662_DIGOUT_NID,
16495 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16496 .channel_mode = alc662_3ST_2ch_modes,
16497 .input_mux = &alc662_eeepc_capture_source,
16498 .unsol_event = alc663_mode4_unsol_event,
16499 .init_hook = alc663_mode4_inithook,
16501 [ALC663_ASUS_MODE5] = {
16502 .mixers = { alc663_asus_15jd_clfe_mixer },
16503 .cap_mixer = alc662_auto_capture_mixer,
16504 .init_verbs = { alc662_init_verbs,
16505 alc663_15jd_amic_init_verbs },
16506 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16508 .dac_nids = alc662_dac_nids,
16509 .dig_out_nid = ALC662_DIGOUT_NID,
16510 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16511 .channel_mode = alc662_3ST_2ch_modes,
16512 .input_mux = &alc662_eeepc_capture_source,
16513 .unsol_event = alc663_mode5_unsol_event,
16514 .init_hook = alc663_mode5_inithook,
16516 [ALC663_ASUS_MODE6] = {
16517 .mixers = { alc663_two_hp_m2_mixer },
16518 .cap_mixer = alc662_auto_capture_mixer,
16519 .init_verbs = { alc662_init_verbs,
16520 alc663_two_hp_amic_m2_init_verbs },
16521 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16523 .dac_nids = alc662_dac_nids,
16524 .dig_out_nid = ALC662_DIGOUT_NID,
16525 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16526 .channel_mode = alc662_3ST_2ch_modes,
16527 .input_mux = &alc662_eeepc_capture_source,
16528 .unsol_event = alc663_mode6_unsol_event,
16529 .init_hook = alc663_mode6_inithook,
16535 * BIOS auto configuration
16538 /* add playback controls from the parsed DAC table */
16539 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16540 const struct auto_pin_cfg *cfg)
16543 static const char *chname[4] = {
16544 "Front", "Surround", NULL /*CLFE*/, "Side"
16549 for (i = 0; i < cfg->line_outs; i++) {
16550 if (!spec->multiout.dac_nids[i])
16552 nid = alc880_idx_to_dac(i);
16555 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16556 "Center Playback Volume",
16557 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16561 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16562 "LFE Playback Volume",
16563 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16567 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16568 "Center Playback Switch",
16569 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16573 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16574 "LFE Playback Switch",
16575 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16580 sprintf(name, "%s Playback Volume", chname[i]);
16581 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16582 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16586 sprintf(name, "%s Playback Switch", chname[i]);
16587 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16588 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16597 /* add playback controls for speaker and HP outputs */
16598 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16609 /* ALC663 has a mono output pin on 0x17 */
16610 sprintf(name, "%s Playback Switch", pfx);
16611 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16612 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16616 if (alc880_is_fixed_pin(pin)) {
16617 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16618 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16619 /* specify the DAC as the extra output */
16620 if (!spec->multiout.hp_nid)
16621 spec->multiout.hp_nid = nid;
16623 spec->multiout.extra_out_nid[0] = nid;
16624 /* control HP volume/switch on the output mixer amp */
16625 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16626 sprintf(name, "%s Playback Volume", pfx);
16627 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16628 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16631 sprintf(name, "%s Playback Switch", pfx);
16632 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16633 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16636 } else if (alc880_is_multi_pin(pin)) {
16637 /* set manual connection */
16638 /* we have only a switch on HP-out PIN */
16639 sprintf(name, "%s Playback Switch", pfx);
16640 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16641 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16648 /* create playback/capture controls for input pins */
16649 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16650 const struct auto_pin_cfg *cfg)
16652 struct hda_input_mux *imux = &spec->private_imux[0];
16655 for (i = 0; i < AUTO_PIN_LAST; i++) {
16656 if (alc880_is_input_pin(cfg->input_pins[i])) {
16657 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16658 err = new_analog_input(spec, cfg->input_pins[i],
16659 auto_pin_cfg_labels[i],
16663 imux->items[imux->num_items].label =
16664 auto_pin_cfg_labels[i];
16665 imux->items[imux->num_items].index =
16666 alc880_input_pin_idx(cfg->input_pins[i]);
16673 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16674 hda_nid_t nid, int pin_type,
16677 alc_set_pin_output(codec, nid, pin_type);
16678 /* need the manual connection? */
16679 if (alc880_is_multi_pin(nid)) {
16680 struct alc_spec *spec = codec->spec;
16681 int idx = alc880_multi_pin_idx(nid);
16682 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16683 AC_VERB_SET_CONNECT_SEL,
16684 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16688 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16690 struct alc_spec *spec = codec->spec;
16693 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16694 for (i = 0; i <= HDA_SIDE; i++) {
16695 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16696 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16698 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16703 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16705 struct alc_spec *spec = codec->spec;
16708 pin = spec->autocfg.hp_pins[0];
16709 if (pin) /* connect to front */
16711 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16712 pin = spec->autocfg.speaker_pins[0];
16714 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16717 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16718 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16720 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16722 struct alc_spec *spec = codec->spec;
16725 for (i = 0; i < AUTO_PIN_LAST; i++) {
16726 hda_nid_t nid = spec->autocfg.input_pins[i];
16727 if (alc662_is_input_pin(nid)) {
16728 alc_set_input_pin(codec, nid, i);
16729 if (nid != ALC662_PIN_CD_NID)
16730 snd_hda_codec_write(codec, nid, 0,
16731 AC_VERB_SET_AMP_GAIN_MUTE,
16737 #define alc662_auto_init_input_src alc882_auto_init_input_src
16739 static int alc662_parse_auto_config(struct hda_codec *codec)
16741 struct alc_spec *spec = codec->spec;
16743 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16745 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16749 if (!spec->autocfg.line_outs)
16750 return 0; /* can't find valid BIOS pin config */
16752 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16755 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16758 err = alc662_auto_create_extra_out(spec,
16759 spec->autocfg.speaker_pins[0],
16763 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16767 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16771 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16773 if (spec->autocfg.dig_outs)
16774 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16776 if (spec->kctls.list)
16777 add_mixer(spec, spec->kctls.list);
16779 spec->num_mux_defs = 1;
16780 spec->input_mux = &spec->private_imux[0];
16782 add_verb(spec, alc662_auto_init_verbs);
16783 if (codec->vendor_id == 0x10ec0663)
16784 add_verb(spec, alc663_auto_init_verbs);
16786 err = alc_auto_add_mic_boost(codec);
16793 /* additional initialization for auto-configuration model */
16794 static void alc662_auto_init(struct hda_codec *codec)
16796 struct alc_spec *spec = codec->spec;
16797 alc662_auto_init_multi_out(codec);
16798 alc662_auto_init_hp_out(codec);
16799 alc662_auto_init_analog_input(codec);
16800 alc662_auto_init_input_src(codec);
16801 if (spec->unsol_event)
16802 alc_inithook(codec);
16805 static int patch_alc662(struct hda_codec *codec)
16807 struct alc_spec *spec;
16808 int err, board_config;
16810 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16814 codec->spec = spec;
16816 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16818 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16821 if (board_config < 0) {
16822 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16823 "trying auto-probe from BIOS...\n");
16824 board_config = ALC662_AUTO;
16827 if (board_config == ALC662_AUTO) {
16828 /* automatic parse from the BIOS config */
16829 err = alc662_parse_auto_config(codec);
16835 "hda_codec: Cannot set up configuration "
16836 "from BIOS. Using base mode...\n");
16837 board_config = ALC662_3ST_2ch_DIG;
16841 err = snd_hda_attach_beep_device(codec, 0x1);
16847 if (board_config != ALC662_AUTO)
16848 setup_preset(spec, &alc662_presets[board_config]);
16850 if (codec->vendor_id == 0x10ec0663) {
16851 spec->stream_name_analog = "ALC663 Analog";
16852 spec->stream_name_digital = "ALC663 Digital";
16853 } else if (codec->vendor_id == 0x10ec0272) {
16854 spec->stream_name_analog = "ALC272 Analog";
16855 spec->stream_name_digital = "ALC272 Digital";
16857 spec->stream_name_analog = "ALC662 Analog";
16858 spec->stream_name_digital = "ALC662 Digital";
16861 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16862 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16864 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16865 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16867 spec->adc_nids = alc662_adc_nids;
16868 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16869 spec->capsrc_nids = alc662_capsrc_nids;
16870 spec->capture_style = CAPT_MIX;
16872 if (!spec->cap_mixer)
16873 set_capture_mixer(spec);
16874 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16876 spec->vmaster_nid = 0x02;
16878 codec->patch_ops = alc_patch_ops;
16879 if (board_config == ALC662_AUTO)
16880 spec->init_hook = alc662_auto_init;
16881 #ifdef CONFIG_SND_HDA_POWER_SAVE
16882 if (!spec->loopback.amplist)
16883 spec->loopback.amplist = alc662_loopbacks;
16885 codec->proc_widget_hook = print_realtek_coef;
16893 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16894 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16895 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16896 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16897 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16898 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16899 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16900 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16901 .patch = patch_alc861 },
16902 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16903 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16904 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16905 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16906 .patch = patch_alc883 },
16907 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16908 .patch = patch_alc662 },
16909 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16910 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16911 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16912 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16913 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16914 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16915 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16916 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16917 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16918 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16919 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16920 .patch = patch_alc883 },
16921 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16922 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16923 {} /* terminator */
16926 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16928 MODULE_LICENSE("GPL");
16929 MODULE_DESCRIPTION("Realtek HD-audio codec");
16931 static struct hda_codec_preset_list realtek_list = {
16932 .preset = snd_hda_preset_realtek,
16933 .owner = THIS_MODULE,
16936 static int __init patch_realtek_init(void)
16938 return snd_hda_add_codec_preset(&realtek_list);
16941 static void __exit patch_realtek_exit(void)
16943 snd_hda_delete_codec_preset(&realtek_list);
16946 module_init(patch_realtek_init)
16947 module_exit(patch_realtek_exit)