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"
34 #define ALC880_FRONT_EVENT 0x01
35 #define ALC880_DCVOL_EVENT 0x02
36 #define ALC880_HP_EVENT 0x04
37 #define ALC880_MIC_EVENT 0x08
39 /* ALC880 board config type */
63 #ifdef CONFIG_SND_DEBUG
67 ALC880_MODEL_LAST /* last tag */
80 #ifdef CONFIG_SND_DEBUG
84 ALC260_MODEL_LAST /* last tag */
94 ALC262_HP_BPC_D7000_WL,
95 ALC262_HP_BPC_D7000_WF,
107 ALC262_MODEL_LAST /* last tag */
117 ALC268_ACER_ASPIRE_ONE,
120 #ifdef CONFIG_SND_DEBUG
124 ALC268_MODEL_LAST /* last tag */
131 ALC269_ASUS_EEEPC_P703,
132 ALC269_ASUS_EEEPC_P901,
136 ALC269_MODEL_LAST /* last tag */
153 /* ALC861-VD models */
175 ALC662_ASUS_EEEPC_P701,
176 ALC662_ASUS_EEEPC_EP20,
215 ALC883_TARGA_2ch_DIG,
218 ALC888_ACER_ASPIRE_4930G,
222 ALC883_LENOVO_101E_2ch,
223 ALC883_LENOVO_NB0763,
224 ALC888_LENOVO_MS7195_DIG,
231 ALC883_FUJITSU_PI2515,
232 ALC888_FUJITSU_XA3530,
233 ALC883_3ST_6ch_INTEL,
241 /* styles of capture selection */
243 CAPT_MUX = 0, /* only mux based */
244 CAPT_MIX, /* only mixer based */
245 CAPT_1MUX_MIX, /* first mux and other mixers */
249 #define GPIO_MASK 0x03
252 /* codec parameterization */
253 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
254 unsigned int num_mixers;
255 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
257 const struct hda_verb *init_verbs[5]; /* initialization verbs
261 unsigned int num_init_verbs;
263 char *stream_name_analog; /* analog PCM stream */
264 struct hda_pcm_stream *stream_analog_playback;
265 struct hda_pcm_stream *stream_analog_capture;
266 struct hda_pcm_stream *stream_analog_alt_playback;
267 struct hda_pcm_stream *stream_analog_alt_capture;
269 char *stream_name_digital; /* digital PCM stream */
270 struct hda_pcm_stream *stream_digital_playback;
271 struct hda_pcm_stream *stream_digital_capture;
274 struct hda_multi_out multiout; /* playback set-up
275 * max_channels, dacs must be set
276 * dig_out_nid and hp_nid are optional
278 hda_nid_t alt_dac_nid;
282 unsigned int num_adc_nids;
284 hda_nid_t *capsrc_nids;
285 hda_nid_t dig_in_nid; /* digital-in NID; optional */
286 int capture_style; /* capture style (CAPT_*) */
289 unsigned int num_mux_defs;
290 const struct hda_input_mux *input_mux;
291 unsigned int cur_mux[3];
294 const struct hda_channel_mode *channel_mode;
295 int num_channel_mode;
298 /* PCM information */
299 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
301 /* dynamic controls, init_verbs and input_mux */
302 struct auto_pin_cfg autocfg;
303 struct snd_array kctls;
304 struct hda_input_mux private_imux[3];
305 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
308 void (*init_hook)(struct hda_codec *codec);
309 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
311 /* for pin sensing */
312 unsigned int sense_updated: 1;
313 unsigned int jack_present: 1;
314 unsigned int master_sw: 1;
317 unsigned int no_analog :1; /* digital I/O only */
319 /* for virtual master */
320 hda_nid_t vmaster_nid;
321 #ifdef CONFIG_SND_HDA_POWER_SAVE
322 struct hda_loopback_check loopback;
327 unsigned int pll_coef_idx, pll_coef_bit;
329 #ifdef SND_HDA_NEEDS_RESUME
330 #define ALC_MAX_PINS 16
331 unsigned int num_pins;
332 hda_nid_t pin_nids[ALC_MAX_PINS];
333 unsigned int pin_cfgs[ALC_MAX_PINS];
338 * configuration template - to be copied to the spec instance
340 struct alc_config_preset {
341 struct snd_kcontrol_new *mixers[5]; /* should be identical size
344 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
345 const struct hda_verb *init_verbs[5];
346 unsigned int num_dacs;
348 hda_nid_t dig_out_nid; /* optional */
349 hda_nid_t hp_nid; /* optional */
350 unsigned int num_adc_nids;
352 hda_nid_t *capsrc_nids;
353 hda_nid_t dig_in_nid;
354 unsigned int num_channel_mode;
355 const struct hda_channel_mode *channel_mode;
357 unsigned int num_mux_defs;
358 const struct hda_input_mux *input_mux;
359 void (*unsol_event)(struct hda_codec *, unsigned int);
360 void (*init_hook)(struct hda_codec *);
361 #ifdef CONFIG_SND_HDA_POWER_SAVE
362 struct hda_amp_list *loopbacks;
370 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
371 struct snd_ctl_elem_info *uinfo)
373 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
374 struct alc_spec *spec = codec->spec;
375 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
376 if (mux_idx >= spec->num_mux_defs)
378 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
381 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
382 struct snd_ctl_elem_value *ucontrol)
384 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
385 struct alc_spec *spec = codec->spec;
386 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
388 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
392 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
393 struct snd_ctl_elem_value *ucontrol)
395 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
396 struct alc_spec *spec = codec->spec;
397 const struct hda_input_mux *imux;
398 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
399 unsigned int mux_idx;
400 hda_nid_t nid = spec->capsrc_nids ?
401 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
403 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
404 imux = &spec->input_mux[mux_idx];
406 if (spec->capture_style &&
407 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
408 /* Matrix-mixer style (e.g. ALC882) */
409 unsigned int *cur_val = &spec->cur_mux[adc_idx];
412 idx = ucontrol->value.enumerated.item[0];
413 if (idx >= imux->num_items)
414 idx = imux->num_items - 1;
417 for (i = 0; i < imux->num_items; i++) {
418 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
419 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
420 imux->items[i].index,
426 /* MUX style (e.g. ALC880) */
427 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
428 &spec->cur_mux[adc_idx]);
433 * channel mode setting
435 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
436 struct snd_ctl_elem_info *uinfo)
438 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
439 struct alc_spec *spec = codec->spec;
440 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
441 spec->num_channel_mode);
444 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
445 struct snd_ctl_elem_value *ucontrol)
447 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
448 struct alc_spec *spec = codec->spec;
449 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
450 spec->num_channel_mode,
451 spec->multiout.max_channels);
454 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
455 struct snd_ctl_elem_value *ucontrol)
457 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
458 struct alc_spec *spec = codec->spec;
459 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
460 spec->num_channel_mode,
461 &spec->multiout.max_channels);
462 if (err >= 0 && spec->need_dac_fix)
463 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
468 * Control the mode of pin widget settings via the mixer. "pc" is used
469 * instead of "%" to avoid consequences of accidently treating the % as
470 * being part of a format specifier. Maximum allowed length of a value is
471 * 63 characters plus NULL terminator.
473 * Note: some retasking pin complexes seem to ignore requests for input
474 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
475 * are requested. Therefore order this list so that this behaviour will not
476 * cause problems when mixer clients move through the enum sequentially.
477 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
480 static char *alc_pin_mode_names[] = {
481 "Mic 50pc bias", "Mic 80pc bias",
482 "Line in", "Line out", "Headphone out",
484 static unsigned char alc_pin_mode_values[] = {
485 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
487 /* The control can present all 5 options, or it can limit the options based
488 * in the pin being assumed to be exclusively an input or an output pin. In
489 * addition, "input" pins may or may not process the mic bias option
490 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
491 * accept requests for bias as of chip versions up to March 2006) and/or
492 * wiring in the computer.
494 #define ALC_PIN_DIR_IN 0x00
495 #define ALC_PIN_DIR_OUT 0x01
496 #define ALC_PIN_DIR_INOUT 0x02
497 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
498 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
500 /* Info about the pin modes supported by the different pin direction modes.
501 * For each direction the minimum and maximum values are given.
503 static signed char alc_pin_mode_dir_info[5][2] = {
504 { 0, 2 }, /* ALC_PIN_DIR_IN */
505 { 3, 4 }, /* ALC_PIN_DIR_OUT */
506 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
507 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
508 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
510 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
511 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
512 #define alc_pin_mode_n_items(_dir) \
513 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
515 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
516 struct snd_ctl_elem_info *uinfo)
518 unsigned int item_num = uinfo->value.enumerated.item;
519 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
521 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
523 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
525 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
526 item_num = alc_pin_mode_min(dir);
527 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
531 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
532 struct snd_ctl_elem_value *ucontrol)
535 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
536 hda_nid_t nid = kcontrol->private_value & 0xffff;
537 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
538 long *valp = ucontrol->value.integer.value;
539 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
540 AC_VERB_GET_PIN_WIDGET_CONTROL,
543 /* Find enumerated value for current pinctl setting */
544 i = alc_pin_mode_min(dir);
545 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
547 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
551 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_value *ucontrol)
555 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
556 hda_nid_t nid = kcontrol->private_value & 0xffff;
557 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
558 long val = *ucontrol->value.integer.value;
559 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
560 AC_VERB_GET_PIN_WIDGET_CONTROL,
563 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
564 val = alc_pin_mode_min(dir);
566 change = pinctl != alc_pin_mode_values[val];
568 /* Set pin mode to that requested */
569 snd_hda_codec_write_cache(codec, nid, 0,
570 AC_VERB_SET_PIN_WIDGET_CONTROL,
571 alc_pin_mode_values[val]);
573 /* Also enable the retasking pin's input/output as required
574 * for the requested pin mode. Enum values of 2 or less are
577 * Dynamically switching the input/output buffers probably
578 * reduces noise slightly (particularly on input) so we'll
579 * do it. However, having both input and output buffers
580 * enabled simultaneously doesn't seem to be problematic if
581 * this turns out to be necessary in the future.
584 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
585 HDA_AMP_MUTE, HDA_AMP_MUTE);
586 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
589 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
590 HDA_AMP_MUTE, HDA_AMP_MUTE);
591 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
598 #define ALC_PIN_MODE(xname, nid, dir) \
599 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
600 .info = alc_pin_mode_info, \
601 .get = alc_pin_mode_get, \
602 .put = alc_pin_mode_put, \
603 .private_value = nid | (dir<<16) }
605 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
606 * together using a mask with more than one bit set. This control is
607 * currently used only by the ALC260 test model. At this stage they are not
608 * needed for any "production" models.
610 #ifdef CONFIG_SND_DEBUG
611 #define alc_gpio_data_info snd_ctl_boolean_mono_info
613 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
614 struct snd_ctl_elem_value *ucontrol)
616 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
617 hda_nid_t nid = kcontrol->private_value & 0xffff;
618 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
619 long *valp = ucontrol->value.integer.value;
620 unsigned int val = snd_hda_codec_read(codec, nid, 0,
621 AC_VERB_GET_GPIO_DATA, 0x00);
623 *valp = (val & mask) != 0;
626 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
627 struct snd_ctl_elem_value *ucontrol)
630 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
631 hda_nid_t nid = kcontrol->private_value & 0xffff;
632 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
633 long val = *ucontrol->value.integer.value;
634 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
635 AC_VERB_GET_GPIO_DATA,
638 /* Set/unset the masked GPIO bit(s) as needed */
639 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
644 snd_hda_codec_write_cache(codec, nid, 0,
645 AC_VERB_SET_GPIO_DATA, gpio_data);
649 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
650 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
651 .info = alc_gpio_data_info, \
652 .get = alc_gpio_data_get, \
653 .put = alc_gpio_data_put, \
654 .private_value = nid | (mask<<16) }
655 #endif /* CONFIG_SND_DEBUG */
657 /* A switch control to allow the enabling of the digital IO pins on the
658 * ALC260. This is incredibly simplistic; the intention of this control is
659 * to provide something in the test model allowing digital outputs to be
660 * identified if present. If models are found which can utilise these
661 * outputs a more complete mixer control can be devised for those models if
664 #ifdef CONFIG_SND_DEBUG
665 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
667 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
668 struct snd_ctl_elem_value *ucontrol)
670 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
671 hda_nid_t nid = kcontrol->private_value & 0xffff;
672 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
673 long *valp = ucontrol->value.integer.value;
674 unsigned int val = snd_hda_codec_read(codec, nid, 0,
675 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
677 *valp = (val & mask) != 0;
680 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
681 struct snd_ctl_elem_value *ucontrol)
684 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
685 hda_nid_t nid = kcontrol->private_value & 0xffff;
686 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
687 long val = *ucontrol->value.integer.value;
688 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
689 AC_VERB_GET_DIGI_CONVERT_1,
692 /* Set/unset the masked control bit(s) as needed */
693 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
698 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
703 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
704 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
705 .info = alc_spdif_ctrl_info, \
706 .get = alc_spdif_ctrl_get, \
707 .put = alc_spdif_ctrl_put, \
708 .private_value = nid | (mask<<16) }
709 #endif /* CONFIG_SND_DEBUG */
711 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
712 * Again, this is only used in the ALC26x test models to help identify when
713 * the EAPD line must be asserted for features to work.
715 #ifdef CONFIG_SND_DEBUG
716 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
718 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
719 struct snd_ctl_elem_value *ucontrol)
721 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
722 hda_nid_t nid = kcontrol->private_value & 0xffff;
723 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
724 long *valp = ucontrol->value.integer.value;
725 unsigned int val = snd_hda_codec_read(codec, nid, 0,
726 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
728 *valp = (val & mask) != 0;
732 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
733 struct snd_ctl_elem_value *ucontrol)
736 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
737 hda_nid_t nid = kcontrol->private_value & 0xffff;
738 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
739 long val = *ucontrol->value.integer.value;
740 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
741 AC_VERB_GET_EAPD_BTLENABLE,
744 /* Set/unset the masked control bit(s) as needed */
745 change = (!val ? 0 : mask) != (ctrl_data & mask);
750 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
756 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
757 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
758 .info = alc_eapd_ctrl_info, \
759 .get = alc_eapd_ctrl_get, \
760 .put = alc_eapd_ctrl_put, \
761 .private_value = nid | (mask<<16) }
762 #endif /* CONFIG_SND_DEBUG */
766 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
768 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
770 spec->mixers[spec->num_mixers++] = mix;
773 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
775 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
777 spec->init_verbs[spec->num_init_verbs++] = verb;
780 #ifdef CONFIG_PROC_FS
784 static void print_realtek_coef(struct snd_info_buffer *buffer,
785 struct hda_codec *codec, hda_nid_t nid)
791 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
792 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
793 coeff = snd_hda_codec_read(codec, nid, 0,
794 AC_VERB_GET_COEF_INDEX, 0);
795 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
798 #define print_realtek_coef NULL
802 * set up from the preset table
804 static void setup_preset(struct alc_spec *spec,
805 const struct alc_config_preset *preset)
809 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
810 add_mixer(spec, preset->mixers[i]);
811 spec->cap_mixer = preset->cap_mixer;
812 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
814 add_verb(spec, preset->init_verbs[i]);
816 spec->channel_mode = preset->channel_mode;
817 spec->num_channel_mode = preset->num_channel_mode;
818 spec->need_dac_fix = preset->need_dac_fix;
820 spec->multiout.max_channels = spec->channel_mode[0].channels;
822 spec->multiout.num_dacs = preset->num_dacs;
823 spec->multiout.dac_nids = preset->dac_nids;
824 spec->multiout.dig_out_nid = preset->dig_out_nid;
825 spec->multiout.hp_nid = preset->hp_nid;
827 spec->num_mux_defs = preset->num_mux_defs;
828 if (!spec->num_mux_defs)
829 spec->num_mux_defs = 1;
830 spec->input_mux = preset->input_mux;
832 spec->num_adc_nids = preset->num_adc_nids;
833 spec->adc_nids = preset->adc_nids;
834 spec->capsrc_nids = preset->capsrc_nids;
835 spec->dig_in_nid = preset->dig_in_nid;
837 spec->unsol_event = preset->unsol_event;
838 spec->init_hook = preset->init_hook;
839 #ifdef CONFIG_SND_HDA_POWER_SAVE
840 spec->loopback.amplist = preset->loopbacks;
844 /* Enable GPIO mask and set output */
845 static struct hda_verb alc_gpio1_init_verbs[] = {
846 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
847 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
848 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
852 static struct hda_verb alc_gpio2_init_verbs[] = {
853 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
854 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
855 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
859 static struct hda_verb alc_gpio3_init_verbs[] = {
860 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
861 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
862 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
867 * Fix hardware PLL issue
868 * On some codecs, the analog PLL gating control must be off while
869 * the default value is 1.
871 static void alc_fix_pll(struct hda_codec *codec)
873 struct alc_spec *spec = codec->spec;
878 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
880 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
881 AC_VERB_GET_PROC_COEF, 0);
882 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
884 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
885 val & ~(1 << spec->pll_coef_bit));
888 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
889 unsigned int coef_idx, unsigned int coef_bit)
891 struct alc_spec *spec = codec->spec;
893 spec->pll_coef_idx = coef_idx;
894 spec->pll_coef_bit = coef_bit;
898 static void alc_sku_automute(struct hda_codec *codec)
900 struct alc_spec *spec = codec->spec;
901 unsigned int present;
902 unsigned int hp_nid = spec->autocfg.hp_pins[0];
903 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
905 /* need to execute and sync at first */
906 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
907 present = snd_hda_codec_read(codec, hp_nid, 0,
908 AC_VERB_GET_PIN_SENSE, 0);
909 spec->jack_present = (present & 0x80000000) != 0;
910 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
911 spec->jack_present ? 0 : PIN_OUT);
914 #if 0 /* it's broken in some acses -- temporarily disabled */
915 static void alc_mic_automute(struct hda_codec *codec)
917 struct alc_spec *spec = codec->spec;
918 unsigned int present;
919 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
920 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
921 unsigned int mix_nid = spec->capsrc_nids[0];
922 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
924 capsrc_idx_mic = mic_nid - 0x18;
925 capsrc_idx_fmic = fmic_nid - 0x18;
926 present = snd_hda_codec_read(codec, mic_nid, 0,
927 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
928 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
929 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
930 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
931 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
932 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
933 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
936 #define alc_mic_automute(codec) /* NOP */
937 #endif /* disabled */
939 /* unsolicited event for HP jack sensing */
940 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
942 if (codec->vendor_id == 0x10ec0880)
946 if (res == ALC880_HP_EVENT)
947 alc_sku_automute(codec);
949 if (res == ALC880_MIC_EVENT)
950 alc_mic_automute(codec);
953 static void alc_inithook(struct hda_codec *codec)
955 alc_sku_automute(codec);
956 alc_mic_automute(codec);
959 /* additional initialization for ALC888 variants */
960 static void alc888_coef_init(struct hda_codec *codec)
964 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
965 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
966 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
967 if ((tmp & 0xf0) == 2)
969 snd_hda_codec_read(codec, 0x20, 0,
970 AC_VERB_SET_PROC_COEF, 0x830);
973 snd_hda_codec_read(codec, 0x20, 0,
974 AC_VERB_SET_PROC_COEF, 0x3030);
977 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
978 * 31 ~ 16 : Manufacture ID
980 * 7 ~ 0 : Assembly ID
981 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
983 static void alc_subsystem_id(struct hda_codec *codec,
984 unsigned int porta, unsigned int porte,
987 unsigned int ass, tmp, i;
989 struct alc_spec *spec = codec->spec;
991 ass = codec->subsystem_id & 0xffff;
992 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
996 * 31~30 : port conetcivity
999 * 19~16 : Check sum (15:1)
1004 if (codec->vendor_id == 0x10ec0260)
1006 ass = snd_hda_codec_read(codec, nid, 0,
1007 AC_VERB_GET_CONFIG_DEFAULT, 0);
1008 if (!(ass & 1) && !(ass & 0x100000))
1010 if ((ass >> 30) != 1) /* no physical connection */
1015 for (i = 1; i < 16; i++) {
1019 if (((ass >> 16) & 0xf) != tmp)
1025 * 2 : 0 --> Desktop, 1 --> Laptop
1026 * 3~5 : External Amplifier control
1029 tmp = (ass & 0x38) >> 3; /* external Amp control */
1032 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1035 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1038 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1040 case 5: /* set EAPD output high */
1041 switch (codec->vendor_id) {
1043 snd_hda_codec_write(codec, 0x0f, 0,
1044 AC_VERB_SET_EAPD_BTLENABLE, 2);
1045 snd_hda_codec_write(codec, 0x10, 0,
1046 AC_VERB_SET_EAPD_BTLENABLE, 2);
1057 snd_hda_codec_write(codec, 0x14, 0,
1058 AC_VERB_SET_EAPD_BTLENABLE, 2);
1059 snd_hda_codec_write(codec, 0x15, 0,
1060 AC_VERB_SET_EAPD_BTLENABLE, 2);
1063 switch (codec->vendor_id) {
1065 snd_hda_codec_write(codec, 0x1a, 0,
1066 AC_VERB_SET_COEF_INDEX, 7);
1067 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1068 AC_VERB_GET_PROC_COEF, 0);
1069 snd_hda_codec_write(codec, 0x1a, 0,
1070 AC_VERB_SET_COEF_INDEX, 7);
1071 snd_hda_codec_write(codec, 0x1a, 0,
1072 AC_VERB_SET_PROC_COEF,
1081 snd_hda_codec_write(codec, 0x20, 0,
1082 AC_VERB_SET_COEF_INDEX, 7);
1083 tmp = snd_hda_codec_read(codec, 0x20, 0,
1084 AC_VERB_GET_PROC_COEF, 0);
1085 snd_hda_codec_write(codec, 0x20, 0,
1086 AC_VERB_SET_COEF_INDEX, 7);
1087 snd_hda_codec_write(codec, 0x20, 0,
1088 AC_VERB_SET_PROC_COEF,
1092 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1096 snd_hda_codec_write(codec, 0x20, 0,
1097 AC_VERB_SET_COEF_INDEX, 7);
1098 tmp = snd_hda_codec_read(codec, 0x20, 0,
1099 AC_VERB_GET_PROC_COEF, 0);
1100 snd_hda_codec_write(codec, 0x20, 0,
1101 AC_VERB_SET_COEF_INDEX, 7);
1102 snd_hda_codec_write(codec, 0x20, 0,
1103 AC_VERB_SET_PROC_COEF,
1111 /* is laptop or Desktop and enable the function "Mute internal speaker
1112 * when the external headphone out jack is plugged"
1114 if (!(ass & 0x8000))
1117 * 10~8 : Jack location
1118 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1120 * 15 : 1 --> enable the function "Mute internal speaker
1121 * when the external headphone out jack is plugged"
1123 if (!spec->autocfg.speaker_pins[0]) {
1124 if (spec->autocfg.line_out_pins[0])
1125 spec->autocfg.speaker_pins[0] =
1126 spec->autocfg.line_out_pins[0];
1131 if (!spec->autocfg.hp_pins[0]) {
1132 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1134 spec->autocfg.hp_pins[0] = porta;
1136 spec->autocfg.hp_pins[0] = porte;
1138 spec->autocfg.hp_pins[0] = portd;
1142 if (spec->autocfg.hp_pins[0])
1143 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1144 AC_VERB_SET_UNSOLICITED_ENABLE,
1145 AC_USRSP_EN | ALC880_HP_EVENT);
1147 #if 0 /* it's broken in some acses -- temporarily disabled */
1148 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1149 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1150 snd_hda_codec_write(codec,
1151 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1152 AC_VERB_SET_UNSOLICITED_ENABLE,
1153 AC_USRSP_EN | ALC880_MIC_EVENT);
1154 #endif /* disabled */
1156 spec->unsol_event = alc_sku_unsol_event;
1160 * Fix-up pin default configurations
1168 static void alc_fix_pincfg(struct hda_codec *codec,
1169 const struct snd_pci_quirk *quirk,
1170 const struct alc_pincfg **pinfix)
1172 const struct alc_pincfg *cfg;
1174 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1178 cfg = pinfix[quirk->value];
1179 for (; cfg->nid; cfg++) {
1182 for (i = 0; i < 4; i++) {
1183 snd_hda_codec_write(codec, cfg->nid, 0,
1184 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1198 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1199 /* Mic-in jack as mic in */
1200 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1201 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1202 /* Line-in jack as Line in */
1203 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1204 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1205 /* Line-Out as Front */
1206 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1213 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1214 /* Mic-in jack as mic in */
1215 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1216 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1217 /* Line-in jack as Surround */
1218 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1219 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1220 /* Line-Out as Front */
1221 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1228 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1229 /* Mic-in jack as CLFE */
1230 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1231 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1232 /* Line-in jack as Surround */
1233 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1234 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1235 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1236 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1243 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1244 /* Mic-in jack as CLFE */
1245 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1246 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1247 /* Line-in jack as Surround */
1248 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1249 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1250 /* Line-Out as Side */
1251 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1255 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1256 { 2, alc888_4ST_ch2_intel_init },
1257 { 4, alc888_4ST_ch4_intel_init },
1258 { 6, alc888_4ST_ch6_intel_init },
1259 { 8, alc888_4ST_ch8_intel_init },
1263 * ALC888 Fujitsu Siemens Amillo xa3530
1266 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1267 /* Front Mic: set to PIN_IN (empty by default) */
1268 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1269 /* Connect Internal HP to Front */
1270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1272 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1273 /* Connect Bass HP to Front */
1274 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1275 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1276 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1277 /* Connect Line-Out side jack (SPDIF) to Side */
1278 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1279 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1280 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1281 /* Connect Mic jack to CLFE */
1282 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1283 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1284 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1285 /* Connect Line-in jack to Surround */
1286 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1287 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1288 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1289 /* Connect HP out jack to Front */
1290 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1291 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1292 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1293 /* Enable unsolicited event for HP jack and Line-out jack */
1294 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1295 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1299 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1301 unsigned int present;
1303 /* Line out presence */
1304 present = snd_hda_codec_read(codec, 0x17, 0,
1305 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1306 /* HP out presence */
1307 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1308 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1309 bits = present ? HDA_AMP_MUTE : 0;
1310 /* Toggle internal speakers muting */
1311 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1312 HDA_AMP_MUTE, bits);
1313 /* Toggle internal bass muting */
1314 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1315 HDA_AMP_MUTE, bits);
1318 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1321 if (res >> 26 == ALC880_HP_EVENT)
1322 alc888_fujitsu_xa3530_automute(codec);
1327 * ALC888 Acer Aspire 4930G model
1330 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1331 /* Front Mic: set to PIN_IN (empty by default) */
1332 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1333 /* Unselect Front Mic by default in input mixer 3 */
1334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1335 /* Enable unsolicited event for HP jack */
1336 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1337 /* Connect Internal HP to front */
1338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1339 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1340 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1341 /* Connect HP out to front */
1342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1348 static struct hda_input_mux alc888_2_capture_sources[2] = {
1349 /* Front mic only available on one ADC */
1356 { "Front Mic", 0xb },
1369 static struct snd_kcontrol_new alc888_base_mixer[] = {
1370 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1371 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1372 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1373 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1374 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1376 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1377 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1378 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1379 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1380 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1381 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1382 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1383 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1384 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1386 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1388 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1389 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1393 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1395 unsigned int present;
1397 present = snd_hda_codec_read(codec, 0x15, 0,
1398 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1399 bits = present ? HDA_AMP_MUTE : 0;
1400 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1401 HDA_AMP_MUTE, bits);
1404 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1407 if (res >> 26 == ALC880_HP_EVENT)
1408 alc888_acer_aspire_4930g_automute(codec);
1412 * ALC880 3-stack model
1414 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1415 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1416 * F-Mic = 0x1b, HP = 0x19
1419 static hda_nid_t alc880_dac_nids[4] = {
1420 /* front, rear, clfe, rear_surr */
1421 0x02, 0x05, 0x04, 0x03
1424 static hda_nid_t alc880_adc_nids[3] = {
1429 /* The datasheet says the node 0x07 is connected from inputs,
1430 * but it shows zero connection in the real implementation on some devices.
1431 * Note: this is a 915GAV bug, fixed on 915GLV
1433 static hda_nid_t alc880_adc_nids_alt[2] = {
1438 #define ALC880_DIGOUT_NID 0x06
1439 #define ALC880_DIGIN_NID 0x0a
1441 static struct hda_input_mux alc880_capture_source = {
1445 { "Front Mic", 0x3 },
1451 /* channel source setting (2/6 channel selection for 3-stack) */
1453 static struct hda_verb alc880_threestack_ch2_init[] = {
1454 /* set line-in to input, mute it */
1455 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1456 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1457 /* set mic-in to input vref 80%, mute it */
1458 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1459 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1464 static struct hda_verb alc880_threestack_ch6_init[] = {
1465 /* set line-in to output, unmute it */
1466 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1467 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1468 /* set mic-in to output, unmute it */
1469 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1470 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1474 static struct hda_channel_mode alc880_threestack_modes[2] = {
1475 { 2, alc880_threestack_ch2_init },
1476 { 6, alc880_threestack_ch6_init },
1479 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1480 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1481 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1482 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1483 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1484 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1485 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1486 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1487 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1488 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1489 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1490 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1491 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1492 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1494 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1495 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1496 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1497 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1500 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1501 .name = "Channel Mode",
1502 .info = alc_ch_mode_info,
1503 .get = alc_ch_mode_get,
1504 .put = alc_ch_mode_put,
1509 /* capture mixer elements */
1510 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1511 struct snd_ctl_elem_info *uinfo)
1513 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1514 struct alc_spec *spec = codec->spec;
1517 mutex_lock(&codec->control_mutex);
1518 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1520 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1521 mutex_unlock(&codec->control_mutex);
1525 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1526 unsigned int size, unsigned int __user *tlv)
1528 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1529 struct alc_spec *spec = codec->spec;
1532 mutex_lock(&codec->control_mutex);
1533 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1535 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1536 mutex_unlock(&codec->control_mutex);
1540 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1541 struct snd_ctl_elem_value *ucontrol);
1543 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1544 struct snd_ctl_elem_value *ucontrol,
1547 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1548 struct alc_spec *spec = codec->spec;
1549 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1552 mutex_lock(&codec->control_mutex);
1553 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1555 err = func(kcontrol, ucontrol);
1556 mutex_unlock(&codec->control_mutex);
1560 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1561 struct snd_ctl_elem_value *ucontrol)
1563 return alc_cap_getput_caller(kcontrol, ucontrol,
1564 snd_hda_mixer_amp_volume_get);
1567 static int alc_cap_vol_put(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_put);
1574 /* capture mixer elements */
1575 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1577 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1578 struct snd_ctl_elem_value *ucontrol)
1580 return alc_cap_getput_caller(kcontrol, ucontrol,
1581 snd_hda_mixer_amp_switch_get);
1584 static int alc_cap_sw_put(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_put);
1591 #define DEFINE_CAPMIX(num) \
1592 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1594 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1595 .name = "Capture Switch", \
1596 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1598 .info = alc_cap_sw_info, \
1599 .get = alc_cap_sw_get, \
1600 .put = alc_cap_sw_put, \
1603 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1604 .name = "Capture Volume", \
1605 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1606 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1607 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1609 .info = alc_cap_vol_info, \
1610 .get = alc_cap_vol_get, \
1611 .put = alc_cap_vol_put, \
1612 .tlv = { .c = alc_cap_vol_tlv }, \
1615 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1616 /* .name = "Capture Source", */ \
1617 .name = "Input Source", \
1619 .info = alc_mux_enum_info, \
1620 .get = alc_mux_enum_get, \
1621 .put = alc_mux_enum_put, \
1626 /* up to three ADCs */
1633 * ALC880 5-stack model
1635 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1637 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1638 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1641 /* additional mixers to alc880_three_stack_mixer */
1642 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1643 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1644 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1648 /* channel source setting (6/8 channel selection for 5-stack) */
1650 static struct hda_verb alc880_fivestack_ch6_init[] = {
1651 /* set line-in to input, mute it */
1652 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1653 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1658 static struct hda_verb alc880_fivestack_ch8_init[] = {
1659 /* set line-in to output, unmute it */
1660 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1661 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1665 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1666 { 6, alc880_fivestack_ch6_init },
1667 { 8, alc880_fivestack_ch8_init },
1672 * ALC880 6-stack model
1674 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1675 * Side = 0x05 (0x0f)
1676 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1677 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1680 static hda_nid_t alc880_6st_dac_nids[4] = {
1681 /* front, rear, clfe, rear_surr */
1682 0x02, 0x03, 0x04, 0x05
1685 static struct hda_input_mux alc880_6stack_capture_source = {
1689 { "Front Mic", 0x1 },
1695 /* fixed 8-channels */
1696 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1700 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1701 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1702 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1703 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1704 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1705 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1706 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1707 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1708 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1709 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1710 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1711 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1712 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1713 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1714 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1715 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1716 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1717 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1718 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1719 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1720 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1722 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1723 .name = "Channel Mode",
1724 .info = alc_ch_mode_info,
1725 .get = alc_ch_mode_get,
1726 .put = alc_ch_mode_put,
1735 * W810 has rear IO for:
1738 * Center/LFE (DAC 04)
1741 * The system also has a pair of internal speakers, and a headphone jack.
1742 * These are both connected to Line2 on the codec, hence to DAC 02.
1744 * There is a variable resistor to control the speaker or headphone
1745 * volume. This is a hardware-only device without a software API.
1747 * Plugging headphones in will disable the internal speakers. This is
1748 * implemented in hardware, not via the driver using jack sense. In
1749 * a similar fashion, plugging into the rear socket marked "front" will
1750 * disable both the speakers and headphones.
1752 * For input, there's a microphone jack, and an "audio in" jack.
1753 * These may not do anything useful with this driver yet, because I
1754 * haven't setup any initialization verbs for these yet...
1757 static hda_nid_t alc880_w810_dac_nids[3] = {
1758 /* front, rear/surround, clfe */
1762 /* fixed 6 channels */
1763 static struct hda_channel_mode alc880_w810_modes[1] = {
1767 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1768 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1769 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1770 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1771 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1772 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1777 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1785 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1786 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1790 static hda_nid_t alc880_z71v_dac_nids[1] = {
1793 #define ALC880_Z71V_HP_DAC 0x03
1795 /* fixed 2 channels */
1796 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1800 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1801 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1802 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1803 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1804 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1805 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1806 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1814 * ALC880 F1734 model
1816 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1817 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1820 static hda_nid_t alc880_f1734_dac_nids[1] = {
1823 #define ALC880_F1734_HP_DAC 0x02
1825 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1826 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1827 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1828 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1829 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1830 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1831 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1833 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1837 static struct hda_input_mux alc880_f1734_capture_source = {
1849 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1850 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1851 * Mic = 0x18, Line = 0x1a
1854 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1855 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1857 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1858 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1859 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1860 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1861 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1862 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1863 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1864 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1865 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1868 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1869 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1871 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1873 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1874 .name = "Channel Mode",
1875 .info = alc_ch_mode_info,
1876 .get = alc_ch_mode_get,
1877 .put = alc_ch_mode_put,
1883 * ALC880 ASUS W1V model
1885 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1886 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1887 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1890 /* additional mixers to alc880_asus_mixer */
1891 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1892 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1893 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1897 /* additional mixers to alc880_asus_mixer */
1898 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1899 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1900 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1905 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1906 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1907 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1909 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1910 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1913 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1914 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1919 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1920 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1921 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1922 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1923 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1924 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1925 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1926 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1927 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1928 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1929 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1930 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1931 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1932 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1933 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1934 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1935 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1936 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1937 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1939 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1940 .name = "Channel Mode",
1941 .info = alc_ch_mode_info,
1942 .get = alc_ch_mode_get,
1943 .put = alc_ch_mode_put,
1948 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1949 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1950 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1951 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1952 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1953 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1954 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1955 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1956 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1957 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1958 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1962 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1963 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1964 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1965 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1966 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1968 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1973 * virtual master controls
1977 * slave controls for virtual master
1979 static const char *alc_slave_vols[] = {
1980 "Front Playback Volume",
1981 "Surround Playback Volume",
1982 "Center Playback Volume",
1983 "LFE Playback Volume",
1984 "Side Playback Volume",
1985 "Headphone Playback Volume",
1986 "Speaker Playback Volume",
1987 "Mono Playback Volume",
1988 "Line-Out Playback Volume",
1989 "PCM Playback Volume",
1993 static const char *alc_slave_sws[] = {
1994 "Front Playback Switch",
1995 "Surround Playback Switch",
1996 "Center Playback Switch",
1997 "LFE Playback Switch",
1998 "Side Playback Switch",
1999 "Headphone Playback Switch",
2000 "Speaker Playback Switch",
2001 "Mono Playback Switch",
2002 "IEC958 Playback Switch",
2007 * build control elements
2010 static void alc_free_kctls(struct hda_codec *codec);
2012 static int alc_build_controls(struct hda_codec *codec)
2014 struct alc_spec *spec = codec->spec;
2018 for (i = 0; i < spec->num_mixers; i++) {
2019 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2023 if (spec->cap_mixer) {
2024 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2028 if (spec->multiout.dig_out_nid) {
2029 err = snd_hda_create_spdif_out_ctls(codec,
2030 spec->multiout.dig_out_nid);
2033 if (!spec->no_analog) {
2034 err = snd_hda_create_spdif_share_sw(codec,
2038 spec->multiout.share_spdif = 1;
2041 if (spec->dig_in_nid) {
2042 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2047 /* if we have no master control, let's create it */
2048 if (!spec->no_analog &&
2049 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2050 unsigned int vmaster_tlv[4];
2051 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2052 HDA_OUTPUT, vmaster_tlv);
2053 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2054 vmaster_tlv, alc_slave_vols);
2058 if (!spec->no_analog &&
2059 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2060 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2061 NULL, alc_slave_sws);
2066 alc_free_kctls(codec); /* no longer needed */
2072 * initialize the codec volumes, etc
2076 * generic initialization of ADC, input mixers and output mixers
2078 static struct hda_verb alc880_volume_init_verbs[] = {
2080 * Unmute ADC0-2 and set the default input to mic-in
2082 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2084 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2085 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2086 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2087 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2089 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2091 * Note: PASD motherboards uses the Line In 2 as the input for front
2094 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2104 * Set up output mixers (0x0c - 0x0f)
2106 /* set vol=0 to output mixers */
2107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2108 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2109 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2110 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2111 /* set up input amps for analog loopback */
2112 /* Amp Indices: DAC = 0, mixer = 1 */
2113 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2114 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2115 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2116 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2117 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2118 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2119 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2120 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2126 * 3-stack pin configuration:
2127 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2129 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2131 * preset connection lists of input pins
2132 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2134 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2135 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2136 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2139 * Set pin mode and muting
2141 /* set front pin widgets 0x14 for output */
2142 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2143 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2144 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2145 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2146 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2147 /* Mic2 (as headphone out) for HP output */
2148 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2149 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2150 /* Line In pin widget for input */
2151 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2152 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2153 /* Line2 (as front mic) pin widget for input and vref at 80% */
2154 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2155 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2156 /* CD pin widget for input */
2157 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2163 * 5-stack pin configuration:
2164 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2165 * line-in/side = 0x1a, f-mic = 0x1b
2167 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2169 * preset connection lists of input pins
2170 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2172 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2173 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2176 * Set pin mode and muting
2178 /* set pin widgets 0x14-0x17 for output */
2179 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2180 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2181 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2182 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2183 /* unmute pins for output (no gain on this amp) */
2184 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2185 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2186 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2187 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2189 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2190 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2191 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2192 /* Mic2 (as headphone out) for HP output */
2193 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2194 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2195 /* Line In pin widget for input */
2196 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2197 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2198 /* Line2 (as front mic) pin widget for input and vref at 80% */
2199 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2200 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2201 /* CD pin widget for input */
2202 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2208 * W810 pin configuration:
2209 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2211 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2212 /* hphone/speaker input selector: front DAC */
2213 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2215 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2216 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2218 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2219 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2220 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2222 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2223 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2229 * Z71V pin configuration:
2230 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2232 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
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_HP},
2236 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2238 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2240 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2241 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2247 * 6-stack pin configuration:
2248 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2249 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2251 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2252 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2254 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2255 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2258 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2259 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2260 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2263 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2265 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2266 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2269 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2270 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2271 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2277 * Uniwill pin configuration:
2278 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2281 static struct hda_verb alc880_uniwill_init_verbs[] = {
2282 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2284 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2285 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2287 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2288 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2289 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2290 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2291 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2299 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2300 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2301 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2302 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2304 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2305 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2306 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2307 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2309 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2310 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2317 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2319 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2320 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2322 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2323 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2324 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2325 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2326 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2327 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2330 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2332 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2335 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2336 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2337 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2338 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2339 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2340 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2342 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2343 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2348 static struct hda_verb alc880_beep_init_verbs[] = {
2349 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2353 /* toggle speaker-output according to the hp-jack state */
2354 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2356 unsigned int present;
2359 present = snd_hda_codec_read(codec, 0x14, 0,
2360 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2361 bits = present ? HDA_AMP_MUTE : 0;
2362 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2363 HDA_AMP_MUTE, bits);
2364 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2365 HDA_AMP_MUTE, bits);
2368 /* auto-toggle front mic */
2369 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2371 unsigned int present;
2374 present = snd_hda_codec_read(codec, 0x18, 0,
2375 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2376 bits = present ? HDA_AMP_MUTE : 0;
2377 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2380 static void alc880_uniwill_automute(struct hda_codec *codec)
2382 alc880_uniwill_hp_automute(codec);
2383 alc880_uniwill_mic_automute(codec);
2386 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2389 /* Looks like the unsol event is incompatible with the standard
2390 * definition. 4bit tag is placed at 28 bit!
2392 switch (res >> 28) {
2393 case ALC880_HP_EVENT:
2394 alc880_uniwill_hp_automute(codec);
2396 case ALC880_MIC_EVENT:
2397 alc880_uniwill_mic_automute(codec);
2402 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2404 unsigned int present;
2407 present = snd_hda_codec_read(codec, 0x14, 0,
2408 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2409 bits = present ? HDA_AMP_MUTE : 0;
2410 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2413 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2415 unsigned int present;
2417 present = snd_hda_codec_read(codec, 0x21, 0,
2418 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2419 present &= HDA_AMP_VOLMASK;
2420 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2421 HDA_AMP_VOLMASK, present);
2422 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2423 HDA_AMP_VOLMASK, present);
2426 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2429 /* Looks like the unsol event is incompatible with the standard
2430 * definition. 4bit tag is placed at 28 bit!
2432 if ((res >> 28) == ALC880_HP_EVENT)
2433 alc880_uniwill_p53_hp_automute(codec);
2434 if ((res >> 28) == ALC880_DCVOL_EVENT)
2435 alc880_uniwill_p53_dcvol_automute(codec);
2439 * F1734 pin configuration:
2440 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2442 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2443 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2444 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2445 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2446 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2447 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2449 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2450 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2452 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2454 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2455 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2456 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2457 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2458 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2459 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2460 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2461 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2462 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2464 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2465 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2471 * ASUS pin configuration:
2472 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2474 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2475 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2476 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2477 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2478 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2480 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2481 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2482 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2484 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2485 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2486 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2489 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2490 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2491 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2492 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2493 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2494 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2497 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2502 /* Enable GPIO mask and set output */
2503 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2504 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2506 /* Clevo m520g init */
2507 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2508 /* headphone output */
2509 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2511 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2514 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2515 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2517 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2518 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2519 /* Mic1 (rear panel) */
2520 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2521 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2522 /* Mic2 (front panel) */
2523 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2524 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2526 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2527 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2528 /* change to EAPD mode */
2529 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2530 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2535 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2536 /* change to EAPD mode */
2537 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2538 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2540 /* Headphone output */
2541 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2543 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2544 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2546 /* Line In pin widget for input */
2547 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2548 /* CD pin widget for input */
2549 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2550 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2551 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2553 /* change to EAPD mode */
2554 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2555 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2561 * LG m1 express dual
2564 * Rear Line-In/Out (blue): 0x14
2565 * Build-in Mic-In: 0x15
2567 * HP-Out (green): 0x1b
2568 * Mic-In/Out (red): 0x19
2572 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2573 static hda_nid_t alc880_lg_dac_nids[3] = {
2577 /* seems analog CD is not working */
2578 static struct hda_input_mux alc880_lg_capture_source = {
2583 { "Internal Mic", 0x6 },
2587 /* 2,4,6 channel modes */
2588 static struct hda_verb alc880_lg_ch2_init[] = {
2589 /* set line-in and mic-in to input */
2590 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2591 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2595 static struct hda_verb alc880_lg_ch4_init[] = {
2596 /* set line-in to out and mic-in to input */
2597 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2598 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2602 static struct hda_verb alc880_lg_ch6_init[] = {
2603 /* set line-in and mic-in to output */
2604 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2605 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2609 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2610 { 2, alc880_lg_ch2_init },
2611 { 4, alc880_lg_ch4_init },
2612 { 6, alc880_lg_ch6_init },
2615 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2616 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2617 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2618 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2619 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2620 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2621 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2622 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2623 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2625 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2626 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2627 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2628 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2629 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2631 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2632 .name = "Channel Mode",
2633 .info = alc_ch_mode_info,
2634 .get = alc_ch_mode_get,
2635 .put = alc_ch_mode_put,
2640 static struct hda_verb alc880_lg_init_verbs[] = {
2641 /* set capture source to mic-in */
2642 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2643 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2644 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2645 /* mute all amp mixer inputs */
2646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2649 /* line-in to input */
2650 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2651 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2653 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2654 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2656 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2657 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2658 /* mic-in to input */
2659 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2661 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2663 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2664 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2665 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2671 /* toggle speaker-output according to the hp-jack state */
2672 static void alc880_lg_automute(struct hda_codec *codec)
2674 unsigned int present;
2677 present = snd_hda_codec_read(codec, 0x1b, 0,
2678 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2679 bits = present ? HDA_AMP_MUTE : 0;
2680 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2681 HDA_AMP_MUTE, bits);
2684 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2686 /* Looks like the unsol event is incompatible with the standard
2687 * definition. 4bit tag is placed at 28 bit!
2689 if ((res >> 28) == 0x01)
2690 alc880_lg_automute(codec);
2699 * Built-in Mic-In: 0x19
2705 static struct hda_input_mux alc880_lg_lw_capture_source = {
2709 { "Internal Mic", 0x1 },
2714 #define alc880_lg_lw_modes alc880_threestack_modes
2716 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2717 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2718 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2719 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2720 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2721 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2722 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2723 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2724 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2725 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2726 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2727 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2728 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2729 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2730 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2732 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2733 .name = "Channel Mode",
2734 .info = alc_ch_mode_info,
2735 .get = alc_ch_mode_get,
2736 .put = alc_ch_mode_put,
2741 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2742 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2743 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2744 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2746 /* set capture source to mic-in */
2747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2748 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2749 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2750 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2752 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2753 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2757 /* mic-in to input */
2758 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2759 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2761 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2764 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2768 /* toggle speaker-output according to the hp-jack state */
2769 static void alc880_lg_lw_automute(struct hda_codec *codec)
2771 unsigned int present;
2774 present = snd_hda_codec_read(codec, 0x1b, 0,
2775 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2776 bits = present ? HDA_AMP_MUTE : 0;
2777 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2778 HDA_AMP_MUTE, bits);
2781 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2783 /* Looks like the unsol event is incompatible with the standard
2784 * definition. 4bit tag is placed at 28 bit!
2786 if ((res >> 28) == 0x01)
2787 alc880_lg_lw_automute(codec);
2790 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2791 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2792 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2793 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2795 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2796 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2800 static struct hda_input_mux alc880_medion_rim_capture_source = {
2804 { "Internal Mic", 0x1 },
2808 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2809 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2814 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2817 /* Mic2 (as headphone out) for HP output */
2818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2820 /* Internal Speaker */
2821 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2822 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2824 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2825 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2827 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2831 /* toggle speaker-output according to the hp-jack state */
2832 static void alc880_medion_rim_automute(struct hda_codec *codec)
2834 unsigned int present;
2837 present = snd_hda_codec_read(codec, 0x14, 0,
2838 AC_VERB_GET_PIN_SENSE, 0)
2839 & AC_PINSENSE_PRESENCE;
2840 bits = present ? HDA_AMP_MUTE : 0;
2841 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2842 HDA_AMP_MUTE, bits);
2844 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2846 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2849 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2852 /* Looks like the unsol event is incompatible with the standard
2853 * definition. 4bit tag is placed at 28 bit!
2855 if ((res >> 28) == ALC880_HP_EVENT)
2856 alc880_medion_rim_automute(codec);
2859 #ifdef CONFIG_SND_HDA_POWER_SAVE
2860 static struct hda_amp_list alc880_loopbacks[] = {
2861 { 0x0b, HDA_INPUT, 0 },
2862 { 0x0b, HDA_INPUT, 1 },
2863 { 0x0b, HDA_INPUT, 2 },
2864 { 0x0b, HDA_INPUT, 3 },
2865 { 0x0b, HDA_INPUT, 4 },
2869 static struct hda_amp_list alc880_lg_loopbacks[] = {
2870 { 0x0b, HDA_INPUT, 1 },
2871 { 0x0b, HDA_INPUT, 6 },
2872 { 0x0b, HDA_INPUT, 7 },
2881 static int alc_init(struct hda_codec *codec)
2883 struct alc_spec *spec = codec->spec;
2887 if (codec->vendor_id == 0x10ec0888)
2888 alc888_coef_init(codec);
2890 for (i = 0; i < spec->num_init_verbs; i++)
2891 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2893 if (spec->init_hook)
2894 spec->init_hook(codec);
2899 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2901 struct alc_spec *spec = codec->spec;
2903 if (spec->unsol_event)
2904 spec->unsol_event(codec, res);
2907 #ifdef CONFIG_SND_HDA_POWER_SAVE
2908 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2910 struct alc_spec *spec = codec->spec;
2911 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2916 * Analog playback callbacks
2918 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2919 struct hda_codec *codec,
2920 struct snd_pcm_substream *substream)
2922 struct alc_spec *spec = codec->spec;
2923 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2927 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2928 struct hda_codec *codec,
2929 unsigned int stream_tag,
2930 unsigned int format,
2931 struct snd_pcm_substream *substream)
2933 struct alc_spec *spec = codec->spec;
2934 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2935 stream_tag, format, substream);
2938 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2939 struct hda_codec *codec,
2940 struct snd_pcm_substream *substream)
2942 struct alc_spec *spec = codec->spec;
2943 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2949 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2950 struct hda_codec *codec,
2951 struct snd_pcm_substream *substream)
2953 struct alc_spec *spec = codec->spec;
2954 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2957 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2958 struct hda_codec *codec,
2959 unsigned int stream_tag,
2960 unsigned int format,
2961 struct snd_pcm_substream *substream)
2963 struct alc_spec *spec = codec->spec;
2964 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2965 stream_tag, format, substream);
2968 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2969 struct hda_codec *codec,
2970 struct snd_pcm_substream *substream)
2972 struct alc_spec *spec = codec->spec;
2973 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2979 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2980 struct hda_codec *codec,
2981 unsigned int stream_tag,
2982 unsigned int format,
2983 struct snd_pcm_substream *substream)
2985 struct alc_spec *spec = codec->spec;
2987 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2988 stream_tag, 0, format);
2992 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2993 struct hda_codec *codec,
2994 struct snd_pcm_substream *substream)
2996 struct alc_spec *spec = codec->spec;
2998 snd_hda_codec_cleanup_stream(codec,
2999 spec->adc_nids[substream->number + 1]);
3006 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3010 /* NID is set in alc_build_pcms */
3012 .open = alc880_playback_pcm_open,
3013 .prepare = alc880_playback_pcm_prepare,
3014 .cleanup = alc880_playback_pcm_cleanup
3018 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3022 /* NID is set in alc_build_pcms */
3025 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3029 /* NID is set in alc_build_pcms */
3032 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3033 .substreams = 2, /* can be overridden */
3036 /* NID is set in alc_build_pcms */
3038 .prepare = alc880_alt_capture_pcm_prepare,
3039 .cleanup = alc880_alt_capture_pcm_cleanup
3043 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3047 /* NID is set in alc_build_pcms */
3049 .open = alc880_dig_playback_pcm_open,
3050 .close = alc880_dig_playback_pcm_close,
3051 .prepare = alc880_dig_playback_pcm_prepare
3055 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3059 /* NID is set in alc_build_pcms */
3062 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3063 static struct hda_pcm_stream alc_pcm_null_stream = {
3069 static int alc_build_pcms(struct hda_codec *codec)
3071 struct alc_spec *spec = codec->spec;
3072 struct hda_pcm *info = spec->pcm_rec;
3075 codec->num_pcms = 1;
3076 codec->pcm_info = info;
3078 if (spec->no_analog)
3081 info->name = spec->stream_name_analog;
3082 if (spec->stream_analog_playback) {
3083 if (snd_BUG_ON(!spec->multiout.dac_nids))
3085 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3086 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3088 if (spec->stream_analog_capture) {
3089 if (snd_BUG_ON(!spec->adc_nids))
3091 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3092 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3095 if (spec->channel_mode) {
3096 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3097 for (i = 0; i < spec->num_channel_mode; i++) {
3098 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3099 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3105 /* SPDIF for stream index #1 */
3106 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3107 codec->num_pcms = 2;
3108 info = spec->pcm_rec + 1;
3109 info->name = spec->stream_name_digital;
3110 if (spec->dig_out_type)
3111 info->pcm_type = spec->dig_out_type;
3113 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3114 if (spec->multiout.dig_out_nid &&
3115 spec->stream_digital_playback) {
3116 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3117 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3119 if (spec->dig_in_nid &&
3120 spec->stream_digital_capture) {
3121 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3122 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3124 /* FIXME: do we need this for all Realtek codec models? */
3125 codec->spdif_status_reset = 1;
3128 if (spec->no_analog)
3131 /* If the use of more than one ADC is requested for the current
3132 * model, configure a second analog capture-only PCM.
3134 /* Additional Analaog capture for index #2 */
3135 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3136 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3137 codec->num_pcms = 3;
3138 info = spec->pcm_rec + 2;
3139 info->name = spec->stream_name_analog;
3140 if (spec->alt_dac_nid) {
3141 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3142 *spec->stream_analog_alt_playback;
3143 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3146 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3147 alc_pcm_null_stream;
3148 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3150 if (spec->num_adc_nids > 1) {
3151 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3152 *spec->stream_analog_alt_capture;
3153 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3155 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3156 spec->num_adc_nids - 1;
3158 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3159 alc_pcm_null_stream;
3160 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3167 static void alc_free_kctls(struct hda_codec *codec)
3169 struct alc_spec *spec = codec->spec;
3171 if (spec->kctls.list) {
3172 struct snd_kcontrol_new *kctl = spec->kctls.list;
3174 for (i = 0; i < spec->kctls.used; i++)
3175 kfree(kctl[i].name);
3177 snd_array_free(&spec->kctls);
3180 static void alc_free(struct hda_codec *codec)
3182 struct alc_spec *spec = codec->spec;
3187 alc_free_kctls(codec);
3189 codec->spec = NULL; /* to be sure */
3192 #ifdef SND_HDA_NEEDS_RESUME
3193 static void store_pin_configs(struct hda_codec *codec)
3195 struct alc_spec *spec = codec->spec;
3196 hda_nid_t nid, end_nid;
3198 end_nid = codec->start_nid + codec->num_nodes;
3199 for (nid = codec->start_nid; nid < end_nid; nid++) {
3200 unsigned int wid_caps = get_wcaps(codec, nid);
3201 unsigned int wid_type =
3202 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3203 if (wid_type != AC_WID_PIN)
3205 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3207 spec->pin_nids[spec->num_pins] = nid;
3208 spec->pin_cfgs[spec->num_pins] =
3209 snd_hda_codec_read(codec, nid, 0,
3210 AC_VERB_GET_CONFIG_DEFAULT, 0);
3215 static void resume_pin_configs(struct hda_codec *codec)
3217 struct alc_spec *spec = codec->spec;
3220 for (i = 0; i < spec->num_pins; i++) {
3221 hda_nid_t pin_nid = spec->pin_nids[i];
3222 unsigned int pin_config = spec->pin_cfgs[i];
3223 snd_hda_codec_write(codec, pin_nid, 0,
3224 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3225 pin_config & 0x000000ff);
3226 snd_hda_codec_write(codec, pin_nid, 0,
3227 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3228 (pin_config & 0x0000ff00) >> 8);
3229 snd_hda_codec_write(codec, pin_nid, 0,
3230 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3231 (pin_config & 0x00ff0000) >> 16);
3232 snd_hda_codec_write(codec, pin_nid, 0,
3233 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3238 static int alc_resume(struct hda_codec *codec)
3240 resume_pin_configs(codec);
3241 codec->patch_ops.init(codec);
3242 snd_hda_codec_resume_amp(codec);
3243 snd_hda_codec_resume_cache(codec);
3247 #define store_pin_configs(codec)
3252 static struct hda_codec_ops alc_patch_ops = {
3253 .build_controls = alc_build_controls,
3254 .build_pcms = alc_build_pcms,
3257 .unsol_event = alc_unsol_event,
3258 #ifdef SND_HDA_NEEDS_RESUME
3259 .resume = alc_resume,
3261 #ifdef CONFIG_SND_HDA_POWER_SAVE
3262 .check_power_status = alc_check_power_status,
3268 * Test configuration for debugging
3270 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3273 #ifdef CONFIG_SND_DEBUG
3274 static hda_nid_t alc880_test_dac_nids[4] = {
3275 0x02, 0x03, 0x04, 0x05
3278 static struct hda_input_mux alc880_test_capture_source = {
3287 { "Surround", 0x6 },
3291 static struct hda_channel_mode alc880_test_modes[4] = {
3298 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3299 struct snd_ctl_elem_info *uinfo)
3301 static char *texts[] = {
3302 "N/A", "Line Out", "HP Out",
3303 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3305 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3307 uinfo->value.enumerated.items = 8;
3308 if (uinfo->value.enumerated.item >= 8)
3309 uinfo->value.enumerated.item = 7;
3310 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3314 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3315 struct snd_ctl_elem_value *ucontrol)
3317 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3318 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3319 unsigned int pin_ctl, item = 0;
3321 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3322 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3323 if (pin_ctl & AC_PINCTL_OUT_EN) {
3324 if (pin_ctl & AC_PINCTL_HP_EN)
3328 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3329 switch (pin_ctl & AC_PINCTL_VREFEN) {
3330 case AC_PINCTL_VREF_HIZ: item = 3; break;
3331 case AC_PINCTL_VREF_50: item = 4; break;
3332 case AC_PINCTL_VREF_GRD: item = 5; break;
3333 case AC_PINCTL_VREF_80: item = 6; break;
3334 case AC_PINCTL_VREF_100: item = 7; break;
3337 ucontrol->value.enumerated.item[0] = item;
3341 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3342 struct snd_ctl_elem_value *ucontrol)
3344 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3345 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3346 static unsigned int ctls[] = {
3347 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3348 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3349 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3350 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3351 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3352 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3354 unsigned int old_ctl, new_ctl;
3356 old_ctl = snd_hda_codec_read(codec, nid, 0,
3357 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3358 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3359 if (old_ctl != new_ctl) {
3361 snd_hda_codec_write_cache(codec, nid, 0,
3362 AC_VERB_SET_PIN_WIDGET_CONTROL,
3364 val = ucontrol->value.enumerated.item[0] >= 3 ?
3366 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3373 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3374 struct snd_ctl_elem_info *uinfo)
3376 static char *texts[] = {
3377 "Front", "Surround", "CLFE", "Side"
3379 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3381 uinfo->value.enumerated.items = 4;
3382 if (uinfo->value.enumerated.item >= 4)
3383 uinfo->value.enumerated.item = 3;
3384 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3388 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3389 struct snd_ctl_elem_value *ucontrol)
3391 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3392 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3395 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3396 ucontrol->value.enumerated.item[0] = sel & 3;
3400 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3401 struct snd_ctl_elem_value *ucontrol)
3403 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3404 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3407 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3408 if (ucontrol->value.enumerated.item[0] != sel) {
3409 sel = ucontrol->value.enumerated.item[0] & 3;
3410 snd_hda_codec_write_cache(codec, nid, 0,
3411 AC_VERB_SET_CONNECT_SEL, sel);
3417 #define PIN_CTL_TEST(xname,nid) { \
3418 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3420 .info = alc_test_pin_ctl_info, \
3421 .get = alc_test_pin_ctl_get, \
3422 .put = alc_test_pin_ctl_put, \
3423 .private_value = nid \
3426 #define PIN_SRC_TEST(xname,nid) { \
3427 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3429 .info = alc_test_pin_src_info, \
3430 .get = alc_test_pin_src_get, \
3431 .put = alc_test_pin_src_put, \
3432 .private_value = nid \
3435 static struct snd_kcontrol_new alc880_test_mixer[] = {
3436 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3437 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3438 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3439 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3440 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3441 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3442 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3443 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3444 PIN_CTL_TEST("Front Pin Mode", 0x14),
3445 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3446 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3447 PIN_CTL_TEST("Side Pin Mode", 0x17),
3448 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3449 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3450 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3451 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3452 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3453 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3454 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3455 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3456 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3457 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3458 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3459 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3460 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3461 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3462 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3463 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3464 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3465 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3468 .name = "Channel Mode",
3469 .info = alc_ch_mode_info,
3470 .get = alc_ch_mode_get,
3471 .put = alc_ch_mode_put,
3476 static struct hda_verb alc880_test_init_verbs[] = {
3477 /* Unmute inputs of 0x0c - 0x0f */
3478 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3479 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3481 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3483 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3485 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3486 /* Vol output for 0x0c-0x0f */
3487 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3488 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3489 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3490 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3491 /* Set output pins 0x14-0x17 */
3492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3493 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3494 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3495 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3496 /* Unmute output pins 0x14-0x17 */
3497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3499 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3500 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3501 /* Set input pins 0x18-0x1c */
3502 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3503 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3505 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3506 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3507 /* Mute input pins 0x18-0x1b */
3508 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3509 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3510 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3511 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3513 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3514 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3515 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3516 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3518 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3519 /* Analog input/passthru */
3520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3532 static const char *alc880_models[ALC880_MODEL_LAST] = {
3533 [ALC880_3ST] = "3stack",
3534 [ALC880_TCL_S700] = "tcl",
3535 [ALC880_3ST_DIG] = "3stack-digout",
3536 [ALC880_CLEVO] = "clevo",
3537 [ALC880_5ST] = "5stack",
3538 [ALC880_5ST_DIG] = "5stack-digout",
3539 [ALC880_W810] = "w810",
3540 [ALC880_Z71V] = "z71v",
3541 [ALC880_6ST] = "6stack",
3542 [ALC880_6ST_DIG] = "6stack-digout",
3543 [ALC880_ASUS] = "asus",
3544 [ALC880_ASUS_W1V] = "asus-w1v",
3545 [ALC880_ASUS_DIG] = "asus-dig",
3546 [ALC880_ASUS_DIG2] = "asus-dig2",
3547 [ALC880_UNIWILL_DIG] = "uniwill",
3548 [ALC880_UNIWILL_P53] = "uniwill-p53",
3549 [ALC880_FUJITSU] = "fujitsu",
3550 [ALC880_F1734] = "F1734",
3552 [ALC880_LG_LW] = "lg-lw",
3553 [ALC880_MEDION_RIM] = "medion",
3554 #ifdef CONFIG_SND_DEBUG
3555 [ALC880_TEST] = "test",
3557 [ALC880_AUTO] = "auto",
3560 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3561 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3562 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3563 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3564 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3565 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3566 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3567 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3568 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3569 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3570 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3571 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3572 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3573 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3574 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3575 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3576 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3577 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3578 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3579 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3580 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3581 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3582 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3583 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3584 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3585 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3586 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3587 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3588 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3589 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3590 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3591 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3592 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3593 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3594 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3595 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3596 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3597 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3598 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3599 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3600 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3601 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3602 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3603 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3604 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3605 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3606 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3607 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3608 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3609 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3610 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3611 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3612 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3613 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3614 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3615 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3616 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3617 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3618 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3619 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3620 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3621 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3622 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3623 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3624 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3625 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3626 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3627 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3628 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3629 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3630 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3631 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3636 * ALC880 codec presets
3638 static struct alc_config_preset alc880_presets[] = {
3640 .mixers = { alc880_three_stack_mixer },
3641 .init_verbs = { alc880_volume_init_verbs,
3642 alc880_pin_3stack_init_verbs },
3643 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3644 .dac_nids = alc880_dac_nids,
3645 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3646 .channel_mode = alc880_threestack_modes,
3648 .input_mux = &alc880_capture_source,
3650 [ALC880_3ST_DIG] = {
3651 .mixers = { alc880_three_stack_mixer },
3652 .init_verbs = { alc880_volume_init_verbs,
3653 alc880_pin_3stack_init_verbs },
3654 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3655 .dac_nids = alc880_dac_nids,
3656 .dig_out_nid = ALC880_DIGOUT_NID,
3657 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3658 .channel_mode = alc880_threestack_modes,
3660 .input_mux = &alc880_capture_source,
3662 [ALC880_TCL_S700] = {
3663 .mixers = { alc880_tcl_s700_mixer },
3664 .init_verbs = { alc880_volume_init_verbs,
3665 alc880_pin_tcl_S700_init_verbs,
3666 alc880_gpio2_init_verbs },
3667 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3668 .dac_nids = alc880_dac_nids,
3669 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3670 .num_adc_nids = 1, /* single ADC */
3672 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3673 .channel_mode = alc880_2_jack_modes,
3674 .input_mux = &alc880_capture_source,
3677 .mixers = { alc880_three_stack_mixer,
3678 alc880_five_stack_mixer},
3679 .init_verbs = { alc880_volume_init_verbs,
3680 alc880_pin_5stack_init_verbs },
3681 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3682 .dac_nids = alc880_dac_nids,
3683 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3684 .channel_mode = alc880_fivestack_modes,
3685 .input_mux = &alc880_capture_source,
3687 [ALC880_5ST_DIG] = {
3688 .mixers = { alc880_three_stack_mixer,
3689 alc880_five_stack_mixer },
3690 .init_verbs = { alc880_volume_init_verbs,
3691 alc880_pin_5stack_init_verbs },
3692 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3693 .dac_nids = alc880_dac_nids,
3694 .dig_out_nid = ALC880_DIGOUT_NID,
3695 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3696 .channel_mode = alc880_fivestack_modes,
3697 .input_mux = &alc880_capture_source,
3700 .mixers = { alc880_six_stack_mixer },
3701 .init_verbs = { alc880_volume_init_verbs,
3702 alc880_pin_6stack_init_verbs },
3703 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3704 .dac_nids = alc880_6st_dac_nids,
3705 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3706 .channel_mode = alc880_sixstack_modes,
3707 .input_mux = &alc880_6stack_capture_source,
3709 [ALC880_6ST_DIG] = {
3710 .mixers = { alc880_six_stack_mixer },
3711 .init_verbs = { alc880_volume_init_verbs,
3712 alc880_pin_6stack_init_verbs },
3713 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3714 .dac_nids = alc880_6st_dac_nids,
3715 .dig_out_nid = ALC880_DIGOUT_NID,
3716 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3717 .channel_mode = alc880_sixstack_modes,
3718 .input_mux = &alc880_6stack_capture_source,
3721 .mixers = { alc880_w810_base_mixer },
3722 .init_verbs = { alc880_volume_init_verbs,
3723 alc880_pin_w810_init_verbs,
3724 alc880_gpio2_init_verbs },
3725 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3726 .dac_nids = alc880_w810_dac_nids,
3727 .dig_out_nid = ALC880_DIGOUT_NID,
3728 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3729 .channel_mode = alc880_w810_modes,
3730 .input_mux = &alc880_capture_source,
3733 .mixers = { alc880_z71v_mixer },
3734 .init_verbs = { alc880_volume_init_verbs,
3735 alc880_pin_z71v_init_verbs },
3736 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3737 .dac_nids = alc880_z71v_dac_nids,
3738 .dig_out_nid = ALC880_DIGOUT_NID,
3740 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3741 .channel_mode = alc880_2_jack_modes,
3742 .input_mux = &alc880_capture_source,
3745 .mixers = { alc880_f1734_mixer },
3746 .init_verbs = { alc880_volume_init_verbs,
3747 alc880_pin_f1734_init_verbs },
3748 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3749 .dac_nids = alc880_f1734_dac_nids,
3751 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3752 .channel_mode = alc880_2_jack_modes,
3753 .input_mux = &alc880_f1734_capture_source,
3754 .unsol_event = alc880_uniwill_p53_unsol_event,
3755 .init_hook = alc880_uniwill_p53_hp_automute,
3758 .mixers = { alc880_asus_mixer },
3759 .init_verbs = { alc880_volume_init_verbs,
3760 alc880_pin_asus_init_verbs,
3761 alc880_gpio1_init_verbs },
3762 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3763 .dac_nids = alc880_asus_dac_nids,
3764 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3765 .channel_mode = alc880_asus_modes,
3767 .input_mux = &alc880_capture_source,
3769 [ALC880_ASUS_DIG] = {
3770 .mixers = { alc880_asus_mixer },
3771 .init_verbs = { alc880_volume_init_verbs,
3772 alc880_pin_asus_init_verbs,
3773 alc880_gpio1_init_verbs },
3774 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3775 .dac_nids = alc880_asus_dac_nids,
3776 .dig_out_nid = ALC880_DIGOUT_NID,
3777 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3778 .channel_mode = alc880_asus_modes,
3780 .input_mux = &alc880_capture_source,
3782 [ALC880_ASUS_DIG2] = {
3783 .mixers = { alc880_asus_mixer },
3784 .init_verbs = { alc880_volume_init_verbs,
3785 alc880_pin_asus_init_verbs,
3786 alc880_gpio2_init_verbs }, /* use GPIO2 */
3787 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3788 .dac_nids = alc880_asus_dac_nids,
3789 .dig_out_nid = ALC880_DIGOUT_NID,
3790 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3791 .channel_mode = alc880_asus_modes,
3793 .input_mux = &alc880_capture_source,
3795 [ALC880_ASUS_W1V] = {
3796 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3797 .init_verbs = { alc880_volume_init_verbs,
3798 alc880_pin_asus_init_verbs,
3799 alc880_gpio1_init_verbs },
3800 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3801 .dac_nids = alc880_asus_dac_nids,
3802 .dig_out_nid = ALC880_DIGOUT_NID,
3803 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3804 .channel_mode = alc880_asus_modes,
3806 .input_mux = &alc880_capture_source,
3808 [ALC880_UNIWILL_DIG] = {
3809 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3810 .init_verbs = { alc880_volume_init_verbs,
3811 alc880_pin_asus_init_verbs },
3812 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3813 .dac_nids = alc880_asus_dac_nids,
3814 .dig_out_nid = ALC880_DIGOUT_NID,
3815 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3816 .channel_mode = alc880_asus_modes,
3818 .input_mux = &alc880_capture_source,
3820 [ALC880_UNIWILL] = {
3821 .mixers = { alc880_uniwill_mixer },
3822 .init_verbs = { alc880_volume_init_verbs,
3823 alc880_uniwill_init_verbs },
3824 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3825 .dac_nids = alc880_asus_dac_nids,
3826 .dig_out_nid = ALC880_DIGOUT_NID,
3827 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3828 .channel_mode = alc880_threestack_modes,
3830 .input_mux = &alc880_capture_source,
3831 .unsol_event = alc880_uniwill_unsol_event,
3832 .init_hook = alc880_uniwill_automute,
3834 [ALC880_UNIWILL_P53] = {
3835 .mixers = { alc880_uniwill_p53_mixer },
3836 .init_verbs = { alc880_volume_init_verbs,
3837 alc880_uniwill_p53_init_verbs },
3838 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3839 .dac_nids = alc880_asus_dac_nids,
3840 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3841 .channel_mode = alc880_threestack_modes,
3842 .input_mux = &alc880_capture_source,
3843 .unsol_event = alc880_uniwill_p53_unsol_event,
3844 .init_hook = alc880_uniwill_p53_hp_automute,
3846 [ALC880_FUJITSU] = {
3847 .mixers = { alc880_fujitsu_mixer,
3848 alc880_pcbeep_mixer, },
3849 .init_verbs = { alc880_volume_init_verbs,
3850 alc880_uniwill_p53_init_verbs,
3851 alc880_beep_init_verbs },
3852 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3853 .dac_nids = alc880_dac_nids,
3854 .dig_out_nid = ALC880_DIGOUT_NID,
3855 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3856 .channel_mode = alc880_2_jack_modes,
3857 .input_mux = &alc880_capture_source,
3858 .unsol_event = alc880_uniwill_p53_unsol_event,
3859 .init_hook = alc880_uniwill_p53_hp_automute,
3862 .mixers = { alc880_three_stack_mixer },
3863 .init_verbs = { alc880_volume_init_verbs,
3864 alc880_pin_clevo_init_verbs },
3865 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3866 .dac_nids = alc880_dac_nids,
3868 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3869 .channel_mode = alc880_threestack_modes,
3871 .input_mux = &alc880_capture_source,
3874 .mixers = { alc880_lg_mixer },
3875 .init_verbs = { alc880_volume_init_verbs,
3876 alc880_lg_init_verbs },
3877 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3878 .dac_nids = alc880_lg_dac_nids,
3879 .dig_out_nid = ALC880_DIGOUT_NID,
3880 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3881 .channel_mode = alc880_lg_ch_modes,
3883 .input_mux = &alc880_lg_capture_source,
3884 .unsol_event = alc880_lg_unsol_event,
3885 .init_hook = alc880_lg_automute,
3886 #ifdef CONFIG_SND_HDA_POWER_SAVE
3887 .loopbacks = alc880_lg_loopbacks,
3891 .mixers = { alc880_lg_lw_mixer },
3892 .init_verbs = { alc880_volume_init_verbs,
3893 alc880_lg_lw_init_verbs },
3894 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3895 .dac_nids = alc880_dac_nids,
3896 .dig_out_nid = ALC880_DIGOUT_NID,
3897 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3898 .channel_mode = alc880_lg_lw_modes,
3899 .input_mux = &alc880_lg_lw_capture_source,
3900 .unsol_event = alc880_lg_lw_unsol_event,
3901 .init_hook = alc880_lg_lw_automute,
3903 [ALC880_MEDION_RIM] = {
3904 .mixers = { alc880_medion_rim_mixer },
3905 .init_verbs = { alc880_volume_init_verbs,
3906 alc880_medion_rim_init_verbs,
3907 alc_gpio2_init_verbs },
3908 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3909 .dac_nids = alc880_dac_nids,
3910 .dig_out_nid = ALC880_DIGOUT_NID,
3911 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3912 .channel_mode = alc880_2_jack_modes,
3913 .input_mux = &alc880_medion_rim_capture_source,
3914 .unsol_event = alc880_medion_rim_unsol_event,
3915 .init_hook = alc880_medion_rim_automute,
3917 #ifdef CONFIG_SND_DEBUG
3919 .mixers = { alc880_test_mixer },
3920 .init_verbs = { alc880_test_init_verbs },
3921 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3922 .dac_nids = alc880_test_dac_nids,
3923 .dig_out_nid = ALC880_DIGOUT_NID,
3924 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3925 .channel_mode = alc880_test_modes,
3926 .input_mux = &alc880_test_capture_source,
3932 * Automatic parse of I/O pins from the BIOS configuration
3937 ALC_CTL_WIDGET_MUTE,
3940 static struct snd_kcontrol_new alc880_control_templates[] = {
3941 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3942 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3943 HDA_BIND_MUTE(NULL, 0, 0, 0),
3946 /* add dynamic controls */
3947 static int add_control(struct alc_spec *spec, int type, const char *name,
3950 struct snd_kcontrol_new *knew;
3952 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3953 knew = snd_array_new(&spec->kctls);
3956 *knew = alc880_control_templates[type];
3957 knew->name = kstrdup(name, GFP_KERNEL);
3960 knew->private_value = val;
3964 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3965 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3966 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3967 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3968 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3969 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3970 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3971 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3972 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3973 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3974 #define ALC880_PIN_CD_NID 0x1c
3976 /* fill in the dac_nids table from the parsed pin configuration */
3977 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3978 const struct auto_pin_cfg *cfg)
3984 memset(assigned, 0, sizeof(assigned));
3985 spec->multiout.dac_nids = spec->private_dac_nids;
3987 /* check the pins hardwired to audio widget */
3988 for (i = 0; i < cfg->line_outs; i++) {
3989 nid = cfg->line_out_pins[i];
3990 if (alc880_is_fixed_pin(nid)) {
3991 int idx = alc880_fixed_pin_idx(nid);
3992 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3996 /* left pins can be connect to any audio widget */
3997 for (i = 0; i < cfg->line_outs; i++) {
3998 nid = cfg->line_out_pins[i];
3999 if (alc880_is_fixed_pin(nid))
4001 /* search for an empty channel */
4002 for (j = 0; j < cfg->line_outs; j++) {
4004 spec->multiout.dac_nids[i] =
4005 alc880_idx_to_dac(j);
4011 spec->multiout.num_dacs = cfg->line_outs;
4015 /* add playback controls from the parsed DAC table */
4016 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4017 const struct auto_pin_cfg *cfg)
4020 static const char *chname[4] = {
4021 "Front", "Surround", NULL /*CLFE*/, "Side"
4026 for (i = 0; i < cfg->line_outs; i++) {
4027 if (!spec->multiout.dac_nids[i])
4029 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4032 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4033 "Center Playback Volume",
4034 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4038 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4039 "LFE Playback Volume",
4040 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4044 err = add_control(spec, ALC_CTL_BIND_MUTE,
4045 "Center Playback Switch",
4046 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4050 err = add_control(spec, ALC_CTL_BIND_MUTE,
4051 "LFE Playback Switch",
4052 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4057 sprintf(name, "%s Playback Volume", chname[i]);
4058 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4059 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4063 sprintf(name, "%s Playback Switch", chname[i]);
4064 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4065 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4074 /* add playback controls for speaker and HP outputs */
4075 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4085 if (alc880_is_fixed_pin(pin)) {
4086 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4087 /* specify the DAC as the extra output */
4088 if (!spec->multiout.hp_nid)
4089 spec->multiout.hp_nid = nid;
4091 spec->multiout.extra_out_nid[0] = nid;
4092 /* control HP volume/switch on the output mixer amp */
4093 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4094 sprintf(name, "%s Playback Volume", pfx);
4095 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4096 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4099 sprintf(name, "%s Playback Switch", pfx);
4100 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4101 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4104 } else if (alc880_is_multi_pin(pin)) {
4105 /* set manual connection */
4106 /* we have only a switch on HP-out PIN */
4107 sprintf(name, "%s Playback Switch", pfx);
4108 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4109 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4116 /* create input playback/capture controls for the given pin */
4117 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4118 const char *ctlname,
4119 int idx, hda_nid_t mix_nid)
4124 sprintf(name, "%s Playback Volume", ctlname);
4125 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4126 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4129 sprintf(name, "%s Playback Switch", ctlname);
4130 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4131 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4137 /* create playback/capture controls for input pins */
4138 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4139 const struct auto_pin_cfg *cfg)
4141 struct hda_input_mux *imux = &spec->private_imux[0];
4144 for (i = 0; i < AUTO_PIN_LAST; i++) {
4145 if (alc880_is_input_pin(cfg->input_pins[i])) {
4146 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4147 err = new_analog_input(spec, cfg->input_pins[i],
4148 auto_pin_cfg_labels[i],
4152 imux->items[imux->num_items].label =
4153 auto_pin_cfg_labels[i];
4154 imux->items[imux->num_items].index =
4155 alc880_input_pin_idx(cfg->input_pins[i]);
4162 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4163 unsigned int pin_type)
4165 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4168 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4172 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4173 hda_nid_t nid, int pin_type,
4176 alc_set_pin_output(codec, nid, pin_type);
4177 /* need the manual connection? */
4178 if (alc880_is_multi_pin(nid)) {
4179 struct alc_spec *spec = codec->spec;
4180 int idx = alc880_multi_pin_idx(nid);
4181 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4182 AC_VERB_SET_CONNECT_SEL,
4183 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4187 static int get_pin_type(int line_out_type)
4189 if (line_out_type == AUTO_PIN_HP_OUT)
4195 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4197 struct alc_spec *spec = codec->spec;
4200 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4201 for (i = 0; i < spec->autocfg.line_outs; i++) {
4202 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4203 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4204 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4208 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4210 struct alc_spec *spec = codec->spec;
4213 pin = spec->autocfg.speaker_pins[0];
4214 if (pin) /* connect to front */
4215 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4216 pin = spec->autocfg.hp_pins[0];
4217 if (pin) /* connect to front */
4218 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4221 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4223 struct alc_spec *spec = codec->spec;
4226 for (i = 0; i < AUTO_PIN_LAST; i++) {
4227 hda_nid_t nid = spec->autocfg.input_pins[i];
4228 if (alc880_is_input_pin(nid)) {
4229 snd_hda_codec_write(codec, nid, 0,
4230 AC_VERB_SET_PIN_WIDGET_CONTROL,
4231 i <= AUTO_PIN_FRONT_MIC ?
4232 PIN_VREF80 : PIN_IN);
4233 if (nid != ALC880_PIN_CD_NID)
4234 snd_hda_codec_write(codec, nid, 0,
4235 AC_VERB_SET_AMP_GAIN_MUTE,
4241 /* parse the BIOS configuration and set up the alc_spec */
4242 /* return 1 if successful, 0 if the proper config is not found,
4243 * or a negative error code
4245 static int alc880_parse_auto_config(struct hda_codec *codec)
4247 struct alc_spec *spec = codec->spec;
4249 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4251 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4255 if (!spec->autocfg.line_outs)
4256 return 0; /* can't find valid BIOS pin config */
4258 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4261 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4264 err = alc880_auto_create_extra_out(spec,
4265 spec->autocfg.speaker_pins[0],
4269 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4273 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4277 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4279 if (spec->autocfg.dig_out_pin)
4280 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4281 if (spec->autocfg.dig_in_pin)
4282 spec->dig_in_nid = ALC880_DIGIN_NID;
4284 if (spec->kctls.list)
4285 add_mixer(spec, spec->kctls.list);
4287 add_verb(spec, alc880_volume_init_verbs);
4289 spec->num_mux_defs = 1;
4290 spec->input_mux = &spec->private_imux[0];
4292 store_pin_configs(codec);
4296 /* additional initialization for auto-configuration model */
4297 static void alc880_auto_init(struct hda_codec *codec)
4299 struct alc_spec *spec = codec->spec;
4300 alc880_auto_init_multi_out(codec);
4301 alc880_auto_init_extra_out(codec);
4302 alc880_auto_init_analog_input(codec);
4303 if (spec->unsol_event)
4304 alc_inithook(codec);
4308 * OK, here we have finally the patch for ALC880
4311 static void set_capture_mixer(struct alc_spec *spec)
4313 static struct snd_kcontrol_new *caps[3] = {
4318 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4319 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4322 static int patch_alc880(struct hda_codec *codec)
4324 struct alc_spec *spec;
4328 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4334 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4337 if (board_config < 0) {
4338 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4339 "trying auto-probe from BIOS...\n");
4340 board_config = ALC880_AUTO;
4343 if (board_config == ALC880_AUTO) {
4344 /* automatic parse from the BIOS config */
4345 err = alc880_parse_auto_config(codec);
4351 "hda_codec: Cannot set up configuration "
4352 "from BIOS. Using 3-stack mode...\n");
4353 board_config = ALC880_3ST;
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);
4384 spec->vmaster_nid = 0x0c;
4386 codec->patch_ops = alc_patch_ops;
4387 if (board_config == ALC880_AUTO)
4388 spec->init_hook = alc880_auto_init;
4389 #ifdef CONFIG_SND_HDA_POWER_SAVE
4390 if (!spec->loopback.amplist)
4391 spec->loopback.amplist = alc880_loopbacks;
4393 codec->proc_widget_hook = print_realtek_coef;
4403 static hda_nid_t alc260_dac_nids[1] = {
4408 static hda_nid_t alc260_adc_nids[1] = {
4413 static hda_nid_t alc260_adc_nids_alt[1] = {
4418 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4419 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4421 static hda_nid_t alc260_dual_adc_nids[2] = {
4426 #define ALC260_DIGOUT_NID 0x03
4427 #define ALC260_DIGIN_NID 0x06
4429 static struct hda_input_mux alc260_capture_source = {
4433 { "Front Mic", 0x1 },
4439 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4440 * headphone jack and the internal CD lines since these are the only pins at
4441 * which audio can appear. For flexibility, also allow the option of
4442 * recording the mixer output on the second ADC (ADC0 doesn't have a
4443 * connection to the mixer output).
4445 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4449 { "Mic/Line", 0x0 },
4451 { "Headphone", 0x2 },
4457 { "Mic/Line", 0x0 },
4459 { "Headphone", 0x2 },
4466 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4467 * the Fujitsu S702x, but jacks are marked differently.
4469 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4476 { "Headphone", 0x5 },
4485 { "Headphone", 0x6 },
4491 * This is just place-holder, so there's something for alc_build_pcms to look
4492 * at when it calculates the maximum number of channels. ALC260 has no mixer
4493 * element which allows changing the channel mode, so the verb list is
4496 static struct hda_channel_mode alc260_modes[1] = {
4501 /* Mixer combinations
4503 * basic: base_output + input + pc_beep + capture
4504 * HP: base_output + input + capture_alt
4505 * HP_3013: hp_3013 + input + capture
4506 * fujitsu: fujitsu + capture
4507 * acer: acer + capture
4510 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4511 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4512 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4513 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4514 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4515 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4516 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4520 static struct snd_kcontrol_new alc260_input_mixer[] = {
4521 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4522 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4523 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4524 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4525 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4526 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4527 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4528 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4532 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4533 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4534 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4538 /* update HP, line and mono out pins according to the master switch */
4539 static void alc260_hp_master_update(struct hda_codec *codec,
4540 hda_nid_t hp, hda_nid_t line,
4543 struct alc_spec *spec = codec->spec;
4544 unsigned int val = spec->master_sw ? PIN_HP : 0;
4545 /* change HP and line-out pins */
4546 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4548 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4550 /* mono (speaker) depending on the HP jack sense */
4551 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4552 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4556 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4557 struct snd_ctl_elem_value *ucontrol)
4559 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4560 struct alc_spec *spec = codec->spec;
4561 *ucontrol->value.integer.value = spec->master_sw;
4565 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4566 struct snd_ctl_elem_value *ucontrol)
4568 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4569 struct alc_spec *spec = codec->spec;
4570 int val = !!*ucontrol->value.integer.value;
4571 hda_nid_t hp, line, mono;
4573 if (val == spec->master_sw)
4575 spec->master_sw = val;
4576 hp = (kcontrol->private_value >> 16) & 0xff;
4577 line = (kcontrol->private_value >> 8) & 0xff;
4578 mono = kcontrol->private_value & 0xff;
4579 alc260_hp_master_update(codec, hp, line, mono);
4583 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4585 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4586 .name = "Master Playback Switch",
4587 .info = snd_ctl_boolean_mono_info,
4588 .get = alc260_hp_master_sw_get,
4589 .put = alc260_hp_master_sw_put,
4590 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4592 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4593 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4594 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4595 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4596 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4598 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4602 static struct hda_verb alc260_hp_unsol_verbs[] = {
4603 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4607 static void alc260_hp_automute(struct hda_codec *codec)
4609 struct alc_spec *spec = codec->spec;
4610 unsigned int present;
4612 present = snd_hda_codec_read(codec, 0x10, 0,
4613 AC_VERB_GET_PIN_SENSE, 0);
4614 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4615 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4618 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4620 if ((res >> 26) == ALC880_HP_EVENT)
4621 alc260_hp_automute(codec);
4624 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4626 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4627 .name = "Master Playback Switch",
4628 .info = snd_ctl_boolean_mono_info,
4629 .get = alc260_hp_master_sw_get,
4630 .put = alc260_hp_master_sw_put,
4631 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4633 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4634 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4635 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4636 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4637 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4639 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4640 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4644 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4645 .ops = &snd_hda_bind_vol,
4647 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4648 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4649 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4654 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4655 .ops = &snd_hda_bind_sw,
4657 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4658 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4663 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4664 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4665 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4666 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4667 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4671 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4672 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4676 static void alc260_hp_3013_automute(struct hda_codec *codec)
4678 struct alc_spec *spec = codec->spec;
4679 unsigned int present;
4681 present = snd_hda_codec_read(codec, 0x15, 0,
4682 AC_VERB_GET_PIN_SENSE, 0);
4683 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4684 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4687 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4690 if ((res >> 26) == ALC880_HP_EVENT)
4691 alc260_hp_3013_automute(codec);
4694 static void alc260_hp_3012_automute(struct hda_codec *codec)
4696 unsigned int present, bits;
4698 present = snd_hda_codec_read(codec, 0x10, 0,
4699 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4701 bits = present ? 0 : PIN_OUT;
4702 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4704 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4706 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4710 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4713 if ((res >> 26) == ALC880_HP_EVENT)
4714 alc260_hp_3012_automute(codec);
4717 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4718 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4720 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4721 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4722 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4723 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4724 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4725 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4726 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4727 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4728 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4729 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4730 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4731 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4732 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4736 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4737 * versions of the ALC260 don't act on requests to enable mic bias from NID
4738 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4739 * datasheet doesn't mention this restriction. At this stage it's not clear
4740 * whether this behaviour is intentional or is a hardware bug in chip
4741 * revisions available in early 2006. Therefore for now allow the
4742 * "Headphone Jack Mode" control to span all choices, but if it turns out
4743 * that the lack of mic bias for this NID is intentional we could change the
4744 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4746 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4747 * don't appear to make the mic bias available from the "line" jack, even
4748 * though the NID used for this jack (0x14) can supply it. The theory is
4749 * that perhaps Acer have included blocking capacitors between the ALC260
4750 * and the output jack. If this turns out to be the case for all such
4751 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4752 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4754 * The C20x Tablet series have a mono internal speaker which is controlled
4755 * via the chip's Mono sum widget and pin complex, so include the necessary
4756 * controls for such models. On models without a "mono speaker" the control
4757 * won't do anything.
4759 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4760 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4761 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4762 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4763 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4765 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4767 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4768 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4770 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4771 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4772 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4773 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4774 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4775 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4776 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4780 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4781 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4783 static struct snd_kcontrol_new alc260_will_mixer[] = {
4784 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4785 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4786 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4787 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4788 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4789 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4790 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4791 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4792 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4793 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4794 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4795 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4799 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4800 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4802 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4803 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4804 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4805 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4806 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4807 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4808 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4809 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4810 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4811 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4812 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4817 * initialization verbs
4819 static struct hda_verb alc260_init_verbs[] = {
4820 /* Line In pin widget for input */
4821 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4822 /* CD pin widget for input */
4823 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4824 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4825 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4826 /* Mic2 (front panel) pin widget for input and vref at 80% */
4827 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4828 /* LINE-2 is used for line-out in rear */
4829 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4830 /* select line-out */
4831 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4833 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4835 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4837 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4838 /* mute capture amp left and right */
4839 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4840 /* set connection select to line in (default select for this ADC) */
4841 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4842 /* mute capture amp left and right */
4843 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4844 /* set connection select to line in (default select for this ADC) */
4845 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4846 /* set vol=0 Line-Out mixer amp left and right */
4847 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4848 /* unmute pin widget amp left and right (no gain on this amp) */
4849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4850 /* set vol=0 HP mixer amp left and right */
4851 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4852 /* unmute pin widget amp left and right (no gain on this amp) */
4853 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4854 /* set vol=0 Mono mixer amp left and right */
4855 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4856 /* unmute pin widget amp left and right (no gain on this amp) */
4857 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4858 /* unmute LINE-2 out pin */
4859 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4860 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4863 /* mute analog inputs */
4864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4865 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4868 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4869 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4870 /* mute Front out path */
4871 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4872 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4873 /* mute Headphone out path */
4874 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4875 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4876 /* mute Mono out path */
4877 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4878 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4882 #if 0 /* should be identical with alc260_init_verbs? */
4883 static struct hda_verb alc260_hp_init_verbs[] = {
4884 /* Headphone and output */
4885 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4887 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4888 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4889 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4890 /* Mic2 (front panel) pin widget for input and vref at 80% */
4891 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4892 /* Line In pin widget for input */
4893 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4894 /* Line-2 pin widget for output */
4895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4896 /* CD pin widget for input */
4897 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4898 /* unmute amp left and right */
4899 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4900 /* set connection select to line in (default select for this ADC) */
4901 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4902 /* unmute Line-Out mixer amp left and right (volume = 0) */
4903 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4904 /* mute pin widget amp left and right (no gain on this amp) */
4905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4906 /* unmute HP mixer amp left and right (volume = 0) */
4907 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4908 /* mute pin widget amp left and right (no gain on this amp) */
4909 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4910 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4913 /* mute analog inputs */
4914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4919 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4920 /* Unmute Front out path */
4921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4922 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4923 /* Unmute Headphone out path */
4924 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4925 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4926 /* Unmute Mono out path */
4927 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4928 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4933 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4934 /* Line out and output */
4935 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4937 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4938 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4939 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4940 /* Mic2 (front panel) pin widget for input and vref at 80% */
4941 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4942 /* Line In pin widget for input */
4943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4944 /* Headphone pin widget for output */
4945 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4946 /* CD pin widget for input */
4947 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4948 /* unmute amp left and right */
4949 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4950 /* set connection select to line in (default select for this ADC) */
4951 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4952 /* unmute Line-Out mixer amp left and right (volume = 0) */
4953 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4954 /* mute pin widget amp left and right (no gain on this amp) */
4955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4956 /* unmute HP mixer amp left and right (volume = 0) */
4957 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4958 /* mute pin widget amp left and right (no gain on this amp) */
4959 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4960 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4963 /* mute analog inputs */
4964 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4965 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4967 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4969 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4970 /* Unmute Front out path */
4971 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4973 /* Unmute Headphone out path */
4974 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4975 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4976 /* Unmute Mono out path */
4977 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4978 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4982 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4983 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4984 * audio = 0x16, internal speaker = 0x10.
4986 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4987 /* Disable all GPIOs */
4988 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4989 /* Internal speaker is connected to headphone pin */
4990 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4991 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4992 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4993 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4994 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4995 /* Ensure all other unused pins are disabled and muted. */
4996 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4997 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4998 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4999 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5000 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5001 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5002 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5003 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5005 /* Disable digital (SPDIF) pins */
5006 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5007 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5009 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5010 * when acting as an output.
5012 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5014 /* Start with output sum widgets muted and their output gains at min */
5015 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5016 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5017 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5019 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5020 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5021 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5022 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5023 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5025 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5026 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5027 /* Unmute Line1 pin widget output buffer since it starts as an output.
5028 * If the pin mode is changed by the user the pin mode control will
5029 * take care of enabling the pin's input/output buffers as needed.
5030 * Therefore there's no need to enable the input buffer at this
5033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5034 /* Unmute input buffer of pin widget used for Line-in (no equiv
5037 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5039 /* Mute capture amp left and right */
5040 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5041 /* Set ADC connection select to match default mixer setting - line
5044 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5046 /* Do the same for the second ADC: mute capture input amp and
5047 * set ADC connection to line in (on mic1 pin)
5049 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5050 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5052 /* Mute all inputs to mixer widget (even unconnected ones) */
5053 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5065 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5066 * similar laptops (adapted from Fujitsu init verbs).
5068 static struct hda_verb alc260_acer_init_verbs[] = {
5069 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5070 * the headphone jack. Turn this on and rely on the standard mute
5071 * methods whenever the user wants to turn these outputs off.
5073 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5074 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5075 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5076 /* Internal speaker/Headphone jack is connected to Line-out pin */
5077 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5078 /* Internal microphone/Mic jack is connected to Mic1 pin */
5079 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5080 /* Line In jack is connected to Line1 pin */
5081 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5082 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5083 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5084 /* Ensure all other unused pins are disabled and muted. */
5085 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5086 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5087 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5088 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5089 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5091 /* Disable digital (SPDIF) pins */
5092 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5093 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5095 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5096 * bus when acting as outputs.
5098 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5099 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5101 /* Start with output sum widgets muted and their output gains at min */
5102 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5103 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5104 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5105 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5107 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5108 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5109 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5110 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5112 /* Unmute Line-out pin widget amp left and right
5113 * (no equiv mixer ctrl)
5115 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5116 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5117 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5118 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5119 * inputs. If the pin mode is changed by the user the pin mode control
5120 * will take care of enabling the pin's input/output buffers as needed.
5121 * Therefore there's no need to enable the input buffer at this
5124 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5127 /* Mute capture amp left and right */
5128 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5129 /* Set ADC connection select to match default mixer setting - mic
5132 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5134 /* Do similar with the second ADC: mute capture input amp and
5135 * set ADC connection to mic to match ALSA's default state.
5137 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5138 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5140 /* Mute all inputs to mixer widget (even unconnected ones) */
5141 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5142 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5143 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5144 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5145 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5146 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5148 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5153 static struct hda_verb alc260_will_verbs[] = {
5154 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5155 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5156 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5157 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5158 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5159 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5163 static struct hda_verb alc260_replacer_672v_verbs[] = {
5164 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5165 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5166 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5168 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5169 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5170 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5172 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5176 /* toggle speaker-output according to the hp-jack state */
5177 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5179 unsigned int present;
5181 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5182 present = snd_hda_codec_read(codec, 0x0f, 0,
5183 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5185 snd_hda_codec_write_cache(codec, 0x01, 0,
5186 AC_VERB_SET_GPIO_DATA, 1);
5187 snd_hda_codec_write_cache(codec, 0x0f, 0,
5188 AC_VERB_SET_PIN_WIDGET_CONTROL,
5191 snd_hda_codec_write_cache(codec, 0x01, 0,
5192 AC_VERB_SET_GPIO_DATA, 0);
5193 snd_hda_codec_write_cache(codec, 0x0f, 0,
5194 AC_VERB_SET_PIN_WIDGET_CONTROL,
5199 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5202 if ((res >> 26) == ALC880_HP_EVENT)
5203 alc260_replacer_672v_automute(codec);
5206 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5207 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5208 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5209 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5210 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5211 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5213 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5214 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5215 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5216 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5220 /* Test configuration for debugging, modelled after the ALC880 test
5223 #ifdef CONFIG_SND_DEBUG
5224 static hda_nid_t alc260_test_dac_nids[1] = {
5227 static hda_nid_t alc260_test_adc_nids[2] = {
5230 /* For testing the ALC260, each input MUX needs its own definition since
5231 * the signal assignments are different. This assumes that the first ADC
5234 static struct hda_input_mux alc260_test_capture_sources[2] = {
5238 { "MIC1 pin", 0x0 },
5239 { "MIC2 pin", 0x1 },
5240 { "LINE1 pin", 0x2 },
5241 { "LINE2 pin", 0x3 },
5243 { "LINE-OUT pin", 0x5 },
5244 { "HP-OUT pin", 0x6 },
5250 { "MIC1 pin", 0x0 },
5251 { "MIC2 pin", 0x1 },
5252 { "LINE1 pin", 0x2 },
5253 { "LINE2 pin", 0x3 },
5256 { "LINE-OUT pin", 0x6 },
5257 { "HP-OUT pin", 0x7 },
5261 static struct snd_kcontrol_new alc260_test_mixer[] = {
5262 /* Output driver widgets */
5263 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5264 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5265 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5266 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5267 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5268 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5270 /* Modes for retasking pin widgets
5271 * Note: the ALC260 doesn't seem to act on requests to enable mic
5272 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5273 * mention this restriction. At this stage it's not clear whether
5274 * this behaviour is intentional or is a hardware bug in chip
5275 * revisions available at least up until early 2006. Therefore for
5276 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5277 * choices, but if it turns out that the lack of mic bias for these
5278 * NIDs is intentional we could change their modes from
5279 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5281 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5282 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5283 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5284 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5285 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5286 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5288 /* Loopback mixer controls */
5289 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5290 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5291 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5292 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5293 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5294 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5295 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5296 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5297 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5298 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5299 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5300 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5301 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5302 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5303 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5304 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5306 /* Controls for GPIO pins, assuming they are configured as outputs */
5307 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5308 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5309 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5310 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5312 /* Switches to allow the digital IO pins to be enabled. The datasheet
5313 * is ambigious as to which NID is which; testing on laptops which
5314 * make this output available should provide clarification.
5316 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5317 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5319 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5320 * this output to turn on an external amplifier.
5322 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5323 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5327 static struct hda_verb alc260_test_init_verbs[] = {
5328 /* Enable all GPIOs as outputs with an initial value of 0 */
5329 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5330 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5331 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5333 /* Enable retasking pins as output, initially without power amp */
5334 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5335 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5338 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5339 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5341 /* Disable digital (SPDIF) pins initially, but users can enable
5342 * them via a mixer switch. In the case of SPDIF-out, this initverb
5343 * payload also sets the generation to 0, output to be in "consumer"
5344 * PCM format, copyright asserted, no pre-emphasis and no validity
5347 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5348 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5350 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5351 * OUT1 sum bus when acting as an output.
5353 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5354 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5355 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5356 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5358 /* Start with output sum widgets muted and their output gains at min */
5359 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5360 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5362 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5365 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5366 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5367 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5369 /* Unmute retasking pin widget output buffers since the default
5370 * state appears to be output. As the pin mode is changed by the
5371 * user the pin mode control will take care of enabling the pin's
5372 * input/output buffers as needed.
5374 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5375 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5376 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5377 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5378 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5379 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5380 /* Also unmute the mono-out pin widget */
5381 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5383 /* Mute capture amp left and right */
5384 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5385 /* Set ADC connection select to match default mixer setting (mic1
5388 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5390 /* Do the same for the second ADC: mute capture input amp and
5391 * set ADC connection to mic1 pin
5393 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5394 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5396 /* Mute all inputs to mixer widget (even unconnected ones) */
5397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5402 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5403 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5410 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5411 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5413 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5414 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5417 * for BIOS auto-configuration
5420 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5421 const char *pfx, int *vol_bits)
5424 unsigned long vol_val, sw_val;
5428 if (nid >= 0x0f && nid < 0x11) {
5429 nid_vol = nid - 0x7;
5430 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5431 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5432 } else if (nid == 0x11) {
5433 nid_vol = nid - 0x7;
5434 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5435 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5436 } else if (nid >= 0x12 && nid <= 0x15) {
5438 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5439 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5443 if (!(*vol_bits & (1 << nid_vol))) {
5444 /* first control for the volume widget */
5445 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5446 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5449 *vol_bits |= (1 << nid_vol);
5451 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5452 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5458 /* add playback controls from the parsed DAC table */
5459 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5460 const struct auto_pin_cfg *cfg)
5466 spec->multiout.num_dacs = 1;
5467 spec->multiout.dac_nids = spec->private_dac_nids;
5468 spec->multiout.dac_nids[0] = 0x02;
5470 nid = cfg->line_out_pins[0];
5472 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5477 nid = cfg->speaker_pins[0];
5479 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5484 nid = cfg->hp_pins[0];
5486 err = alc260_add_playback_controls(spec, nid, "Headphone",
5494 /* create playback/capture controls for input pins */
5495 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5496 const struct auto_pin_cfg *cfg)
5498 struct hda_input_mux *imux = &spec->private_imux[0];
5501 for (i = 0; i < AUTO_PIN_LAST; i++) {
5502 if (cfg->input_pins[i] >= 0x12) {
5503 idx = cfg->input_pins[i] - 0x12;
5504 err = new_analog_input(spec, cfg->input_pins[i],
5505 auto_pin_cfg_labels[i], idx,
5509 imux->items[imux->num_items].label =
5510 auto_pin_cfg_labels[i];
5511 imux->items[imux->num_items].index = idx;
5514 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5515 idx = cfg->input_pins[i] - 0x09;
5516 err = new_analog_input(spec, cfg->input_pins[i],
5517 auto_pin_cfg_labels[i], idx,
5521 imux->items[imux->num_items].label =
5522 auto_pin_cfg_labels[i];
5523 imux->items[imux->num_items].index = idx;
5530 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5531 hda_nid_t nid, int pin_type,
5534 alc_set_pin_output(codec, nid, pin_type);
5535 /* need the manual connection? */
5537 int idx = nid - 0x12;
5538 snd_hda_codec_write(codec, idx + 0x0b, 0,
5539 AC_VERB_SET_CONNECT_SEL, sel_idx);
5543 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5545 struct alc_spec *spec = codec->spec;
5548 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5549 nid = spec->autocfg.line_out_pins[0];
5551 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5552 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5555 nid = spec->autocfg.speaker_pins[0];
5557 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5559 nid = spec->autocfg.hp_pins[0];
5561 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5564 #define ALC260_PIN_CD_NID 0x16
5565 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5567 struct alc_spec *spec = codec->spec;
5570 for (i = 0; i < AUTO_PIN_LAST; i++) {
5571 hda_nid_t nid = spec->autocfg.input_pins[i];
5573 snd_hda_codec_write(codec, nid, 0,
5574 AC_VERB_SET_PIN_WIDGET_CONTROL,
5575 i <= AUTO_PIN_FRONT_MIC ?
5576 PIN_VREF80 : PIN_IN);
5577 if (nid != ALC260_PIN_CD_NID)
5578 snd_hda_codec_write(codec, nid, 0,
5579 AC_VERB_SET_AMP_GAIN_MUTE,
5586 * generic initialization of ADC, input mixers and output mixers
5588 static struct hda_verb alc260_volume_init_verbs[] = {
5590 * Unmute ADC0-1 and set the default input to mic-in
5592 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5593 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5594 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5595 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5597 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5599 * Note: PASD motherboards uses the Line In 2 as the input for
5600 * front panel mic (mic 2)
5602 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5603 /* mute analog inputs */
5604 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5605 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5606 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5607 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5611 * Set up output mixers (0x08 - 0x0a)
5613 /* set vol=0 to output mixers */
5614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5615 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5616 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5617 /* set up input amps for analog loopback */
5618 /* Amp Indices: DAC = 0, mixer = 1 */
5619 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5620 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5621 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5622 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5623 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5624 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5629 static int alc260_parse_auto_config(struct hda_codec *codec)
5631 struct alc_spec *spec = codec->spec;
5633 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5635 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5639 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5642 if (!spec->kctls.list)
5643 return 0; /* can't find valid BIOS pin config */
5644 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5648 spec->multiout.max_channels = 2;
5650 if (spec->autocfg.dig_out_pin)
5651 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5652 if (spec->kctls.list)
5653 add_mixer(spec, spec->kctls.list);
5655 add_verb(spec, alc260_volume_init_verbs);
5657 spec->num_mux_defs = 1;
5658 spec->input_mux = &spec->private_imux[0];
5660 store_pin_configs(codec);
5664 /* additional initialization for auto-configuration model */
5665 static void alc260_auto_init(struct hda_codec *codec)
5667 struct alc_spec *spec = codec->spec;
5668 alc260_auto_init_multi_out(codec);
5669 alc260_auto_init_analog_input(codec);
5670 if (spec->unsol_event)
5671 alc_inithook(codec);
5674 #ifdef CONFIG_SND_HDA_POWER_SAVE
5675 static struct hda_amp_list alc260_loopbacks[] = {
5676 { 0x07, HDA_INPUT, 0 },
5677 { 0x07, HDA_INPUT, 1 },
5678 { 0x07, HDA_INPUT, 2 },
5679 { 0x07, HDA_INPUT, 3 },
5680 { 0x07, HDA_INPUT, 4 },
5686 * ALC260 configurations
5688 static const char *alc260_models[ALC260_MODEL_LAST] = {
5689 [ALC260_BASIC] = "basic",
5691 [ALC260_HP_3013] = "hp-3013",
5692 [ALC260_HP_DC7600] = "hp-dc7600",
5693 [ALC260_FUJITSU_S702X] = "fujitsu",
5694 [ALC260_ACER] = "acer",
5695 [ALC260_WILL] = "will",
5696 [ALC260_REPLACER_672V] = "replacer",
5697 #ifdef CONFIG_SND_DEBUG
5698 [ALC260_TEST] = "test",
5700 [ALC260_AUTO] = "auto",
5703 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5704 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5705 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5706 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5707 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5708 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5709 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5710 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5711 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5712 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5713 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5714 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5715 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5716 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5717 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5718 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5719 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5720 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5721 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5725 static struct alc_config_preset alc260_presets[] = {
5727 .mixers = { alc260_base_output_mixer,
5729 alc260_pc_beep_mixer },
5730 .init_verbs = { alc260_init_verbs },
5731 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5732 .dac_nids = alc260_dac_nids,
5733 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5734 .adc_nids = alc260_adc_nids,
5735 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5736 .channel_mode = alc260_modes,
5737 .input_mux = &alc260_capture_source,
5740 .mixers = { alc260_hp_output_mixer,
5741 alc260_input_mixer },
5742 .init_verbs = { alc260_init_verbs,
5743 alc260_hp_unsol_verbs },
5744 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5745 .dac_nids = alc260_dac_nids,
5746 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5747 .adc_nids = alc260_adc_nids_alt,
5748 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5749 .channel_mode = alc260_modes,
5750 .input_mux = &alc260_capture_source,
5751 .unsol_event = alc260_hp_unsol_event,
5752 .init_hook = alc260_hp_automute,
5754 [ALC260_HP_DC7600] = {
5755 .mixers = { alc260_hp_dc7600_mixer,
5756 alc260_input_mixer },
5757 .init_verbs = { alc260_init_verbs,
5758 alc260_hp_dc7600_verbs },
5759 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5760 .dac_nids = alc260_dac_nids,
5761 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5762 .adc_nids = alc260_adc_nids_alt,
5763 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5764 .channel_mode = alc260_modes,
5765 .input_mux = &alc260_capture_source,
5766 .unsol_event = alc260_hp_3012_unsol_event,
5767 .init_hook = alc260_hp_3012_automute,
5769 [ALC260_HP_3013] = {
5770 .mixers = { alc260_hp_3013_mixer,
5771 alc260_input_mixer },
5772 .init_verbs = { alc260_hp_3013_init_verbs,
5773 alc260_hp_3013_unsol_verbs },
5774 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5775 .dac_nids = alc260_dac_nids,
5776 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5777 .adc_nids = alc260_adc_nids_alt,
5778 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5779 .channel_mode = alc260_modes,
5780 .input_mux = &alc260_capture_source,
5781 .unsol_event = alc260_hp_3013_unsol_event,
5782 .init_hook = alc260_hp_3013_automute,
5784 [ALC260_FUJITSU_S702X] = {
5785 .mixers = { alc260_fujitsu_mixer },
5786 .init_verbs = { alc260_fujitsu_init_verbs },
5787 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5788 .dac_nids = alc260_dac_nids,
5789 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5790 .adc_nids = alc260_dual_adc_nids,
5791 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5792 .channel_mode = alc260_modes,
5793 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5794 .input_mux = alc260_fujitsu_capture_sources,
5797 .mixers = { alc260_acer_mixer },
5798 .init_verbs = { alc260_acer_init_verbs },
5799 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5800 .dac_nids = alc260_dac_nids,
5801 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5802 .adc_nids = alc260_dual_adc_nids,
5803 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5804 .channel_mode = alc260_modes,
5805 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5806 .input_mux = alc260_acer_capture_sources,
5809 .mixers = { alc260_will_mixer },
5810 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5811 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5812 .dac_nids = alc260_dac_nids,
5813 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5814 .adc_nids = alc260_adc_nids,
5815 .dig_out_nid = ALC260_DIGOUT_NID,
5816 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5817 .channel_mode = alc260_modes,
5818 .input_mux = &alc260_capture_source,
5820 [ALC260_REPLACER_672V] = {
5821 .mixers = { alc260_replacer_672v_mixer },
5822 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5823 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5824 .dac_nids = alc260_dac_nids,
5825 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5826 .adc_nids = alc260_adc_nids,
5827 .dig_out_nid = ALC260_DIGOUT_NID,
5828 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5829 .channel_mode = alc260_modes,
5830 .input_mux = &alc260_capture_source,
5831 .unsol_event = alc260_replacer_672v_unsol_event,
5832 .init_hook = alc260_replacer_672v_automute,
5834 #ifdef CONFIG_SND_DEBUG
5836 .mixers = { alc260_test_mixer },
5837 .init_verbs = { alc260_test_init_verbs },
5838 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5839 .dac_nids = alc260_test_dac_nids,
5840 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5841 .adc_nids = alc260_test_adc_nids,
5842 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5843 .channel_mode = alc260_modes,
5844 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5845 .input_mux = alc260_test_capture_sources,
5850 static int patch_alc260(struct hda_codec *codec)
5852 struct alc_spec *spec;
5853 int err, board_config;
5855 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5861 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5864 if (board_config < 0) {
5865 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5866 "trying auto-probe from BIOS...\n");
5867 board_config = ALC260_AUTO;
5870 if (board_config == ALC260_AUTO) {
5871 /* automatic parse from the BIOS config */
5872 err = alc260_parse_auto_config(codec);
5878 "hda_codec: Cannot set up configuration "
5879 "from BIOS. Using base mode...\n");
5880 board_config = ALC260_BASIC;
5884 if (board_config != ALC260_AUTO)
5885 setup_preset(spec, &alc260_presets[board_config]);
5887 spec->stream_name_analog = "ALC260 Analog";
5888 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5889 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5891 spec->stream_name_digital = "ALC260 Digital";
5892 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5893 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5895 if (!spec->adc_nids && spec->input_mux) {
5896 /* check whether NID 0x04 is valid */
5897 unsigned int wcap = get_wcaps(codec, 0x04);
5898 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5900 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5901 spec->adc_nids = alc260_adc_nids_alt;
5902 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5904 spec->adc_nids = alc260_adc_nids;
5905 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5908 set_capture_mixer(spec);
5910 spec->vmaster_nid = 0x08;
5912 codec->patch_ops = alc_patch_ops;
5913 if (board_config == ALC260_AUTO)
5914 spec->init_hook = alc260_auto_init;
5915 #ifdef CONFIG_SND_HDA_POWER_SAVE
5916 if (!spec->loopback.amplist)
5917 spec->loopback.amplist = alc260_loopbacks;
5919 codec->proc_widget_hook = print_realtek_coef;
5928 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5929 * configuration. Each pin widget can choose any input DACs and a mixer.
5930 * Each ADC is connected from a mixer of all inputs. This makes possible
5931 * 6-channel independent captures.
5933 * In addition, an independent DAC for the multi-playback (not used in this
5936 #define ALC882_DIGOUT_NID 0x06
5937 #define ALC882_DIGIN_NID 0x0a
5939 static struct hda_channel_mode alc882_ch_modes[1] = {
5943 static hda_nid_t alc882_dac_nids[4] = {
5944 /* front, rear, clfe, rear_surr */
5945 0x02, 0x03, 0x04, 0x05
5948 /* identical with ALC880 */
5949 #define alc882_adc_nids alc880_adc_nids
5950 #define alc882_adc_nids_alt alc880_adc_nids_alt
5952 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5953 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5956 /* FIXME: should be a matrix-type input source selection */
5958 static struct hda_input_mux alc882_capture_source = {
5962 { "Front Mic", 0x1 },
5970 static struct hda_verb alc882_3ST_ch2_init[] = {
5971 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5972 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5973 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5974 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5981 static struct hda_verb alc882_3ST_ch6_init[] = {
5982 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5983 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5984 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5985 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5986 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5987 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5991 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5992 { 2, alc882_3ST_ch2_init },
5993 { 6, alc882_3ST_ch6_init },
5999 static struct hda_verb alc882_sixstack_ch6_init[] = {
6000 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6001 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6002 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6003 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6010 static struct hda_verb alc882_sixstack_ch8_init[] = {
6011 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6012 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6013 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6014 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6018 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6019 { 6, alc882_sixstack_ch6_init },
6020 { 8, alc882_sixstack_ch8_init },
6024 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6030 static struct hda_verb alc885_mbp_ch2_init[] = {
6031 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6032 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6033 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6040 static struct hda_verb alc885_mbp_ch6_init[] = {
6041 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6042 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6043 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6044 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6045 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6049 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6050 { 2, alc885_mbp_ch2_init },
6051 { 6, alc885_mbp_ch6_init },
6055 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6056 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6058 static struct snd_kcontrol_new alc882_base_mixer[] = {
6059 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6060 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6061 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6062 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6063 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6064 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6065 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6066 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6067 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6068 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6069 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6070 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6071 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6072 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6073 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6074 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6075 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6076 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6077 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6078 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6079 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6080 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6081 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6085 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6087 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6088 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6089 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6090 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6091 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6093 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6094 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6095 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6098 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6099 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6100 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6101 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6102 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6103 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6104 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6106 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6107 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6108 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6109 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6113 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6117 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6118 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6119 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6120 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6122 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6123 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6124 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6125 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6126 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6130 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6131 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6133 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6135 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6136 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6137 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6142 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6143 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6150 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6151 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6152 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6153 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6154 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6155 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6156 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6157 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6159 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6160 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6161 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6162 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6166 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6169 .name = "Channel Mode",
6170 .info = alc_ch_mode_info,
6171 .get = alc_ch_mode_get,
6172 .put = alc_ch_mode_put,
6177 static struct hda_verb alc882_init_verbs[] = {
6178 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6183 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6184 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6185 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6187 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6188 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6189 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6191 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6192 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6193 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6195 /* Front Pin: output 0 (0x0c) */
6196 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6197 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6198 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6199 /* Rear Pin: output 1 (0x0d) */
6200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6202 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6203 /* CLFE Pin: output 2 (0x0e) */
6204 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6205 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6206 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6207 /* Side Pin: output 3 (0x0f) */
6208 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6209 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6210 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6211 /* Mic (rear) pin: input vref at 80% */
6212 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6213 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6214 /* Front Mic pin: input vref at 80% */
6215 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6216 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6217 /* Line In pin: input */
6218 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6219 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6220 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6221 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6222 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6223 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6224 /* CD pin widget for input */
6225 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6227 /* FIXME: use matrix-type input source selection */
6228 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6229 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6235 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6236 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6237 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6238 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6240 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6241 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6242 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6243 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6244 /* ADC1: mute amp left and right */
6245 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6246 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6247 /* ADC2: mute amp left and right */
6248 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6249 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6250 /* ADC3: mute amp left and right */
6251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6252 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6257 static struct hda_verb alc882_eapd_verbs[] = {
6258 /* change to EAPD mode */
6259 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6260 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6265 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6266 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6267 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6271 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6272 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6276 static struct hda_verb alc882_macpro_init_verbs[] = {
6277 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6281 /* Front Pin: output 0 (0x0c) */
6282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6284 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6285 /* Front Mic pin: input vref at 80% */
6286 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6287 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6288 /* Speaker: output */
6289 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6290 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6291 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6292 /* Headphone output (output 0 - 0x0c) */
6293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6295 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6297 /* FIXME: use matrix-type input source selection */
6298 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6299 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6314 /* ADC1: mute amp left and right */
6315 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6316 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6317 /* ADC2: mute amp left and right */
6318 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6319 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6320 /* ADC3: mute amp left and right */
6321 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6322 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6327 /* Macbook Pro rev3 */
6328 static struct hda_verb alc885_mbp3_init_verbs[] = {
6329 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6337 /* Front Pin: output 0 (0x0c) */
6338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6339 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6340 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6341 /* HP Pin: output 0 (0x0d) */
6342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6345 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6346 /* Mic (rear) pin: input vref at 80% */
6347 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6348 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6349 /* Front Mic pin: input vref at 80% */
6350 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6351 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6352 /* Line In pin: use output 1 when in LineOut mode */
6353 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6354 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6355 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6357 /* FIXME: use matrix-type input source selection */
6358 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6359 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6374 /* ADC1: mute amp left and right */
6375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6376 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6377 /* ADC2: mute amp left and right */
6378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6379 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6380 /* ADC3: mute amp left and right */
6381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6382 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6387 /* iMac 24 mixer. */
6388 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6389 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6390 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6394 /* iMac 24 init verbs. */
6395 static struct hda_verb alc885_imac24_init_verbs[] = {
6396 /* Internal speakers: output 0 (0x0c) */
6397 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6398 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6399 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6400 /* Internal speakers: output 0 (0x0c) */
6401 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6402 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6403 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6404 /* Headphone: output 0 (0x0c) */
6405 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6406 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6407 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6408 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6409 /* Front Mic: input vref at 80% */
6410 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6411 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6415 /* Toggle speaker-output according to the hp-jack state */
6416 static void alc885_imac24_automute(struct hda_codec *codec)
6418 unsigned int present;
6420 present = snd_hda_codec_read(codec, 0x14, 0,
6421 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6422 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6423 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6424 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6425 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6428 /* Processes unsolicited events. */
6429 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6432 /* Headphone insertion or removal. */
6433 if ((res >> 26) == ALC880_HP_EVENT)
6434 alc885_imac24_automute(codec);
6437 static void alc885_mbp3_automute(struct hda_codec *codec)
6439 unsigned int present;
6441 present = snd_hda_codec_read(codec, 0x15, 0,
6442 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6443 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6444 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6445 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6446 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6449 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6452 /* Headphone insertion or removal. */
6453 if ((res >> 26) == ALC880_HP_EVENT)
6454 alc885_mbp3_automute(codec);
6458 static struct hda_verb alc882_targa_verbs[] = {
6459 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6463 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6465 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6466 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6467 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6469 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6470 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6471 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6472 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6476 /* toggle speaker-output according to the hp-jack state */
6477 static void alc882_targa_automute(struct hda_codec *codec)
6479 unsigned int present;
6481 present = snd_hda_codec_read(codec, 0x14, 0,
6482 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6483 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6484 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6485 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6489 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6491 /* Looks like the unsol event is incompatible with the standard
6492 * definition. 4bit tag is placed at 26 bit!
6494 if (((res >> 26) == ALC880_HP_EVENT)) {
6495 alc882_targa_automute(codec);
6499 static struct hda_verb alc882_asus_a7j_verbs[] = {
6500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6505 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6507 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6508 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6509 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6511 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6512 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6513 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6517 static struct hda_verb alc882_asus_a7m_verbs[] = {
6518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6525 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6526 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6527 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6529 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6530 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6531 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6535 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6537 unsigned int gpiostate, gpiomask, gpiodir;
6539 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6540 AC_VERB_GET_GPIO_DATA, 0);
6543 gpiostate |= (1 << pin);
6545 gpiostate &= ~(1 << pin);
6547 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6548 AC_VERB_GET_GPIO_MASK, 0);
6549 gpiomask |= (1 << pin);
6551 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6552 AC_VERB_GET_GPIO_DIRECTION, 0);
6553 gpiodir |= (1 << pin);
6556 snd_hda_codec_write(codec, codec->afg, 0,
6557 AC_VERB_SET_GPIO_MASK, gpiomask);
6558 snd_hda_codec_write(codec, codec->afg, 0,
6559 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6563 snd_hda_codec_write(codec, codec->afg, 0,
6564 AC_VERB_SET_GPIO_DATA, gpiostate);
6567 /* set up GPIO at initialization */
6568 static void alc885_macpro_init_hook(struct hda_codec *codec)
6570 alc882_gpio_mute(codec, 0, 0);
6571 alc882_gpio_mute(codec, 1, 0);
6574 /* set up GPIO and update auto-muting at initialization */
6575 static void alc885_imac24_init_hook(struct hda_codec *codec)
6577 alc885_macpro_init_hook(codec);
6578 alc885_imac24_automute(codec);
6582 * generic initialization of ADC, input mixers and output mixers
6584 static struct hda_verb alc882_auto_init_verbs[] = {
6586 * Unmute ADC0-2 and set the default input to mic-in
6588 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6589 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6590 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6591 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6592 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6593 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6595 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6597 * Note: PASD motherboards uses the Line In 2 as the input for
6598 * front panel mic (mic 2)
6600 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6601 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6608 * Set up output mixers (0x0c - 0x0f)
6610 /* set vol=0 to output mixers */
6611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6612 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6613 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6614 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6615 /* set up input amps for analog loopback */
6616 /* Amp Indices: DAC = 0, mixer = 1 */
6617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6623 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6624 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6625 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6626 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6628 /* FIXME: use matrix-type input source selection */
6629 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6630 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6631 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6632 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6633 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6634 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6637 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6638 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6639 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6643 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6649 #ifdef CONFIG_SND_HDA_POWER_SAVE
6650 #define alc882_loopbacks alc880_loopbacks
6653 /* pcm configuration: identiacal with ALC880 */
6654 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6655 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6656 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6657 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6660 * configuration and preset
6662 static const char *alc882_models[ALC882_MODEL_LAST] = {
6663 [ALC882_3ST_DIG] = "3stack-dig",
6664 [ALC882_6ST_DIG] = "6stack-dig",
6665 [ALC882_ARIMA] = "arima",
6666 [ALC882_W2JC] = "w2jc",
6667 [ALC882_TARGA] = "targa",
6668 [ALC882_ASUS_A7J] = "asus-a7j",
6669 [ALC882_ASUS_A7M] = "asus-a7m",
6670 [ALC885_MACPRO] = "macpro",
6671 [ALC885_MBP3] = "mbp3",
6672 [ALC885_IMAC24] = "imac24",
6673 [ALC882_AUTO] = "auto",
6676 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6677 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6678 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6679 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6680 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6681 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6682 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6683 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6684 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6685 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6686 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6687 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6688 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6692 static struct alc_config_preset alc882_presets[] = {
6693 [ALC882_3ST_DIG] = {
6694 .mixers = { alc882_base_mixer },
6695 .init_verbs = { alc882_init_verbs },
6696 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6697 .dac_nids = alc882_dac_nids,
6698 .dig_out_nid = ALC882_DIGOUT_NID,
6699 .dig_in_nid = ALC882_DIGIN_NID,
6700 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6701 .channel_mode = alc882_ch_modes,
6703 .input_mux = &alc882_capture_source,
6705 [ALC882_6ST_DIG] = {
6706 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6707 .init_verbs = { alc882_init_verbs },
6708 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6709 .dac_nids = alc882_dac_nids,
6710 .dig_out_nid = ALC882_DIGOUT_NID,
6711 .dig_in_nid = ALC882_DIGIN_NID,
6712 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6713 .channel_mode = alc882_sixstack_modes,
6714 .input_mux = &alc882_capture_source,
6717 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6718 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6719 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6720 .dac_nids = alc882_dac_nids,
6721 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6722 .channel_mode = alc882_sixstack_modes,
6723 .input_mux = &alc882_capture_source,
6726 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6727 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6728 alc880_gpio1_init_verbs },
6729 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6730 .dac_nids = alc882_dac_nids,
6731 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6732 .channel_mode = alc880_threestack_modes,
6734 .input_mux = &alc882_capture_source,
6735 .dig_out_nid = ALC882_DIGOUT_NID,
6738 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6739 .init_verbs = { alc885_mbp3_init_verbs,
6740 alc880_gpio1_init_verbs },
6741 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6742 .dac_nids = alc882_dac_nids,
6743 .channel_mode = alc885_mbp_6ch_modes,
6744 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6745 .input_mux = &alc882_capture_source,
6746 .dig_out_nid = ALC882_DIGOUT_NID,
6747 .dig_in_nid = ALC882_DIGIN_NID,
6748 .unsol_event = alc885_mbp3_unsol_event,
6749 .init_hook = alc885_mbp3_automute,
6752 .mixers = { alc882_macpro_mixer },
6753 .init_verbs = { alc882_macpro_init_verbs },
6754 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6755 .dac_nids = alc882_dac_nids,
6756 .dig_out_nid = ALC882_DIGOUT_NID,
6757 .dig_in_nid = ALC882_DIGIN_NID,
6758 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6759 .channel_mode = alc882_ch_modes,
6760 .input_mux = &alc882_capture_source,
6761 .init_hook = alc885_macpro_init_hook,
6764 .mixers = { alc885_imac24_mixer },
6765 .init_verbs = { alc885_imac24_init_verbs },
6766 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6767 .dac_nids = alc882_dac_nids,
6768 .dig_out_nid = ALC882_DIGOUT_NID,
6769 .dig_in_nid = ALC882_DIGIN_NID,
6770 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6771 .channel_mode = alc882_ch_modes,
6772 .input_mux = &alc882_capture_source,
6773 .unsol_event = alc885_imac24_unsol_event,
6774 .init_hook = alc885_imac24_init_hook,
6777 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6778 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6779 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6780 .dac_nids = alc882_dac_nids,
6781 .dig_out_nid = ALC882_DIGOUT_NID,
6782 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6783 .adc_nids = alc882_adc_nids,
6784 .capsrc_nids = alc882_capsrc_nids,
6785 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6786 .channel_mode = alc882_3ST_6ch_modes,
6788 .input_mux = &alc882_capture_source,
6789 .unsol_event = alc882_targa_unsol_event,
6790 .init_hook = alc882_targa_automute,
6792 [ALC882_ASUS_A7J] = {
6793 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6794 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6795 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6796 .dac_nids = alc882_dac_nids,
6797 .dig_out_nid = ALC882_DIGOUT_NID,
6798 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6799 .adc_nids = alc882_adc_nids,
6800 .capsrc_nids = alc882_capsrc_nids,
6801 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6802 .channel_mode = alc882_3ST_6ch_modes,
6804 .input_mux = &alc882_capture_source,
6806 [ALC882_ASUS_A7M] = {
6807 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6808 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6809 alc880_gpio1_init_verbs,
6810 alc882_asus_a7m_verbs },
6811 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6812 .dac_nids = alc882_dac_nids,
6813 .dig_out_nid = ALC882_DIGOUT_NID,
6814 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6815 .channel_mode = alc880_threestack_modes,
6817 .input_mux = &alc882_capture_source,
6826 PINFIX_ABIT_AW9D_MAX
6829 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6830 { 0x15, 0x01080104 }, /* side */
6831 { 0x16, 0x01011012 }, /* rear */
6832 { 0x17, 0x01016011 }, /* clfe */
6836 static const struct alc_pincfg *alc882_pin_fixes[] = {
6837 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6840 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6841 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6846 * BIOS auto configuration
6848 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6849 hda_nid_t nid, int pin_type,
6853 struct alc_spec *spec = codec->spec;
6856 alc_set_pin_output(codec, nid, pin_type);
6857 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6860 idx = spec->multiout.dac_nids[dac_idx] - 2;
6861 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6865 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6867 struct alc_spec *spec = codec->spec;
6870 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6871 for (i = 0; i <= HDA_SIDE; i++) {
6872 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6873 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6875 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6880 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6882 struct alc_spec *spec = codec->spec;
6885 pin = spec->autocfg.hp_pins[0];
6886 if (pin) /* connect to front */
6888 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6889 pin = spec->autocfg.speaker_pins[0];
6891 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6894 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6895 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6897 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6899 struct alc_spec *spec = codec->spec;
6902 for (i = 0; i < AUTO_PIN_LAST; i++) {
6903 hda_nid_t nid = spec->autocfg.input_pins[i];
6908 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6909 unsigned int pincap;
6910 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6911 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6915 snd_hda_codec_write(codec, nid, 0,
6916 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6917 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6918 snd_hda_codec_write(codec, nid, 0,
6919 AC_VERB_SET_AMP_GAIN_MUTE,
6924 static void alc882_auto_init_input_src(struct hda_codec *codec)
6926 struct alc_spec *spec = codec->spec;
6927 const struct hda_input_mux *imux = spec->input_mux;
6930 for (c = 0; c < spec->num_adc_nids; c++) {
6931 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6932 hda_nid_t nid = spec->capsrc_nids[c];
6933 int conns, mute, idx, item;
6935 conns = snd_hda_get_connections(codec, nid, conn_list,
6936 ARRAY_SIZE(conn_list));
6939 for (idx = 0; idx < conns; idx++) {
6940 /* if the current connection is the selected one,
6941 * unmute it as default - otherwise mute it
6943 mute = AMP_IN_MUTE(idx);
6944 for (item = 0; item < imux->num_items; item++) {
6945 if (imux->items[item].index == idx) {
6946 if (spec->cur_mux[c] == item)
6947 mute = AMP_IN_UNMUTE(idx);
6951 snd_hda_codec_write(codec, nid, 0,
6952 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6957 /* add mic boosts if needed */
6958 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6960 struct alc_spec *spec = codec->spec;
6964 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6965 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6966 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6968 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6972 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6973 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6974 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6976 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6983 /* almost identical with ALC880 parser... */
6984 static int alc882_parse_auto_config(struct hda_codec *codec)
6986 struct alc_spec *spec = codec->spec;
6987 int err = alc880_parse_auto_config(codec);
6992 return 0; /* no config found */
6994 err = alc_auto_add_mic_boost(codec);
6998 /* hack - override the init verbs */
6999 spec->init_verbs[0] = alc882_auto_init_verbs;
7001 return 1; /* config found */
7004 /* additional initialization for auto-configuration model */
7005 static void alc882_auto_init(struct hda_codec *codec)
7007 struct alc_spec *spec = codec->spec;
7008 alc882_auto_init_multi_out(codec);
7009 alc882_auto_init_hp_out(codec);
7010 alc882_auto_init_analog_input(codec);
7011 alc882_auto_init_input_src(codec);
7012 if (spec->unsol_event)
7013 alc_inithook(codec);
7016 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7018 static int patch_alc882(struct hda_codec *codec)
7020 struct alc_spec *spec;
7021 int err, board_config;
7023 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7029 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7033 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7034 /* Pick up systems that don't supply PCI SSID */
7035 switch (codec->subsystem_id) {
7036 case 0x106b0c00: /* Mac Pro */
7037 board_config = ALC885_MACPRO;
7039 case 0x106b1000: /* iMac 24 */
7040 case 0x106b2800: /* AppleTV */
7041 board_config = ALC885_IMAC24;
7043 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7044 case 0x106b00a4: /* MacbookPro4,1 */
7045 case 0x106b2c00: /* Macbook Pro rev3 */
7046 case 0x106b3600: /* Macbook 3.1 */
7047 board_config = ALC885_MBP3;
7050 /* ALC889A is handled better as ALC888-compatible */
7051 if (codec->revision_id == 0x100101 ||
7052 codec->revision_id == 0x100103) {
7054 return patch_alc883(codec);
7056 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7057 "trying auto-probe from BIOS...\n");
7058 board_config = ALC882_AUTO;
7062 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7064 if (board_config == ALC882_AUTO) {
7065 /* automatic parse from the BIOS config */
7066 err = alc882_parse_auto_config(codec);
7072 "hda_codec: Cannot set up configuration "
7073 "from BIOS. Using base mode...\n");
7074 board_config = ALC882_3ST_DIG;
7078 if (board_config != ALC882_AUTO)
7079 setup_preset(spec, &alc882_presets[board_config]);
7081 if (codec->vendor_id == 0x10ec0885) {
7082 spec->stream_name_analog = "ALC885 Analog";
7083 spec->stream_name_digital = "ALC885 Digital";
7085 spec->stream_name_analog = "ALC882 Analog";
7086 spec->stream_name_digital = "ALC882 Digital";
7089 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7090 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7091 /* FIXME: setup DAC5 */
7092 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7093 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7095 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7096 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7098 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7099 if (!spec->adc_nids && spec->input_mux) {
7100 /* check whether NID 0x07 is valid */
7101 unsigned int wcap = get_wcaps(codec, 0x07);
7103 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7104 if (wcap != AC_WID_AUD_IN) {
7105 spec->adc_nids = alc882_adc_nids_alt;
7106 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7107 spec->capsrc_nids = alc882_capsrc_nids_alt;
7109 spec->adc_nids = alc882_adc_nids;
7110 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7111 spec->capsrc_nids = alc882_capsrc_nids;
7114 set_capture_mixer(spec);
7116 spec->vmaster_nid = 0x0c;
7118 codec->patch_ops = alc_patch_ops;
7119 if (board_config == ALC882_AUTO)
7120 spec->init_hook = alc882_auto_init;
7121 #ifdef CONFIG_SND_HDA_POWER_SAVE
7122 if (!spec->loopback.amplist)
7123 spec->loopback.amplist = alc882_loopbacks;
7125 codec->proc_widget_hook = print_realtek_coef;
7133 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7134 * configuration. Each pin widget can choose any input DACs and a mixer.
7135 * Each ADC is connected from a mixer of all inputs. This makes possible
7136 * 6-channel independent captures.
7138 * In addition, an independent DAC for the multi-playback (not used in this
7141 #define ALC883_DIGOUT_NID 0x06
7142 #define ALC883_DIGIN_NID 0x0a
7144 #define ALC1200_DIGOUT_NID 0x10
7146 static hda_nid_t alc883_dac_nids[4] = {
7147 /* front, rear, clfe, rear_surr */
7148 0x02, 0x03, 0x04, 0x05
7151 static hda_nid_t alc883_adc_nids[2] = {
7156 static hda_nid_t alc883_adc_nids_alt[1] = {
7161 static hda_nid_t alc883_adc_nids_rev[2] = {
7166 #define alc889_adc_nids alc880_adc_nids
7168 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7170 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7172 #define alc889_capsrc_nids alc882_capsrc_nids
7175 /* FIXME: should be a matrix-type input source selection */
7177 static struct hda_input_mux alc883_capture_source = {
7181 { "Front Mic", 0x1 },
7187 static struct hda_input_mux alc883_3stack_6ch_intel = {
7191 { "Front Mic", 0x0 },
7197 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7205 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7215 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7223 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7227 { "Front Mic", 0x1 },
7232 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7243 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7250 static struct hda_verb alc883_3ST_ch2_init[] = {
7251 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7252 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7253 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7254 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7261 static struct hda_verb alc883_3ST_ch4_init[] = {
7262 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7263 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7264 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7265 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7266 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7273 static struct hda_verb alc883_3ST_ch6_init[] = {
7274 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7275 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7276 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7277 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7278 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7279 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7283 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7284 { 2, alc883_3ST_ch2_init },
7285 { 4, alc883_3ST_ch4_init },
7286 { 6, alc883_3ST_ch6_init },
7292 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7293 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7294 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7295 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7296 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7303 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7304 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7305 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7306 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7307 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7308 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7315 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7316 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7317 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7318 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7319 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7320 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7321 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7325 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7326 { 2, alc883_3ST_ch2_intel_init },
7327 { 4, alc883_3ST_ch4_intel_init },
7328 { 6, alc883_3ST_ch6_intel_init },
7334 static struct hda_verb alc883_sixstack_ch6_init[] = {
7335 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7336 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7337 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7338 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7345 static struct hda_verb alc883_sixstack_ch8_init[] = {
7346 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7347 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7348 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7349 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7353 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7354 { 6, alc883_sixstack_ch6_init },
7355 { 8, alc883_sixstack_ch8_init },
7358 static struct hda_verb alc883_medion_eapd_verbs[] = {
7359 /* eanable EAPD on medion laptop */
7360 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7361 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7365 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7366 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7369 static struct snd_kcontrol_new alc883_base_mixer[] = {
7370 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7371 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7372 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7373 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7374 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7375 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7376 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7377 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7378 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7379 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7380 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7381 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7382 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7383 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7384 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7386 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7388 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7389 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7390 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7391 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7392 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7396 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7397 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7398 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7399 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7400 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7401 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7402 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7405 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7406 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7407 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7408 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7409 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7413 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7414 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7415 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7416 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7417 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7419 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7420 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7423 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7427 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7428 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7429 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7431 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7435 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7436 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7437 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7441 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7442 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7443 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7444 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7445 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7446 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7448 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7450 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7451 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7452 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7453 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7454 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7455 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7456 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7460 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7461 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7462 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7463 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7464 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7465 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7466 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7467 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7468 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7469 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7470 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7471 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7473 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7475 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7476 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7477 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7478 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7479 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7480 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7481 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7485 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7486 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7487 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7488 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7489 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7490 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7492 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7493 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7494 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7495 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7496 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7497 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7498 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7499 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7501 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7504 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7505 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7506 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7507 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7511 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7512 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7513 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7514 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7515 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7516 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7517 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7518 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7519 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7521 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7522 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7523 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7524 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7525 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7526 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7527 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7528 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7529 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7530 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7531 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7532 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7536 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7537 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7538 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7539 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7540 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7541 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7542 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7543 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7544 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7545 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7548 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7549 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7551 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7556 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7557 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7559 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7560 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7561 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7563 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7565 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7566 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7567 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7571 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7572 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7573 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7574 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7575 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7579 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7583 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7584 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7585 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7586 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7587 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7588 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7590 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7591 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7592 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7596 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7597 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7598 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7599 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7600 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7601 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7603 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7604 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7605 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7609 static struct snd_kcontrol_new alc883_acer_aspire_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_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7613 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7614 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7616 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7621 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7622 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7623 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7624 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7625 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7626 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7627 0x0d, 1, 0x0, HDA_OUTPUT),
7628 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7629 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7630 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7631 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7632 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7633 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7634 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7635 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7636 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7637 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7638 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7640 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7644 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7648 static struct hda_bind_ctls alc883_bind_cap_vol = {
7649 .ops = &snd_hda_bind_vol,
7651 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7652 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7657 static struct hda_bind_ctls alc883_bind_cap_switch = {
7658 .ops = &snd_hda_bind_sw,
7660 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7661 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7666 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7667 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7668 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7670 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7671 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7673 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7678 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7679 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7680 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7682 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7683 /* .name = "Capture Source", */
7684 .name = "Input Source",
7686 .info = alc_mux_enum_info,
7687 .get = alc_mux_enum_get,
7688 .put = alc_mux_enum_put,
7693 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7695 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7696 .name = "Channel Mode",
7697 .info = alc_ch_mode_info,
7698 .get = alc_ch_mode_get,
7699 .put = alc_ch_mode_put,
7704 static struct hda_verb alc883_init_verbs[] = {
7705 /* ADC1: mute amp left and right */
7706 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7707 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7708 /* ADC2: mute amp left and right */
7709 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7710 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7711 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7713 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7716 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7717 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7718 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7720 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7721 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7722 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7724 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7725 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7728 /* mute analog input loopbacks */
7729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7735 /* Front Pin: output 0 (0x0c) */
7736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7738 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7739 /* Rear Pin: output 1 (0x0d) */
7740 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7742 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7743 /* CLFE Pin: output 2 (0x0e) */
7744 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7745 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7746 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7747 /* Side Pin: output 3 (0x0f) */
7748 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7749 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7750 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7751 /* Mic (rear) pin: input vref at 80% */
7752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7753 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7754 /* Front Mic pin: input vref at 80% */
7755 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7756 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7757 /* Line In pin: input */
7758 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7759 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7760 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7761 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7762 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7763 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7764 /* CD pin widget for input */
7765 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7767 /* FIXME: use matrix-type input source selection */
7768 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7782 /* toggle speaker-output according to the hp-jack state */
7783 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7785 unsigned int present;
7787 present = snd_hda_codec_read(codec, 0x15, 0,
7788 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7789 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7790 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7791 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7792 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7795 /* auto-toggle front mic */
7797 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7799 unsigned int present;
7802 present = snd_hda_codec_read(codec, 0x18, 0,
7803 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7804 bits = present ? HDA_AMP_MUTE : 0;
7805 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7809 static void alc883_mitac_automute(struct hda_codec *codec)
7811 alc883_mitac_hp_automute(codec);
7812 /* alc883_mitac_mic_automute(codec); */
7815 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7818 switch (res >> 26) {
7819 case ALC880_HP_EVENT:
7820 alc883_mitac_hp_automute(codec);
7822 case ALC880_MIC_EVENT:
7823 /* alc883_mitac_mic_automute(codec); */
7828 static struct hda_verb alc883_mitac_verbs[] = {
7830 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7831 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7833 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7834 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7836 /* enable unsolicited event */
7837 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7838 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7843 static struct hda_verb alc883_clevo_m720_verbs[] = {
7845 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7848 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7851 /* enable unsolicited event */
7852 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7853 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7858 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7860 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7863 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7866 /* enable unsolicited event */
7867 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7872 static struct hda_verb alc883_tagra_verbs[] = {
7873 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7876 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7877 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7879 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7880 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7881 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7883 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7884 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7885 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7886 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7891 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7892 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7893 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7898 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7899 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7901 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7902 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7906 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7909 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7910 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7911 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7915 static struct hda_verb alc883_haier_w66_verbs[] = {
7916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7919 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7921 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7922 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7923 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7924 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7928 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7931 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7932 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7934 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7935 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7936 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7940 static struct hda_verb alc888_3st_hp_verbs[] = {
7941 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7942 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7943 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7947 static struct hda_verb alc888_6st_dell_verbs[] = {
7948 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7952 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7953 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7954 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7955 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7956 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7960 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7961 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7962 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7963 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7964 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7968 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7969 { 2, alc888_3st_hp_2ch_init },
7970 { 6, alc888_3st_hp_6ch_init },
7973 /* toggle front-jack and RCA according to the hp-jack state */
7974 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7976 unsigned int present;
7978 present = snd_hda_codec_read(codec, 0x1b, 0,
7979 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7980 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7981 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7982 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7983 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7986 /* toggle RCA according to the front-jack state */
7987 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7989 unsigned int present;
7991 present = snd_hda_codec_read(codec, 0x14, 0,
7992 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7993 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7994 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7997 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8000 if ((res >> 26) == ALC880_HP_EVENT)
8001 alc888_lenovo_ms7195_front_automute(codec);
8002 if ((res >> 26) == ALC880_FRONT_EVENT)
8003 alc888_lenovo_ms7195_rca_automute(codec);
8006 static struct hda_verb alc883_medion_md2_verbs[] = {
8007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8008 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8012 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8016 /* toggle speaker-output according to the hp-jack state */
8017 static void alc883_medion_md2_automute(struct hda_codec *codec)
8019 unsigned int present;
8021 present = snd_hda_codec_read(codec, 0x14, 0,
8022 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8023 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8024 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8027 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8030 if ((res >> 26) == ALC880_HP_EVENT)
8031 alc883_medion_md2_automute(codec);
8034 /* toggle speaker-output according to the hp-jack state */
8035 static void alc883_tagra_automute(struct hda_codec *codec)
8037 unsigned int present;
8040 present = snd_hda_codec_read(codec, 0x14, 0,
8041 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8042 bits = present ? HDA_AMP_MUTE : 0;
8043 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8044 HDA_AMP_MUTE, bits);
8045 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8049 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8051 if ((res >> 26) == ALC880_HP_EVENT)
8052 alc883_tagra_automute(codec);
8055 /* toggle speaker-output according to the hp-jack state */
8056 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8058 unsigned int present;
8061 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8062 & AC_PINSENSE_PRESENCE;
8063 bits = present ? HDA_AMP_MUTE : 0;
8064 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8065 HDA_AMP_MUTE, bits);
8068 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8070 unsigned int present;
8072 present = snd_hda_codec_read(codec, 0x18, 0,
8073 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8074 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8075 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8078 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8080 alc883_clevo_m720_hp_automute(codec);
8081 alc883_clevo_m720_mic_automute(codec);
8084 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8087 switch (res >> 26) {
8088 case ALC880_HP_EVENT:
8089 alc883_clevo_m720_hp_automute(codec);
8091 case ALC880_MIC_EVENT:
8092 alc883_clevo_m720_mic_automute(codec);
8097 /* toggle speaker-output according to the hp-jack state */
8098 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8100 unsigned int present;
8103 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8104 & AC_PINSENSE_PRESENCE;
8105 bits = present ? HDA_AMP_MUTE : 0;
8106 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8107 HDA_AMP_MUTE, bits);
8110 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8113 if ((res >> 26) == ALC880_HP_EVENT)
8114 alc883_2ch_fujitsu_pi2515_automute(codec);
8117 static void alc883_haier_w66_automute(struct hda_codec *codec)
8119 unsigned int present;
8122 present = snd_hda_codec_read(codec, 0x1b, 0,
8123 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8124 bits = present ? 0x80 : 0;
8125 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8129 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8132 if ((res >> 26) == ALC880_HP_EVENT)
8133 alc883_haier_w66_automute(codec);
8136 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8138 unsigned int present;
8141 present = snd_hda_codec_read(codec, 0x14, 0,
8142 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8143 bits = present ? HDA_AMP_MUTE : 0;
8144 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8145 HDA_AMP_MUTE, bits);
8148 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8150 unsigned int present;
8153 present = snd_hda_codec_read(codec, 0x1b, 0,
8154 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8155 bits = present ? HDA_AMP_MUTE : 0;
8156 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8157 HDA_AMP_MUTE, bits);
8158 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8159 HDA_AMP_MUTE, bits);
8162 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8165 if ((res >> 26) == ALC880_HP_EVENT)
8166 alc883_lenovo_101e_all_automute(codec);
8167 if ((res >> 26) == ALC880_FRONT_EVENT)
8168 alc883_lenovo_101e_ispeaker_automute(codec);
8171 /* toggle speaker-output according to the hp-jack state */
8172 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8174 unsigned int present;
8176 present = snd_hda_codec_read(codec, 0x14, 0,
8177 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8178 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8179 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8180 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8181 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8184 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8187 if ((res >> 26) == ALC880_HP_EVENT)
8188 alc883_acer_aspire_automute(codec);
8191 static struct hda_verb alc883_acer_eapd_verbs[] = {
8192 /* HP Pin: output 0 (0x0c) */
8193 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8194 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8195 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8196 /* Front Pin: output 0 (0x0c) */
8197 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8198 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8199 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8200 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8201 /* eanable EAPD on medion laptop */
8202 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8203 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8204 /* enable unsolicited event */
8205 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8209 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8211 unsigned int present;
8213 present = snd_hda_codec_read(codec, 0x1b, 0,
8214 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8215 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8216 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8217 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8218 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8219 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8220 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8221 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8222 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8225 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8228 switch (res >> 26) {
8229 case ALC880_HP_EVENT:
8230 printk("hp_event\n");
8231 alc888_6st_dell_front_automute(codec);
8236 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8239 unsigned int present;
8241 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8242 present = snd_hda_codec_read(codec, 0x1b, 0,
8243 AC_VERB_GET_PIN_SENSE, 0);
8244 present = (present & 0x80000000) != 0;
8246 /* mute internal speaker */
8247 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8248 HDA_AMP_MUTE, HDA_AMP_MUTE);
8249 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8250 HDA_AMP_MUTE, HDA_AMP_MUTE);
8251 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8252 HDA_AMP_MUTE, HDA_AMP_MUTE);
8253 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8254 HDA_AMP_MUTE, HDA_AMP_MUTE);
8255 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8256 HDA_AMP_MUTE, HDA_AMP_MUTE);
8258 /* unmute internal speaker if necessary */
8259 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8260 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8261 HDA_AMP_MUTE, mute);
8262 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8263 HDA_AMP_MUTE, mute);
8264 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8265 HDA_AMP_MUTE, mute);
8266 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8267 HDA_AMP_MUTE, mute);
8268 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8269 HDA_AMP_MUTE, mute);
8273 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8276 if ((res >> 26) == ALC880_HP_EVENT)
8277 alc888_lenovo_sky_front_automute(codec);
8281 * generic initialization of ADC, input mixers and output mixers
8283 static struct hda_verb alc883_auto_init_verbs[] = {
8285 * Unmute ADC0-2 and set the default input to mic-in
8287 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8288 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8289 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8292 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8294 * Note: PASD motherboards uses the Line In 2 as the input for
8295 * front panel mic (mic 2)
8297 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8305 * Set up output mixers (0x0c - 0x0f)
8307 /* set vol=0 to output mixers */
8308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8311 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8312 /* set up input amps for analog loopback */
8313 /* Amp Indices: DAC = 0, mixer = 1 */
8314 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8315 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8321 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8322 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8323 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8325 /* FIXME: use matrix-type input source selection */
8326 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8331 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8337 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8343 static struct hda_verb alc888_asus_m90v_verbs[] = {
8344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8347 /* enable unsolicited event */
8348 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8349 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8353 static void alc883_nb_mic_automute(struct hda_codec *codec)
8355 unsigned int present;
8357 present = snd_hda_codec_read(codec, 0x18, 0,
8358 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8359 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8360 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8361 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8362 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8365 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8367 unsigned int present;
8370 present = snd_hda_codec_read(codec, 0x1b, 0,
8371 AC_VERB_GET_PIN_SENSE, 0)
8372 & AC_PINSENSE_PRESENCE;
8373 bits = present ? 0 : PIN_OUT;
8374 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8376 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8378 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8382 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8385 switch (res >> 26) {
8386 case ALC880_HP_EVENT:
8387 alc883_M90V_speaker_automute(codec);
8389 case ALC880_MIC_EVENT:
8390 alc883_nb_mic_automute(codec);
8395 static void alc883_mode2_inithook(struct hda_codec *codec)
8397 alc883_M90V_speaker_automute(codec);
8398 alc883_nb_mic_automute(codec);
8401 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8402 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8403 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8407 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8408 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8409 /* enable unsolicited event */
8410 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8414 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8416 unsigned int present;
8419 present = snd_hda_codec_read(codec, 0x14, 0,
8420 AC_VERB_GET_PIN_SENSE, 0)
8421 & AC_PINSENSE_PRESENCE;
8422 bits = present ? 0 : PIN_OUT;
8423 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8427 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8430 switch (res >> 26) {
8431 case ALC880_HP_EVENT:
8432 alc883_eee1601_speaker_automute(codec);
8437 static void alc883_eee1601_inithook(struct hda_codec *codec)
8439 alc883_eee1601_speaker_automute(codec);
8442 #ifdef CONFIG_SND_HDA_POWER_SAVE
8443 #define alc883_loopbacks alc880_loopbacks
8446 /* pcm configuration: identiacal with ALC880 */
8447 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8448 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8449 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8450 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8451 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8454 * configuration and preset
8456 static const char *alc883_models[ALC883_MODEL_LAST] = {
8457 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8458 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8459 [ALC883_3ST_6ch] = "3stack-6ch",
8460 [ALC883_6ST_DIG] = "6stack-dig",
8461 [ALC883_TARGA_DIG] = "targa-dig",
8462 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8463 [ALC883_ACER] = "acer",
8464 [ALC883_ACER_ASPIRE] = "acer-aspire",
8465 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8466 [ALC883_MEDION] = "medion",
8467 [ALC883_MEDION_MD2] = "medion-md2",
8468 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8469 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8470 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8471 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8472 [ALC888_LENOVO_SKY] = "lenovo-sky",
8473 [ALC883_HAIER_W66] = "haier-w66",
8474 [ALC888_3ST_HP] = "3stack-hp",
8475 [ALC888_6ST_DELL] = "6stack-dell",
8476 [ALC883_MITAC] = "mitac",
8477 [ALC883_CLEVO_M720] = "clevo-m720",
8478 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8479 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8480 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8481 [ALC1200_ASUS_P5Q] = "asus-p5q",
8482 [ALC883_AUTO] = "auto",
8485 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8486 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8487 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8488 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8489 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8490 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8491 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8492 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8493 ALC888_ACER_ASPIRE_4930G),
8494 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8495 ALC888_ACER_ASPIRE_4930G),
8496 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8497 ALC888_ACER_ASPIRE_4930G),
8498 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8499 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8500 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8501 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8502 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8503 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8504 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8505 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8506 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8507 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8508 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8509 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8510 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8511 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8512 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8513 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8514 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8515 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8516 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8517 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8518 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8519 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8520 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8521 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8522 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8523 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8524 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8525 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8526 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8527 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8528 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8529 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8530 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8531 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8532 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8533 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8534 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8535 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8536 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8537 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8538 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8539 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8540 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8541 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8542 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8543 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8544 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8545 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8546 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8547 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8548 ALC888_FUJITSU_XA3530),
8549 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8550 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8551 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8552 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8553 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8554 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8555 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8556 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8557 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8558 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8559 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8560 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8561 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8562 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8566 static struct alc_config_preset alc883_presets[] = {
8567 [ALC883_3ST_2ch_DIG] = {
8568 .mixers = { alc883_3ST_2ch_mixer },
8569 .init_verbs = { alc883_init_verbs },
8570 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8571 .dac_nids = alc883_dac_nids,
8572 .dig_out_nid = ALC883_DIGOUT_NID,
8573 .dig_in_nid = ALC883_DIGIN_NID,
8574 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8575 .channel_mode = alc883_3ST_2ch_modes,
8576 .input_mux = &alc883_capture_source,
8578 [ALC883_3ST_6ch_DIG] = {
8579 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8580 .init_verbs = { alc883_init_verbs },
8581 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8582 .dac_nids = alc883_dac_nids,
8583 .dig_out_nid = ALC883_DIGOUT_NID,
8584 .dig_in_nid = ALC883_DIGIN_NID,
8585 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8586 .channel_mode = alc883_3ST_6ch_modes,
8588 .input_mux = &alc883_capture_source,
8590 [ALC883_3ST_6ch] = {
8591 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8592 .init_verbs = { alc883_init_verbs },
8593 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8594 .dac_nids = alc883_dac_nids,
8595 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8596 .channel_mode = alc883_3ST_6ch_modes,
8598 .input_mux = &alc883_capture_source,
8600 [ALC883_3ST_6ch_INTEL] = {
8601 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8602 .init_verbs = { alc883_init_verbs },
8603 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8604 .dac_nids = alc883_dac_nids,
8605 .dig_out_nid = ALC883_DIGOUT_NID,
8606 .dig_in_nid = ALC883_DIGIN_NID,
8607 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8608 .channel_mode = alc883_3ST_6ch_intel_modes,
8610 .input_mux = &alc883_3stack_6ch_intel,
8612 [ALC883_6ST_DIG] = {
8613 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8614 .init_verbs = { alc883_init_verbs },
8615 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8616 .dac_nids = alc883_dac_nids,
8617 .dig_out_nid = ALC883_DIGOUT_NID,
8618 .dig_in_nid = ALC883_DIGIN_NID,
8619 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8620 .channel_mode = alc883_sixstack_modes,
8621 .input_mux = &alc883_capture_source,
8623 [ALC883_TARGA_DIG] = {
8624 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8625 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8626 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8627 .dac_nids = alc883_dac_nids,
8628 .dig_out_nid = ALC883_DIGOUT_NID,
8629 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8630 .channel_mode = alc883_3ST_6ch_modes,
8632 .input_mux = &alc883_capture_source,
8633 .unsol_event = alc883_tagra_unsol_event,
8634 .init_hook = alc883_tagra_automute,
8636 [ALC883_TARGA_2ch_DIG] = {
8637 .mixers = { alc883_tagra_2ch_mixer},
8638 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8639 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8640 .dac_nids = alc883_dac_nids,
8641 .adc_nids = alc883_adc_nids_alt,
8642 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8643 .dig_out_nid = ALC883_DIGOUT_NID,
8644 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8645 .channel_mode = alc883_3ST_2ch_modes,
8646 .input_mux = &alc883_capture_source,
8647 .unsol_event = alc883_tagra_unsol_event,
8648 .init_hook = alc883_tagra_automute,
8651 .mixers = { alc883_base_mixer },
8652 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8653 * and the headphone jack. Turn this on and rely on the
8654 * standard mute methods whenever the user wants to turn
8655 * these outputs off.
8657 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8658 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8659 .dac_nids = alc883_dac_nids,
8660 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8661 .channel_mode = alc883_3ST_2ch_modes,
8662 .input_mux = &alc883_capture_source,
8664 [ALC883_ACER_ASPIRE] = {
8665 .mixers = { alc883_acer_aspire_mixer },
8666 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8667 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8668 .dac_nids = alc883_dac_nids,
8669 .dig_out_nid = ALC883_DIGOUT_NID,
8670 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8671 .channel_mode = alc883_3ST_2ch_modes,
8672 .input_mux = &alc883_capture_source,
8673 .unsol_event = alc883_acer_aspire_unsol_event,
8674 .init_hook = alc883_acer_aspire_automute,
8676 [ALC888_ACER_ASPIRE_4930G] = {
8677 .mixers = { alc888_base_mixer,
8678 alc883_chmode_mixer },
8679 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8680 alc888_acer_aspire_4930g_verbs },
8681 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8682 .dac_nids = alc883_dac_nids,
8683 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8684 .adc_nids = alc883_adc_nids_rev,
8685 .capsrc_nids = alc883_capsrc_nids_rev,
8686 .dig_out_nid = ALC883_DIGOUT_NID,
8687 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8688 .channel_mode = alc883_3ST_6ch_modes,
8691 ARRAY_SIZE(alc888_2_capture_sources),
8692 .input_mux = alc888_2_capture_sources,
8693 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8694 .init_hook = alc888_acer_aspire_4930g_automute,
8697 .mixers = { alc883_fivestack_mixer,
8698 alc883_chmode_mixer },
8699 .init_verbs = { alc883_init_verbs,
8700 alc883_medion_eapd_verbs },
8701 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8702 .dac_nids = alc883_dac_nids,
8703 .adc_nids = alc883_adc_nids_alt,
8704 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8705 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8706 .channel_mode = alc883_sixstack_modes,
8707 .input_mux = &alc883_capture_source,
8709 [ALC883_MEDION_MD2] = {
8710 .mixers = { alc883_medion_md2_mixer},
8711 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8712 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8713 .dac_nids = alc883_dac_nids,
8714 .dig_out_nid = ALC883_DIGOUT_NID,
8715 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8716 .channel_mode = alc883_3ST_2ch_modes,
8717 .input_mux = &alc883_capture_source,
8718 .unsol_event = alc883_medion_md2_unsol_event,
8719 .init_hook = alc883_medion_md2_automute,
8721 [ALC883_LAPTOP_EAPD] = {
8722 .mixers = { alc883_base_mixer },
8723 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8724 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8725 .dac_nids = alc883_dac_nids,
8726 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8727 .channel_mode = alc883_3ST_2ch_modes,
8728 .input_mux = &alc883_capture_source,
8730 [ALC883_CLEVO_M720] = {
8731 .mixers = { alc883_clevo_m720_mixer },
8732 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8733 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8734 .dac_nids = alc883_dac_nids,
8735 .dig_out_nid = ALC883_DIGOUT_NID,
8736 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8737 .channel_mode = alc883_3ST_2ch_modes,
8738 .input_mux = &alc883_capture_source,
8739 .unsol_event = alc883_clevo_m720_unsol_event,
8740 .init_hook = alc883_clevo_m720_automute,
8742 [ALC883_LENOVO_101E_2ch] = {
8743 .mixers = { alc883_lenovo_101e_2ch_mixer},
8744 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8745 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8746 .dac_nids = alc883_dac_nids,
8747 .adc_nids = alc883_adc_nids_alt,
8748 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8749 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8750 .channel_mode = alc883_3ST_2ch_modes,
8751 .input_mux = &alc883_lenovo_101e_capture_source,
8752 .unsol_event = alc883_lenovo_101e_unsol_event,
8753 .init_hook = alc883_lenovo_101e_all_automute,
8755 [ALC883_LENOVO_NB0763] = {
8756 .mixers = { alc883_lenovo_nb0763_mixer },
8757 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8759 .dac_nids = alc883_dac_nids,
8760 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8761 .channel_mode = alc883_3ST_2ch_modes,
8763 .input_mux = &alc883_lenovo_nb0763_capture_source,
8764 .unsol_event = alc883_medion_md2_unsol_event,
8765 .init_hook = alc883_medion_md2_automute,
8767 [ALC888_LENOVO_MS7195_DIG] = {
8768 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8769 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8770 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8771 .dac_nids = alc883_dac_nids,
8772 .dig_out_nid = ALC883_DIGOUT_NID,
8773 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8774 .channel_mode = alc883_3ST_6ch_modes,
8776 .input_mux = &alc883_capture_source,
8777 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8778 .init_hook = alc888_lenovo_ms7195_front_automute,
8780 [ALC883_HAIER_W66] = {
8781 .mixers = { alc883_tagra_2ch_mixer},
8782 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8783 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8784 .dac_nids = alc883_dac_nids,
8785 .dig_out_nid = ALC883_DIGOUT_NID,
8786 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8787 .channel_mode = alc883_3ST_2ch_modes,
8788 .input_mux = &alc883_capture_source,
8789 .unsol_event = alc883_haier_w66_unsol_event,
8790 .init_hook = alc883_haier_w66_automute,
8793 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8794 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8795 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8796 .dac_nids = alc883_dac_nids,
8797 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8798 .channel_mode = alc888_3st_hp_modes,
8800 .input_mux = &alc883_capture_source,
8802 [ALC888_6ST_DELL] = {
8803 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8804 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8805 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8806 .dac_nids = alc883_dac_nids,
8807 .dig_out_nid = ALC883_DIGOUT_NID,
8808 .dig_in_nid = ALC883_DIGIN_NID,
8809 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8810 .channel_mode = alc883_sixstack_modes,
8811 .input_mux = &alc883_capture_source,
8812 .unsol_event = alc888_6st_dell_unsol_event,
8813 .init_hook = alc888_6st_dell_front_automute,
8816 .mixers = { alc883_mitac_mixer },
8817 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8818 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8819 .dac_nids = alc883_dac_nids,
8820 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8821 .channel_mode = alc883_3ST_2ch_modes,
8822 .input_mux = &alc883_capture_source,
8823 .unsol_event = alc883_mitac_unsol_event,
8824 .init_hook = alc883_mitac_automute,
8826 [ALC883_FUJITSU_PI2515] = {
8827 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8828 .init_verbs = { alc883_init_verbs,
8829 alc883_2ch_fujitsu_pi2515_verbs},
8830 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8831 .dac_nids = alc883_dac_nids,
8832 .dig_out_nid = ALC883_DIGOUT_NID,
8833 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8834 .channel_mode = alc883_3ST_2ch_modes,
8835 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8836 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8837 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8839 [ALC888_FUJITSU_XA3530] = {
8840 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8841 .init_verbs = { alc883_init_verbs,
8842 alc888_fujitsu_xa3530_verbs },
8843 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8844 .dac_nids = alc883_dac_nids,
8845 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8846 .adc_nids = alc883_adc_nids_rev,
8847 .capsrc_nids = alc883_capsrc_nids_rev,
8848 .dig_out_nid = ALC883_DIGOUT_NID,
8849 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8850 .channel_mode = alc888_4ST_8ch_intel_modes,
8852 ARRAY_SIZE(alc888_2_capture_sources),
8853 .input_mux = alc888_2_capture_sources,
8854 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8855 .init_hook = alc888_fujitsu_xa3530_automute,
8857 [ALC888_LENOVO_SKY] = {
8858 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8859 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8860 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8861 .dac_nids = alc883_dac_nids,
8862 .dig_out_nid = ALC883_DIGOUT_NID,
8863 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8864 .channel_mode = alc883_sixstack_modes,
8866 .input_mux = &alc883_lenovo_sky_capture_source,
8867 .unsol_event = alc883_lenovo_sky_unsol_event,
8868 .init_hook = alc888_lenovo_sky_front_automute,
8870 [ALC888_ASUS_M90V] = {
8871 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8872 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8873 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8874 .dac_nids = alc883_dac_nids,
8875 .dig_out_nid = ALC883_DIGOUT_NID,
8876 .dig_in_nid = ALC883_DIGIN_NID,
8877 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8878 .channel_mode = alc883_3ST_6ch_modes,
8880 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8881 .unsol_event = alc883_mode2_unsol_event,
8882 .init_hook = alc883_mode2_inithook,
8884 [ALC888_ASUS_EEE1601] = {
8885 .mixers = { alc883_asus_eee1601_mixer },
8886 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8887 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8888 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8889 .dac_nids = alc883_dac_nids,
8890 .dig_out_nid = ALC883_DIGOUT_NID,
8891 .dig_in_nid = ALC883_DIGIN_NID,
8892 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8893 .channel_mode = alc883_3ST_2ch_modes,
8895 .input_mux = &alc883_asus_eee1601_capture_source,
8896 .unsol_event = alc883_eee1601_unsol_event,
8897 .init_hook = alc883_eee1601_inithook,
8899 [ALC1200_ASUS_P5Q] = {
8900 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8901 .init_verbs = { alc883_init_verbs },
8902 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8903 .dac_nids = alc883_dac_nids,
8904 .dig_out_nid = ALC1200_DIGOUT_NID,
8905 .dig_in_nid = ALC883_DIGIN_NID,
8906 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8907 .channel_mode = alc883_sixstack_modes,
8908 .input_mux = &alc883_capture_source,
8914 * BIOS auto configuration
8916 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8917 hda_nid_t nid, int pin_type,
8921 struct alc_spec *spec = codec->spec;
8924 alc_set_pin_output(codec, nid, pin_type);
8925 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8928 idx = spec->multiout.dac_nids[dac_idx] - 2;
8929 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8933 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8935 struct alc_spec *spec = codec->spec;
8938 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8939 for (i = 0; i <= HDA_SIDE; i++) {
8940 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8941 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8943 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8948 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8950 struct alc_spec *spec = codec->spec;
8953 pin = spec->autocfg.hp_pins[0];
8954 if (pin) /* connect to front */
8956 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8957 pin = spec->autocfg.speaker_pins[0];
8959 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8962 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8963 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8965 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8967 struct alc_spec *spec = codec->spec;
8970 for (i = 0; i < AUTO_PIN_LAST; i++) {
8971 hda_nid_t nid = spec->autocfg.input_pins[i];
8972 if (alc883_is_input_pin(nid)) {
8973 snd_hda_codec_write(codec, nid, 0,
8974 AC_VERB_SET_PIN_WIDGET_CONTROL,
8975 (i <= AUTO_PIN_FRONT_MIC ?
8976 PIN_VREF80 : PIN_IN));
8977 if (nid != ALC883_PIN_CD_NID)
8978 snd_hda_codec_write(codec, nid, 0,
8979 AC_VERB_SET_AMP_GAIN_MUTE,
8985 #define alc883_auto_init_input_src alc882_auto_init_input_src
8987 /* almost identical with ALC880 parser... */
8988 static int alc883_parse_auto_config(struct hda_codec *codec)
8990 struct alc_spec *spec = codec->spec;
8991 int err = alc880_parse_auto_config(codec);
8992 struct auto_pin_cfg *cfg = &spec->autocfg;
8998 return 0; /* no config found */
9000 err = alc_auto_add_mic_boost(codec);
9004 /* hack - override the init verbs */
9005 spec->init_verbs[0] = alc883_auto_init_verbs;
9007 /* setup input_mux for ALC889 */
9008 if (codec->vendor_id == 0x10ec0889) {
9009 /* digital-mic input pin is excluded in alc880_auto_create..()
9010 * because it's under 0x18
9012 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9013 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9014 struct hda_input_mux *imux = &spec->private_imux[0];
9015 for (i = 1; i < 3; i++)
9016 memcpy(&spec->private_imux[i],
9017 &spec->private_imux[0],
9018 sizeof(spec->private_imux[0]));
9019 imux->items[imux->num_items].label = "Int DMic";
9020 imux->items[imux->num_items].index = 0x0b;
9022 spec->num_mux_defs = 3;
9023 spec->input_mux = spec->private_imux;
9027 return 1; /* config found */
9030 /* additional initialization for auto-configuration model */
9031 static void alc883_auto_init(struct hda_codec *codec)
9033 struct alc_spec *spec = codec->spec;
9034 alc883_auto_init_multi_out(codec);
9035 alc883_auto_init_hp_out(codec);
9036 alc883_auto_init_analog_input(codec);
9037 alc883_auto_init_input_src(codec);
9038 if (spec->unsol_event)
9039 alc_inithook(codec);
9042 static int patch_alc883(struct hda_codec *codec)
9044 struct alc_spec *spec;
9045 int err, board_config;
9047 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9053 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9055 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9058 if (board_config < 0) {
9059 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9060 "trying auto-probe from BIOS...\n");
9061 board_config = ALC883_AUTO;
9064 if (board_config == ALC883_AUTO) {
9065 /* automatic parse from the BIOS config */
9066 err = alc883_parse_auto_config(codec);
9072 "hda_codec: Cannot set up configuration "
9073 "from BIOS. Using base mode...\n");
9074 board_config = ALC883_3ST_2ch_DIG;
9078 if (board_config != ALC883_AUTO)
9079 setup_preset(spec, &alc883_presets[board_config]);
9081 switch (codec->vendor_id) {
9083 if (codec->revision_id == 0x100101) {
9084 spec->stream_name_analog = "ALC1200 Analog";
9085 spec->stream_name_digital = "ALC1200 Digital";
9087 spec->stream_name_analog = "ALC888 Analog";
9088 spec->stream_name_digital = "ALC888 Digital";
9090 if (!spec->num_adc_nids) {
9091 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9092 spec->adc_nids = alc883_adc_nids;
9094 if (!spec->capsrc_nids)
9095 spec->capsrc_nids = alc883_capsrc_nids;
9096 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9099 spec->stream_name_analog = "ALC889 Analog";
9100 spec->stream_name_digital = "ALC889 Digital";
9101 if (!spec->num_adc_nids) {
9102 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9103 spec->adc_nids = alc889_adc_nids;
9105 if (!spec->capsrc_nids)
9106 spec->capsrc_nids = alc889_capsrc_nids;
9107 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9111 spec->stream_name_analog = "ALC883 Analog";
9112 spec->stream_name_digital = "ALC883 Digital";
9113 if (!spec->num_adc_nids) {
9114 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9115 spec->adc_nids = alc883_adc_nids;
9117 if (!spec->capsrc_nids)
9118 spec->capsrc_nids = alc883_capsrc_nids;
9119 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9123 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9124 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9125 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9127 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9128 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9130 if (!spec->cap_mixer)
9131 set_capture_mixer(spec);
9133 spec->vmaster_nid = 0x0c;
9135 codec->patch_ops = alc_patch_ops;
9136 if (board_config == ALC883_AUTO)
9137 spec->init_hook = alc883_auto_init;
9139 #ifdef CONFIG_SND_HDA_POWER_SAVE
9140 if (!spec->loopback.amplist)
9141 spec->loopback.amplist = alc883_loopbacks;
9143 codec->proc_widget_hook = print_realtek_coef;
9152 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9153 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9155 #define alc262_dac_nids alc260_dac_nids
9156 #define alc262_adc_nids alc882_adc_nids
9157 #define alc262_adc_nids_alt alc882_adc_nids_alt
9158 #define alc262_capsrc_nids alc882_capsrc_nids
9159 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9161 #define alc262_modes alc260_modes
9162 #define alc262_capture_source alc882_capture_source
9164 static hda_nid_t alc262_dmic_adc_nids[1] = {
9169 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9171 static struct snd_kcontrol_new alc262_base_mixer[] = {
9172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9173 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9174 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9175 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9176 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9177 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9180 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9181 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9182 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9183 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9184 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9185 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9186 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9188 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9189 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9193 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9194 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9195 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9198 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9199 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9202 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9205 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9206 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9207 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9208 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9213 /* update HP, line and mono-out pins according to the master switch */
9214 static void alc262_hp_master_update(struct hda_codec *codec)
9216 struct alc_spec *spec = codec->spec;
9217 int val = spec->master_sw;
9220 snd_hda_codec_write_cache(codec, 0x1b, 0,
9221 AC_VERB_SET_PIN_WIDGET_CONTROL,
9223 snd_hda_codec_write_cache(codec, 0x15, 0,
9224 AC_VERB_SET_PIN_WIDGET_CONTROL,
9226 /* mono (speaker) depending on the HP jack sense */
9227 val = val && !spec->jack_present;
9228 snd_hda_codec_write_cache(codec, 0x16, 0,
9229 AC_VERB_SET_PIN_WIDGET_CONTROL,
9233 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9235 struct alc_spec *spec = codec->spec;
9236 unsigned int presence;
9237 presence = snd_hda_codec_read(codec, 0x1b, 0,
9238 AC_VERB_GET_PIN_SENSE, 0);
9239 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9240 alc262_hp_master_update(codec);
9243 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9245 if ((res >> 26) != ALC880_HP_EVENT)
9247 alc262_hp_bpc_automute(codec);
9250 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9252 struct alc_spec *spec = codec->spec;
9253 unsigned int presence;
9254 presence = snd_hda_codec_read(codec, 0x15, 0,
9255 AC_VERB_GET_PIN_SENSE, 0);
9256 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9257 alc262_hp_master_update(codec);
9260 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9263 if ((res >> 26) != ALC880_HP_EVENT)
9265 alc262_hp_wildwest_automute(codec);
9268 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9269 struct snd_ctl_elem_value *ucontrol)
9271 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9272 struct alc_spec *spec = codec->spec;
9273 *ucontrol->value.integer.value = spec->master_sw;
9277 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9278 struct snd_ctl_elem_value *ucontrol)
9280 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9281 struct alc_spec *spec = codec->spec;
9282 int val = !!*ucontrol->value.integer.value;
9284 if (val == spec->master_sw)
9286 spec->master_sw = val;
9287 alc262_hp_master_update(codec);
9291 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9293 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9294 .name = "Master Playback Switch",
9295 .info = snd_ctl_boolean_mono_info,
9296 .get = alc262_hp_master_sw_get,
9297 .put = alc262_hp_master_sw_put,
9299 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9300 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9301 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9302 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9304 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9308 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9309 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9310 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9311 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9312 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9313 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9314 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9315 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9316 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9317 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9318 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9319 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9323 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9325 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9326 .name = "Master Playback Switch",
9327 .info = snd_ctl_boolean_mono_info,
9328 .get = alc262_hp_master_sw_get,
9329 .put = alc262_hp_master_sw_put,
9331 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9332 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9333 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9335 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9337 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9339 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9340 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9341 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9342 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9343 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9344 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9345 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9346 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9347 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9351 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9352 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9353 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9354 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9358 /* mute/unmute internal speaker according to the hp jack and mute state */
9359 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9361 struct alc_spec *spec = codec->spec;
9363 if (force || !spec->sense_updated) {
9364 unsigned int present;
9365 present = snd_hda_codec_read(codec, 0x15, 0,
9366 AC_VERB_GET_PIN_SENSE, 0);
9367 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9368 spec->sense_updated = 1;
9370 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9371 spec->jack_present ? HDA_AMP_MUTE : 0);
9374 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9377 if ((res >> 26) != ALC880_HP_EVENT)
9379 alc262_hp_t5735_automute(codec, 1);
9382 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9384 alc262_hp_t5735_automute(codec, 1);
9387 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9388 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9389 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9390 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9391 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9394 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9398 static struct hda_verb alc262_hp_t5735_verbs[] = {
9399 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9400 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9402 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9406 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9407 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9408 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9409 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9410 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9411 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9412 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9416 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9417 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9418 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9419 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9420 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9421 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9422 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9423 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9424 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9430 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9437 /* bind hp and internal speaker mute (with plug check) */
9438 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9439 struct snd_ctl_elem_value *ucontrol)
9441 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9442 long *valp = ucontrol->value.integer.value;
9445 /* change hp mute */
9446 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9448 valp[0] ? 0 : HDA_AMP_MUTE);
9449 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9451 valp[1] ? 0 : HDA_AMP_MUTE);
9453 /* change speaker according to HP jack state */
9454 struct alc_spec *spec = codec->spec;
9456 if (spec->jack_present)
9457 mute = HDA_AMP_MUTE;
9459 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9461 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9462 HDA_AMP_MUTE, mute);
9467 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9468 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9470 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9471 .name = "Master Playback Switch",
9472 .info = snd_hda_mixer_amp_switch_info,
9473 .get = snd_hda_mixer_amp_switch_get,
9474 .put = alc262_sony_master_sw_put,
9475 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9477 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9478 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9479 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9480 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9484 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9485 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9486 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9487 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9488 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9489 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9490 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9491 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9495 #define alc262_capture_mixer alc882_capture_mixer
9496 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9499 * generic initialization of ADC, input mixers and output mixers
9501 static struct hda_verb alc262_init_verbs[] = {
9503 * Unmute ADC0-2 and set the default input to mic-in
9505 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9507 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9509 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9512 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9514 * Note: PASD motherboards uses the Line In 2 as the input for
9515 * front panel mic (mic 2)
9517 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9525 * Set up output mixers (0x0c - 0x0e)
9527 /* set vol=0 to output mixers */
9528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9529 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9531 /* set up input amps for analog loopback */
9532 /* Amp Indices: DAC = 0, mixer = 1 */
9533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9535 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9537 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9541 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9542 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9544 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9545 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9548 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9549 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9551 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9553 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9554 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9556 /* FIXME: use matrix-type input source selection */
9557 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9558 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9577 static struct hda_verb alc262_eapd_verbs[] = {
9578 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9579 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9583 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9584 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9589 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9591 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9592 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9594 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9599 static struct hda_verb alc262_sony_unsol_verbs[] = {
9600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9601 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9602 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9604 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9609 static struct hda_input_mux alc262_dmic_capture_source = {
9612 { "Int DMic", 0x9 },
9617 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9618 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9619 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9620 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9621 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9622 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9626 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9627 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9628 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9629 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9630 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9631 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9632 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9633 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9634 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9638 static void alc262_dmic_automute(struct hda_codec *codec)
9640 unsigned int present;
9642 present = snd_hda_codec_read(codec, 0x18, 0,
9643 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9644 snd_hda_codec_write(codec, 0x22, 0,
9645 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9648 /* toggle speaker-output according to the hp-jack state */
9649 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9651 unsigned int present;
9654 present = snd_hda_codec_read(codec, 0x15, 0,
9655 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9656 bits = present ? 0 : PIN_OUT;
9657 snd_hda_codec_write(codec, 0x14, 0,
9658 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9663 /* unsolicited event for HP jack sensing */
9664 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9667 if ((res >> 26) == ALC880_HP_EVENT)
9668 alc262_toshiba_s06_speaker_automute(codec);
9669 if ((res >> 26) == ALC880_MIC_EVENT)
9670 alc262_dmic_automute(codec);
9674 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9676 alc262_toshiba_s06_speaker_automute(codec);
9677 alc262_dmic_automute(codec);
9680 /* mute/unmute internal speaker according to the hp jack and mute state */
9681 static void alc262_hippo_automute(struct hda_codec *codec)
9683 struct alc_spec *spec = codec->spec;
9685 unsigned int present;
9687 /* need to execute and sync at first */
9688 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9689 present = snd_hda_codec_read(codec, 0x15, 0,
9690 AC_VERB_GET_PIN_SENSE, 0);
9691 spec->jack_present = (present & 0x80000000) != 0;
9692 if (spec->jack_present) {
9693 /* mute internal speaker */
9694 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9695 HDA_AMP_MUTE, HDA_AMP_MUTE);
9697 /* unmute internal speaker if necessary */
9698 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9699 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9700 HDA_AMP_MUTE, mute);
9704 /* unsolicited event for HP jack sensing */
9705 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9708 if ((res >> 26) != ALC880_HP_EVENT)
9710 alc262_hippo_automute(codec);
9713 static void alc262_hippo1_automute(struct hda_codec *codec)
9716 unsigned int present;
9718 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9719 present = snd_hda_codec_read(codec, 0x1b, 0,
9720 AC_VERB_GET_PIN_SENSE, 0);
9721 present = (present & 0x80000000) != 0;
9723 /* mute internal speaker */
9724 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9725 HDA_AMP_MUTE, HDA_AMP_MUTE);
9727 /* unmute internal speaker if necessary */
9728 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9729 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9730 HDA_AMP_MUTE, mute);
9734 /* unsolicited event for HP jack sensing */
9735 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9738 if ((res >> 26) != ALC880_HP_EVENT)
9740 alc262_hippo1_automute(codec);
9746 * 0x16 = internal speaker
9747 * 0x18 = external mic
9750 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9751 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9752 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9754 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9756 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9758 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9759 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9763 static struct hda_verb alc262_nec_verbs[] = {
9764 /* Unmute Speaker */
9765 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9768 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9771 /* External mic to headphone */
9772 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9773 /* External mic to speaker */
9774 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9780 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9781 * 0x1b = port replicator headphone out
9784 #define ALC_HP_EVENT 0x37
9786 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9787 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9788 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9789 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9790 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9794 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9795 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9800 static struct hda_input_mux alc262_fujitsu_capture_source = {
9809 static struct hda_input_mux alc262_HP_capture_source = {
9813 { "Front Mic", 0x1 },
9820 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9824 { "Front Mic", 0x2 },
9830 /* mute/unmute internal speaker according to the hp jacks and mute state */
9831 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9833 struct alc_spec *spec = codec->spec;
9836 if (force || !spec->sense_updated) {
9837 unsigned int present;
9838 /* need to execute and sync at first */
9839 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9840 /* check laptop HP jack */
9841 present = snd_hda_codec_read(codec, 0x14, 0,
9842 AC_VERB_GET_PIN_SENSE, 0);
9843 /* need to execute and sync at first */
9844 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9845 /* check docking HP jack */
9846 present |= snd_hda_codec_read(codec, 0x1b, 0,
9847 AC_VERB_GET_PIN_SENSE, 0);
9848 if (present & AC_PINSENSE_PRESENCE)
9849 spec->jack_present = 1;
9851 spec->jack_present = 0;
9852 spec->sense_updated = 1;
9854 /* unmute internal speaker only if both HPs are unplugged and
9855 * master switch is on
9857 if (spec->jack_present)
9858 mute = HDA_AMP_MUTE;
9860 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9861 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9862 HDA_AMP_MUTE, mute);
9865 /* unsolicited event for HP jack sensing */
9866 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9869 if ((res >> 26) != ALC_HP_EVENT)
9871 alc262_fujitsu_automute(codec, 1);
9874 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9876 alc262_fujitsu_automute(codec, 1);
9879 /* bind volumes of both NID 0x0c and 0x0d */
9880 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9881 .ops = &snd_hda_bind_vol,
9883 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9884 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9889 /* mute/unmute internal speaker according to the hp jack and mute state */
9890 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9892 struct alc_spec *spec = codec->spec;
9895 if (force || !spec->sense_updated) {
9896 unsigned int present_int_hp;
9897 /* need to execute and sync at first */
9898 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9899 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9900 AC_VERB_GET_PIN_SENSE, 0);
9901 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9902 spec->sense_updated = 1;
9904 if (spec->jack_present) {
9905 /* mute internal speaker */
9906 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9907 HDA_AMP_MUTE, HDA_AMP_MUTE);
9908 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9909 HDA_AMP_MUTE, HDA_AMP_MUTE);
9911 /* unmute internal speaker if necessary */
9912 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9913 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9914 HDA_AMP_MUTE, mute);
9915 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9916 HDA_AMP_MUTE, mute);
9920 /* unsolicited event for HP jack sensing */
9921 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9924 if ((res >> 26) != ALC_HP_EVENT)
9926 alc262_lenovo_3000_automute(codec, 1);
9929 /* bind hp and internal speaker mute (with plug check) */
9930 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9931 struct snd_ctl_elem_value *ucontrol)
9933 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9934 long *valp = ucontrol->value.integer.value;
9937 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9939 valp ? 0 : HDA_AMP_MUTE);
9940 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9942 valp ? 0 : HDA_AMP_MUTE);
9945 alc262_fujitsu_automute(codec, 0);
9949 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9950 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9953 .name = "Master Playback Switch",
9954 .info = snd_hda_mixer_amp_switch_info,
9955 .get = snd_hda_mixer_amp_switch_get,
9956 .put = alc262_fujitsu_master_sw_put,
9957 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9959 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9960 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9961 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9962 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9963 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9965 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9966 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9967 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9968 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9972 /* bind hp and internal speaker mute (with plug check) */
9973 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9974 struct snd_ctl_elem_value *ucontrol)
9976 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9977 long *valp = ucontrol->value.integer.value;
9980 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9982 valp ? 0 : HDA_AMP_MUTE);
9985 alc262_lenovo_3000_automute(codec, 0);
9989 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9990 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9992 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9993 .name = "Master Playback Switch",
9994 .info = snd_hda_mixer_amp_switch_info,
9995 .get = snd_hda_mixer_amp_switch_get,
9996 .put = alc262_lenovo_3000_master_sw_put,
9997 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9999 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10000 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10003 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10004 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10005 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10006 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10010 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10011 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10013 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10014 .name = "Master Playback Switch",
10015 .info = snd_hda_mixer_amp_switch_info,
10016 .get = snd_hda_mixer_amp_switch_get,
10017 .put = alc262_sony_master_sw_put,
10018 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10022 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10023 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10024 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10025 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10029 /* additional init verbs for Benq laptops */
10030 static struct hda_verb alc262_EAPD_verbs[] = {
10031 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10032 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10036 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10037 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10038 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10040 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10041 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10045 /* Samsung Q1 Ultra Vista model setup */
10046 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10047 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10048 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10051 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10052 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10056 static struct hda_verb alc262_ultra_verbs[] = {
10058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10063 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10064 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10065 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10067 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10070 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10073 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10074 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10075 /* ADC, choose mic */
10076 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10077 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10089 /* mute/unmute internal speaker according to the hp jack and mute state */
10090 static void alc262_ultra_automute(struct hda_codec *codec)
10092 struct alc_spec *spec = codec->spec;
10096 /* auto-mute only when HP is used as HP */
10097 if (!spec->cur_mux[0]) {
10098 unsigned int present;
10099 /* need to execute and sync at first */
10100 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10101 present = snd_hda_codec_read(codec, 0x15, 0,
10102 AC_VERB_GET_PIN_SENSE, 0);
10103 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10104 if (spec->jack_present)
10105 mute = HDA_AMP_MUTE;
10107 /* mute/unmute internal speaker */
10108 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10109 HDA_AMP_MUTE, mute);
10110 /* mute/unmute HP */
10111 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10112 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10115 /* unsolicited event for HP jack sensing */
10116 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10119 if ((res >> 26) != ALC880_HP_EVENT)
10121 alc262_ultra_automute(codec);
10124 static struct hda_input_mux alc262_ultra_capture_source = {
10128 { "Headphone", 0x7 },
10132 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10133 struct snd_ctl_elem_value *ucontrol)
10135 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10136 struct alc_spec *spec = codec->spec;
10139 ret = alc_mux_enum_put(kcontrol, ucontrol);
10142 /* reprogram the HP pin as mic or HP according to the input source */
10143 snd_hda_codec_write_cache(codec, 0x15, 0,
10144 AC_VERB_SET_PIN_WIDGET_CONTROL,
10145 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10146 alc262_ultra_automute(codec); /* mute/unmute HP */
10150 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10151 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10152 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10154 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10155 .name = "Capture Source",
10156 .info = alc_mux_enum_info,
10157 .get = alc_mux_enum_get,
10158 .put = alc262_ultra_mux_enum_put,
10163 /* add playback controls from the parsed DAC table */
10164 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10165 const struct auto_pin_cfg *cfg)
10170 spec->multiout.num_dacs = 1; /* only use one dac */
10171 spec->multiout.dac_nids = spec->private_dac_nids;
10172 spec->multiout.dac_nids[0] = 2;
10174 nid = cfg->line_out_pins[0];
10176 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10177 "Front Playback Volume",
10178 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10181 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10182 "Front Playback Switch",
10183 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10188 nid = cfg->speaker_pins[0];
10191 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10192 "Speaker Playback Volume",
10193 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10197 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10198 "Speaker Playback Switch",
10199 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10204 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10205 "Speaker Playback Switch",
10206 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10212 nid = cfg->hp_pins[0];
10214 /* spec->multiout.hp_nid = 2; */
10216 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10217 "Headphone Playback Volume",
10218 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10222 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10223 "Headphone Playback Switch",
10224 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10229 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10230 "Headphone Playback Switch",
10231 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10240 /* identical with ALC880 */
10241 #define alc262_auto_create_analog_input_ctls \
10242 alc880_auto_create_analog_input_ctls
10245 * generic initialization of ADC, input mixers and output mixers
10247 static struct hda_verb alc262_volume_init_verbs[] = {
10249 * Unmute ADC0-2 and set the default input to mic-in
10251 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10253 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10254 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10255 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10256 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10258 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10260 * Note: PASD motherboards uses the Line In 2 as the input for
10261 * front panel mic (mic 2)
10263 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10264 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10266 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10271 * Set up output mixers (0x0c - 0x0f)
10273 /* set vol=0 to output mixers */
10274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10275 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10276 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10278 /* set up input amps for analog loopback */
10279 /* Amp Indices: DAC = 0, mixer = 1 */
10280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10282 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10283 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10284 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10285 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10287 /* FIXME: use matrix-type input source selection */
10288 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10289 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10308 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10310 * Unmute ADC0-2 and set the default input to mic-in
10312 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10314 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10316 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10319 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10321 * Note: PASD motherboards uses the Line In 2 as the input for
10322 * front panel mic (mic 2)
10324 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10334 * Set up output mixers (0x0c - 0x0e)
10336 /* set vol=0 to output mixers */
10337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10341 /* set up input amps for analog loopback */
10342 /* Amp Indices: DAC = 0, mixer = 1 */
10343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10345 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10350 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10352 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10354 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10355 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10357 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10358 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10361 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10362 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10363 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10364 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10366 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10367 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10368 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10369 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10370 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10371 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10374 /* FIXME: use matrix-type input source selection */
10375 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10376 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10377 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10378 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10379 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10380 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10383 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10385 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10390 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10392 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10397 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10399 * Unmute ADC0-2 and set the default input to mic-in
10401 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10402 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10403 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10404 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10405 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10406 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10408 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10410 * Note: PASD motherboards uses the Line In 2 as the input for front
10411 * panel mic (mic 2)
10413 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10414 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10421 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10423 * Set up output mixers (0x0c - 0x0e)
10425 /* set vol=0 to output mixers */
10426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10427 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10428 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10430 /* set up input amps for analog loopback */
10431 /* Amp Indices: DAC = 0, mixer = 1 */
10432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10433 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10435 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10437 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10440 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10441 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10442 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10443 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10444 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10445 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10446 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10448 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10451 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10452 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10454 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10455 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10456 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10457 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10458 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10459 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10461 /* FIXME: use matrix-type input source selection */
10462 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10463 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10464 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10465 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10467 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10469 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10472 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10477 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10485 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10486 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10488 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10493 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10497 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10499 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10500 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10504 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10505 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10506 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10511 #ifdef CONFIG_SND_HDA_POWER_SAVE
10512 #define alc262_loopbacks alc880_loopbacks
10515 /* pcm configuration: identiacal with ALC880 */
10516 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10517 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10518 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10519 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10522 * BIOS auto configuration
10524 static int alc262_parse_auto_config(struct hda_codec *codec)
10526 struct alc_spec *spec = codec->spec;
10528 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10530 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10534 if (!spec->autocfg.line_outs) {
10535 if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) {
10536 spec->multiout.max_channels = 2;
10537 spec->no_analog = 1;
10540 return 0; /* can't find valid BIOS pin config */
10542 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10545 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10549 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10552 if (spec->autocfg.dig_out_pin) {
10553 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10554 spec->dig_out_type = spec->autocfg.dig_out_type;
10556 if (spec->autocfg.dig_in_pin)
10557 spec->dig_in_nid = ALC262_DIGIN_NID;
10559 if (spec->kctls.list)
10560 add_mixer(spec, spec->kctls.list);
10562 add_verb(spec, alc262_volume_init_verbs);
10563 spec->num_mux_defs = 1;
10564 spec->input_mux = &spec->private_imux[0];
10566 err = alc_auto_add_mic_boost(codec);
10570 store_pin_configs(codec);
10574 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10575 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10576 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10577 #define alc262_auto_init_input_src alc882_auto_init_input_src
10580 /* init callback for auto-configuration model -- overriding the default init */
10581 static void alc262_auto_init(struct hda_codec *codec)
10583 struct alc_spec *spec = codec->spec;
10584 alc262_auto_init_multi_out(codec);
10585 alc262_auto_init_hp_out(codec);
10586 alc262_auto_init_analog_input(codec);
10587 alc262_auto_init_input_src(codec);
10588 if (spec->unsol_event)
10589 alc_inithook(codec);
10593 * configuration and preset
10595 static const char *alc262_models[ALC262_MODEL_LAST] = {
10596 [ALC262_BASIC] = "basic",
10597 [ALC262_HIPPO] = "hippo",
10598 [ALC262_HIPPO_1] = "hippo_1",
10599 [ALC262_FUJITSU] = "fujitsu",
10600 [ALC262_HP_BPC] = "hp-bpc",
10601 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10602 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10603 [ALC262_HP_RP5700] = "hp-rp5700",
10604 [ALC262_BENQ_ED8] = "benq",
10605 [ALC262_BENQ_T31] = "benq-t31",
10606 [ALC262_SONY_ASSAMD] = "sony-assamd",
10607 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10608 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10609 [ALC262_ULTRA] = "ultra",
10610 [ALC262_LENOVO_3000] = "lenovo-3000",
10611 [ALC262_NEC] = "nec",
10612 [ALC262_AUTO] = "auto",
10615 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10616 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10617 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10618 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10619 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10620 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10621 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10622 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10623 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10624 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10625 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10626 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10627 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10628 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10629 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10630 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10631 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10632 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10633 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10634 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10635 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10636 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10637 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10638 ALC262_HP_TC_T5735),
10639 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10640 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10641 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10642 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10643 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10644 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10645 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10646 ALC262_SONY_ASSAMD),
10647 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10648 ALC262_TOSHIBA_RX1),
10649 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10650 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10651 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10652 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10653 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10654 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10655 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10656 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10657 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10658 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10662 static struct alc_config_preset alc262_presets[] = {
10664 .mixers = { alc262_base_mixer },
10665 .init_verbs = { alc262_init_verbs },
10666 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10667 .dac_nids = alc262_dac_nids,
10669 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10670 .channel_mode = alc262_modes,
10671 .input_mux = &alc262_capture_source,
10674 .mixers = { alc262_base_mixer },
10675 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10676 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10677 .dac_nids = alc262_dac_nids,
10679 .dig_out_nid = ALC262_DIGOUT_NID,
10680 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10681 .channel_mode = alc262_modes,
10682 .input_mux = &alc262_capture_source,
10683 .unsol_event = alc262_hippo_unsol_event,
10684 .init_hook = alc262_hippo_automute,
10686 [ALC262_HIPPO_1] = {
10687 .mixers = { alc262_hippo1_mixer },
10688 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10689 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10690 .dac_nids = alc262_dac_nids,
10692 .dig_out_nid = ALC262_DIGOUT_NID,
10693 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10694 .channel_mode = alc262_modes,
10695 .input_mux = &alc262_capture_source,
10696 .unsol_event = alc262_hippo1_unsol_event,
10697 .init_hook = alc262_hippo1_automute,
10699 [ALC262_FUJITSU] = {
10700 .mixers = { alc262_fujitsu_mixer },
10701 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10702 alc262_fujitsu_unsol_verbs },
10703 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10704 .dac_nids = alc262_dac_nids,
10706 .dig_out_nid = ALC262_DIGOUT_NID,
10707 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10708 .channel_mode = alc262_modes,
10709 .input_mux = &alc262_fujitsu_capture_source,
10710 .unsol_event = alc262_fujitsu_unsol_event,
10711 .init_hook = alc262_fujitsu_init_hook,
10713 [ALC262_HP_BPC] = {
10714 .mixers = { alc262_HP_BPC_mixer },
10715 .init_verbs = { alc262_HP_BPC_init_verbs },
10716 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10717 .dac_nids = alc262_dac_nids,
10719 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10720 .channel_mode = alc262_modes,
10721 .input_mux = &alc262_HP_capture_source,
10722 .unsol_event = alc262_hp_bpc_unsol_event,
10723 .init_hook = alc262_hp_bpc_automute,
10725 [ALC262_HP_BPC_D7000_WF] = {
10726 .mixers = { alc262_HP_BPC_WildWest_mixer },
10727 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10728 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10729 .dac_nids = alc262_dac_nids,
10731 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10732 .channel_mode = alc262_modes,
10733 .input_mux = &alc262_HP_D7000_capture_source,
10734 .unsol_event = alc262_hp_wildwest_unsol_event,
10735 .init_hook = alc262_hp_wildwest_automute,
10737 [ALC262_HP_BPC_D7000_WL] = {
10738 .mixers = { alc262_HP_BPC_WildWest_mixer,
10739 alc262_HP_BPC_WildWest_option_mixer },
10740 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10741 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10742 .dac_nids = alc262_dac_nids,
10744 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10745 .channel_mode = alc262_modes,
10746 .input_mux = &alc262_HP_D7000_capture_source,
10747 .unsol_event = alc262_hp_wildwest_unsol_event,
10748 .init_hook = alc262_hp_wildwest_automute,
10750 [ALC262_HP_TC_T5735] = {
10751 .mixers = { alc262_hp_t5735_mixer },
10752 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10753 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10754 .dac_nids = alc262_dac_nids,
10756 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10757 .channel_mode = alc262_modes,
10758 .input_mux = &alc262_capture_source,
10759 .unsol_event = alc262_hp_t5735_unsol_event,
10760 .init_hook = alc262_hp_t5735_init_hook,
10762 [ALC262_HP_RP5700] = {
10763 .mixers = { alc262_hp_rp5700_mixer },
10764 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10765 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10766 .dac_nids = alc262_dac_nids,
10767 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10768 .channel_mode = alc262_modes,
10769 .input_mux = &alc262_hp_rp5700_capture_source,
10771 [ALC262_BENQ_ED8] = {
10772 .mixers = { alc262_base_mixer },
10773 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10774 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10775 .dac_nids = alc262_dac_nids,
10777 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10778 .channel_mode = alc262_modes,
10779 .input_mux = &alc262_capture_source,
10781 [ALC262_SONY_ASSAMD] = {
10782 .mixers = { alc262_sony_mixer },
10783 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10784 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10785 .dac_nids = alc262_dac_nids,
10787 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10788 .channel_mode = alc262_modes,
10789 .input_mux = &alc262_capture_source,
10790 .unsol_event = alc262_hippo_unsol_event,
10791 .init_hook = alc262_hippo_automute,
10793 [ALC262_BENQ_T31] = {
10794 .mixers = { alc262_benq_t31_mixer },
10795 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10796 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10797 .dac_nids = alc262_dac_nids,
10799 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10800 .channel_mode = alc262_modes,
10801 .input_mux = &alc262_capture_source,
10802 .unsol_event = alc262_hippo_unsol_event,
10803 .init_hook = alc262_hippo_automute,
10806 .mixers = { alc262_ultra_mixer },
10807 .cap_mixer = alc262_ultra_capture_mixer,
10808 .init_verbs = { alc262_ultra_verbs },
10809 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10810 .dac_nids = alc262_dac_nids,
10811 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10812 .channel_mode = alc262_modes,
10813 .input_mux = &alc262_ultra_capture_source,
10814 .adc_nids = alc262_adc_nids, /* ADC0 */
10815 .capsrc_nids = alc262_capsrc_nids,
10816 .num_adc_nids = 1, /* single ADC */
10817 .unsol_event = alc262_ultra_unsol_event,
10818 .init_hook = alc262_ultra_automute,
10820 [ALC262_LENOVO_3000] = {
10821 .mixers = { alc262_lenovo_3000_mixer },
10822 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10823 alc262_lenovo_3000_unsol_verbs },
10824 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10825 .dac_nids = alc262_dac_nids,
10827 .dig_out_nid = ALC262_DIGOUT_NID,
10828 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10829 .channel_mode = alc262_modes,
10830 .input_mux = &alc262_fujitsu_capture_source,
10831 .unsol_event = alc262_lenovo_3000_unsol_event,
10834 .mixers = { alc262_nec_mixer },
10835 .init_verbs = { alc262_nec_verbs },
10836 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10837 .dac_nids = alc262_dac_nids,
10839 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10840 .channel_mode = alc262_modes,
10841 .input_mux = &alc262_capture_source,
10843 [ALC262_TOSHIBA_S06] = {
10844 .mixers = { alc262_toshiba_s06_mixer },
10845 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10846 alc262_eapd_verbs },
10847 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10848 .capsrc_nids = alc262_dmic_capsrc_nids,
10849 .dac_nids = alc262_dac_nids,
10850 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10851 .dig_out_nid = ALC262_DIGOUT_NID,
10852 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10853 .channel_mode = alc262_modes,
10854 .input_mux = &alc262_dmic_capture_source,
10855 .unsol_event = alc262_toshiba_s06_unsol_event,
10856 .init_hook = alc262_toshiba_s06_init_hook,
10858 [ALC262_TOSHIBA_RX1] = {
10859 .mixers = { alc262_toshiba_rx1_mixer },
10860 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10861 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10862 .dac_nids = alc262_dac_nids,
10864 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10865 .channel_mode = alc262_modes,
10866 .input_mux = &alc262_capture_source,
10867 .unsol_event = alc262_hippo_unsol_event,
10868 .init_hook = alc262_hippo_automute,
10872 static int patch_alc262(struct hda_codec *codec)
10874 struct alc_spec *spec;
10878 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10882 codec->spec = spec;
10884 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10889 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10890 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10891 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10892 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10896 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10898 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10902 if (board_config < 0) {
10903 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10904 "trying auto-probe from BIOS...\n");
10905 board_config = ALC262_AUTO;
10908 if (board_config == ALC262_AUTO) {
10909 /* automatic parse from the BIOS config */
10910 err = alc262_parse_auto_config(codec);
10916 "hda_codec: Cannot set up configuration "
10917 "from BIOS. Using base mode...\n");
10918 board_config = ALC262_BASIC;
10922 if (board_config != ALC262_AUTO)
10923 setup_preset(spec, &alc262_presets[board_config]);
10925 spec->stream_name_analog = "ALC262 Analog";
10926 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10927 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10929 spec->stream_name_digital = "ALC262 Digital";
10930 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10931 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10933 spec->capture_style = CAPT_MIX;
10934 if (!spec->adc_nids && spec->input_mux) {
10935 /* check whether NID 0x07 is valid */
10936 unsigned int wcap = get_wcaps(codec, 0x07);
10939 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10940 if (wcap != AC_WID_AUD_IN) {
10941 spec->adc_nids = alc262_adc_nids_alt;
10942 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10943 spec->capsrc_nids = alc262_capsrc_nids_alt;
10945 spec->adc_nids = alc262_adc_nids;
10946 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10947 spec->capsrc_nids = alc262_capsrc_nids;
10950 if (!spec->cap_mixer && !spec->no_analog)
10951 set_capture_mixer(spec);
10953 spec->vmaster_nid = 0x0c;
10955 codec->patch_ops = alc_patch_ops;
10956 if (board_config == ALC262_AUTO)
10957 spec->init_hook = alc262_auto_init;
10958 #ifdef CONFIG_SND_HDA_POWER_SAVE
10959 if (!spec->loopback.amplist)
10960 spec->loopback.amplist = alc262_loopbacks;
10962 codec->proc_widget_hook = print_realtek_coef;
10968 * ALC268 channel source setting (2 channel)
10970 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10971 #define alc268_modes alc260_modes
10973 static hda_nid_t alc268_dac_nids[2] = {
10978 static hda_nid_t alc268_adc_nids[2] = {
10983 static hda_nid_t alc268_adc_nids_alt[1] = {
10988 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10990 static struct snd_kcontrol_new alc268_base_mixer[] = {
10991 /* output mixer control */
10992 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10993 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10994 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10995 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10996 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10997 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10998 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11002 /* bind Beep switches of both NID 0x0f and 0x10 */
11003 static struct hda_bind_ctls alc268_bind_beep_sw = {
11004 .ops = &snd_hda_bind_sw,
11006 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11007 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11012 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11013 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11014 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11018 static struct hda_verb alc268_eapd_verbs[] = {
11019 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11020 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11024 /* Toshiba specific */
11025 #define alc268_toshiba_automute alc262_hippo_automute
11027 static struct hda_verb alc268_toshiba_verbs[] = {
11028 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11032 static struct hda_input_mux alc268_acer_lc_capture_source = {
11040 /* Acer specific */
11041 /* bind volumes of both NID 0x02 and 0x03 */
11042 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11043 .ops = &snd_hda_bind_vol,
11045 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11046 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11051 /* mute/unmute internal speaker according to the hp jack and mute state */
11052 static void alc268_acer_automute(struct hda_codec *codec, int force)
11054 struct alc_spec *spec = codec->spec;
11057 if (force || !spec->sense_updated) {
11058 unsigned int present;
11059 present = snd_hda_codec_read(codec, 0x14, 0,
11060 AC_VERB_GET_PIN_SENSE, 0);
11061 spec->jack_present = (present & 0x80000000) != 0;
11062 spec->sense_updated = 1;
11064 if (spec->jack_present)
11065 mute = HDA_AMP_MUTE; /* mute internal speaker */
11066 else /* unmute internal speaker if necessary */
11067 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11068 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11069 HDA_AMP_MUTE, mute);
11073 /* bind hp and internal speaker mute (with plug check) */
11074 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11075 struct snd_ctl_elem_value *ucontrol)
11077 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11078 long *valp = ucontrol->value.integer.value;
11081 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11083 valp[0] ? 0 : HDA_AMP_MUTE);
11084 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11086 valp[1] ? 0 : HDA_AMP_MUTE);
11088 alc268_acer_automute(codec, 0);
11092 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11093 /* output mixer control */
11094 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11096 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11097 .name = "Master Playback Switch",
11098 .info = snd_hda_mixer_amp_switch_info,
11099 .get = snd_hda_mixer_amp_switch_get,
11100 .put = alc268_acer_master_sw_put,
11101 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11103 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11107 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11108 /* output mixer control */
11109 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11111 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11112 .name = "Master Playback Switch",
11113 .info = snd_hda_mixer_amp_switch_info,
11114 .get = snd_hda_mixer_amp_switch_get,
11115 .put = alc268_acer_master_sw_put,
11116 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11118 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11119 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11120 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11124 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11125 /* output mixer control */
11126 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11128 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11129 .name = "Master Playback Switch",
11130 .info = snd_hda_mixer_amp_switch_info,
11131 .get = snd_hda_mixer_amp_switch_get,
11132 .put = alc268_acer_master_sw_put,
11133 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11136 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11140 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11141 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11143 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11144 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11145 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11146 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11150 static struct hda_verb alc268_acer_verbs[] = {
11151 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11152 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11154 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11155 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11157 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11161 /* unsolicited event for HP jack sensing */
11162 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11165 if ((res >> 26) != ALC880_HP_EVENT)
11167 alc268_toshiba_automute(codec);
11170 static void alc268_acer_unsol_event(struct hda_codec *codec,
11173 if ((res >> 26) != ALC880_HP_EVENT)
11175 alc268_acer_automute(codec, 1);
11178 static void alc268_acer_init_hook(struct hda_codec *codec)
11180 alc268_acer_automute(codec, 1);
11183 /* toggle speaker-output according to the hp-jack state */
11184 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11186 unsigned int present;
11187 unsigned char bits;
11189 present = snd_hda_codec_read(codec, 0x15, 0,
11190 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11191 bits = present ? AMP_IN_MUTE(0) : 0;
11192 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11193 AMP_IN_MUTE(0), bits);
11194 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11195 AMP_IN_MUTE(0), bits);
11199 static void alc268_acer_mic_automute(struct hda_codec *codec)
11201 unsigned int present;
11203 present = snd_hda_codec_read(codec, 0x18, 0,
11204 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11205 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11206 present ? 0x0 : 0x6);
11209 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11212 if ((res >> 26) == ALC880_HP_EVENT)
11213 alc268_aspire_one_speaker_automute(codec);
11214 if ((res >> 26) == ALC880_MIC_EVENT)
11215 alc268_acer_mic_automute(codec);
11218 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11220 alc268_aspire_one_speaker_automute(codec);
11221 alc268_acer_mic_automute(codec);
11224 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11225 /* output mixer control */
11226 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11227 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11228 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11229 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11230 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11231 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11235 static struct hda_verb alc268_dell_verbs[] = {
11236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11238 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11242 /* mute/unmute internal speaker according to the hp jack and mute state */
11243 static void alc268_dell_automute(struct hda_codec *codec)
11245 unsigned int present;
11248 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11249 if (present & 0x80000000)
11250 mute = HDA_AMP_MUTE;
11252 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11253 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11254 HDA_AMP_MUTE, mute);
11257 static void alc268_dell_unsol_event(struct hda_codec *codec,
11260 if ((res >> 26) != ALC880_HP_EVENT)
11262 alc268_dell_automute(codec);
11265 #define alc268_dell_init_hook alc268_dell_automute
11267 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11268 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11269 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11270 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11271 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11272 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11273 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11274 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11275 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11279 static struct hda_verb alc267_quanta_il1_verbs[] = {
11280 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11281 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11285 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11287 unsigned int present;
11289 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11290 & AC_PINSENSE_PRESENCE;
11291 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11292 present ? 0 : PIN_OUT);
11295 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11297 unsigned int present;
11299 present = snd_hda_codec_read(codec, 0x18, 0,
11300 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11301 snd_hda_codec_write(codec, 0x23, 0,
11302 AC_VERB_SET_CONNECT_SEL,
11303 present ? 0x00 : 0x01);
11306 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11308 alc267_quanta_il1_hp_automute(codec);
11309 alc267_quanta_il1_mic_automute(codec);
11312 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11315 switch (res >> 26) {
11316 case ALC880_HP_EVENT:
11317 alc267_quanta_il1_hp_automute(codec);
11319 case ALC880_MIC_EVENT:
11320 alc267_quanta_il1_mic_automute(codec);
11326 * generic initialization of ADC, input mixers and output mixers
11328 static struct hda_verb alc268_base_init_verbs[] = {
11329 /* Unmute DAC0-1 and set vol = 0 */
11330 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11331 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11334 * Set up output mixers (0x0c - 0x0e)
11336 /* set vol=0 to output mixers */
11337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11338 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11340 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11341 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11343 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11345 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11346 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11347 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11348 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11349 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11350 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11354 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11356 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11358 /* set PCBEEP vol = 0, mute connections */
11359 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11360 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11361 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11363 /* Unmute Selector 23h,24h and set the default input to mic-in */
11365 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11367 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11374 * generic initialization of ADC, input mixers and output mixers
11376 static struct hda_verb alc268_volume_init_verbs[] = {
11377 /* set output DAC */
11378 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11379 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11382 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11383 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11384 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11385 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11387 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11388 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11389 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11391 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11392 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11394 /* set PCBEEP vol = 0, mute connections */
11395 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11396 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11397 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11402 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11403 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11404 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11407 /* The multiple "Capture Source" controls confuse alsamixer
11408 * So call somewhat different..
11410 /* .name = "Capture Source", */
11411 .name = "Input Source",
11413 .info = alc_mux_enum_info,
11414 .get = alc_mux_enum_get,
11415 .put = alc_mux_enum_put,
11420 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11421 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11422 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11423 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11424 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11427 /* The multiple "Capture Source" controls confuse alsamixer
11428 * So call somewhat different..
11430 /* .name = "Capture Source", */
11431 .name = "Input Source",
11433 .info = alc_mux_enum_info,
11434 .get = alc_mux_enum_get,
11435 .put = alc_mux_enum_put,
11440 static struct hda_input_mux alc268_capture_source = {
11444 { "Front Mic", 0x1 },
11450 static struct hda_input_mux alc268_acer_capture_source = {
11454 { "Internal Mic", 0x1 },
11459 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11463 { "Internal Mic", 0x6 },
11468 #ifdef CONFIG_SND_DEBUG
11469 static struct snd_kcontrol_new alc268_test_mixer[] = {
11470 /* Volume widgets */
11471 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11472 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11473 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11474 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11475 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11476 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11477 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11478 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11479 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11480 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11481 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11482 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11483 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11484 /* The below appears problematic on some hardwares */
11485 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11486 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11487 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11488 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11489 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11491 /* Modes for retasking pin widgets */
11492 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11493 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11494 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11495 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11497 /* Controls for GPIO pins, assuming they are configured as outputs */
11498 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11499 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11500 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11501 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11503 /* Switches to allow the digital SPDIF output pin to be enabled.
11504 * The ALC268 does not have an SPDIF input.
11506 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11508 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11509 * this output to turn on an external amplifier.
11511 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11512 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11518 /* create input playback/capture controls for the given pin */
11519 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11520 const char *ctlname, int idx)
11525 sprintf(name, "%s Playback Volume", ctlname);
11527 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11528 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11532 } else if (nid == 0x15) {
11533 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11534 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11540 sprintf(name, "%s Playback Switch", ctlname);
11541 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11542 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11548 /* add playback controls from the parsed DAC table */
11549 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11550 const struct auto_pin_cfg *cfg)
11555 spec->multiout.num_dacs = 2; /* only use one dac */
11556 spec->multiout.dac_nids = spec->private_dac_nids;
11557 spec->multiout.dac_nids[0] = 2;
11558 spec->multiout.dac_nids[1] = 3;
11560 nid = cfg->line_out_pins[0];
11562 alc268_new_analog_output(spec, nid, "Front", 0);
11564 nid = cfg->speaker_pins[0];
11566 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11567 "Speaker Playback Volume",
11568 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11572 nid = cfg->hp_pins[0];
11574 alc268_new_analog_output(spec, nid, "Headphone", 0);
11576 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11578 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11579 "Mono Playback Switch",
11580 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11587 /* create playback/capture controls for input pins */
11588 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11589 const struct auto_pin_cfg *cfg)
11591 struct hda_input_mux *imux = &spec->private_imux[0];
11594 for (i = 0; i < AUTO_PIN_LAST; i++) {
11595 switch(cfg->input_pins[i]) {
11597 idx1 = 0; /* Mic 1 */
11600 idx1 = 1; /* Mic 2 */
11603 idx1 = 2; /* Line In */
11610 idx1 = 6; /* digital mics */
11615 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11616 imux->items[imux->num_items].index = idx1;
11622 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11624 struct alc_spec *spec = codec->spec;
11625 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11626 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11627 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11628 unsigned int dac_vol1, dac_vol2;
11631 snd_hda_codec_write(codec, speaker_nid, 0,
11632 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11633 snd_hda_codec_write(codec, 0x0f, 0,
11634 AC_VERB_SET_AMP_GAIN_MUTE,
11636 snd_hda_codec_write(codec, 0x10, 0,
11637 AC_VERB_SET_AMP_GAIN_MUTE,
11640 snd_hda_codec_write(codec, 0x0f, 0,
11641 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11642 snd_hda_codec_write(codec, 0x10, 0,
11643 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11646 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11647 if (line_nid == 0x14)
11648 dac_vol2 = AMP_OUT_ZERO;
11649 else if (line_nid == 0x15)
11650 dac_vol1 = AMP_OUT_ZERO;
11651 if (hp_nid == 0x14)
11652 dac_vol2 = AMP_OUT_ZERO;
11653 else if (hp_nid == 0x15)
11654 dac_vol1 = AMP_OUT_ZERO;
11655 if (line_nid != 0x16 || hp_nid != 0x16 ||
11656 spec->autocfg.line_out_pins[1] != 0x16 ||
11657 spec->autocfg.line_out_pins[2] != 0x16)
11658 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11660 snd_hda_codec_write(codec, 0x02, 0,
11661 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11662 snd_hda_codec_write(codec, 0x03, 0,
11663 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11666 /* pcm configuration: identiacal with ALC880 */
11667 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11668 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11669 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11670 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11673 * BIOS auto configuration
11675 static int alc268_parse_auto_config(struct hda_codec *codec)
11677 struct alc_spec *spec = codec->spec;
11679 static hda_nid_t alc268_ignore[] = { 0 };
11681 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11685 if (!spec->autocfg.line_outs)
11686 return 0; /* can't find valid BIOS pin config */
11688 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11691 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11695 spec->multiout.max_channels = 2;
11697 /* digital only support output */
11698 if (spec->autocfg.dig_out_pin)
11699 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11701 if (spec->kctls.list)
11702 add_mixer(spec, spec->kctls.list);
11704 if (spec->autocfg.speaker_pins[0] != 0x1d)
11705 add_mixer(spec, alc268_beep_mixer);
11707 add_verb(spec, alc268_volume_init_verbs);
11708 spec->num_mux_defs = 1;
11709 spec->input_mux = &spec->private_imux[0];
11711 err = alc_auto_add_mic_boost(codec);
11715 store_pin_configs(codec);
11719 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11720 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11721 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11723 /* init callback for auto-configuration model -- overriding the default init */
11724 static void alc268_auto_init(struct hda_codec *codec)
11726 struct alc_spec *spec = codec->spec;
11727 alc268_auto_init_multi_out(codec);
11728 alc268_auto_init_hp_out(codec);
11729 alc268_auto_init_mono_speaker_out(codec);
11730 alc268_auto_init_analog_input(codec);
11731 if (spec->unsol_event)
11732 alc_inithook(codec);
11736 * configuration and preset
11738 static const char *alc268_models[ALC268_MODEL_LAST] = {
11739 [ALC267_QUANTA_IL1] = "quanta-il1",
11740 [ALC268_3ST] = "3stack",
11741 [ALC268_TOSHIBA] = "toshiba",
11742 [ALC268_ACER] = "acer",
11743 [ALC268_ACER_DMIC] = "acer-dmic",
11744 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11745 [ALC268_DELL] = "dell",
11746 [ALC268_ZEPTO] = "zepto",
11747 #ifdef CONFIG_SND_DEBUG
11748 [ALC268_TEST] = "test",
11750 [ALC268_AUTO] = "auto",
11753 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11754 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11755 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11756 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11757 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11758 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11759 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11760 ALC268_ACER_ASPIRE_ONE),
11761 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11762 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11763 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11764 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11765 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11766 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11767 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11768 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11769 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11770 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11771 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11775 static struct alc_config_preset alc268_presets[] = {
11776 [ALC267_QUANTA_IL1] = {
11777 .mixers = { alc267_quanta_il1_mixer },
11778 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11779 alc267_quanta_il1_verbs },
11780 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11781 .dac_nids = alc268_dac_nids,
11782 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11783 .adc_nids = alc268_adc_nids_alt,
11785 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11786 .channel_mode = alc268_modes,
11787 .input_mux = &alc268_capture_source,
11788 .unsol_event = alc267_quanta_il1_unsol_event,
11789 .init_hook = alc267_quanta_il1_automute,
11792 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11793 alc268_beep_mixer },
11794 .init_verbs = { alc268_base_init_verbs },
11795 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11796 .dac_nids = alc268_dac_nids,
11797 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11798 .adc_nids = alc268_adc_nids_alt,
11799 .capsrc_nids = alc268_capsrc_nids,
11801 .dig_out_nid = ALC268_DIGOUT_NID,
11802 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11803 .channel_mode = alc268_modes,
11804 .input_mux = &alc268_capture_source,
11806 [ALC268_TOSHIBA] = {
11807 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11808 alc268_beep_mixer },
11809 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11810 alc268_toshiba_verbs },
11811 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11812 .dac_nids = alc268_dac_nids,
11813 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11814 .adc_nids = alc268_adc_nids_alt,
11815 .capsrc_nids = alc268_capsrc_nids,
11817 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11818 .channel_mode = alc268_modes,
11819 .input_mux = &alc268_capture_source,
11820 .unsol_event = alc268_toshiba_unsol_event,
11821 .init_hook = alc268_toshiba_automute,
11824 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11825 alc268_beep_mixer },
11826 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11827 alc268_acer_verbs },
11828 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11829 .dac_nids = alc268_dac_nids,
11830 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11831 .adc_nids = alc268_adc_nids_alt,
11832 .capsrc_nids = alc268_capsrc_nids,
11834 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11835 .channel_mode = alc268_modes,
11836 .input_mux = &alc268_acer_capture_source,
11837 .unsol_event = alc268_acer_unsol_event,
11838 .init_hook = alc268_acer_init_hook,
11840 [ALC268_ACER_DMIC] = {
11841 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11842 alc268_beep_mixer },
11843 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11844 alc268_acer_verbs },
11845 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11846 .dac_nids = alc268_dac_nids,
11847 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11848 .adc_nids = alc268_adc_nids_alt,
11849 .capsrc_nids = alc268_capsrc_nids,
11851 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11852 .channel_mode = alc268_modes,
11853 .input_mux = &alc268_acer_dmic_capture_source,
11854 .unsol_event = alc268_acer_unsol_event,
11855 .init_hook = alc268_acer_init_hook,
11857 [ALC268_ACER_ASPIRE_ONE] = {
11858 .mixers = { alc268_acer_aspire_one_mixer,
11859 alc268_capture_alt_mixer },
11860 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11861 alc268_acer_aspire_one_verbs },
11862 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11863 .dac_nids = alc268_dac_nids,
11864 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11865 .adc_nids = alc268_adc_nids_alt,
11866 .capsrc_nids = alc268_capsrc_nids,
11868 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11869 .channel_mode = alc268_modes,
11870 .input_mux = &alc268_acer_lc_capture_source,
11871 .unsol_event = alc268_acer_lc_unsol_event,
11872 .init_hook = alc268_acer_lc_init_hook,
11875 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11876 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11877 alc268_dell_verbs },
11878 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11879 .dac_nids = alc268_dac_nids,
11881 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11882 .channel_mode = alc268_modes,
11883 .unsol_event = alc268_dell_unsol_event,
11884 .init_hook = alc268_dell_init_hook,
11885 .input_mux = &alc268_capture_source,
11888 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11889 alc268_beep_mixer },
11890 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11891 alc268_toshiba_verbs },
11892 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11893 .dac_nids = alc268_dac_nids,
11894 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11895 .adc_nids = alc268_adc_nids_alt,
11896 .capsrc_nids = alc268_capsrc_nids,
11898 .dig_out_nid = ALC268_DIGOUT_NID,
11899 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11900 .channel_mode = alc268_modes,
11901 .input_mux = &alc268_capture_source,
11902 .unsol_event = alc268_toshiba_unsol_event,
11903 .init_hook = alc268_toshiba_automute
11905 #ifdef CONFIG_SND_DEBUG
11907 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11908 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11909 alc268_volume_init_verbs },
11910 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11911 .dac_nids = alc268_dac_nids,
11912 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11913 .adc_nids = alc268_adc_nids_alt,
11914 .capsrc_nids = alc268_capsrc_nids,
11916 .dig_out_nid = ALC268_DIGOUT_NID,
11917 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11918 .channel_mode = alc268_modes,
11919 .input_mux = &alc268_capture_source,
11924 static int patch_alc268(struct hda_codec *codec)
11926 struct alc_spec *spec;
11930 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11934 codec->spec = spec;
11936 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11940 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11941 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11942 "trying auto-probe from BIOS...\n");
11943 board_config = ALC268_AUTO;
11946 if (board_config == ALC268_AUTO) {
11947 /* automatic parse from the BIOS config */
11948 err = alc268_parse_auto_config(codec);
11954 "hda_codec: Cannot set up configuration "
11955 "from BIOS. Using base mode...\n");
11956 board_config = ALC268_3ST;
11960 if (board_config != ALC268_AUTO)
11961 setup_preset(spec, &alc268_presets[board_config]);
11963 if (codec->vendor_id == 0x10ec0267) {
11964 spec->stream_name_analog = "ALC267 Analog";
11965 spec->stream_name_digital = "ALC267 Digital";
11967 spec->stream_name_analog = "ALC268 Analog";
11968 spec->stream_name_digital = "ALC268 Digital";
11971 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11972 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11973 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11975 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11977 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11978 /* override the amp caps for beep generator */
11979 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11980 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11981 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11982 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11983 (0 << AC_AMPCAP_MUTE_SHIFT));
11985 if (!spec->adc_nids && spec->input_mux) {
11986 /* check whether NID 0x07 is valid */
11987 unsigned int wcap = get_wcaps(codec, 0x07);
11991 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11992 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11993 spec->adc_nids = alc268_adc_nids_alt;
11994 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11995 add_mixer(spec, alc268_capture_alt_mixer);
11997 spec->adc_nids = alc268_adc_nids;
11998 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11999 add_mixer(spec, alc268_capture_mixer);
12001 spec->capsrc_nids = alc268_capsrc_nids;
12002 /* set default input source */
12003 for (i = 0; i < spec->num_adc_nids; i++)
12004 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12005 0, AC_VERB_SET_CONNECT_SEL,
12006 spec->input_mux->items[0].index);
12009 spec->vmaster_nid = 0x02;
12011 codec->patch_ops = alc_patch_ops;
12012 if (board_config == ALC268_AUTO)
12013 spec->init_hook = alc268_auto_init;
12015 codec->proc_widget_hook = print_realtek_coef;
12021 * ALC269 channel source setting (2 channel)
12023 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12025 #define alc269_dac_nids alc260_dac_nids
12027 static hda_nid_t alc269_adc_nids[1] = {
12032 static hda_nid_t alc269_capsrc_nids[1] = {
12036 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12040 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12048 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12056 #define alc269_modes alc260_modes
12057 #define alc269_capture_source alc880_lg_lw_capture_source
12059 static struct snd_kcontrol_new alc269_base_mixer[] = {
12060 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12061 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12062 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12063 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12066 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12067 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12068 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12069 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12070 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12071 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12072 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12073 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12077 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12078 /* output mixer control */
12079 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12081 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12082 .name = "Master Playback Switch",
12083 .info = snd_hda_mixer_amp_switch_info,
12084 .get = snd_hda_mixer_amp_switch_get,
12085 .put = alc268_acer_master_sw_put,
12086 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12089 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12090 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12091 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12092 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12093 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12094 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12095 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12099 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12100 /* output mixer control */
12101 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12103 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12104 .name = "Master Playback Switch",
12105 .info = snd_hda_mixer_amp_switch_info,
12106 .get = snd_hda_mixer_amp_switch_get,
12107 .put = alc268_acer_master_sw_put,
12108 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12112 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12113 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12114 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12115 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12116 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12117 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12118 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12119 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12120 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12124 /* bind volumes of both NID 0x0c and 0x0d */
12125 static struct hda_bind_ctls alc269_epc_bind_vol = {
12126 .ops = &snd_hda_bind_vol,
12128 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12129 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12134 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12135 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12136 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12137 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12141 /* capture mixer elements */
12142 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12143 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12144 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12150 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12151 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12152 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12153 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12158 static struct snd_kcontrol_new alc269_beep_mixer[] = {
12159 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12160 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12164 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12165 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12166 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12167 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12168 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12169 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12170 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12174 static struct hda_verb alc269_lifebook_verbs[] = {
12175 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12176 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12177 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12179 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12180 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12181 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12182 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12183 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12184 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12188 /* toggle speaker-output according to the hp-jack state */
12189 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12191 unsigned int present;
12192 unsigned char bits;
12194 present = snd_hda_codec_read(codec, 0x15, 0,
12195 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12196 bits = present ? AMP_IN_MUTE(0) : 0;
12197 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12198 AMP_IN_MUTE(0), bits);
12199 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12200 AMP_IN_MUTE(0), bits);
12202 snd_hda_codec_write(codec, 0x20, 0,
12203 AC_VERB_SET_COEF_INDEX, 0x0c);
12204 snd_hda_codec_write(codec, 0x20, 0,
12205 AC_VERB_SET_PROC_COEF, 0x680);
12207 snd_hda_codec_write(codec, 0x20, 0,
12208 AC_VERB_SET_COEF_INDEX, 0x0c);
12209 snd_hda_codec_write(codec, 0x20, 0,
12210 AC_VERB_SET_PROC_COEF, 0x480);
12213 /* toggle speaker-output according to the hp-jacks state */
12214 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12216 unsigned int present;
12217 unsigned char bits;
12219 /* Check laptop headphone socket */
12220 present = snd_hda_codec_read(codec, 0x15, 0,
12221 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12223 /* Check port replicator headphone socket */
12224 present |= snd_hda_codec_read(codec, 0x1a, 0,
12225 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12227 bits = present ? AMP_IN_MUTE(0) : 0;
12228 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12229 AMP_IN_MUTE(0), bits);
12230 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12231 AMP_IN_MUTE(0), bits);
12233 snd_hda_codec_write(codec, 0x20, 0,
12234 AC_VERB_SET_COEF_INDEX, 0x0c);
12235 snd_hda_codec_write(codec, 0x20, 0,
12236 AC_VERB_SET_PROC_COEF, 0x680);
12238 snd_hda_codec_write(codec, 0x20, 0,
12239 AC_VERB_SET_COEF_INDEX, 0x0c);
12240 snd_hda_codec_write(codec, 0x20, 0,
12241 AC_VERB_SET_PROC_COEF, 0x480);
12244 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12246 unsigned int present;
12248 present = snd_hda_codec_read(codec, 0x18, 0,
12249 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12250 snd_hda_codec_write(codec, 0x23, 0,
12251 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12254 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12256 unsigned int present_laptop;
12257 unsigned int present_dock;
12259 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12260 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12262 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12263 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12265 /* Laptop mic port overrides dock mic port, design decision */
12267 snd_hda_codec_write(codec, 0x23, 0,
12268 AC_VERB_SET_CONNECT_SEL, 0x3);
12269 if (present_laptop)
12270 snd_hda_codec_write(codec, 0x23, 0,
12271 AC_VERB_SET_CONNECT_SEL, 0x0);
12272 if (!present_dock && !present_laptop)
12273 snd_hda_codec_write(codec, 0x23, 0,
12274 AC_VERB_SET_CONNECT_SEL, 0x1);
12277 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12280 if ((res >> 26) == ALC880_HP_EVENT)
12281 alc269_quanta_fl1_speaker_automute(codec);
12282 if ((res >> 26) == ALC880_MIC_EVENT)
12283 alc269_quanta_fl1_mic_automute(codec);
12286 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12289 if ((res >> 26) == ALC880_HP_EVENT)
12290 alc269_lifebook_speaker_automute(codec);
12291 if ((res >> 26) == ALC880_MIC_EVENT)
12292 alc269_lifebook_mic_autoswitch(codec);
12295 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12297 alc269_quanta_fl1_speaker_automute(codec);
12298 alc269_quanta_fl1_mic_automute(codec);
12301 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12303 alc269_lifebook_speaker_automute(codec);
12304 alc269_lifebook_mic_autoswitch(codec);
12307 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12308 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12309 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12310 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12311 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12312 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12313 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12314 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12318 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12319 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12320 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12321 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12323 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12324 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12328 /* toggle speaker-output according to the hp-jack state */
12329 static void alc269_speaker_automute(struct hda_codec *codec)
12331 unsigned int present;
12332 unsigned char bits;
12334 present = snd_hda_codec_read(codec, 0x15, 0,
12335 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12336 bits = present ? AMP_IN_MUTE(0) : 0;
12337 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12338 AMP_IN_MUTE(0), bits);
12339 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12340 AMP_IN_MUTE(0), bits);
12343 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12345 unsigned int present;
12347 present = snd_hda_codec_read(codec, 0x18, 0,
12348 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12349 snd_hda_codec_write(codec, 0x23, 0,
12350 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12353 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12355 unsigned int present;
12357 present = snd_hda_codec_read(codec, 0x18, 0,
12358 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12359 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12360 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12361 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12362 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12365 /* unsolicited event for HP jack sensing */
12366 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12369 if ((res >> 26) == ALC880_HP_EVENT)
12370 alc269_speaker_automute(codec);
12372 if ((res >> 26) == ALC880_MIC_EVENT)
12373 alc269_eeepc_dmic_automute(codec);
12376 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12378 alc269_speaker_automute(codec);
12379 alc269_eeepc_dmic_automute(codec);
12382 /* unsolicited event for HP jack sensing */
12383 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12386 if ((res >> 26) == ALC880_HP_EVENT)
12387 alc269_speaker_automute(codec);
12389 if ((res >> 26) == ALC880_MIC_EVENT)
12390 alc269_eeepc_amic_automute(codec);
12393 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12395 alc269_speaker_automute(codec);
12396 alc269_eeepc_amic_automute(codec);
12400 * generic initialization of ADC, input mixers and output mixers
12402 static struct hda_verb alc269_init_verbs[] = {
12404 * Unmute ADC0 and set the default input to mic-in
12406 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12408 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12409 * analog-loopback mixer widget
12410 * Note: PASD motherboards uses the Line In 2 as the input for
12411 * front panel mic (mic 2)
12413 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12414 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12421 * Set up output mixers (0x0c - 0x0e)
12423 /* set vol=0 to output mixers */
12424 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12425 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12427 /* set up input amps for analog loopback */
12428 /* Amp Indices: DAC = 0, mixer = 1 */
12429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12432 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12433 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12438 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12439 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12441 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12442 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12445 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12446 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12448 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12449 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12450 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12452 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12453 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12455 /* FIXME: use matrix-type input source selection */
12456 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12457 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12464 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12465 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12469 /* add playback controls from the parsed DAC table */
12470 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12471 const struct auto_pin_cfg *cfg)
12476 spec->multiout.num_dacs = 1; /* only use one dac */
12477 spec->multiout.dac_nids = spec->private_dac_nids;
12478 spec->multiout.dac_nids[0] = 2;
12480 nid = cfg->line_out_pins[0];
12482 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12483 "Front Playback Volume",
12484 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12487 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12488 "Front Playback Switch",
12489 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12494 nid = cfg->speaker_pins[0];
12496 if (!cfg->line_out_pins[0]) {
12497 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12498 "Speaker Playback Volume",
12499 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12505 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12506 "Speaker Playback Switch",
12507 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12512 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12513 "Speaker Playback Switch",
12514 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12520 nid = cfg->hp_pins[0];
12522 /* spec->multiout.hp_nid = 2; */
12523 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12524 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12525 "Headphone Playback Volume",
12526 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12532 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12533 "Headphone Playback Switch",
12534 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12539 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12540 "Headphone Playback Switch",
12541 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12550 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12551 const struct auto_pin_cfg *cfg)
12555 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12558 /* digital-mic input pin is excluded in alc880_auto_create..()
12559 * because it's under 0x18
12561 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12562 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12563 struct hda_input_mux *imux = &spec->private_imux[0];
12564 imux->items[imux->num_items].label = "Int Mic";
12565 imux->items[imux->num_items].index = 0x05;
12571 #ifdef CONFIG_SND_HDA_POWER_SAVE
12572 #define alc269_loopbacks alc880_loopbacks
12575 /* pcm configuration: identiacal with ALC880 */
12576 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12577 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12578 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12579 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12582 * BIOS auto configuration
12584 static int alc269_parse_auto_config(struct hda_codec *codec)
12586 struct alc_spec *spec = codec->spec;
12588 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12590 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12595 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12598 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12602 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12604 if (spec->autocfg.dig_out_pin)
12605 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12607 if (spec->kctls.list)
12608 add_mixer(spec, spec->kctls.list);
12610 /* create a beep mixer control if the pin 0x1d isn't assigned */
12611 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12612 if (spec->autocfg.input_pins[i] == 0x1d)
12614 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12615 add_mixer(spec, alc269_beep_mixer);
12617 add_verb(spec, alc269_init_verbs);
12618 spec->num_mux_defs = 1;
12619 spec->input_mux = &spec->private_imux[0];
12620 /* set default input source */
12621 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12622 0, AC_VERB_SET_CONNECT_SEL,
12623 spec->input_mux->items[0].index);
12625 err = alc_auto_add_mic_boost(codec);
12629 if (!spec->cap_mixer)
12630 set_capture_mixer(spec);
12632 store_pin_configs(codec);
12636 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12637 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12638 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12641 /* init callback for auto-configuration model -- overriding the default init */
12642 static void alc269_auto_init(struct hda_codec *codec)
12644 struct alc_spec *spec = codec->spec;
12645 alc269_auto_init_multi_out(codec);
12646 alc269_auto_init_hp_out(codec);
12647 alc269_auto_init_analog_input(codec);
12648 if (spec->unsol_event)
12649 alc_inithook(codec);
12653 * configuration and preset
12655 static const char *alc269_models[ALC269_MODEL_LAST] = {
12656 [ALC269_BASIC] = "basic",
12657 [ALC269_QUANTA_FL1] = "quanta",
12658 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12659 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12660 [ALC269_FUJITSU] = "fujitsu",
12661 [ALC269_LIFEBOOK] = "lifebook"
12664 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12665 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12666 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12667 ALC269_ASUS_EEEPC_P703),
12668 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12669 ALC269_ASUS_EEEPC_P901),
12670 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12671 ALC269_ASUS_EEEPC_P901),
12672 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12673 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12677 static struct alc_config_preset alc269_presets[] = {
12679 .mixers = { alc269_base_mixer },
12680 .init_verbs = { alc269_init_verbs },
12681 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12682 .dac_nids = alc269_dac_nids,
12684 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12685 .channel_mode = alc269_modes,
12686 .input_mux = &alc269_capture_source,
12688 [ALC269_QUANTA_FL1] = {
12689 .mixers = { alc269_quanta_fl1_mixer },
12690 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12691 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12692 .dac_nids = alc269_dac_nids,
12694 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12695 .channel_mode = alc269_modes,
12696 .input_mux = &alc269_capture_source,
12697 .unsol_event = alc269_quanta_fl1_unsol_event,
12698 .init_hook = alc269_quanta_fl1_init_hook,
12700 [ALC269_ASUS_EEEPC_P703] = {
12701 .mixers = { alc269_eeepc_mixer },
12702 .cap_mixer = alc269_epc_capture_mixer,
12703 .init_verbs = { alc269_init_verbs,
12704 alc269_eeepc_amic_init_verbs },
12705 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12706 .dac_nids = alc269_dac_nids,
12708 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12709 .channel_mode = alc269_modes,
12710 .input_mux = &alc269_eeepc_amic_capture_source,
12711 .unsol_event = alc269_eeepc_amic_unsol_event,
12712 .init_hook = alc269_eeepc_amic_inithook,
12714 [ALC269_ASUS_EEEPC_P901] = {
12715 .mixers = { alc269_eeepc_mixer },
12716 .cap_mixer = alc269_epc_capture_mixer,
12717 .init_verbs = { alc269_init_verbs,
12718 alc269_eeepc_dmic_init_verbs },
12719 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12720 .dac_nids = alc269_dac_nids,
12722 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12723 .channel_mode = alc269_modes,
12724 .input_mux = &alc269_eeepc_dmic_capture_source,
12725 .unsol_event = alc269_eeepc_dmic_unsol_event,
12726 .init_hook = alc269_eeepc_dmic_inithook,
12728 [ALC269_FUJITSU] = {
12729 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12730 .cap_mixer = alc269_epc_capture_mixer,
12731 .init_verbs = { alc269_init_verbs,
12732 alc269_eeepc_dmic_init_verbs },
12733 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12734 .dac_nids = alc269_dac_nids,
12736 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12737 .channel_mode = alc269_modes,
12738 .input_mux = &alc269_eeepc_dmic_capture_source,
12739 .unsol_event = alc269_eeepc_dmic_unsol_event,
12740 .init_hook = alc269_eeepc_dmic_inithook,
12742 [ALC269_LIFEBOOK] = {
12743 .mixers = { alc269_lifebook_mixer },
12744 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12745 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12746 .dac_nids = alc269_dac_nids,
12748 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12749 .channel_mode = alc269_modes,
12750 .input_mux = &alc269_capture_source,
12751 .unsol_event = alc269_lifebook_unsol_event,
12752 .init_hook = alc269_lifebook_init_hook,
12756 static int patch_alc269(struct hda_codec *codec)
12758 struct alc_spec *spec;
12762 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12766 codec->spec = spec;
12768 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12770 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12774 if (board_config < 0) {
12775 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12776 "trying auto-probe from BIOS...\n");
12777 board_config = ALC269_AUTO;
12780 if (board_config == ALC269_AUTO) {
12781 /* automatic parse from the BIOS config */
12782 err = alc269_parse_auto_config(codec);
12788 "hda_codec: Cannot set up configuration "
12789 "from BIOS. Using base mode...\n");
12790 board_config = ALC269_BASIC;
12794 if (board_config != ALC269_AUTO)
12795 setup_preset(spec, &alc269_presets[board_config]);
12797 spec->stream_name_analog = "ALC269 Analog";
12798 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12799 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12801 spec->stream_name_digital = "ALC269 Digital";
12802 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12803 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12805 spec->adc_nids = alc269_adc_nids;
12806 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12807 spec->capsrc_nids = alc269_capsrc_nids;
12808 if (!spec->cap_mixer)
12809 set_capture_mixer(spec);
12811 codec->patch_ops = alc_patch_ops;
12812 if (board_config == ALC269_AUTO)
12813 spec->init_hook = alc269_auto_init;
12814 #ifdef CONFIG_SND_HDA_POWER_SAVE
12815 if (!spec->loopback.amplist)
12816 spec->loopback.amplist = alc269_loopbacks;
12818 codec->proc_widget_hook = print_realtek_coef;
12824 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12828 * set the path ways for 2 channel output
12829 * need to set the codec line out and mic 1 pin widgets to inputs
12831 static struct hda_verb alc861_threestack_ch2_init[] = {
12832 /* set pin widget 1Ah (line in) for input */
12833 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12834 /* set pin widget 18h (mic1/2) for input, for mic also enable
12837 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12839 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12841 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12842 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12848 * need to set the codec line out and mic 1 pin widgets to outputs
12850 static struct hda_verb alc861_threestack_ch6_init[] = {
12851 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12852 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12853 /* set pin widget 18h (mic1) for output (CLFE)*/
12854 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12856 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12857 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12859 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12861 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12862 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12867 static struct hda_channel_mode alc861_threestack_modes[2] = {
12868 { 2, alc861_threestack_ch2_init },
12869 { 6, alc861_threestack_ch6_init },
12871 /* Set mic1 as input and unmute the mixer */
12872 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12873 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12874 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12877 /* Set mic1 as output and mute mixer */
12878 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12879 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12880 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12884 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12885 { 2, alc861_uniwill_m31_ch2_init },
12886 { 4, alc861_uniwill_m31_ch4_init },
12889 /* Set mic1 and line-in as input and unmute the mixer */
12890 static struct hda_verb alc861_asus_ch2_init[] = {
12891 /* set pin widget 1Ah (line in) for input */
12892 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12893 /* set pin widget 18h (mic1/2) for input, for mic also enable
12896 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12898 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12900 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12901 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12905 /* Set mic1 nad line-in as output and mute mixer */
12906 static struct hda_verb alc861_asus_ch6_init[] = {
12907 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12908 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12909 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12910 /* set pin widget 18h (mic1) for output (CLFE)*/
12911 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12912 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12913 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12914 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12916 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12918 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12919 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12924 static struct hda_channel_mode alc861_asus_modes[2] = {
12925 { 2, alc861_asus_ch2_init },
12926 { 6, alc861_asus_ch6_init },
12931 static struct snd_kcontrol_new alc861_base_mixer[] = {
12932 /* output mixer control */
12933 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12934 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12935 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12936 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12937 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12939 /*Input mixer control */
12940 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12941 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12942 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12943 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12944 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12945 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12947 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12948 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12949 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12954 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12955 /* output mixer control */
12956 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12957 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12958 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12959 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12960 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12962 /* Input mixer control */
12963 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12964 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12965 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12966 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12967 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12968 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12970 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12971 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12975 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12976 .name = "Channel Mode",
12977 .info = alc_ch_mode_info,
12978 .get = alc_ch_mode_get,
12979 .put = alc_ch_mode_put,
12980 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12985 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12986 /* output mixer control */
12987 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12989 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12994 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12995 /* output mixer control */
12996 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12997 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12998 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12999 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13000 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13002 /* Input mixer control */
13003 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13004 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13005 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13006 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13007 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13008 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13010 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13011 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13012 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13015 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13016 .name = "Channel Mode",
13017 .info = alc_ch_mode_info,
13018 .get = alc_ch_mode_get,
13019 .put = alc_ch_mode_put,
13020 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13025 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13026 /* output mixer control */
13027 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13028 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13029 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13030 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13031 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13033 /* Input mixer control */
13034 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13035 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13036 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13037 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13038 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13039 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13041 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13042 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13043 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13047 .name = "Channel Mode",
13048 .info = alc_ch_mode_info,
13049 .get = alc_ch_mode_get,
13050 .put = alc_ch_mode_put,
13051 .private_value = ARRAY_SIZE(alc861_asus_modes),
13056 /* additional mixer */
13057 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13058 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13059 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13060 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
13061 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
13066 * generic initialization of ADC, input mixers and output mixers
13068 static struct hda_verb alc861_base_init_verbs[] = {
13070 * Unmute ADC0 and set the default input to mic-in
13072 /* port-A for surround (rear panel) */
13073 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13074 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13075 /* port-B for mic-in (rear panel) with vref */
13076 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13077 /* port-C for line-in (rear panel) */
13078 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13079 /* port-D for Front */
13080 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13081 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13082 /* port-E for HP out (front panel) */
13083 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13084 /* route front PCM to HP */
13085 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13086 /* port-F for mic-in (front panel) with vref */
13087 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13088 /* port-G for CLFE (rear panel) */
13089 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13090 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13091 /* port-H for side (rear panel) */
13092 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13093 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13095 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13096 /* route front mic to ADC1*/
13097 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13098 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13100 /* Unmute DAC0~3 & spdif out*/
13101 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13103 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13104 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13107 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13108 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13109 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13110 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13111 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13113 /* Unmute Stereo Mixer 15 */
13114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13119 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13120 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13121 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13122 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13123 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13124 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13125 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13127 /* hp used DAC 3 (Front) */
13128 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13129 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13134 static struct hda_verb alc861_threestack_init_verbs[] = {
13136 * Unmute ADC0 and set the default input to mic-in
13138 /* port-A for surround (rear panel) */
13139 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13140 /* port-B for mic-in (rear panel) with vref */
13141 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13142 /* port-C for line-in (rear panel) */
13143 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13144 /* port-D for Front */
13145 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13146 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13147 /* port-E for HP out (front panel) */
13148 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13149 /* route front PCM to HP */
13150 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13151 /* port-F for mic-in (front panel) with vref */
13152 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13153 /* port-G for CLFE (rear panel) */
13154 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13155 /* port-H for side (rear panel) */
13156 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13158 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13159 /* route front mic to ADC1*/
13160 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13161 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13162 /* Unmute DAC0~3 & spdif out*/
13163 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13164 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13165 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13166 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13169 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13170 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13171 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13172 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13173 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13175 /* Unmute Stereo Mixer 15 */
13176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13181 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13182 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13184 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13185 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13189 /* hp used DAC 3 (Front) */
13190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13195 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13197 * Unmute ADC0 and set the default input to mic-in
13199 /* port-A for surround (rear panel) */
13200 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13201 /* port-B for mic-in (rear panel) with vref */
13202 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13203 /* port-C for line-in (rear panel) */
13204 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13205 /* port-D for Front */
13206 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13207 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13208 /* port-E for HP out (front panel) */
13209 /* this has to be set to VREF80 */
13210 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13211 /* route front PCM to HP */
13212 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13213 /* port-F for mic-in (front panel) with vref */
13214 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13215 /* port-G for CLFE (rear panel) */
13216 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13217 /* port-H for side (rear panel) */
13218 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13220 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13221 /* route front mic to ADC1*/
13222 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13224 /* Unmute DAC0~3 & spdif out*/
13225 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13226 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13227 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13228 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13231 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13232 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13233 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13234 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13235 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13237 /* Unmute Stereo Mixer 15 */
13238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13239 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13241 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13243 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13244 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13245 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13246 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13247 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13249 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13251 /* hp used DAC 3 (Front) */
13252 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13257 static struct hda_verb alc861_asus_init_verbs[] = {
13259 * Unmute ADC0 and set the default input to mic-in
13261 /* port-A for surround (rear panel)
13262 * according to codec#0 this is the HP jack
13264 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13265 /* route front PCM to HP */
13266 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13267 /* port-B for mic-in (rear panel) with vref */
13268 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13269 /* port-C for line-in (rear panel) */
13270 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13271 /* port-D for Front */
13272 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13273 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13274 /* port-E for HP out (front panel) */
13275 /* this has to be set to VREF80 */
13276 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13277 /* route front PCM to HP */
13278 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13279 /* port-F for mic-in (front panel) with vref */
13280 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13281 /* port-G for CLFE (rear panel) */
13282 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13283 /* port-H for side (rear panel) */
13284 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13286 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13287 /* route front mic to ADC1*/
13288 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13289 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13290 /* Unmute DAC0~3 & spdif out*/
13291 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13292 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13293 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13294 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13296 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13297 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13298 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13299 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13300 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13302 /* Unmute Stereo Mixer 15 */
13303 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13308 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13309 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13310 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13311 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13312 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13313 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13314 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13315 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13316 /* hp used DAC 3 (Front) */
13317 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13318 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13322 /* additional init verbs for ASUS laptops */
13323 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13324 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13325 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13330 * generic initialization of ADC, input mixers and output mixers
13332 static struct hda_verb alc861_auto_init_verbs[] = {
13334 * Unmute ADC0 and set the default input to mic-in
13336 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13337 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13339 /* Unmute DAC0~3 & spdif out*/
13340 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13341 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13342 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13343 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13344 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13346 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13347 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13348 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13349 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13350 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13352 /* Unmute Stereo Mixer 15 */
13353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13354 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13355 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13358 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13359 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13360 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13361 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13362 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13363 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13364 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13365 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13367 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13368 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13369 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13370 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13371 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13372 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13373 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13374 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13376 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13381 static struct hda_verb alc861_toshiba_init_verbs[] = {
13382 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13387 /* toggle speaker-output according to the hp-jack state */
13388 static void alc861_toshiba_automute(struct hda_codec *codec)
13390 unsigned int present;
13392 present = snd_hda_codec_read(codec, 0x0f, 0,
13393 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13394 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13395 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13396 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13397 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13400 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13403 if ((res >> 26) == ALC880_HP_EVENT)
13404 alc861_toshiba_automute(codec);
13407 /* pcm configuration: identiacal with ALC880 */
13408 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13409 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13410 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13411 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13414 #define ALC861_DIGOUT_NID 0x07
13416 static struct hda_channel_mode alc861_8ch_modes[1] = {
13420 static hda_nid_t alc861_dac_nids[4] = {
13421 /* front, surround, clfe, side */
13422 0x03, 0x06, 0x05, 0x04
13425 static hda_nid_t alc660_dac_nids[3] = {
13426 /* front, clfe, surround */
13430 static hda_nid_t alc861_adc_nids[1] = {
13435 static struct hda_input_mux alc861_capture_source = {
13439 { "Front Mic", 0x3 },
13446 /* fill in the dac_nids table from the parsed pin configuration */
13447 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13448 const struct auto_pin_cfg *cfg)
13453 spec->multiout.dac_nids = spec->private_dac_nids;
13454 for (i = 0; i < cfg->line_outs; i++) {
13455 nid = cfg->line_out_pins[i];
13457 if (i >= ARRAY_SIZE(alc861_dac_nids))
13459 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13462 spec->multiout.num_dacs = cfg->line_outs;
13466 /* add playback controls from the parsed DAC table */
13467 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13468 const struct auto_pin_cfg *cfg)
13471 static const char *chname[4] = {
13472 "Front", "Surround", NULL /*CLFE*/, "Side"
13477 for (i = 0; i < cfg->line_outs; i++) {
13478 nid = spec->multiout.dac_nids[i];
13483 err = add_control(spec, ALC_CTL_BIND_MUTE,
13484 "Center Playback Switch",
13485 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13489 err = add_control(spec, ALC_CTL_BIND_MUTE,
13490 "LFE Playback Switch",
13491 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13496 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13498 if (nid == alc861_dac_nids[idx])
13500 sprintf(name, "%s Playback Switch", chname[idx]);
13501 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13502 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13511 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13519 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13521 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13522 "Headphone Playback Switch",
13523 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13526 spec->multiout.hp_nid = nid;
13531 /* create playback/capture controls for input pins */
13532 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13533 const struct auto_pin_cfg *cfg)
13535 struct hda_input_mux *imux = &spec->private_imux[0];
13536 int i, err, idx, idx1;
13538 for (i = 0; i < AUTO_PIN_LAST; i++) {
13539 switch (cfg->input_pins[i]) {
13542 idx = 2; /* Line In */
13546 idx = 2; /* Line In */
13550 idx = 1; /* Mic In */
13554 idx = 1; /* Mic In */
13564 err = new_analog_input(spec, cfg->input_pins[i],
13565 auto_pin_cfg_labels[i], idx, 0x15);
13569 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13570 imux->items[imux->num_items].index = idx1;
13576 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13578 int pin_type, int dac_idx)
13580 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13582 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13586 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13588 struct alc_spec *spec = codec->spec;
13591 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13592 for (i = 0; i < spec->autocfg.line_outs; i++) {
13593 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13594 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13596 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13597 spec->multiout.dac_nids[i]);
13601 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13603 struct alc_spec *spec = codec->spec;
13606 pin = spec->autocfg.hp_pins[0];
13607 if (pin) /* connect to front */
13608 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13609 spec->multiout.dac_nids[0]);
13610 pin = spec->autocfg.speaker_pins[0];
13612 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13615 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13617 struct alc_spec *spec = codec->spec;
13620 for (i = 0; i < AUTO_PIN_LAST; i++) {
13621 hda_nid_t nid = spec->autocfg.input_pins[i];
13622 if (nid >= 0x0c && nid <= 0x11) {
13623 snd_hda_codec_write(codec, nid, 0,
13624 AC_VERB_SET_PIN_WIDGET_CONTROL,
13625 i <= AUTO_PIN_FRONT_MIC ?
13626 PIN_VREF80 : PIN_IN);
13631 /* parse the BIOS configuration and set up the alc_spec */
13632 /* return 1 if successful, 0 if the proper config is not found,
13633 * or a negative error code
13635 static int alc861_parse_auto_config(struct hda_codec *codec)
13637 struct alc_spec *spec = codec->spec;
13639 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13641 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13645 if (!spec->autocfg.line_outs)
13646 return 0; /* can't find valid BIOS pin config */
13648 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13651 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13654 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13657 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13661 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13663 if (spec->autocfg.dig_out_pin)
13664 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13666 if (spec->kctls.list)
13667 add_mixer(spec, spec->kctls.list);
13669 add_verb(spec, alc861_auto_init_verbs);
13671 spec->num_mux_defs = 1;
13672 spec->input_mux = &spec->private_imux[0];
13674 spec->adc_nids = alc861_adc_nids;
13675 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13676 set_capture_mixer(spec);
13678 store_pin_configs(codec);
13682 /* additional initialization for auto-configuration model */
13683 static void alc861_auto_init(struct hda_codec *codec)
13685 struct alc_spec *spec = codec->spec;
13686 alc861_auto_init_multi_out(codec);
13687 alc861_auto_init_hp_out(codec);
13688 alc861_auto_init_analog_input(codec);
13689 if (spec->unsol_event)
13690 alc_inithook(codec);
13693 #ifdef CONFIG_SND_HDA_POWER_SAVE
13694 static struct hda_amp_list alc861_loopbacks[] = {
13695 { 0x15, HDA_INPUT, 0 },
13696 { 0x15, HDA_INPUT, 1 },
13697 { 0x15, HDA_INPUT, 2 },
13698 { 0x15, HDA_INPUT, 3 },
13705 * configuration and preset
13707 static const char *alc861_models[ALC861_MODEL_LAST] = {
13708 [ALC861_3ST] = "3stack",
13709 [ALC660_3ST] = "3stack-660",
13710 [ALC861_3ST_DIG] = "3stack-dig",
13711 [ALC861_6ST_DIG] = "6stack-dig",
13712 [ALC861_UNIWILL_M31] = "uniwill-m31",
13713 [ALC861_TOSHIBA] = "toshiba",
13714 [ALC861_ASUS] = "asus",
13715 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13716 [ALC861_AUTO] = "auto",
13719 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13720 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13721 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13722 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13723 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13724 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13725 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13726 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13727 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13728 * Any other models that need this preset?
13730 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13731 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13732 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13733 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13734 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13735 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13736 /* FIXME: the below seems conflict */
13737 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13738 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13739 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13743 static struct alc_config_preset alc861_presets[] = {
13745 .mixers = { alc861_3ST_mixer },
13746 .init_verbs = { alc861_threestack_init_verbs },
13747 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13748 .dac_nids = alc861_dac_nids,
13749 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13750 .channel_mode = alc861_threestack_modes,
13752 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13753 .adc_nids = alc861_adc_nids,
13754 .input_mux = &alc861_capture_source,
13756 [ALC861_3ST_DIG] = {
13757 .mixers = { alc861_base_mixer },
13758 .init_verbs = { alc861_threestack_init_verbs },
13759 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13760 .dac_nids = alc861_dac_nids,
13761 .dig_out_nid = ALC861_DIGOUT_NID,
13762 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13763 .channel_mode = alc861_threestack_modes,
13765 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13766 .adc_nids = alc861_adc_nids,
13767 .input_mux = &alc861_capture_source,
13769 [ALC861_6ST_DIG] = {
13770 .mixers = { alc861_base_mixer },
13771 .init_verbs = { alc861_base_init_verbs },
13772 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13773 .dac_nids = alc861_dac_nids,
13774 .dig_out_nid = ALC861_DIGOUT_NID,
13775 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13776 .channel_mode = alc861_8ch_modes,
13777 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13778 .adc_nids = alc861_adc_nids,
13779 .input_mux = &alc861_capture_source,
13782 .mixers = { alc861_3ST_mixer },
13783 .init_verbs = { alc861_threestack_init_verbs },
13784 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13785 .dac_nids = alc660_dac_nids,
13786 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13787 .channel_mode = alc861_threestack_modes,
13789 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13790 .adc_nids = alc861_adc_nids,
13791 .input_mux = &alc861_capture_source,
13793 [ALC861_UNIWILL_M31] = {
13794 .mixers = { alc861_uniwill_m31_mixer },
13795 .init_verbs = { alc861_uniwill_m31_init_verbs },
13796 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13797 .dac_nids = alc861_dac_nids,
13798 .dig_out_nid = ALC861_DIGOUT_NID,
13799 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13800 .channel_mode = alc861_uniwill_m31_modes,
13802 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13803 .adc_nids = alc861_adc_nids,
13804 .input_mux = &alc861_capture_source,
13806 [ALC861_TOSHIBA] = {
13807 .mixers = { alc861_toshiba_mixer },
13808 .init_verbs = { alc861_base_init_verbs,
13809 alc861_toshiba_init_verbs },
13810 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13811 .dac_nids = alc861_dac_nids,
13812 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13813 .channel_mode = alc883_3ST_2ch_modes,
13814 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13815 .adc_nids = alc861_adc_nids,
13816 .input_mux = &alc861_capture_source,
13817 .unsol_event = alc861_toshiba_unsol_event,
13818 .init_hook = alc861_toshiba_automute,
13821 .mixers = { alc861_asus_mixer },
13822 .init_verbs = { alc861_asus_init_verbs },
13823 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13824 .dac_nids = alc861_dac_nids,
13825 .dig_out_nid = ALC861_DIGOUT_NID,
13826 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13827 .channel_mode = alc861_asus_modes,
13830 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13831 .adc_nids = alc861_adc_nids,
13832 .input_mux = &alc861_capture_source,
13834 [ALC861_ASUS_LAPTOP] = {
13835 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13836 .init_verbs = { alc861_asus_init_verbs,
13837 alc861_asus_laptop_init_verbs },
13838 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13839 .dac_nids = alc861_dac_nids,
13840 .dig_out_nid = ALC861_DIGOUT_NID,
13841 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13842 .channel_mode = alc883_3ST_2ch_modes,
13844 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13845 .adc_nids = alc861_adc_nids,
13846 .input_mux = &alc861_capture_source,
13851 static int patch_alc861(struct hda_codec *codec)
13853 struct alc_spec *spec;
13857 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13861 codec->spec = spec;
13863 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13867 if (board_config < 0) {
13868 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13869 "trying auto-probe from BIOS...\n");
13870 board_config = ALC861_AUTO;
13873 if (board_config == ALC861_AUTO) {
13874 /* automatic parse from the BIOS config */
13875 err = alc861_parse_auto_config(codec);
13881 "hda_codec: Cannot set up configuration "
13882 "from BIOS. Using base mode...\n");
13883 board_config = ALC861_3ST_DIG;
13887 if (board_config != ALC861_AUTO)
13888 setup_preset(spec, &alc861_presets[board_config]);
13890 spec->stream_name_analog = "ALC861 Analog";
13891 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13892 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13894 spec->stream_name_digital = "ALC861 Digital";
13895 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13896 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13898 spec->vmaster_nid = 0x03;
13900 codec->patch_ops = alc_patch_ops;
13901 if (board_config == ALC861_AUTO)
13902 spec->init_hook = alc861_auto_init;
13903 #ifdef CONFIG_SND_HDA_POWER_SAVE
13904 if (!spec->loopback.amplist)
13905 spec->loopback.amplist = alc861_loopbacks;
13907 codec->proc_widget_hook = print_realtek_coef;
13913 * ALC861-VD support
13917 * In addition, an independent DAC
13919 #define ALC861VD_DIGOUT_NID 0x06
13921 static hda_nid_t alc861vd_dac_nids[4] = {
13922 /* front, surr, clfe, side surr */
13923 0x02, 0x03, 0x04, 0x05
13926 /* dac_nids for ALC660vd are in a different order - according to
13927 * Realtek's driver.
13928 * This should probably tesult in a different mixer for 6stack models
13929 * of ALC660vd codecs, but for now there is only 3stack mixer
13930 * - and it is the same as in 861vd.
13931 * adc_nids in ALC660vd are (is) the same as in 861vd
13933 static hda_nid_t alc660vd_dac_nids[3] = {
13934 /* front, rear, clfe, rear_surr */
13938 static hda_nid_t alc861vd_adc_nids[1] = {
13943 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13946 /* FIXME: should be a matrix-type input source selection */
13947 static struct hda_input_mux alc861vd_capture_source = {
13951 { "Front Mic", 0x1 },
13957 static struct hda_input_mux alc861vd_dallas_capture_source = {
13960 { "Ext Mic", 0x0 },
13961 { "Int Mic", 0x1 },
13965 static struct hda_input_mux alc861vd_hp_capture_source = {
13968 { "Front Mic", 0x0 },
13969 { "ATAPI Mic", 0x1 },
13976 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13983 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13984 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13985 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13986 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13987 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13994 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13995 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13996 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13997 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13998 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14002 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14003 { 6, alc861vd_6stack_ch6_init },
14004 { 8, alc861vd_6stack_ch8_init },
14007 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14009 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14010 .name = "Channel Mode",
14011 .info = alc_ch_mode_info,
14012 .get = alc_ch_mode_get,
14013 .put = alc_ch_mode_put,
14018 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14019 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14021 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14022 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14023 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14025 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14026 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14028 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14030 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14032 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14033 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14035 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14036 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14038 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14040 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14041 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14042 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14044 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14045 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14046 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14048 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14049 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14051 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14052 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14054 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14055 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14060 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14061 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14062 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14066 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14070 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14071 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14072 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14074 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14075 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14077 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14078 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14080 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14081 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14086 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14087 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14088 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14089 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14091 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14093 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14097 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14098 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14099 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14101 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14102 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14107 /* Pin assignment: Speaker=0x14, HP = 0x15,
14108 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14110 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14111 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14112 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14113 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14114 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14115 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14116 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14117 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14118 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14119 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14120 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14121 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
14122 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
14126 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14127 * Front Mic=0x18, ATAPI Mic = 0x19,
14129 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14130 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14132 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14133 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14134 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14135 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14136 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14137 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14143 * generic initialization of ADC, input mixers and output mixers
14145 static struct hda_verb alc861vd_volume_init_verbs[] = {
14147 * Unmute ADC0 and set the default input to mic-in
14149 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14150 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14152 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14153 * the analog-loopback mixer widget
14155 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14159 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14160 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14162 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14164 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14165 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14169 * Set up output mixers (0x02 - 0x05)
14171 /* set vol=0 to output mixers */
14172 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14173 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14174 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14175 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14177 /* set up input amps for analog loopback */
14178 /* Amp Indices: DAC = 0, mixer = 1 */
14179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14181 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14185 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14186 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14192 * 3-stack pin configuration:
14193 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14195 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14197 * Set pin mode and muting
14199 /* set front pin widgets 0x14 for output */
14200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14201 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14202 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14204 /* Mic (rear) pin: input vref at 80% */
14205 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14207 /* Front Mic pin: input vref at 80% */
14208 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14209 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14210 /* Line In pin: input */
14211 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14213 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14215 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14216 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14217 /* CD pin widget for input */
14218 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14224 * 6-stack pin configuration:
14226 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14228 * Set pin mode and muting
14230 /* set front pin widgets 0x14 for output */
14231 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14232 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14233 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14235 /* Rear Pin: output 1 (0x0d) */
14236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14237 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14238 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14239 /* CLFE Pin: output 2 (0x0e) */
14240 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14241 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14242 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14243 /* Side Pin: output 3 (0x0f) */
14244 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14245 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14246 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14248 /* Mic (rear) pin: input vref at 80% */
14249 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14250 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14251 /* Front Mic pin: input vref at 80% */
14252 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14254 /* Line In pin: input */
14255 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14256 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14257 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14258 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14259 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14260 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14261 /* CD pin widget for input */
14262 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14267 static struct hda_verb alc861vd_eapd_verbs[] = {
14268 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14272 static struct hda_verb alc660vd_eapd_verbs[] = {
14273 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14274 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14278 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14282 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14283 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14287 /* toggle speaker-output according to the hp-jack state */
14288 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14290 unsigned int present;
14291 unsigned char bits;
14293 present = snd_hda_codec_read(codec, 0x1b, 0,
14294 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14295 bits = present ? HDA_AMP_MUTE : 0;
14296 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14297 HDA_AMP_MUTE, bits);
14300 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14302 unsigned int present;
14303 unsigned char bits;
14305 present = snd_hda_codec_read(codec, 0x18, 0,
14306 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14307 bits = present ? HDA_AMP_MUTE : 0;
14308 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14309 HDA_AMP_MUTE, bits);
14312 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14314 alc861vd_lenovo_hp_automute(codec);
14315 alc861vd_lenovo_mic_automute(codec);
14318 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14321 switch (res >> 26) {
14322 case ALC880_HP_EVENT:
14323 alc861vd_lenovo_hp_automute(codec);
14325 case ALC880_MIC_EVENT:
14326 alc861vd_lenovo_mic_automute(codec);
14331 static struct hda_verb alc861vd_dallas_verbs[] = {
14332 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14333 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14334 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14335 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14343 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14344 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14346 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14347 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14348 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14350 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14351 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14352 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14353 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14355 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14356 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14357 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14358 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14359 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14360 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14361 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14362 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14369 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14370 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14371 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14376 /* toggle speaker-output according to the hp-jack state */
14377 static void alc861vd_dallas_automute(struct hda_codec *codec)
14379 unsigned int present;
14381 present = snd_hda_codec_read(codec, 0x15, 0,
14382 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14383 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14384 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14387 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14389 if ((res >> 26) == ALC880_HP_EVENT)
14390 alc861vd_dallas_automute(codec);
14393 #ifdef CONFIG_SND_HDA_POWER_SAVE
14394 #define alc861vd_loopbacks alc880_loopbacks
14397 /* pcm configuration: identiacal with ALC880 */
14398 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14399 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14400 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14401 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14404 * configuration and preset
14406 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14407 [ALC660VD_3ST] = "3stack-660",
14408 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14409 [ALC660VD_ASUS_V1S] = "asus-v1s",
14410 [ALC861VD_3ST] = "3stack",
14411 [ALC861VD_3ST_DIG] = "3stack-digout",
14412 [ALC861VD_6ST_DIG] = "6stack-digout",
14413 [ALC861VD_LENOVO] = "lenovo",
14414 [ALC861VD_DALLAS] = "dallas",
14415 [ALC861VD_HP] = "hp",
14416 [ALC861VD_AUTO] = "auto",
14419 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14420 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14421 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14422 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14423 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14424 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14425 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14426 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14427 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14428 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14429 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14430 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14431 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14432 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14433 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14434 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14435 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14436 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14440 static struct alc_config_preset alc861vd_presets[] = {
14442 .mixers = { alc861vd_3st_mixer },
14443 .init_verbs = { alc861vd_volume_init_verbs,
14444 alc861vd_3stack_init_verbs },
14445 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14446 .dac_nids = alc660vd_dac_nids,
14447 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14448 .channel_mode = alc861vd_3stack_2ch_modes,
14449 .input_mux = &alc861vd_capture_source,
14451 [ALC660VD_3ST_DIG] = {
14452 .mixers = { alc861vd_3st_mixer },
14453 .init_verbs = { alc861vd_volume_init_verbs,
14454 alc861vd_3stack_init_verbs },
14455 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14456 .dac_nids = alc660vd_dac_nids,
14457 .dig_out_nid = ALC861VD_DIGOUT_NID,
14458 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14459 .channel_mode = alc861vd_3stack_2ch_modes,
14460 .input_mux = &alc861vd_capture_source,
14463 .mixers = { alc861vd_3st_mixer },
14464 .init_verbs = { alc861vd_volume_init_verbs,
14465 alc861vd_3stack_init_verbs },
14466 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14467 .dac_nids = alc861vd_dac_nids,
14468 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14469 .channel_mode = alc861vd_3stack_2ch_modes,
14470 .input_mux = &alc861vd_capture_source,
14472 [ALC861VD_3ST_DIG] = {
14473 .mixers = { alc861vd_3st_mixer },
14474 .init_verbs = { alc861vd_volume_init_verbs,
14475 alc861vd_3stack_init_verbs },
14476 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14477 .dac_nids = alc861vd_dac_nids,
14478 .dig_out_nid = ALC861VD_DIGOUT_NID,
14479 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14480 .channel_mode = alc861vd_3stack_2ch_modes,
14481 .input_mux = &alc861vd_capture_source,
14483 [ALC861VD_6ST_DIG] = {
14484 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14485 .init_verbs = { alc861vd_volume_init_verbs,
14486 alc861vd_6stack_init_verbs },
14487 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14488 .dac_nids = alc861vd_dac_nids,
14489 .dig_out_nid = ALC861VD_DIGOUT_NID,
14490 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14491 .channel_mode = alc861vd_6stack_modes,
14492 .input_mux = &alc861vd_capture_source,
14494 [ALC861VD_LENOVO] = {
14495 .mixers = { alc861vd_lenovo_mixer },
14496 .init_verbs = { alc861vd_volume_init_verbs,
14497 alc861vd_3stack_init_verbs,
14498 alc861vd_eapd_verbs,
14499 alc861vd_lenovo_unsol_verbs },
14500 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14501 .dac_nids = alc660vd_dac_nids,
14502 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14503 .channel_mode = alc861vd_3stack_2ch_modes,
14504 .input_mux = &alc861vd_capture_source,
14505 .unsol_event = alc861vd_lenovo_unsol_event,
14506 .init_hook = alc861vd_lenovo_automute,
14508 [ALC861VD_DALLAS] = {
14509 .mixers = { alc861vd_dallas_mixer },
14510 .init_verbs = { alc861vd_dallas_verbs },
14511 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14512 .dac_nids = alc861vd_dac_nids,
14513 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14514 .channel_mode = alc861vd_3stack_2ch_modes,
14515 .input_mux = &alc861vd_dallas_capture_source,
14516 .unsol_event = alc861vd_dallas_unsol_event,
14517 .init_hook = alc861vd_dallas_automute,
14520 .mixers = { alc861vd_hp_mixer },
14521 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14522 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14523 .dac_nids = alc861vd_dac_nids,
14524 .dig_out_nid = ALC861VD_DIGOUT_NID,
14525 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14526 .channel_mode = alc861vd_3stack_2ch_modes,
14527 .input_mux = &alc861vd_hp_capture_source,
14528 .unsol_event = alc861vd_dallas_unsol_event,
14529 .init_hook = alc861vd_dallas_automute,
14531 [ALC660VD_ASUS_V1S] = {
14532 .mixers = { alc861vd_lenovo_mixer },
14533 .init_verbs = { alc861vd_volume_init_verbs,
14534 alc861vd_3stack_init_verbs,
14535 alc861vd_eapd_verbs,
14536 alc861vd_lenovo_unsol_verbs },
14537 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14538 .dac_nids = alc660vd_dac_nids,
14539 .dig_out_nid = ALC861VD_DIGOUT_NID,
14540 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14541 .channel_mode = alc861vd_3stack_2ch_modes,
14542 .input_mux = &alc861vd_capture_source,
14543 .unsol_event = alc861vd_lenovo_unsol_event,
14544 .init_hook = alc861vd_lenovo_automute,
14549 * BIOS auto configuration
14551 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14552 hda_nid_t nid, int pin_type, int dac_idx)
14554 alc_set_pin_output(codec, nid, pin_type);
14557 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14559 struct alc_spec *spec = codec->spec;
14562 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14563 for (i = 0; i <= HDA_SIDE; i++) {
14564 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14565 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14567 alc861vd_auto_set_output_and_unmute(codec, nid,
14573 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14575 struct alc_spec *spec = codec->spec;
14578 pin = spec->autocfg.hp_pins[0];
14579 if (pin) /* connect to front and use dac 0 */
14580 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14581 pin = spec->autocfg.speaker_pins[0];
14583 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14586 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14587 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14589 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14591 struct alc_spec *spec = codec->spec;
14594 for (i = 0; i < AUTO_PIN_LAST; i++) {
14595 hda_nid_t nid = spec->autocfg.input_pins[i];
14596 if (alc861vd_is_input_pin(nid)) {
14597 snd_hda_codec_write(codec, nid, 0,
14598 AC_VERB_SET_PIN_WIDGET_CONTROL,
14599 i <= AUTO_PIN_FRONT_MIC ?
14600 PIN_VREF80 : PIN_IN);
14601 if (nid != ALC861VD_PIN_CD_NID)
14602 snd_hda_codec_write(codec, nid, 0,
14603 AC_VERB_SET_AMP_GAIN_MUTE,
14609 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14611 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14612 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14614 /* add playback controls from the parsed DAC table */
14615 /* Based on ALC880 version. But ALC861VD has separate,
14616 * different NIDs for mute/unmute switch and volume control */
14617 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14618 const struct auto_pin_cfg *cfg)
14621 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14622 hda_nid_t nid_v, nid_s;
14625 for (i = 0; i < cfg->line_outs; i++) {
14626 if (!spec->multiout.dac_nids[i])
14628 nid_v = alc861vd_idx_to_mixer_vol(
14630 spec->multiout.dac_nids[i]));
14631 nid_s = alc861vd_idx_to_mixer_switch(
14633 spec->multiout.dac_nids[i]));
14637 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14638 "Center Playback Volume",
14639 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14643 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14644 "LFE Playback Volume",
14645 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14649 err = add_control(spec, ALC_CTL_BIND_MUTE,
14650 "Center Playback Switch",
14651 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14655 err = add_control(spec, ALC_CTL_BIND_MUTE,
14656 "LFE Playback Switch",
14657 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14662 sprintf(name, "%s Playback Volume", chname[i]);
14663 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14664 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14668 sprintf(name, "%s Playback Switch", chname[i]);
14669 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14670 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14679 /* add playback controls for speaker and HP outputs */
14680 /* Based on ALC880 version. But ALC861VD has separate,
14681 * different NIDs for mute/unmute switch and volume control */
14682 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14683 hda_nid_t pin, const char *pfx)
14685 hda_nid_t nid_v, nid_s;
14692 if (alc880_is_fixed_pin(pin)) {
14693 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14694 /* specify the DAC as the extra output */
14695 if (!spec->multiout.hp_nid)
14696 spec->multiout.hp_nid = nid_v;
14698 spec->multiout.extra_out_nid[0] = nid_v;
14699 /* control HP volume/switch on the output mixer amp */
14700 nid_v = alc861vd_idx_to_mixer_vol(
14701 alc880_fixed_pin_idx(pin));
14702 nid_s = alc861vd_idx_to_mixer_switch(
14703 alc880_fixed_pin_idx(pin));
14705 sprintf(name, "%s Playback Volume", pfx);
14706 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14707 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14710 sprintf(name, "%s Playback Switch", pfx);
14711 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14712 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14715 } else if (alc880_is_multi_pin(pin)) {
14716 /* set manual connection */
14717 /* we have only a switch on HP-out PIN */
14718 sprintf(name, "%s Playback Switch", pfx);
14719 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14720 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14727 /* parse the BIOS configuration and set up the alc_spec
14728 * return 1 if successful, 0 if the proper config is not found,
14729 * or a negative error code
14730 * Based on ALC880 version - had to change it to override
14731 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14732 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14734 struct alc_spec *spec = codec->spec;
14736 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14738 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14742 if (!spec->autocfg.line_outs)
14743 return 0; /* can't find valid BIOS pin config */
14745 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14748 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14751 err = alc861vd_auto_create_extra_out(spec,
14752 spec->autocfg.speaker_pins[0],
14756 err = alc861vd_auto_create_extra_out(spec,
14757 spec->autocfg.hp_pins[0],
14761 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14765 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14767 if (spec->autocfg.dig_out_pin)
14768 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14770 if (spec->kctls.list)
14771 add_mixer(spec, spec->kctls.list);
14773 add_verb(spec, alc861vd_volume_init_verbs);
14775 spec->num_mux_defs = 1;
14776 spec->input_mux = &spec->private_imux[0];
14778 err = alc_auto_add_mic_boost(codec);
14782 store_pin_configs(codec);
14786 /* additional initialization for auto-configuration model */
14787 static void alc861vd_auto_init(struct hda_codec *codec)
14789 struct alc_spec *spec = codec->spec;
14790 alc861vd_auto_init_multi_out(codec);
14791 alc861vd_auto_init_hp_out(codec);
14792 alc861vd_auto_init_analog_input(codec);
14793 alc861vd_auto_init_input_src(codec);
14794 if (spec->unsol_event)
14795 alc_inithook(codec);
14798 static int patch_alc861vd(struct hda_codec *codec)
14800 struct alc_spec *spec;
14801 int err, board_config;
14803 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14807 codec->spec = spec;
14809 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14813 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14814 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14815 "ALC861VD, trying auto-probe from BIOS...\n");
14816 board_config = ALC861VD_AUTO;
14819 if (board_config == ALC861VD_AUTO) {
14820 /* automatic parse from the BIOS config */
14821 err = alc861vd_parse_auto_config(codec);
14827 "hda_codec: Cannot set up configuration "
14828 "from BIOS. Using base mode...\n");
14829 board_config = ALC861VD_3ST;
14833 if (board_config != ALC861VD_AUTO)
14834 setup_preset(spec, &alc861vd_presets[board_config]);
14836 if (codec->vendor_id == 0x10ec0660) {
14837 spec->stream_name_analog = "ALC660-VD Analog";
14838 spec->stream_name_digital = "ALC660-VD Digital";
14839 /* always turn on EAPD */
14840 add_verb(spec, alc660vd_eapd_verbs);
14842 spec->stream_name_analog = "ALC861VD Analog";
14843 spec->stream_name_digital = "ALC861VD Digital";
14846 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14847 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14849 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14850 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14852 spec->adc_nids = alc861vd_adc_nids;
14853 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14854 spec->capsrc_nids = alc861vd_capsrc_nids;
14855 spec->capture_style = CAPT_MIX;
14857 set_capture_mixer(spec);
14859 spec->vmaster_nid = 0x02;
14861 codec->patch_ops = alc_patch_ops;
14863 if (board_config == ALC861VD_AUTO)
14864 spec->init_hook = alc861vd_auto_init;
14865 #ifdef CONFIG_SND_HDA_POWER_SAVE
14866 if (!spec->loopback.amplist)
14867 spec->loopback.amplist = alc861vd_loopbacks;
14869 codec->proc_widget_hook = print_realtek_coef;
14877 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14878 * configuration. Each pin widget can choose any input DACs and a mixer.
14879 * Each ADC is connected from a mixer of all inputs. This makes possible
14880 * 6-channel independent captures.
14882 * In addition, an independent DAC for the multi-playback (not used in this
14885 #define ALC662_DIGOUT_NID 0x06
14886 #define ALC662_DIGIN_NID 0x0a
14888 static hda_nid_t alc662_dac_nids[4] = {
14889 /* front, rear, clfe, rear_surr */
14893 static hda_nid_t alc662_adc_nids[1] = {
14898 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14901 /* FIXME: should be a matrix-type input source selection */
14902 static struct hda_input_mux alc662_capture_source = {
14906 { "Front Mic", 0x1 },
14912 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14920 static struct hda_input_mux alc662_eeepc_capture_source = {
14928 static struct hda_input_mux alc663_capture_source = {
14932 { "Front Mic", 0x1 },
14937 static struct hda_input_mux alc663_m51va_capture_source = {
14940 { "Ext-Mic", 0x0 },
14948 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14955 static struct hda_verb alc662_3ST_ch2_init[] = {
14956 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14957 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14958 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14959 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14966 static struct hda_verb alc662_3ST_ch6_init[] = {
14967 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14968 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14969 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14970 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14971 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14972 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14976 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14977 { 2, alc662_3ST_ch2_init },
14978 { 6, alc662_3ST_ch6_init },
14984 static struct hda_verb alc662_sixstack_ch6_init[] = {
14985 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14986 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14987 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14994 static struct hda_verb alc662_sixstack_ch8_init[] = {
14995 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14996 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14997 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15001 static struct hda_channel_mode alc662_5stack_modes[2] = {
15002 { 2, alc662_sixstack_ch6_init },
15003 { 6, alc662_sixstack_ch8_init },
15006 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15007 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15010 static struct snd_kcontrol_new alc662_base_mixer[] = {
15011 /* output mixer control */
15012 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15013 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15014 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15015 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15016 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15017 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15018 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15019 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15020 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15022 /*Input mixer control */
15023 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15024 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15025 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15026 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15027 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15028 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15029 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15030 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15034 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15035 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15036 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15037 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15038 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15039 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15040 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15041 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15042 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15043 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15044 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15045 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15046 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
15047 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15051 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15052 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15053 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15054 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15055 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15056 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15057 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15058 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15059 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15060 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15061 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15062 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15065 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15066 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15067 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15068 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15069 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
15070 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15074 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15075 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15076 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15077 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15078 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15081 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15087 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15088 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15090 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15091 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15093 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15094 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15095 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15097 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15098 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15099 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15103 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15104 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15105 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15106 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15107 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15108 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15109 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15110 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15111 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15112 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15113 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15115 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15121 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15122 .ops = &snd_hda_bind_vol,
15124 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15125 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15130 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15131 .ops = &snd_hda_bind_sw,
15133 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15134 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15139 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15140 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15141 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15147 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15148 .ops = &snd_hda_bind_sw,
15150 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15151 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15152 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15157 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15158 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15159 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15162 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15163 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15168 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15169 .ops = &snd_hda_bind_sw,
15171 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15172 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15173 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15178 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15179 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15180 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15183 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15184 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15188 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15189 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15190 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15194 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15195 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15199 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15200 .ops = &snd_hda_bind_vol,
15202 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15203 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15208 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15209 .ops = &snd_hda_bind_sw,
15211 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15212 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15217 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15218 HDA_BIND_VOL("Master Playback Volume",
15219 &alc663_asus_two_bind_master_vol),
15220 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15221 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15222 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15228 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15229 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15230 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15231 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15232 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15238 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15239 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15240 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15241 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15242 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15243 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15247 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15248 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15252 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15253 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15254 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15257 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15258 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15259 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15260 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15261 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15262 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15266 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15268 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15269 .name = "Channel Mode",
15270 .info = alc_ch_mode_info,
15271 .get = alc_ch_mode_get,
15272 .put = alc_ch_mode_put,
15277 static struct hda_verb alc662_init_verbs[] = {
15278 /* ADC: mute amp left and right */
15279 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15280 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15281 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15291 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15292 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15293 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15294 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15296 /* Front Pin: output 0 (0x0c) */
15297 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15298 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15300 /* Rear Pin: output 1 (0x0d) */
15301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15304 /* CLFE Pin: output 2 (0x0e) */
15305 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15306 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15308 /* Mic (rear) pin: input vref at 80% */
15309 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15310 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15311 /* Front Mic pin: input vref at 80% */
15312 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15313 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15314 /* Line In pin: input */
15315 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15317 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15318 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15319 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15320 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15321 /* CD pin widget for input */
15322 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15324 /* FIXME: use matrix-type input source selection */
15325 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15327 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15335 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15337 /* always trun on EAPD */
15338 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15339 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15344 static struct hda_verb alc662_sue_init_verbs[] = {
15345 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15346 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15350 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15351 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15352 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15356 /* Set Unsolicited Event*/
15357 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15359 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15364 * generic initialization of ADC, input mixers and output mixers
15366 static struct hda_verb alc662_auto_init_verbs[] = {
15368 * Unmute ADC and set the default input to mic-in
15370 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15371 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15373 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15375 * Note: PASD motherboards uses the Line In 2 as the input for front
15376 * panel mic (mic 2)
15378 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15382 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15386 * Set up output mixers (0x0c - 0x0f)
15388 /* set vol=0 to output mixers */
15389 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15390 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15391 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15393 /* set up input amps for analog loopback */
15394 /* Amp Indices: DAC = 0, mixer = 1 */
15395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15397 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15399 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15400 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15403 /* FIXME: use matrix-type input source selection */
15404 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15411 /* additional verbs for ALC663 */
15412 static struct hda_verb alc663_auto_init_verbs[] = {
15413 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15414 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15418 static struct hda_verb alc663_m51va_init_verbs[] = {
15419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15421 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15422 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15423 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15426 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15427 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15431 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15432 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15433 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15434 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15435 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15437 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15438 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15442 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15443 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15444 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15445 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15446 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15448 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15449 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15450 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15454 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15456 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15457 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15460 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15461 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15465 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15466 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15467 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15468 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15469 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15472 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15475 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15476 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15477 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15481 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15482 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15483 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15484 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15485 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15487 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15491 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15492 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15493 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15497 static struct hda_verb alc663_g71v_init_verbs[] = {
15498 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15499 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15500 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15502 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15503 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15504 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15506 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15507 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15508 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15512 static struct hda_verb alc663_g50v_init_verbs[] = {
15513 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15514 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15515 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15517 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15518 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15522 static struct hda_verb alc662_ecs_init_verbs[] = {
15523 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15525 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15526 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15530 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15531 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15532 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15536 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15538 unsigned int present;
15539 unsigned char bits;
15541 present = snd_hda_codec_read(codec, 0x14, 0,
15542 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15543 bits = present ? HDA_AMP_MUTE : 0;
15544 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15545 HDA_AMP_MUTE, bits);
15548 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15550 unsigned int present;
15551 unsigned char bits;
15553 present = snd_hda_codec_read(codec, 0x1b, 0,
15554 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15555 bits = present ? HDA_AMP_MUTE : 0;
15556 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15557 HDA_AMP_MUTE, bits);
15558 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15559 HDA_AMP_MUTE, bits);
15562 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15565 if ((res >> 26) == ALC880_HP_EVENT)
15566 alc662_lenovo_101e_all_automute(codec);
15567 if ((res >> 26) == ALC880_FRONT_EVENT)
15568 alc662_lenovo_101e_ispeaker_automute(codec);
15571 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15573 unsigned int present;
15575 present = snd_hda_codec_read(codec, 0x18, 0,
15576 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15577 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15578 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15579 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15580 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15581 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15582 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15583 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15584 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15587 /* unsolicited event for HP jack sensing */
15588 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15591 if ((res >> 26) == ALC880_HP_EVENT)
15592 alc262_hippo1_automute( codec );
15594 if ((res >> 26) == ALC880_MIC_EVENT)
15595 alc662_eeepc_mic_automute(codec);
15598 static void alc662_eeepc_inithook(struct hda_codec *codec)
15600 alc262_hippo1_automute( codec );
15601 alc662_eeepc_mic_automute(codec);
15604 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15607 unsigned int present;
15609 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15610 present = snd_hda_codec_read(codec, 0x14, 0,
15611 AC_VERB_GET_PIN_SENSE, 0);
15612 present = (present & 0x80000000) != 0;
15614 /* mute internal speaker */
15615 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15616 HDA_AMP_MUTE, HDA_AMP_MUTE);
15618 /* unmute internal speaker if necessary */
15619 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15620 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15621 HDA_AMP_MUTE, mute);
15625 /* unsolicited event for HP jack sensing */
15626 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15629 if ((res >> 26) == ALC880_HP_EVENT)
15630 alc662_eeepc_ep20_automute(codec);
15633 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15635 alc662_eeepc_ep20_automute(codec);
15638 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15640 unsigned int present;
15641 unsigned char bits;
15643 present = snd_hda_codec_read(codec, 0x21, 0,
15644 AC_VERB_GET_PIN_SENSE, 0)
15645 & AC_PINSENSE_PRESENCE;
15646 bits = present ? HDA_AMP_MUTE : 0;
15647 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15648 AMP_IN_MUTE(0), bits);
15649 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15650 AMP_IN_MUTE(0), bits);
15653 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15655 unsigned int present;
15656 unsigned char bits;
15658 present = snd_hda_codec_read(codec, 0x21, 0,
15659 AC_VERB_GET_PIN_SENSE, 0)
15660 & AC_PINSENSE_PRESENCE;
15661 bits = present ? HDA_AMP_MUTE : 0;
15662 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15663 AMP_IN_MUTE(0), bits);
15664 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15665 AMP_IN_MUTE(0), bits);
15666 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15667 AMP_IN_MUTE(0), bits);
15668 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15669 AMP_IN_MUTE(0), bits);
15672 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15674 unsigned int present;
15675 unsigned char bits;
15677 present = snd_hda_codec_read(codec, 0x15, 0,
15678 AC_VERB_GET_PIN_SENSE, 0)
15679 & AC_PINSENSE_PRESENCE;
15680 bits = present ? HDA_AMP_MUTE : 0;
15681 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15682 AMP_IN_MUTE(0), bits);
15683 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15684 AMP_IN_MUTE(0), bits);
15685 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15686 AMP_IN_MUTE(0), bits);
15687 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15688 AMP_IN_MUTE(0), bits);
15691 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15693 unsigned int present;
15694 unsigned char bits;
15696 present = snd_hda_codec_read(codec, 0x1b, 0,
15697 AC_VERB_GET_PIN_SENSE, 0)
15698 & AC_PINSENSE_PRESENCE;
15699 bits = present ? 0 : PIN_OUT;
15700 snd_hda_codec_write(codec, 0x14, 0,
15701 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15704 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15706 unsigned int present1, present2;
15708 present1 = snd_hda_codec_read(codec, 0x21, 0,
15709 AC_VERB_GET_PIN_SENSE, 0)
15710 & AC_PINSENSE_PRESENCE;
15711 present2 = snd_hda_codec_read(codec, 0x15, 0,
15712 AC_VERB_GET_PIN_SENSE, 0)
15713 & AC_PINSENSE_PRESENCE;
15715 if (present1 || present2) {
15716 snd_hda_codec_write_cache(codec, 0x14, 0,
15717 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15719 snd_hda_codec_write_cache(codec, 0x14, 0,
15720 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15724 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15726 unsigned int present1, present2;
15728 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15729 AC_VERB_GET_PIN_SENSE, 0)
15730 & AC_PINSENSE_PRESENCE;
15731 present2 = snd_hda_codec_read(codec, 0x15, 0,
15732 AC_VERB_GET_PIN_SENSE, 0)
15733 & AC_PINSENSE_PRESENCE;
15735 if (present1 || present2) {
15736 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15737 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15738 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15739 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15741 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15742 AMP_IN_MUTE(0), 0);
15743 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15744 AMP_IN_MUTE(0), 0);
15748 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15750 unsigned int present;
15752 present = snd_hda_codec_read(codec, 0x18, 0,
15753 AC_VERB_GET_PIN_SENSE, 0)
15754 & AC_PINSENSE_PRESENCE;
15755 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15756 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15757 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15758 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15759 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15760 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15761 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15762 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15765 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15768 switch (res >> 26) {
15769 case ALC880_HP_EVENT:
15770 alc663_m51va_speaker_automute(codec);
15772 case ALC880_MIC_EVENT:
15773 alc663_m51va_mic_automute(codec);
15778 static void alc663_m51va_inithook(struct hda_codec *codec)
15780 alc663_m51va_speaker_automute(codec);
15781 alc663_m51va_mic_automute(codec);
15784 /* ***************** Mode1 ******************************/
15785 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15788 switch (res >> 26) {
15789 case ALC880_HP_EVENT:
15790 alc663_m51va_speaker_automute(codec);
15792 case ALC880_MIC_EVENT:
15793 alc662_eeepc_mic_automute(codec);
15798 static void alc663_mode1_inithook(struct hda_codec *codec)
15800 alc663_m51va_speaker_automute(codec);
15801 alc662_eeepc_mic_automute(codec);
15803 /* ***************** Mode2 ******************************/
15804 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15807 switch (res >> 26) {
15808 case ALC880_HP_EVENT:
15809 alc662_f5z_speaker_automute(codec);
15811 case ALC880_MIC_EVENT:
15812 alc662_eeepc_mic_automute(codec);
15817 static void alc662_mode2_inithook(struct hda_codec *codec)
15819 alc662_f5z_speaker_automute(codec);
15820 alc662_eeepc_mic_automute(codec);
15822 /* ***************** Mode3 ******************************/
15823 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15826 switch (res >> 26) {
15827 case ALC880_HP_EVENT:
15828 alc663_two_hp_m1_speaker_automute(codec);
15830 case ALC880_MIC_EVENT:
15831 alc662_eeepc_mic_automute(codec);
15836 static void alc663_mode3_inithook(struct hda_codec *codec)
15838 alc663_two_hp_m1_speaker_automute(codec);
15839 alc662_eeepc_mic_automute(codec);
15841 /* ***************** Mode4 ******************************/
15842 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15845 switch (res >> 26) {
15846 case ALC880_HP_EVENT:
15847 alc663_21jd_two_speaker_automute(codec);
15849 case ALC880_MIC_EVENT:
15850 alc662_eeepc_mic_automute(codec);
15855 static void alc663_mode4_inithook(struct hda_codec *codec)
15857 alc663_21jd_two_speaker_automute(codec);
15858 alc662_eeepc_mic_automute(codec);
15860 /* ***************** Mode5 ******************************/
15861 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15864 switch (res >> 26) {
15865 case ALC880_HP_EVENT:
15866 alc663_15jd_two_speaker_automute(codec);
15868 case ALC880_MIC_EVENT:
15869 alc662_eeepc_mic_automute(codec);
15874 static void alc663_mode5_inithook(struct hda_codec *codec)
15876 alc663_15jd_two_speaker_automute(codec);
15877 alc662_eeepc_mic_automute(codec);
15879 /* ***************** Mode6 ******************************/
15880 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15883 switch (res >> 26) {
15884 case ALC880_HP_EVENT:
15885 alc663_two_hp_m2_speaker_automute(codec);
15887 case ALC880_MIC_EVENT:
15888 alc662_eeepc_mic_automute(codec);
15893 static void alc663_mode6_inithook(struct hda_codec *codec)
15895 alc663_two_hp_m2_speaker_automute(codec);
15896 alc662_eeepc_mic_automute(codec);
15899 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15901 unsigned int present;
15902 unsigned char bits;
15904 present = snd_hda_codec_read(codec, 0x21, 0,
15905 AC_VERB_GET_PIN_SENSE, 0)
15906 & AC_PINSENSE_PRESENCE;
15907 bits = present ? HDA_AMP_MUTE : 0;
15908 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15909 HDA_AMP_MUTE, bits);
15910 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15911 HDA_AMP_MUTE, bits);
15914 static void alc663_g71v_front_automute(struct hda_codec *codec)
15916 unsigned int present;
15917 unsigned char bits;
15919 present = snd_hda_codec_read(codec, 0x15, 0,
15920 AC_VERB_GET_PIN_SENSE, 0)
15921 & AC_PINSENSE_PRESENCE;
15922 bits = present ? HDA_AMP_MUTE : 0;
15923 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15924 HDA_AMP_MUTE, bits);
15927 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15930 switch (res >> 26) {
15931 case ALC880_HP_EVENT:
15932 alc663_g71v_hp_automute(codec);
15934 case ALC880_FRONT_EVENT:
15935 alc663_g71v_front_automute(codec);
15937 case ALC880_MIC_EVENT:
15938 alc662_eeepc_mic_automute(codec);
15943 static void alc663_g71v_inithook(struct hda_codec *codec)
15945 alc663_g71v_front_automute(codec);
15946 alc663_g71v_hp_automute(codec);
15947 alc662_eeepc_mic_automute(codec);
15950 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15953 switch (res >> 26) {
15954 case ALC880_HP_EVENT:
15955 alc663_m51va_speaker_automute(codec);
15957 case ALC880_MIC_EVENT:
15958 alc662_eeepc_mic_automute(codec);
15963 static void alc663_g50v_inithook(struct hda_codec *codec)
15965 alc663_m51va_speaker_automute(codec);
15966 alc662_eeepc_mic_automute(codec);
15969 /* bind hp and internal speaker mute (with plug check) */
15970 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15971 struct snd_ctl_elem_value *ucontrol)
15973 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15974 long *valp = ucontrol->value.integer.value;
15977 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15979 valp[0] ? 0 : HDA_AMP_MUTE);
15980 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15982 valp[1] ? 0 : HDA_AMP_MUTE);
15984 alc262_hippo1_automute(codec);
15988 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15989 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15991 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15992 .name = "Master Playback Switch",
15993 .info = snd_hda_mixer_amp_switch_info,
15994 .get = snd_hda_mixer_amp_switch_get,
15995 .put = alc662_ecs_master_sw_put,
15996 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15999 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16000 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16001 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16003 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16004 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16005 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16009 #ifdef CONFIG_SND_HDA_POWER_SAVE
16010 #define alc662_loopbacks alc880_loopbacks
16014 /* pcm configuration: identiacal with ALC880 */
16015 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16016 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16017 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16018 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16021 * configuration and preset
16023 static const char *alc662_models[ALC662_MODEL_LAST] = {
16024 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16025 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16026 [ALC662_3ST_6ch] = "3stack-6ch",
16027 [ALC662_5ST_DIG] = "6stack-dig",
16028 [ALC662_LENOVO_101E] = "lenovo-101e",
16029 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16030 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16031 [ALC662_ECS] = "ecs",
16032 [ALC663_ASUS_M51VA] = "m51va",
16033 [ALC663_ASUS_G71V] = "g71v",
16034 [ALC663_ASUS_H13] = "h13",
16035 [ALC663_ASUS_G50V] = "g50v",
16036 [ALC663_ASUS_MODE1] = "asus-mode1",
16037 [ALC662_ASUS_MODE2] = "asus-mode2",
16038 [ALC663_ASUS_MODE3] = "asus-mode3",
16039 [ALC663_ASUS_MODE4] = "asus-mode4",
16040 [ALC663_ASUS_MODE5] = "asus-mode5",
16041 [ALC663_ASUS_MODE6] = "asus-mode6",
16042 [ALC662_AUTO] = "auto",
16045 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16046 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16047 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16048 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16049 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16050 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16051 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16052 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
16053 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16054 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16055 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16056 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
16057 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16058 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16059 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16060 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16061 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16062 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16063 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16064 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16065 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16066 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16067 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16068 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16069 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16070 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16071 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16072 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16073 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16074 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16075 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16076 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16077 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16078 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16079 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16080 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16081 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16082 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16083 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16084 ALC662_3ST_6ch_DIG),
16085 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16086 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16087 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16088 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16089 ALC662_3ST_6ch_DIG),
16090 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16091 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16092 ALC662_3ST_6ch_DIG),
16093 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
16094 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
16095 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
16099 static struct alc_config_preset alc662_presets[] = {
16100 [ALC662_3ST_2ch_DIG] = {
16101 .mixers = { alc662_3ST_2ch_mixer },
16102 .init_verbs = { alc662_init_verbs },
16103 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16104 .dac_nids = alc662_dac_nids,
16105 .dig_out_nid = ALC662_DIGOUT_NID,
16106 .dig_in_nid = ALC662_DIGIN_NID,
16107 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16108 .channel_mode = alc662_3ST_2ch_modes,
16109 .input_mux = &alc662_capture_source,
16111 [ALC662_3ST_6ch_DIG] = {
16112 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16113 .init_verbs = { alc662_init_verbs },
16114 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16115 .dac_nids = alc662_dac_nids,
16116 .dig_out_nid = ALC662_DIGOUT_NID,
16117 .dig_in_nid = ALC662_DIGIN_NID,
16118 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16119 .channel_mode = alc662_3ST_6ch_modes,
16121 .input_mux = &alc662_capture_source,
16123 [ALC662_3ST_6ch] = {
16124 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16125 .init_verbs = { alc662_init_verbs },
16126 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16127 .dac_nids = alc662_dac_nids,
16128 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16129 .channel_mode = alc662_3ST_6ch_modes,
16131 .input_mux = &alc662_capture_source,
16133 [ALC662_5ST_DIG] = {
16134 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16135 .init_verbs = { alc662_init_verbs },
16136 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16137 .dac_nids = alc662_dac_nids,
16138 .dig_out_nid = ALC662_DIGOUT_NID,
16139 .dig_in_nid = ALC662_DIGIN_NID,
16140 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16141 .channel_mode = alc662_5stack_modes,
16142 .input_mux = &alc662_capture_source,
16144 [ALC662_LENOVO_101E] = {
16145 .mixers = { alc662_lenovo_101e_mixer },
16146 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16147 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16148 .dac_nids = alc662_dac_nids,
16149 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16150 .channel_mode = alc662_3ST_2ch_modes,
16151 .input_mux = &alc662_lenovo_101e_capture_source,
16152 .unsol_event = alc662_lenovo_101e_unsol_event,
16153 .init_hook = alc662_lenovo_101e_all_automute,
16155 [ALC662_ASUS_EEEPC_P701] = {
16156 .mixers = { alc662_eeepc_p701_mixer },
16157 .init_verbs = { alc662_init_verbs,
16158 alc662_eeepc_sue_init_verbs },
16159 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16160 .dac_nids = alc662_dac_nids,
16161 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16162 .channel_mode = alc662_3ST_2ch_modes,
16163 .input_mux = &alc662_eeepc_capture_source,
16164 .unsol_event = alc662_eeepc_unsol_event,
16165 .init_hook = alc662_eeepc_inithook,
16167 [ALC662_ASUS_EEEPC_EP20] = {
16168 .mixers = { alc662_eeepc_ep20_mixer,
16169 alc662_chmode_mixer },
16170 .init_verbs = { alc662_init_verbs,
16171 alc662_eeepc_ep20_sue_init_verbs },
16172 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16173 .dac_nids = alc662_dac_nids,
16174 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16175 .channel_mode = alc662_3ST_6ch_modes,
16176 .input_mux = &alc662_lenovo_101e_capture_source,
16177 .unsol_event = alc662_eeepc_ep20_unsol_event,
16178 .init_hook = alc662_eeepc_ep20_inithook,
16181 .mixers = { alc662_ecs_mixer },
16182 .init_verbs = { alc662_init_verbs,
16183 alc662_ecs_init_verbs },
16184 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16185 .dac_nids = alc662_dac_nids,
16186 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16187 .channel_mode = alc662_3ST_2ch_modes,
16188 .input_mux = &alc662_eeepc_capture_source,
16189 .unsol_event = alc662_eeepc_unsol_event,
16190 .init_hook = alc662_eeepc_inithook,
16192 [ALC663_ASUS_M51VA] = {
16193 .mixers = { alc663_m51va_mixer },
16194 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16195 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16196 .dac_nids = alc662_dac_nids,
16197 .dig_out_nid = ALC662_DIGOUT_NID,
16198 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16199 .channel_mode = alc662_3ST_2ch_modes,
16200 .input_mux = &alc663_m51va_capture_source,
16201 .unsol_event = alc663_m51va_unsol_event,
16202 .init_hook = alc663_m51va_inithook,
16204 [ALC663_ASUS_G71V] = {
16205 .mixers = { alc663_g71v_mixer },
16206 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16207 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16208 .dac_nids = alc662_dac_nids,
16209 .dig_out_nid = ALC662_DIGOUT_NID,
16210 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16211 .channel_mode = alc662_3ST_2ch_modes,
16212 .input_mux = &alc662_eeepc_capture_source,
16213 .unsol_event = alc663_g71v_unsol_event,
16214 .init_hook = alc663_g71v_inithook,
16216 [ALC663_ASUS_H13] = {
16217 .mixers = { alc663_m51va_mixer },
16218 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16219 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16220 .dac_nids = alc662_dac_nids,
16221 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16222 .channel_mode = alc662_3ST_2ch_modes,
16223 .input_mux = &alc663_m51va_capture_source,
16224 .unsol_event = alc663_m51va_unsol_event,
16225 .init_hook = alc663_m51va_inithook,
16227 [ALC663_ASUS_G50V] = {
16228 .mixers = { alc663_g50v_mixer },
16229 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16230 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16231 .dac_nids = alc662_dac_nids,
16232 .dig_out_nid = ALC662_DIGOUT_NID,
16233 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16234 .channel_mode = alc662_3ST_6ch_modes,
16235 .input_mux = &alc663_capture_source,
16236 .unsol_event = alc663_g50v_unsol_event,
16237 .init_hook = alc663_g50v_inithook,
16239 [ALC663_ASUS_MODE1] = {
16240 .mixers = { alc663_m51va_mixer },
16241 .cap_mixer = alc662_auto_capture_mixer,
16242 .init_verbs = { alc662_init_verbs,
16243 alc663_21jd_amic_init_verbs },
16244 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16246 .dac_nids = alc662_dac_nids,
16247 .dig_out_nid = ALC662_DIGOUT_NID,
16248 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16249 .channel_mode = alc662_3ST_2ch_modes,
16250 .input_mux = &alc662_eeepc_capture_source,
16251 .unsol_event = alc663_mode1_unsol_event,
16252 .init_hook = alc663_mode1_inithook,
16254 [ALC662_ASUS_MODE2] = {
16255 .mixers = { alc662_1bjd_mixer },
16256 .cap_mixer = alc662_auto_capture_mixer,
16257 .init_verbs = { alc662_init_verbs,
16258 alc662_1bjd_amic_init_verbs },
16259 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16260 .dac_nids = alc662_dac_nids,
16261 .dig_out_nid = ALC662_DIGOUT_NID,
16262 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16263 .channel_mode = alc662_3ST_2ch_modes,
16264 .input_mux = &alc662_eeepc_capture_source,
16265 .unsol_event = alc662_mode2_unsol_event,
16266 .init_hook = alc662_mode2_inithook,
16268 [ALC663_ASUS_MODE3] = {
16269 .mixers = { alc663_two_hp_m1_mixer },
16270 .cap_mixer = alc662_auto_capture_mixer,
16271 .init_verbs = { alc662_init_verbs,
16272 alc663_two_hp_amic_m1_init_verbs },
16273 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16275 .dac_nids = alc662_dac_nids,
16276 .dig_out_nid = ALC662_DIGOUT_NID,
16277 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16278 .channel_mode = alc662_3ST_2ch_modes,
16279 .input_mux = &alc662_eeepc_capture_source,
16280 .unsol_event = alc663_mode3_unsol_event,
16281 .init_hook = alc663_mode3_inithook,
16283 [ALC663_ASUS_MODE4] = {
16284 .mixers = { alc663_asus_21jd_clfe_mixer },
16285 .cap_mixer = alc662_auto_capture_mixer,
16286 .init_verbs = { alc662_init_verbs,
16287 alc663_21jd_amic_init_verbs},
16288 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16290 .dac_nids = alc662_dac_nids,
16291 .dig_out_nid = ALC662_DIGOUT_NID,
16292 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16293 .channel_mode = alc662_3ST_2ch_modes,
16294 .input_mux = &alc662_eeepc_capture_source,
16295 .unsol_event = alc663_mode4_unsol_event,
16296 .init_hook = alc663_mode4_inithook,
16298 [ALC663_ASUS_MODE5] = {
16299 .mixers = { alc663_asus_15jd_clfe_mixer },
16300 .cap_mixer = alc662_auto_capture_mixer,
16301 .init_verbs = { alc662_init_verbs,
16302 alc663_15jd_amic_init_verbs },
16303 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16305 .dac_nids = alc662_dac_nids,
16306 .dig_out_nid = ALC662_DIGOUT_NID,
16307 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16308 .channel_mode = alc662_3ST_2ch_modes,
16309 .input_mux = &alc662_eeepc_capture_source,
16310 .unsol_event = alc663_mode5_unsol_event,
16311 .init_hook = alc663_mode5_inithook,
16313 [ALC663_ASUS_MODE6] = {
16314 .mixers = { alc663_two_hp_m2_mixer },
16315 .cap_mixer = alc662_auto_capture_mixer,
16316 .init_verbs = { alc662_init_verbs,
16317 alc663_two_hp_amic_m2_init_verbs },
16318 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16320 .dac_nids = alc662_dac_nids,
16321 .dig_out_nid = ALC662_DIGOUT_NID,
16322 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16323 .channel_mode = alc662_3ST_2ch_modes,
16324 .input_mux = &alc662_eeepc_capture_source,
16325 .unsol_event = alc663_mode6_unsol_event,
16326 .init_hook = alc663_mode6_inithook,
16332 * BIOS auto configuration
16335 /* add playback controls from the parsed DAC table */
16336 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16337 const struct auto_pin_cfg *cfg)
16340 static const char *chname[4] = {
16341 "Front", "Surround", NULL /*CLFE*/, "Side"
16346 for (i = 0; i < cfg->line_outs; i++) {
16347 if (!spec->multiout.dac_nids[i])
16349 nid = alc880_idx_to_dac(i);
16352 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16353 "Center Playback Volume",
16354 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16358 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16359 "LFE Playback Volume",
16360 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16364 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16365 "Center Playback Switch",
16366 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16370 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16371 "LFE Playback Switch",
16372 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16377 sprintf(name, "%s Playback Volume", chname[i]);
16378 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16379 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16383 sprintf(name, "%s Playback Switch", chname[i]);
16384 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16385 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16394 /* add playback controls for speaker and HP outputs */
16395 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16406 /* ALC663 has a mono output pin on 0x17 */
16407 sprintf(name, "%s Playback Switch", pfx);
16408 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16409 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16413 if (alc880_is_fixed_pin(pin)) {
16414 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16415 /* printk("DAC nid=%x\n",nid); */
16416 /* specify the DAC as the extra output */
16417 if (!spec->multiout.hp_nid)
16418 spec->multiout.hp_nid = nid;
16420 spec->multiout.extra_out_nid[0] = nid;
16421 /* control HP volume/switch on the output mixer amp */
16422 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16423 sprintf(name, "%s Playback Volume", pfx);
16424 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16425 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16428 sprintf(name, "%s Playback Switch", pfx);
16429 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16430 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16433 } else if (alc880_is_multi_pin(pin)) {
16434 /* set manual connection */
16435 /* we have only a switch on HP-out PIN */
16436 sprintf(name, "%s Playback Switch", pfx);
16437 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16438 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16445 /* create playback/capture controls for input pins */
16446 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16447 const struct auto_pin_cfg *cfg)
16449 struct hda_input_mux *imux = &spec->private_imux[0];
16452 for (i = 0; i < AUTO_PIN_LAST; i++) {
16453 if (alc880_is_input_pin(cfg->input_pins[i])) {
16454 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16455 err = new_analog_input(spec, cfg->input_pins[i],
16456 auto_pin_cfg_labels[i],
16460 imux->items[imux->num_items].label =
16461 auto_pin_cfg_labels[i];
16462 imux->items[imux->num_items].index =
16463 alc880_input_pin_idx(cfg->input_pins[i]);
16470 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16471 hda_nid_t nid, int pin_type,
16474 alc_set_pin_output(codec, nid, pin_type);
16475 /* need the manual connection? */
16476 if (alc880_is_multi_pin(nid)) {
16477 struct alc_spec *spec = codec->spec;
16478 int idx = alc880_multi_pin_idx(nid);
16479 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16480 AC_VERB_SET_CONNECT_SEL,
16481 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16485 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16487 struct alc_spec *spec = codec->spec;
16490 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16491 for (i = 0; i <= HDA_SIDE; i++) {
16492 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16493 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16495 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16500 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16502 struct alc_spec *spec = codec->spec;
16505 pin = spec->autocfg.hp_pins[0];
16506 if (pin) /* connect to front */
16508 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16509 pin = spec->autocfg.speaker_pins[0];
16511 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16514 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16515 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16517 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16519 struct alc_spec *spec = codec->spec;
16522 for (i = 0; i < AUTO_PIN_LAST; i++) {
16523 hda_nid_t nid = spec->autocfg.input_pins[i];
16524 if (alc662_is_input_pin(nid)) {
16525 snd_hda_codec_write(codec, nid, 0,
16526 AC_VERB_SET_PIN_WIDGET_CONTROL,
16527 (i <= AUTO_PIN_FRONT_MIC ?
16528 PIN_VREF80 : PIN_IN));
16529 if (nid != ALC662_PIN_CD_NID)
16530 snd_hda_codec_write(codec, nid, 0,
16531 AC_VERB_SET_AMP_GAIN_MUTE,
16537 #define alc662_auto_init_input_src alc882_auto_init_input_src
16539 static int alc662_parse_auto_config(struct hda_codec *codec)
16541 struct alc_spec *spec = codec->spec;
16543 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16545 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16549 if (!spec->autocfg.line_outs)
16550 return 0; /* can't find valid BIOS pin config */
16552 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16555 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16558 err = alc662_auto_create_extra_out(spec,
16559 spec->autocfg.speaker_pins[0],
16563 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16567 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16571 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16573 if (spec->autocfg.dig_out_pin)
16574 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16576 if (spec->kctls.list)
16577 add_mixer(spec, spec->kctls.list);
16579 spec->num_mux_defs = 1;
16580 spec->input_mux = &spec->private_imux[0];
16582 add_verb(spec, alc662_auto_init_verbs);
16583 if (codec->vendor_id == 0x10ec0663)
16584 add_verb(spec, alc663_auto_init_verbs);
16586 err = alc_auto_add_mic_boost(codec);
16590 store_pin_configs(codec);
16594 /* additional initialization for auto-configuration model */
16595 static void alc662_auto_init(struct hda_codec *codec)
16597 struct alc_spec *spec = codec->spec;
16598 alc662_auto_init_multi_out(codec);
16599 alc662_auto_init_hp_out(codec);
16600 alc662_auto_init_analog_input(codec);
16601 alc662_auto_init_input_src(codec);
16602 if (spec->unsol_event)
16603 alc_inithook(codec);
16606 static int patch_alc662(struct hda_codec *codec)
16608 struct alc_spec *spec;
16609 int err, board_config;
16611 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16615 codec->spec = spec;
16617 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16619 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16622 if (board_config < 0) {
16623 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16624 "trying auto-probe from BIOS...\n");
16625 board_config = ALC662_AUTO;
16628 if (board_config == ALC662_AUTO) {
16629 /* automatic parse from the BIOS config */
16630 err = alc662_parse_auto_config(codec);
16636 "hda_codec: Cannot set up configuration "
16637 "from BIOS. Using base mode...\n");
16638 board_config = ALC662_3ST_2ch_DIG;
16642 if (board_config != ALC662_AUTO)
16643 setup_preset(spec, &alc662_presets[board_config]);
16645 if (codec->vendor_id == 0x10ec0663) {
16646 spec->stream_name_analog = "ALC663 Analog";
16647 spec->stream_name_digital = "ALC663 Digital";
16648 } else if (codec->vendor_id == 0x10ec0272) {
16649 spec->stream_name_analog = "ALC272 Analog";
16650 spec->stream_name_digital = "ALC272 Digital";
16652 spec->stream_name_analog = "ALC662 Analog";
16653 spec->stream_name_digital = "ALC662 Digital";
16656 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16657 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16659 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16660 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16662 spec->adc_nids = alc662_adc_nids;
16663 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16664 spec->capsrc_nids = alc662_capsrc_nids;
16665 spec->capture_style = CAPT_MIX;
16667 if (!spec->cap_mixer)
16668 set_capture_mixer(spec);
16670 spec->vmaster_nid = 0x02;
16672 codec->patch_ops = alc_patch_ops;
16673 if (board_config == ALC662_AUTO)
16674 spec->init_hook = alc662_auto_init;
16675 #ifdef CONFIG_SND_HDA_POWER_SAVE
16676 if (!spec->loopback.amplist)
16677 spec->loopback.amplist = alc662_loopbacks;
16679 codec->proc_widget_hook = print_realtek_coef;
16687 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16688 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16689 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16690 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16691 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16692 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16693 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16694 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16695 .patch = patch_alc861 },
16696 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16697 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16698 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16699 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16700 .patch = patch_alc883 },
16701 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16702 .patch = patch_alc662 },
16703 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16704 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16705 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16706 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16707 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16708 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16709 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16710 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16711 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16712 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16713 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16714 .patch = patch_alc883 },
16715 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16716 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16717 {} /* terminator */
16720 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16722 MODULE_LICENSE("GPL");
16723 MODULE_DESCRIPTION("Realtek HD-audio codec");
16725 static struct hda_codec_preset_list realtek_list = {
16726 .preset = snd_hda_preset_realtek,
16727 .owner = THIS_MODULE,
16730 static int __init patch_realtek_init(void)
16732 return snd_hda_add_codec_preset(&realtek_list);
16735 static void __exit patch_realtek_exit(void)
16737 snd_hda_delete_codec_preset(&realtek_list);
16740 module_init(patch_realtek_init)
16741 module_exit(patch_realtek_exit)