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;
6929 for (c = 0; c < spec->num_adc_nids; c++) {
6930 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6931 hda_nid_t nid = spec->capsrc_nids[c];
6932 unsigned int mux_idx;
6933 const struct hda_input_mux *imux;
6934 int conns, mute, idx, item;
6936 conns = snd_hda_get_connections(codec, nid, conn_list,
6937 ARRAY_SIZE(conn_list));
6940 mux_idx = c >= spec->num_mux_defs ? 0 : c;
6941 imux = &spec->input_mux[mux_idx];
6942 for (idx = 0; idx < conns; idx++) {
6943 /* if the current connection is the selected one,
6944 * unmute it as default - otherwise mute it
6946 mute = AMP_IN_MUTE(idx);
6947 for (item = 0; item < imux->num_items; item++) {
6948 if (imux->items[item].index == idx) {
6949 if (spec->cur_mux[c] == item)
6950 mute = AMP_IN_UNMUTE(idx);
6954 /* check if we have a selector or mixer
6955 * we could check for the widget type instead, but
6956 * just check for Amp-In presence (in case of mixer
6957 * without amp-in there is something wrong, this
6958 * function shouldn't be used or capsrc nid is wrong)
6960 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
6961 snd_hda_codec_write(codec, nid, 0,
6962 AC_VERB_SET_AMP_GAIN_MUTE,
6964 else if (mute != AMP_IN_MUTE(idx))
6965 snd_hda_codec_write(codec, nid, 0,
6966 AC_VERB_SET_CONNECT_SEL,
6972 /* add mic boosts if needed */
6973 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6975 struct alc_spec *spec = codec->spec;
6979 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6980 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6981 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6983 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6987 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6988 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6989 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6991 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6998 /* almost identical with ALC880 parser... */
6999 static int alc882_parse_auto_config(struct hda_codec *codec)
7001 struct alc_spec *spec = codec->spec;
7002 int err = alc880_parse_auto_config(codec);
7007 return 0; /* no config found */
7009 err = alc_auto_add_mic_boost(codec);
7013 /* hack - override the init verbs */
7014 spec->init_verbs[0] = alc882_auto_init_verbs;
7016 return 1; /* config found */
7019 /* additional initialization for auto-configuration model */
7020 static void alc882_auto_init(struct hda_codec *codec)
7022 struct alc_spec *spec = codec->spec;
7023 alc882_auto_init_multi_out(codec);
7024 alc882_auto_init_hp_out(codec);
7025 alc882_auto_init_analog_input(codec);
7026 alc882_auto_init_input_src(codec);
7027 if (spec->unsol_event)
7028 alc_inithook(codec);
7031 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7033 static int patch_alc882(struct hda_codec *codec)
7035 struct alc_spec *spec;
7036 int err, board_config;
7038 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7044 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7048 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7049 /* Pick up systems that don't supply PCI SSID */
7050 switch (codec->subsystem_id) {
7051 case 0x106b0c00: /* Mac Pro */
7052 board_config = ALC885_MACPRO;
7054 case 0x106b1000: /* iMac 24 */
7055 case 0x106b2800: /* AppleTV */
7056 board_config = ALC885_IMAC24;
7058 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7059 case 0x106b00a4: /* MacbookPro4,1 */
7060 case 0x106b2c00: /* Macbook Pro rev3 */
7061 case 0x106b3600: /* Macbook 3.1 */
7062 board_config = ALC885_MBP3;
7065 /* ALC889A is handled better as ALC888-compatible */
7066 if (codec->revision_id == 0x100101 ||
7067 codec->revision_id == 0x100103) {
7069 return patch_alc883(codec);
7071 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7072 "trying auto-probe from BIOS...\n");
7073 board_config = ALC882_AUTO;
7077 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7079 if (board_config == ALC882_AUTO) {
7080 /* automatic parse from the BIOS config */
7081 err = alc882_parse_auto_config(codec);
7087 "hda_codec: Cannot set up configuration "
7088 "from BIOS. Using base mode...\n");
7089 board_config = ALC882_3ST_DIG;
7093 if (board_config != ALC882_AUTO)
7094 setup_preset(spec, &alc882_presets[board_config]);
7096 if (codec->vendor_id == 0x10ec0885) {
7097 spec->stream_name_analog = "ALC885 Analog";
7098 spec->stream_name_digital = "ALC885 Digital";
7100 spec->stream_name_analog = "ALC882 Analog";
7101 spec->stream_name_digital = "ALC882 Digital";
7104 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7105 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7106 /* FIXME: setup DAC5 */
7107 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7108 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7110 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7111 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7113 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7114 if (!spec->adc_nids && spec->input_mux) {
7115 /* check whether NID 0x07 is valid */
7116 unsigned int wcap = get_wcaps(codec, 0x07);
7118 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7119 if (wcap != AC_WID_AUD_IN) {
7120 spec->adc_nids = alc882_adc_nids_alt;
7121 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7122 spec->capsrc_nids = alc882_capsrc_nids_alt;
7124 spec->adc_nids = alc882_adc_nids;
7125 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7126 spec->capsrc_nids = alc882_capsrc_nids;
7129 set_capture_mixer(spec);
7131 spec->vmaster_nid = 0x0c;
7133 codec->patch_ops = alc_patch_ops;
7134 if (board_config == ALC882_AUTO)
7135 spec->init_hook = alc882_auto_init;
7136 #ifdef CONFIG_SND_HDA_POWER_SAVE
7137 if (!spec->loopback.amplist)
7138 spec->loopback.amplist = alc882_loopbacks;
7140 codec->proc_widget_hook = print_realtek_coef;
7148 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7149 * configuration. Each pin widget can choose any input DACs and a mixer.
7150 * Each ADC is connected from a mixer of all inputs. This makes possible
7151 * 6-channel independent captures.
7153 * In addition, an independent DAC for the multi-playback (not used in this
7156 #define ALC883_DIGOUT_NID 0x06
7157 #define ALC883_DIGIN_NID 0x0a
7159 #define ALC1200_DIGOUT_NID 0x10
7161 static hda_nid_t alc883_dac_nids[4] = {
7162 /* front, rear, clfe, rear_surr */
7163 0x02, 0x03, 0x04, 0x05
7166 static hda_nid_t alc883_adc_nids[2] = {
7171 static hda_nid_t alc883_adc_nids_alt[1] = {
7176 static hda_nid_t alc883_adc_nids_rev[2] = {
7181 #define alc889_adc_nids alc880_adc_nids
7183 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7185 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7187 #define alc889_capsrc_nids alc882_capsrc_nids
7190 /* FIXME: should be a matrix-type input source selection */
7192 static struct hda_input_mux alc883_capture_source = {
7196 { "Front Mic", 0x1 },
7202 static struct hda_input_mux alc883_3stack_6ch_intel = {
7206 { "Front Mic", 0x0 },
7212 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7220 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7230 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7238 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7242 { "Front Mic", 0x1 },
7247 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7258 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7265 static struct hda_verb alc883_3ST_ch2_init[] = {
7266 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7267 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7268 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7269 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7276 static struct hda_verb alc883_3ST_ch4_init[] = {
7277 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7278 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7279 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7280 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7281 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7288 static struct hda_verb alc883_3ST_ch6_init[] = {
7289 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7290 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7291 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7292 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7293 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7294 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7298 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7299 { 2, alc883_3ST_ch2_init },
7300 { 4, alc883_3ST_ch4_init },
7301 { 6, alc883_3ST_ch6_init },
7307 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7308 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7309 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7310 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7311 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7318 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7319 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7320 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7321 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7322 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7323 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7330 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7331 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7332 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7333 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7334 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7335 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7336 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7340 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7341 { 2, alc883_3ST_ch2_intel_init },
7342 { 4, alc883_3ST_ch4_intel_init },
7343 { 6, alc883_3ST_ch6_intel_init },
7349 static struct hda_verb alc883_sixstack_ch6_init[] = {
7350 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7351 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7352 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7353 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7360 static struct hda_verb alc883_sixstack_ch8_init[] = {
7361 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7362 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7363 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7364 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7368 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7369 { 6, alc883_sixstack_ch6_init },
7370 { 8, alc883_sixstack_ch8_init },
7373 static struct hda_verb alc883_medion_eapd_verbs[] = {
7374 /* eanable EAPD on medion laptop */
7375 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7376 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7380 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7381 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7384 static struct snd_kcontrol_new alc883_base_mixer[] = {
7385 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7386 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7387 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7388 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7389 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7390 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7391 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7392 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7393 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7394 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7395 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7396 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7397 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7398 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7399 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7401 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7403 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7404 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7405 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7406 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7407 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7411 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7413 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7414 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7415 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7416 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7417 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7424 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7428 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7429 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7430 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7431 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7432 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7436 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7437 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7438 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7442 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7443 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7444 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7445 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7446 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7450 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7452 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7456 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7457 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7458 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7460 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7461 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7462 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7463 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7464 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7465 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7467 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7468 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7469 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7470 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7471 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7475 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7476 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7478 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7479 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7480 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7481 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7482 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7483 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7484 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7485 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7486 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7487 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7488 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7489 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7490 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7492 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7493 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7494 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7495 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7496 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7500 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7501 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7502 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7503 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7504 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7505 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7507 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7508 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7509 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7511 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7512 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7513 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7514 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7516 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7518 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7519 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7520 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7521 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7522 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7526 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7527 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7528 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7529 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7530 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7531 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7532 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7533 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7534 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7535 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7536 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7537 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7538 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7539 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7541 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7543 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7545 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7546 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7547 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7551 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7552 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7553 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7554 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7555 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7556 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7557 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7558 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7559 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7560 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7561 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7562 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7563 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7564 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7565 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7566 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7571 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7572 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7573 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7574 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7575 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7576 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7579 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7580 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7581 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7582 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7586 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7587 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7588 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7590 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7591 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7593 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7598 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7599 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7600 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7601 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7602 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7603 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7605 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7606 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7607 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7611 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7612 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7614 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7615 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7616 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7619 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7620 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7624 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7625 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7626 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7627 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7628 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7629 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7636 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7637 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7638 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7640 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7641 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7642 0x0d, 1, 0x0, HDA_OUTPUT),
7643 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7644 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7645 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7646 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7647 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7649 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7650 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7651 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7652 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7653 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7654 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7655 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7657 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7658 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7659 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7663 static struct hda_bind_ctls alc883_bind_cap_vol = {
7664 .ops = &snd_hda_bind_vol,
7666 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7667 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7672 static struct hda_bind_ctls alc883_bind_cap_switch = {
7673 .ops = &snd_hda_bind_sw,
7675 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7676 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7681 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7682 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7683 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7685 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7686 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7688 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7693 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7694 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7695 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7698 /* .name = "Capture Source", */
7699 .name = "Input Source",
7701 .info = alc_mux_enum_info,
7702 .get = alc_mux_enum_get,
7703 .put = alc_mux_enum_put,
7708 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7710 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7711 .name = "Channel Mode",
7712 .info = alc_ch_mode_info,
7713 .get = alc_ch_mode_get,
7714 .put = alc_ch_mode_put,
7719 static struct hda_verb alc883_init_verbs[] = {
7720 /* ADC1: mute amp left and right */
7721 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7722 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7723 /* ADC2: mute amp left and right */
7724 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7725 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7726 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7731 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7739 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7740 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7741 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7743 /* mute analog input loopbacks */
7744 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7745 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7747 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7748 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7750 /* Front Pin: output 0 (0x0c) */
7751 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7752 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7753 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7754 /* Rear Pin: output 1 (0x0d) */
7755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7757 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7758 /* CLFE Pin: output 2 (0x0e) */
7759 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7760 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7761 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7762 /* Side Pin: output 3 (0x0f) */
7763 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7764 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7765 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7766 /* Mic (rear) pin: input vref at 80% */
7767 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7768 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7769 /* Front Mic pin: input vref at 80% */
7770 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7771 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7772 /* Line In pin: input */
7773 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7774 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7775 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7776 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7777 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7778 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7779 /* CD pin widget for input */
7780 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7782 /* FIXME: use matrix-type input source selection */
7783 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7786 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7787 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7788 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7791 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7792 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7793 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7797 /* toggle speaker-output according to the hp-jack state */
7798 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7800 unsigned int present;
7802 present = snd_hda_codec_read(codec, 0x15, 0,
7803 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7804 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7805 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7806 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7807 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7810 /* auto-toggle front mic */
7812 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7814 unsigned int present;
7817 present = snd_hda_codec_read(codec, 0x18, 0,
7818 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7819 bits = present ? HDA_AMP_MUTE : 0;
7820 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7824 static void alc883_mitac_automute(struct hda_codec *codec)
7826 alc883_mitac_hp_automute(codec);
7827 /* alc883_mitac_mic_automute(codec); */
7830 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7833 switch (res >> 26) {
7834 case ALC880_HP_EVENT:
7835 alc883_mitac_hp_automute(codec);
7837 case ALC880_MIC_EVENT:
7838 /* alc883_mitac_mic_automute(codec); */
7843 static struct hda_verb alc883_mitac_verbs[] = {
7845 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7848 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7849 {0x17, 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_clevo_m720_verbs[] = {
7860 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7861 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7863 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7864 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7866 /* enable unsolicited event */
7867 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7868 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7873 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7875 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7876 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7878 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7879 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7881 /* enable unsolicited event */
7882 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7887 static struct hda_verb alc883_tagra_verbs[] = {
7888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7892 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7894 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7895 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7896 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7899 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7900 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7901 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7906 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7907 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7908 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7909 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7913 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7914 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7915 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7916 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7921 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7924 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7925 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7926 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7930 static struct hda_verb alc883_haier_w66_verbs[] = {
7931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7932 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7936 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7937 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7938 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7943 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7947 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7948 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7949 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7950 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7951 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7955 static struct hda_verb alc888_3st_hp_verbs[] = {
7956 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7957 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7958 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7962 static struct hda_verb alc888_6st_dell_verbs[] = {
7963 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7967 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7968 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7969 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7970 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7971 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7975 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7976 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7977 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7978 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7979 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7983 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7984 { 2, alc888_3st_hp_2ch_init },
7985 { 6, alc888_3st_hp_6ch_init },
7988 /* toggle front-jack and RCA according to the hp-jack state */
7989 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7991 unsigned int present;
7993 present = snd_hda_codec_read(codec, 0x1b, 0,
7994 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7995 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7996 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7997 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7998 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8001 /* toggle RCA according to the front-jack state */
8002 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8004 unsigned int present;
8006 present = snd_hda_codec_read(codec, 0x14, 0,
8007 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8008 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8009 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8012 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8015 if ((res >> 26) == ALC880_HP_EVENT)
8016 alc888_lenovo_ms7195_front_automute(codec);
8017 if ((res >> 26) == ALC880_FRONT_EVENT)
8018 alc888_lenovo_ms7195_rca_automute(codec);
8021 static struct hda_verb alc883_medion_md2_verbs[] = {
8022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8025 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8027 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8031 /* toggle speaker-output according to the hp-jack state */
8032 static void alc883_medion_md2_automute(struct hda_codec *codec)
8034 unsigned int present;
8036 present = snd_hda_codec_read(codec, 0x14, 0,
8037 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8038 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8039 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8042 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8045 if ((res >> 26) == ALC880_HP_EVENT)
8046 alc883_medion_md2_automute(codec);
8049 /* toggle speaker-output according to the hp-jack state */
8050 static void alc883_tagra_automute(struct hda_codec *codec)
8052 unsigned int present;
8055 present = snd_hda_codec_read(codec, 0x14, 0,
8056 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8057 bits = present ? HDA_AMP_MUTE : 0;
8058 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8059 HDA_AMP_MUTE, bits);
8060 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8064 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8066 if ((res >> 26) == ALC880_HP_EVENT)
8067 alc883_tagra_automute(codec);
8070 /* toggle speaker-output according to the hp-jack state */
8071 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8073 unsigned int present;
8076 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8077 & AC_PINSENSE_PRESENCE;
8078 bits = present ? HDA_AMP_MUTE : 0;
8079 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8080 HDA_AMP_MUTE, bits);
8083 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8085 unsigned int present;
8087 present = snd_hda_codec_read(codec, 0x18, 0,
8088 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8089 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8090 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8093 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8095 alc883_clevo_m720_hp_automute(codec);
8096 alc883_clevo_m720_mic_automute(codec);
8099 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8102 switch (res >> 26) {
8103 case ALC880_HP_EVENT:
8104 alc883_clevo_m720_hp_automute(codec);
8106 case ALC880_MIC_EVENT:
8107 alc883_clevo_m720_mic_automute(codec);
8112 /* toggle speaker-output according to the hp-jack state */
8113 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8115 unsigned int present;
8118 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8119 & AC_PINSENSE_PRESENCE;
8120 bits = present ? HDA_AMP_MUTE : 0;
8121 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8122 HDA_AMP_MUTE, bits);
8125 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8128 if ((res >> 26) == ALC880_HP_EVENT)
8129 alc883_2ch_fujitsu_pi2515_automute(codec);
8132 static void alc883_haier_w66_automute(struct hda_codec *codec)
8134 unsigned int present;
8137 present = snd_hda_codec_read(codec, 0x1b, 0,
8138 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8139 bits = present ? 0x80 : 0;
8140 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8144 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8147 if ((res >> 26) == ALC880_HP_EVENT)
8148 alc883_haier_w66_automute(codec);
8151 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8153 unsigned int present;
8156 present = snd_hda_codec_read(codec, 0x14, 0,
8157 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8158 bits = present ? HDA_AMP_MUTE : 0;
8159 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8160 HDA_AMP_MUTE, bits);
8163 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8165 unsigned int present;
8168 present = snd_hda_codec_read(codec, 0x1b, 0,
8169 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8170 bits = present ? HDA_AMP_MUTE : 0;
8171 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8172 HDA_AMP_MUTE, bits);
8173 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8174 HDA_AMP_MUTE, bits);
8177 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8180 if ((res >> 26) == ALC880_HP_EVENT)
8181 alc883_lenovo_101e_all_automute(codec);
8182 if ((res >> 26) == ALC880_FRONT_EVENT)
8183 alc883_lenovo_101e_ispeaker_automute(codec);
8186 /* toggle speaker-output according to the hp-jack state */
8187 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8189 unsigned int present;
8191 present = snd_hda_codec_read(codec, 0x14, 0,
8192 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8193 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8194 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8195 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8196 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8199 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8202 if ((res >> 26) == ALC880_HP_EVENT)
8203 alc883_acer_aspire_automute(codec);
8206 static struct hda_verb alc883_acer_eapd_verbs[] = {
8207 /* HP Pin: output 0 (0x0c) */
8208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8209 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8210 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8211 /* Front Pin: output 0 (0x0c) */
8212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8213 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8214 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8215 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8216 /* eanable EAPD on medion laptop */
8217 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8218 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8219 /* enable unsolicited event */
8220 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8224 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8226 unsigned int present;
8228 present = snd_hda_codec_read(codec, 0x1b, 0,
8229 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8230 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8231 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8232 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8233 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8234 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8235 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8236 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8237 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8240 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8243 switch (res >> 26) {
8244 case ALC880_HP_EVENT:
8245 printk("hp_event\n");
8246 alc888_6st_dell_front_automute(codec);
8251 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8254 unsigned int present;
8256 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8257 present = snd_hda_codec_read(codec, 0x1b, 0,
8258 AC_VERB_GET_PIN_SENSE, 0);
8259 present = (present & 0x80000000) != 0;
8261 /* mute internal speaker */
8262 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8263 HDA_AMP_MUTE, HDA_AMP_MUTE);
8264 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8265 HDA_AMP_MUTE, HDA_AMP_MUTE);
8266 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8267 HDA_AMP_MUTE, HDA_AMP_MUTE);
8268 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8269 HDA_AMP_MUTE, HDA_AMP_MUTE);
8270 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8271 HDA_AMP_MUTE, HDA_AMP_MUTE);
8273 /* unmute internal speaker if necessary */
8274 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8275 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8276 HDA_AMP_MUTE, mute);
8277 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8278 HDA_AMP_MUTE, mute);
8279 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8280 HDA_AMP_MUTE, mute);
8281 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8282 HDA_AMP_MUTE, mute);
8283 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8284 HDA_AMP_MUTE, mute);
8288 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8291 if ((res >> 26) == ALC880_HP_EVENT)
8292 alc888_lenovo_sky_front_automute(codec);
8296 * generic initialization of ADC, input mixers and output mixers
8298 static struct hda_verb alc883_auto_init_verbs[] = {
8300 * Unmute ADC0-2 and set the default input to mic-in
8302 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8303 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8304 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8307 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8309 * Note: PASD motherboards uses the Line In 2 as the input for
8310 * front panel mic (mic 2)
8312 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8320 * Set up output mixers (0x0c - 0x0f)
8322 /* set vol=0 to output mixers */
8323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8324 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8325 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8326 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8327 /* set up input amps for analog loopback */
8328 /* Amp Indices: DAC = 0, mixer = 1 */
8329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8335 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8337 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8338 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8340 /* FIXME: use matrix-type input source selection */
8341 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8346 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8352 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8358 static struct hda_verb alc888_asus_m90v_verbs[] = {
8359 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8361 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8362 /* enable unsolicited event */
8363 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8364 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8368 static void alc883_nb_mic_automute(struct hda_codec *codec)
8370 unsigned int present;
8372 present = snd_hda_codec_read(codec, 0x18, 0,
8373 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8374 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8375 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8376 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8377 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8380 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8382 unsigned int present;
8385 present = snd_hda_codec_read(codec, 0x1b, 0,
8386 AC_VERB_GET_PIN_SENSE, 0)
8387 & AC_PINSENSE_PRESENCE;
8388 bits = present ? 0 : PIN_OUT;
8389 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8391 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8393 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8397 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8400 switch (res >> 26) {
8401 case ALC880_HP_EVENT:
8402 alc883_M90V_speaker_automute(codec);
8404 case ALC880_MIC_EVENT:
8405 alc883_nb_mic_automute(codec);
8410 static void alc883_mode2_inithook(struct hda_codec *codec)
8412 alc883_M90V_speaker_automute(codec);
8413 alc883_nb_mic_automute(codec);
8416 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8418 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8420 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8421 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8422 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8423 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8424 /* enable unsolicited event */
8425 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8429 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8431 unsigned int present;
8434 present = snd_hda_codec_read(codec, 0x14, 0,
8435 AC_VERB_GET_PIN_SENSE, 0)
8436 & AC_PINSENSE_PRESENCE;
8437 bits = present ? 0 : PIN_OUT;
8438 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8442 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8445 switch (res >> 26) {
8446 case ALC880_HP_EVENT:
8447 alc883_eee1601_speaker_automute(codec);
8452 static void alc883_eee1601_inithook(struct hda_codec *codec)
8454 alc883_eee1601_speaker_automute(codec);
8457 #ifdef CONFIG_SND_HDA_POWER_SAVE
8458 #define alc883_loopbacks alc880_loopbacks
8461 /* pcm configuration: identiacal with ALC880 */
8462 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8463 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8464 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8465 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8466 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8469 * configuration and preset
8471 static const char *alc883_models[ALC883_MODEL_LAST] = {
8472 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8473 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8474 [ALC883_3ST_6ch] = "3stack-6ch",
8475 [ALC883_6ST_DIG] = "6stack-dig",
8476 [ALC883_TARGA_DIG] = "targa-dig",
8477 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8478 [ALC883_ACER] = "acer",
8479 [ALC883_ACER_ASPIRE] = "acer-aspire",
8480 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8481 [ALC883_MEDION] = "medion",
8482 [ALC883_MEDION_MD2] = "medion-md2",
8483 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8484 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8485 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8486 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8487 [ALC888_LENOVO_SKY] = "lenovo-sky",
8488 [ALC883_HAIER_W66] = "haier-w66",
8489 [ALC888_3ST_HP] = "3stack-hp",
8490 [ALC888_6ST_DELL] = "6stack-dell",
8491 [ALC883_MITAC] = "mitac",
8492 [ALC883_CLEVO_M720] = "clevo-m720",
8493 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8494 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8495 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8496 [ALC1200_ASUS_P5Q] = "asus-p5q",
8497 [ALC883_AUTO] = "auto",
8500 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8501 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8502 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8503 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8504 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8505 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8506 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8507 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8508 ALC888_ACER_ASPIRE_4930G),
8509 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8510 ALC888_ACER_ASPIRE_4930G),
8511 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8512 ALC888_ACER_ASPIRE_4930G),
8513 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8514 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8515 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8516 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8517 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8518 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8519 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8520 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8521 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8522 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8523 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8524 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8525 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8526 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8527 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8528 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8529 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8530 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8531 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8532 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8533 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8534 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8535 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8536 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8537 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8538 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8539 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8540 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8541 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8542 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8543 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8544 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8545 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8546 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8547 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8548 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8549 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8550 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8551 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8552 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8553 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8554 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8555 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8556 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8557 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8558 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8559 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8560 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8561 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8562 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8563 ALC888_FUJITSU_XA3530),
8564 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8565 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8566 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8567 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8568 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8569 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8570 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8571 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8572 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8573 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8574 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8575 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8576 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8577 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8581 static struct alc_config_preset alc883_presets[] = {
8582 [ALC883_3ST_2ch_DIG] = {
8583 .mixers = { alc883_3ST_2ch_mixer },
8584 .init_verbs = { alc883_init_verbs },
8585 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8586 .dac_nids = alc883_dac_nids,
8587 .dig_out_nid = ALC883_DIGOUT_NID,
8588 .dig_in_nid = ALC883_DIGIN_NID,
8589 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8590 .channel_mode = alc883_3ST_2ch_modes,
8591 .input_mux = &alc883_capture_source,
8593 [ALC883_3ST_6ch_DIG] = {
8594 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8595 .init_verbs = { alc883_init_verbs },
8596 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8597 .dac_nids = alc883_dac_nids,
8598 .dig_out_nid = ALC883_DIGOUT_NID,
8599 .dig_in_nid = ALC883_DIGIN_NID,
8600 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8601 .channel_mode = alc883_3ST_6ch_modes,
8603 .input_mux = &alc883_capture_source,
8605 [ALC883_3ST_6ch] = {
8606 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8607 .init_verbs = { alc883_init_verbs },
8608 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8609 .dac_nids = alc883_dac_nids,
8610 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8611 .channel_mode = alc883_3ST_6ch_modes,
8613 .input_mux = &alc883_capture_source,
8615 [ALC883_3ST_6ch_INTEL] = {
8616 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8617 .init_verbs = { alc883_init_verbs },
8618 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8619 .dac_nids = alc883_dac_nids,
8620 .dig_out_nid = ALC883_DIGOUT_NID,
8621 .dig_in_nid = ALC883_DIGIN_NID,
8622 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8623 .channel_mode = alc883_3ST_6ch_intel_modes,
8625 .input_mux = &alc883_3stack_6ch_intel,
8627 [ALC883_6ST_DIG] = {
8628 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8629 .init_verbs = { alc883_init_verbs },
8630 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8631 .dac_nids = alc883_dac_nids,
8632 .dig_out_nid = ALC883_DIGOUT_NID,
8633 .dig_in_nid = ALC883_DIGIN_NID,
8634 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8635 .channel_mode = alc883_sixstack_modes,
8636 .input_mux = &alc883_capture_source,
8638 [ALC883_TARGA_DIG] = {
8639 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8640 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8641 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8642 .dac_nids = alc883_dac_nids,
8643 .dig_out_nid = ALC883_DIGOUT_NID,
8644 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8645 .channel_mode = alc883_3ST_6ch_modes,
8647 .input_mux = &alc883_capture_source,
8648 .unsol_event = alc883_tagra_unsol_event,
8649 .init_hook = alc883_tagra_automute,
8651 [ALC883_TARGA_2ch_DIG] = {
8652 .mixers = { alc883_tagra_2ch_mixer},
8653 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8654 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8655 .dac_nids = alc883_dac_nids,
8656 .adc_nids = alc883_adc_nids_alt,
8657 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8658 .dig_out_nid = ALC883_DIGOUT_NID,
8659 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8660 .channel_mode = alc883_3ST_2ch_modes,
8661 .input_mux = &alc883_capture_source,
8662 .unsol_event = alc883_tagra_unsol_event,
8663 .init_hook = alc883_tagra_automute,
8666 .mixers = { alc883_base_mixer },
8667 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8668 * and the headphone jack. Turn this on and rely on the
8669 * standard mute methods whenever the user wants to turn
8670 * these outputs off.
8672 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8673 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8674 .dac_nids = alc883_dac_nids,
8675 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8676 .channel_mode = alc883_3ST_2ch_modes,
8677 .input_mux = &alc883_capture_source,
8679 [ALC883_ACER_ASPIRE] = {
8680 .mixers = { alc883_acer_aspire_mixer },
8681 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8682 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8683 .dac_nids = alc883_dac_nids,
8684 .dig_out_nid = ALC883_DIGOUT_NID,
8685 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8686 .channel_mode = alc883_3ST_2ch_modes,
8687 .input_mux = &alc883_capture_source,
8688 .unsol_event = alc883_acer_aspire_unsol_event,
8689 .init_hook = alc883_acer_aspire_automute,
8691 [ALC888_ACER_ASPIRE_4930G] = {
8692 .mixers = { alc888_base_mixer,
8693 alc883_chmode_mixer },
8694 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8695 alc888_acer_aspire_4930g_verbs },
8696 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8697 .dac_nids = alc883_dac_nids,
8698 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8699 .adc_nids = alc883_adc_nids_rev,
8700 .capsrc_nids = alc883_capsrc_nids_rev,
8701 .dig_out_nid = ALC883_DIGOUT_NID,
8702 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8703 .channel_mode = alc883_3ST_6ch_modes,
8706 ARRAY_SIZE(alc888_2_capture_sources),
8707 .input_mux = alc888_2_capture_sources,
8708 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8709 .init_hook = alc888_acer_aspire_4930g_automute,
8712 .mixers = { alc883_fivestack_mixer,
8713 alc883_chmode_mixer },
8714 .init_verbs = { alc883_init_verbs,
8715 alc883_medion_eapd_verbs },
8716 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8717 .dac_nids = alc883_dac_nids,
8718 .adc_nids = alc883_adc_nids_alt,
8719 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8720 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8721 .channel_mode = alc883_sixstack_modes,
8722 .input_mux = &alc883_capture_source,
8724 [ALC883_MEDION_MD2] = {
8725 .mixers = { alc883_medion_md2_mixer},
8726 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8727 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8728 .dac_nids = alc883_dac_nids,
8729 .dig_out_nid = ALC883_DIGOUT_NID,
8730 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8731 .channel_mode = alc883_3ST_2ch_modes,
8732 .input_mux = &alc883_capture_source,
8733 .unsol_event = alc883_medion_md2_unsol_event,
8734 .init_hook = alc883_medion_md2_automute,
8736 [ALC883_LAPTOP_EAPD] = {
8737 .mixers = { alc883_base_mixer },
8738 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8739 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8740 .dac_nids = alc883_dac_nids,
8741 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8742 .channel_mode = alc883_3ST_2ch_modes,
8743 .input_mux = &alc883_capture_source,
8745 [ALC883_CLEVO_M720] = {
8746 .mixers = { alc883_clevo_m720_mixer },
8747 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8748 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8749 .dac_nids = alc883_dac_nids,
8750 .dig_out_nid = ALC883_DIGOUT_NID,
8751 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8752 .channel_mode = alc883_3ST_2ch_modes,
8753 .input_mux = &alc883_capture_source,
8754 .unsol_event = alc883_clevo_m720_unsol_event,
8755 .init_hook = alc883_clevo_m720_automute,
8757 [ALC883_LENOVO_101E_2ch] = {
8758 .mixers = { alc883_lenovo_101e_2ch_mixer},
8759 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8760 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8761 .dac_nids = alc883_dac_nids,
8762 .adc_nids = alc883_adc_nids_alt,
8763 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8764 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8765 .channel_mode = alc883_3ST_2ch_modes,
8766 .input_mux = &alc883_lenovo_101e_capture_source,
8767 .unsol_event = alc883_lenovo_101e_unsol_event,
8768 .init_hook = alc883_lenovo_101e_all_automute,
8770 [ALC883_LENOVO_NB0763] = {
8771 .mixers = { alc883_lenovo_nb0763_mixer },
8772 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8773 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8774 .dac_nids = alc883_dac_nids,
8775 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8776 .channel_mode = alc883_3ST_2ch_modes,
8778 .input_mux = &alc883_lenovo_nb0763_capture_source,
8779 .unsol_event = alc883_medion_md2_unsol_event,
8780 .init_hook = alc883_medion_md2_automute,
8782 [ALC888_LENOVO_MS7195_DIG] = {
8783 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8784 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8785 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8786 .dac_nids = alc883_dac_nids,
8787 .dig_out_nid = ALC883_DIGOUT_NID,
8788 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8789 .channel_mode = alc883_3ST_6ch_modes,
8791 .input_mux = &alc883_capture_source,
8792 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8793 .init_hook = alc888_lenovo_ms7195_front_automute,
8795 [ALC883_HAIER_W66] = {
8796 .mixers = { alc883_tagra_2ch_mixer},
8797 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8798 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8799 .dac_nids = alc883_dac_nids,
8800 .dig_out_nid = ALC883_DIGOUT_NID,
8801 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8802 .channel_mode = alc883_3ST_2ch_modes,
8803 .input_mux = &alc883_capture_source,
8804 .unsol_event = alc883_haier_w66_unsol_event,
8805 .init_hook = alc883_haier_w66_automute,
8808 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8809 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8810 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8811 .dac_nids = alc883_dac_nids,
8812 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8813 .channel_mode = alc888_3st_hp_modes,
8815 .input_mux = &alc883_capture_source,
8817 [ALC888_6ST_DELL] = {
8818 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8819 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8820 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8821 .dac_nids = alc883_dac_nids,
8822 .dig_out_nid = ALC883_DIGOUT_NID,
8823 .dig_in_nid = ALC883_DIGIN_NID,
8824 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8825 .channel_mode = alc883_sixstack_modes,
8826 .input_mux = &alc883_capture_source,
8827 .unsol_event = alc888_6st_dell_unsol_event,
8828 .init_hook = alc888_6st_dell_front_automute,
8831 .mixers = { alc883_mitac_mixer },
8832 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8833 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8834 .dac_nids = alc883_dac_nids,
8835 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8836 .channel_mode = alc883_3ST_2ch_modes,
8837 .input_mux = &alc883_capture_source,
8838 .unsol_event = alc883_mitac_unsol_event,
8839 .init_hook = alc883_mitac_automute,
8841 [ALC883_FUJITSU_PI2515] = {
8842 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8843 .init_verbs = { alc883_init_verbs,
8844 alc883_2ch_fujitsu_pi2515_verbs},
8845 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8846 .dac_nids = alc883_dac_nids,
8847 .dig_out_nid = ALC883_DIGOUT_NID,
8848 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8849 .channel_mode = alc883_3ST_2ch_modes,
8850 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8851 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8852 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8854 [ALC888_FUJITSU_XA3530] = {
8855 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8856 .init_verbs = { alc883_init_verbs,
8857 alc888_fujitsu_xa3530_verbs },
8858 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8859 .dac_nids = alc883_dac_nids,
8860 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8861 .adc_nids = alc883_adc_nids_rev,
8862 .capsrc_nids = alc883_capsrc_nids_rev,
8863 .dig_out_nid = ALC883_DIGOUT_NID,
8864 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8865 .channel_mode = alc888_4ST_8ch_intel_modes,
8867 ARRAY_SIZE(alc888_2_capture_sources),
8868 .input_mux = alc888_2_capture_sources,
8869 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8870 .init_hook = alc888_fujitsu_xa3530_automute,
8872 [ALC888_LENOVO_SKY] = {
8873 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8874 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8875 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8876 .dac_nids = alc883_dac_nids,
8877 .dig_out_nid = ALC883_DIGOUT_NID,
8878 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8879 .channel_mode = alc883_sixstack_modes,
8881 .input_mux = &alc883_lenovo_sky_capture_source,
8882 .unsol_event = alc883_lenovo_sky_unsol_event,
8883 .init_hook = alc888_lenovo_sky_front_automute,
8885 [ALC888_ASUS_M90V] = {
8886 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8887 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_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_6ch_modes),
8893 .channel_mode = alc883_3ST_6ch_modes,
8895 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8896 .unsol_event = alc883_mode2_unsol_event,
8897 .init_hook = alc883_mode2_inithook,
8899 [ALC888_ASUS_EEE1601] = {
8900 .mixers = { alc883_asus_eee1601_mixer },
8901 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8902 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8903 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8904 .dac_nids = alc883_dac_nids,
8905 .dig_out_nid = ALC883_DIGOUT_NID,
8906 .dig_in_nid = ALC883_DIGIN_NID,
8907 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8908 .channel_mode = alc883_3ST_2ch_modes,
8910 .input_mux = &alc883_asus_eee1601_capture_source,
8911 .unsol_event = alc883_eee1601_unsol_event,
8912 .init_hook = alc883_eee1601_inithook,
8914 [ALC1200_ASUS_P5Q] = {
8915 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8916 .init_verbs = { alc883_init_verbs },
8917 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8918 .dac_nids = alc883_dac_nids,
8919 .dig_out_nid = ALC1200_DIGOUT_NID,
8920 .dig_in_nid = ALC883_DIGIN_NID,
8921 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8922 .channel_mode = alc883_sixstack_modes,
8923 .input_mux = &alc883_capture_source,
8929 * BIOS auto configuration
8931 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8932 hda_nid_t nid, int pin_type,
8936 struct alc_spec *spec = codec->spec;
8939 alc_set_pin_output(codec, nid, pin_type);
8940 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8943 idx = spec->multiout.dac_nids[dac_idx] - 2;
8944 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8948 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8950 struct alc_spec *spec = codec->spec;
8953 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8954 for (i = 0; i <= HDA_SIDE; i++) {
8955 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8956 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8958 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8963 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8965 struct alc_spec *spec = codec->spec;
8968 pin = spec->autocfg.hp_pins[0];
8969 if (pin) /* connect to front */
8971 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8972 pin = spec->autocfg.speaker_pins[0];
8974 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8977 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8978 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8980 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8982 struct alc_spec *spec = codec->spec;
8985 for (i = 0; i < AUTO_PIN_LAST; i++) {
8986 hda_nid_t nid = spec->autocfg.input_pins[i];
8987 if (alc883_is_input_pin(nid)) {
8988 snd_hda_codec_write(codec, nid, 0,
8989 AC_VERB_SET_PIN_WIDGET_CONTROL,
8990 (i <= AUTO_PIN_FRONT_MIC ?
8991 PIN_VREF80 : PIN_IN));
8992 if (nid != ALC883_PIN_CD_NID)
8993 snd_hda_codec_write(codec, nid, 0,
8994 AC_VERB_SET_AMP_GAIN_MUTE,
9000 #define alc883_auto_init_input_src alc882_auto_init_input_src
9002 /* almost identical with ALC880 parser... */
9003 static int alc883_parse_auto_config(struct hda_codec *codec)
9005 struct alc_spec *spec = codec->spec;
9006 int err = alc880_parse_auto_config(codec);
9007 struct auto_pin_cfg *cfg = &spec->autocfg;
9013 return 0; /* no config found */
9015 err = alc_auto_add_mic_boost(codec);
9019 /* hack - override the init verbs */
9020 spec->init_verbs[0] = alc883_auto_init_verbs;
9022 /* setup input_mux for ALC889 */
9023 if (codec->vendor_id == 0x10ec0889) {
9024 /* digital-mic input pin is excluded in alc880_auto_create..()
9025 * because it's under 0x18
9027 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9028 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9029 struct hda_input_mux *imux = &spec->private_imux[0];
9030 for (i = 1; i < 3; i++)
9031 memcpy(&spec->private_imux[i],
9032 &spec->private_imux[0],
9033 sizeof(spec->private_imux[0]));
9034 imux->items[imux->num_items].label = "Int DMic";
9035 imux->items[imux->num_items].index = 0x0b;
9037 spec->num_mux_defs = 3;
9038 spec->input_mux = spec->private_imux;
9042 return 1; /* config found */
9045 /* additional initialization for auto-configuration model */
9046 static void alc883_auto_init(struct hda_codec *codec)
9048 struct alc_spec *spec = codec->spec;
9049 alc883_auto_init_multi_out(codec);
9050 alc883_auto_init_hp_out(codec);
9051 alc883_auto_init_analog_input(codec);
9052 alc883_auto_init_input_src(codec);
9053 if (spec->unsol_event)
9054 alc_inithook(codec);
9057 static int patch_alc883(struct hda_codec *codec)
9059 struct alc_spec *spec;
9060 int err, board_config;
9062 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9068 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9070 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9073 if (board_config < 0) {
9074 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9075 "trying auto-probe from BIOS...\n");
9076 board_config = ALC883_AUTO;
9079 if (board_config == ALC883_AUTO) {
9080 /* automatic parse from the BIOS config */
9081 err = alc883_parse_auto_config(codec);
9087 "hda_codec: Cannot set up configuration "
9088 "from BIOS. Using base mode...\n");
9089 board_config = ALC883_3ST_2ch_DIG;
9093 if (board_config != ALC883_AUTO)
9094 setup_preset(spec, &alc883_presets[board_config]);
9096 switch (codec->vendor_id) {
9098 if (codec->revision_id == 0x100101) {
9099 spec->stream_name_analog = "ALC1200 Analog";
9100 spec->stream_name_digital = "ALC1200 Digital";
9102 spec->stream_name_analog = "ALC888 Analog";
9103 spec->stream_name_digital = "ALC888 Digital";
9105 if (!spec->num_adc_nids) {
9106 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9107 spec->adc_nids = alc883_adc_nids;
9109 if (!spec->capsrc_nids)
9110 spec->capsrc_nids = alc883_capsrc_nids;
9111 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9114 spec->stream_name_analog = "ALC889 Analog";
9115 spec->stream_name_digital = "ALC889 Digital";
9116 if (!spec->num_adc_nids) {
9117 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9118 spec->adc_nids = alc889_adc_nids;
9120 if (!spec->capsrc_nids)
9121 spec->capsrc_nids = alc889_capsrc_nids;
9122 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9126 spec->stream_name_analog = "ALC883 Analog";
9127 spec->stream_name_digital = "ALC883 Digital";
9128 if (!spec->num_adc_nids) {
9129 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9130 spec->adc_nids = alc883_adc_nids;
9132 if (!spec->capsrc_nids)
9133 spec->capsrc_nids = alc883_capsrc_nids;
9134 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9138 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9139 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9140 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9142 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9143 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9145 if (!spec->cap_mixer)
9146 set_capture_mixer(spec);
9148 spec->vmaster_nid = 0x0c;
9150 codec->patch_ops = alc_patch_ops;
9151 if (board_config == ALC883_AUTO)
9152 spec->init_hook = alc883_auto_init;
9154 #ifdef CONFIG_SND_HDA_POWER_SAVE
9155 if (!spec->loopback.amplist)
9156 spec->loopback.amplist = alc883_loopbacks;
9158 codec->proc_widget_hook = print_realtek_coef;
9167 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9168 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9170 #define alc262_dac_nids alc260_dac_nids
9171 #define alc262_adc_nids alc882_adc_nids
9172 #define alc262_adc_nids_alt alc882_adc_nids_alt
9173 #define alc262_capsrc_nids alc882_capsrc_nids
9174 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9176 #define alc262_modes alc260_modes
9177 #define alc262_capture_source alc882_capture_source
9179 static hda_nid_t alc262_dmic_adc_nids[1] = {
9184 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9186 static struct snd_kcontrol_new alc262_base_mixer[] = {
9187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9188 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9189 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9190 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9191 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9192 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9195 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9196 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9197 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9198 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9199 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9200 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9201 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9203 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9204 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9208 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9209 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9210 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9217 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9218 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9219 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9220 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9221 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9222 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9223 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9224 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9228 /* update HP, line and mono-out pins according to the master switch */
9229 static void alc262_hp_master_update(struct hda_codec *codec)
9231 struct alc_spec *spec = codec->spec;
9232 int val = spec->master_sw;
9235 snd_hda_codec_write_cache(codec, 0x1b, 0,
9236 AC_VERB_SET_PIN_WIDGET_CONTROL,
9238 snd_hda_codec_write_cache(codec, 0x15, 0,
9239 AC_VERB_SET_PIN_WIDGET_CONTROL,
9241 /* mono (speaker) depending on the HP jack sense */
9242 val = val && !spec->jack_present;
9243 snd_hda_codec_write_cache(codec, 0x16, 0,
9244 AC_VERB_SET_PIN_WIDGET_CONTROL,
9248 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9250 struct alc_spec *spec = codec->spec;
9251 unsigned int presence;
9252 presence = snd_hda_codec_read(codec, 0x1b, 0,
9253 AC_VERB_GET_PIN_SENSE, 0);
9254 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9255 alc262_hp_master_update(codec);
9258 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9260 if ((res >> 26) != ALC880_HP_EVENT)
9262 alc262_hp_bpc_automute(codec);
9265 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9267 struct alc_spec *spec = codec->spec;
9268 unsigned int presence;
9269 presence = snd_hda_codec_read(codec, 0x15, 0,
9270 AC_VERB_GET_PIN_SENSE, 0);
9271 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9272 alc262_hp_master_update(codec);
9275 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9278 if ((res >> 26) != ALC880_HP_EVENT)
9280 alc262_hp_wildwest_automute(codec);
9283 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9284 struct snd_ctl_elem_value *ucontrol)
9286 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9287 struct alc_spec *spec = codec->spec;
9288 *ucontrol->value.integer.value = spec->master_sw;
9292 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9293 struct snd_ctl_elem_value *ucontrol)
9295 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9296 struct alc_spec *spec = codec->spec;
9297 int val = !!*ucontrol->value.integer.value;
9299 if (val == spec->master_sw)
9301 spec->master_sw = val;
9302 alc262_hp_master_update(codec);
9306 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9308 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9309 .name = "Master Playback Switch",
9310 .info = snd_ctl_boolean_mono_info,
9311 .get = alc262_hp_master_sw_get,
9312 .put = alc262_hp_master_sw_put,
9314 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9315 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9316 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9317 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9319 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9323 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9324 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9325 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9326 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9327 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9328 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9330 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9331 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9332 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9333 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9334 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9338 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9340 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9341 .name = "Master Playback Switch",
9342 .info = snd_ctl_boolean_mono_info,
9343 .get = alc262_hp_master_sw_get,
9344 .put = alc262_hp_master_sw_put,
9346 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9347 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9348 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9350 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9352 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9356 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9359 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9360 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9361 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9362 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9366 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9367 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9368 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9369 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9373 /* mute/unmute internal speaker according to the hp jack and mute state */
9374 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9376 struct alc_spec *spec = codec->spec;
9378 if (force || !spec->sense_updated) {
9379 unsigned int present;
9380 present = snd_hda_codec_read(codec, 0x15, 0,
9381 AC_VERB_GET_PIN_SENSE, 0);
9382 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9383 spec->sense_updated = 1;
9385 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9386 spec->jack_present ? HDA_AMP_MUTE : 0);
9389 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9392 if ((res >> 26) != ALC880_HP_EVENT)
9394 alc262_hp_t5735_automute(codec, 1);
9397 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9399 alc262_hp_t5735_automute(codec, 1);
9402 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9403 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9404 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9405 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9406 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9407 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9408 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9409 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9413 static struct hda_verb alc262_hp_t5735_verbs[] = {
9414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9417 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9421 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9422 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9424 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9425 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9426 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9427 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9431 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9432 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9433 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9434 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9435 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9436 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9437 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9438 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9440 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9441 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9445 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9452 /* bind hp and internal speaker mute (with plug check) */
9453 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9454 struct snd_ctl_elem_value *ucontrol)
9456 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9457 long *valp = ucontrol->value.integer.value;
9460 /* change hp mute */
9461 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9463 valp[0] ? 0 : HDA_AMP_MUTE);
9464 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9466 valp[1] ? 0 : HDA_AMP_MUTE);
9468 /* change speaker according to HP jack state */
9469 struct alc_spec *spec = codec->spec;
9471 if (spec->jack_present)
9472 mute = HDA_AMP_MUTE;
9474 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9476 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9477 HDA_AMP_MUTE, mute);
9482 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9483 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9485 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9486 .name = "Master Playback Switch",
9487 .info = snd_hda_mixer_amp_switch_info,
9488 .get = snd_hda_mixer_amp_switch_get,
9489 .put = alc262_sony_master_sw_put,
9490 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9492 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9494 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9495 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9499 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9500 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9501 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9504 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9505 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9506 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9510 #define alc262_capture_mixer alc882_capture_mixer
9511 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9514 * generic initialization of ADC, input mixers and output mixers
9516 static struct hda_verb alc262_init_verbs[] = {
9518 * Unmute ADC0-2 and set the default input to mic-in
9520 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9522 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9523 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9524 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9525 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9527 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9529 * Note: PASD motherboards uses the Line In 2 as the input for
9530 * front panel mic (mic 2)
9532 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9533 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9535 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9536 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9540 * Set up output mixers (0x0c - 0x0e)
9542 /* set vol=0 to output mixers */
9543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9545 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9546 /* set up input amps for analog loopback */
9547 /* Amp Indices: DAC = 0, mixer = 1 */
9548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9550 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9552 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9553 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9555 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9557 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9558 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9559 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9560 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9562 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9564 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9565 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9566 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9568 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9569 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9571 /* FIXME: use matrix-type input source selection */
9572 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9573 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9580 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9581 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9582 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9584 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9592 static struct hda_verb alc262_eapd_verbs[] = {
9593 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9594 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9598 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9604 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9605 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9606 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9607 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9609 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9610 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9614 static struct hda_verb alc262_sony_unsol_verbs[] = {
9615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9616 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9617 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9619 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9620 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9624 static struct hda_input_mux alc262_dmic_capture_source = {
9627 { "Int DMic", 0x9 },
9632 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9633 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9634 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9637 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9641 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9642 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9645 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9646 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9647 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9648 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9649 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9653 static void alc262_dmic_automute(struct hda_codec *codec)
9655 unsigned int present;
9657 present = snd_hda_codec_read(codec, 0x18, 0,
9658 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9659 snd_hda_codec_write(codec, 0x22, 0,
9660 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9663 /* toggle speaker-output according to the hp-jack state */
9664 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9666 unsigned int present;
9669 present = snd_hda_codec_read(codec, 0x15, 0,
9670 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9671 bits = present ? 0 : PIN_OUT;
9672 snd_hda_codec_write(codec, 0x14, 0,
9673 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9678 /* unsolicited event for HP jack sensing */
9679 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9682 if ((res >> 26) == ALC880_HP_EVENT)
9683 alc262_toshiba_s06_speaker_automute(codec);
9684 if ((res >> 26) == ALC880_MIC_EVENT)
9685 alc262_dmic_automute(codec);
9689 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9691 alc262_toshiba_s06_speaker_automute(codec);
9692 alc262_dmic_automute(codec);
9695 /* mute/unmute internal speaker according to the hp jack and mute state */
9696 static void alc262_hippo_automute(struct hda_codec *codec)
9698 struct alc_spec *spec = codec->spec;
9700 unsigned int present;
9702 /* need to execute and sync at first */
9703 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9704 present = snd_hda_codec_read(codec, 0x15, 0,
9705 AC_VERB_GET_PIN_SENSE, 0);
9706 spec->jack_present = (present & 0x80000000) != 0;
9707 if (spec->jack_present) {
9708 /* mute internal speaker */
9709 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9710 HDA_AMP_MUTE, HDA_AMP_MUTE);
9712 /* unmute internal speaker if necessary */
9713 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9714 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9715 HDA_AMP_MUTE, mute);
9719 /* unsolicited event for HP jack sensing */
9720 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9723 if ((res >> 26) != ALC880_HP_EVENT)
9725 alc262_hippo_automute(codec);
9728 static void alc262_hippo1_automute(struct hda_codec *codec)
9731 unsigned int present;
9733 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9734 present = snd_hda_codec_read(codec, 0x1b, 0,
9735 AC_VERB_GET_PIN_SENSE, 0);
9736 present = (present & 0x80000000) != 0;
9738 /* mute internal speaker */
9739 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9740 HDA_AMP_MUTE, HDA_AMP_MUTE);
9742 /* unmute internal speaker if necessary */
9743 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9744 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9745 HDA_AMP_MUTE, mute);
9749 /* unsolicited event for HP jack sensing */
9750 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9753 if ((res >> 26) != ALC880_HP_EVENT)
9755 alc262_hippo1_automute(codec);
9761 * 0x16 = internal speaker
9762 * 0x18 = external mic
9765 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9766 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9767 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9771 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9773 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9778 static struct hda_verb alc262_nec_verbs[] = {
9779 /* Unmute Speaker */
9780 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9783 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9784 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9786 /* External mic to headphone */
9787 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9788 /* External mic to speaker */
9789 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9795 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9796 * 0x1b = port replicator headphone out
9799 #define ALC_HP_EVENT 0x37
9801 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9802 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9803 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9804 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9805 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9809 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9810 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9811 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9815 static struct hda_input_mux alc262_fujitsu_capture_source = {
9824 static struct hda_input_mux alc262_HP_capture_source = {
9828 { "Front Mic", 0x1 },
9835 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9839 { "Front Mic", 0x2 },
9845 /* mute/unmute internal speaker according to the hp jacks and mute state */
9846 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9848 struct alc_spec *spec = codec->spec;
9851 if (force || !spec->sense_updated) {
9852 unsigned int present;
9853 /* need to execute and sync at first */
9854 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9855 /* check laptop HP jack */
9856 present = snd_hda_codec_read(codec, 0x14, 0,
9857 AC_VERB_GET_PIN_SENSE, 0);
9858 /* need to execute and sync at first */
9859 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9860 /* check docking HP jack */
9861 present |= snd_hda_codec_read(codec, 0x1b, 0,
9862 AC_VERB_GET_PIN_SENSE, 0);
9863 if (present & AC_PINSENSE_PRESENCE)
9864 spec->jack_present = 1;
9866 spec->jack_present = 0;
9867 spec->sense_updated = 1;
9869 /* unmute internal speaker only if both HPs are unplugged and
9870 * master switch is on
9872 if (spec->jack_present)
9873 mute = HDA_AMP_MUTE;
9875 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9876 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9877 HDA_AMP_MUTE, mute);
9880 /* unsolicited event for HP jack sensing */
9881 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9884 if ((res >> 26) != ALC_HP_EVENT)
9886 alc262_fujitsu_automute(codec, 1);
9889 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9891 alc262_fujitsu_automute(codec, 1);
9894 /* bind volumes of both NID 0x0c and 0x0d */
9895 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9896 .ops = &snd_hda_bind_vol,
9898 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9899 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9904 /* mute/unmute internal speaker according to the hp jack and mute state */
9905 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9907 struct alc_spec *spec = codec->spec;
9910 if (force || !spec->sense_updated) {
9911 unsigned int present_int_hp;
9912 /* need to execute and sync at first */
9913 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9914 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9915 AC_VERB_GET_PIN_SENSE, 0);
9916 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9917 spec->sense_updated = 1;
9919 if (spec->jack_present) {
9920 /* mute internal speaker */
9921 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9922 HDA_AMP_MUTE, HDA_AMP_MUTE);
9923 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9924 HDA_AMP_MUTE, HDA_AMP_MUTE);
9926 /* unmute internal speaker if necessary */
9927 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9928 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9929 HDA_AMP_MUTE, mute);
9930 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9931 HDA_AMP_MUTE, mute);
9935 /* unsolicited event for HP jack sensing */
9936 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9939 if ((res >> 26) != ALC_HP_EVENT)
9941 alc262_lenovo_3000_automute(codec, 1);
9944 /* bind hp and internal speaker mute (with plug check) */
9945 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9946 struct snd_ctl_elem_value *ucontrol)
9948 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9949 long *valp = ucontrol->value.integer.value;
9952 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9954 valp ? 0 : HDA_AMP_MUTE);
9955 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9957 valp ? 0 : HDA_AMP_MUTE);
9960 alc262_fujitsu_automute(codec, 0);
9964 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9965 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9967 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9968 .name = "Master Playback Switch",
9969 .info = snd_hda_mixer_amp_switch_info,
9970 .get = snd_hda_mixer_amp_switch_get,
9971 .put = alc262_fujitsu_master_sw_put,
9972 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9974 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9975 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9976 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9977 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9978 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9981 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9982 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9983 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9987 /* bind hp and internal speaker mute (with plug check) */
9988 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9989 struct snd_ctl_elem_value *ucontrol)
9991 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9992 long *valp = ucontrol->value.integer.value;
9995 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9997 valp ? 0 : HDA_AMP_MUTE);
10000 alc262_lenovo_3000_automute(codec, 0);
10004 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10005 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10007 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10008 .name = "Master Playback Switch",
10009 .info = snd_hda_mixer_amp_switch_info,
10010 .get = snd_hda_mixer_amp_switch_get,
10011 .put = alc262_lenovo_3000_master_sw_put,
10012 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10014 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10015 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10016 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10019 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10020 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10021 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10025 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10026 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10029 .name = "Master Playback Switch",
10030 .info = snd_hda_mixer_amp_switch_info,
10031 .get = snd_hda_mixer_amp_switch_get,
10032 .put = alc262_sony_master_sw_put,
10033 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10037 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10038 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10039 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10040 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10044 /* additional init verbs for Benq laptops */
10045 static struct hda_verb alc262_EAPD_verbs[] = {
10046 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10047 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10051 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10052 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10053 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10055 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10056 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10060 /* Samsung Q1 Ultra Vista model setup */
10061 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10062 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10063 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10066 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10067 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10071 static struct hda_verb alc262_ultra_verbs[] = {
10073 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10078 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10079 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10080 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10082 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10084 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10085 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10086 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10088 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10090 /* ADC, choose mic */
10091 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10092 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10093 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10094 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10095 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10097 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10098 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10100 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10104 /* mute/unmute internal speaker according to the hp jack and mute state */
10105 static void alc262_ultra_automute(struct hda_codec *codec)
10107 struct alc_spec *spec = codec->spec;
10111 /* auto-mute only when HP is used as HP */
10112 if (!spec->cur_mux[0]) {
10113 unsigned int present;
10114 /* need to execute and sync at first */
10115 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10116 present = snd_hda_codec_read(codec, 0x15, 0,
10117 AC_VERB_GET_PIN_SENSE, 0);
10118 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10119 if (spec->jack_present)
10120 mute = HDA_AMP_MUTE;
10122 /* mute/unmute internal speaker */
10123 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10124 HDA_AMP_MUTE, mute);
10125 /* mute/unmute HP */
10126 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10127 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10130 /* unsolicited event for HP jack sensing */
10131 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10134 if ((res >> 26) != ALC880_HP_EVENT)
10136 alc262_ultra_automute(codec);
10139 static struct hda_input_mux alc262_ultra_capture_source = {
10143 { "Headphone", 0x7 },
10147 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10148 struct snd_ctl_elem_value *ucontrol)
10150 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10151 struct alc_spec *spec = codec->spec;
10154 ret = alc_mux_enum_put(kcontrol, ucontrol);
10157 /* reprogram the HP pin as mic or HP according to the input source */
10158 snd_hda_codec_write_cache(codec, 0x15, 0,
10159 AC_VERB_SET_PIN_WIDGET_CONTROL,
10160 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10161 alc262_ultra_automute(codec); /* mute/unmute HP */
10165 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10166 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10167 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10169 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10170 .name = "Capture Source",
10171 .info = alc_mux_enum_info,
10172 .get = alc_mux_enum_get,
10173 .put = alc262_ultra_mux_enum_put,
10178 /* add playback controls from the parsed DAC table */
10179 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10180 const struct auto_pin_cfg *cfg)
10185 spec->multiout.num_dacs = 1; /* only use one dac */
10186 spec->multiout.dac_nids = spec->private_dac_nids;
10187 spec->multiout.dac_nids[0] = 2;
10189 nid = cfg->line_out_pins[0];
10191 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10192 "Front Playback Volume",
10193 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10196 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10197 "Front Playback Switch",
10198 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10203 nid = cfg->speaker_pins[0];
10206 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10207 "Speaker Playback Volume",
10208 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10212 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10213 "Speaker Playback Switch",
10214 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10219 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10220 "Speaker Playback Switch",
10221 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10227 nid = cfg->hp_pins[0];
10229 /* spec->multiout.hp_nid = 2; */
10231 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10232 "Headphone Playback Volume",
10233 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10237 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10238 "Headphone Playback Switch",
10239 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10244 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10245 "Headphone Playback Switch",
10246 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10255 /* identical with ALC880 */
10256 #define alc262_auto_create_analog_input_ctls \
10257 alc880_auto_create_analog_input_ctls
10260 * generic initialization of ADC, input mixers and output mixers
10262 static struct hda_verb alc262_volume_init_verbs[] = {
10264 * Unmute ADC0-2 and set the default input to mic-in
10266 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10268 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10269 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10270 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10273 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10275 * Note: PASD motherboards uses the Line In 2 as the input for
10276 * front panel mic (mic 2)
10278 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10280 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10286 * Set up output mixers (0x0c - 0x0f)
10288 /* set vol=0 to output mixers */
10289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10290 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10291 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10293 /* set up input amps for analog loopback */
10294 /* Amp Indices: DAC = 0, mixer = 1 */
10295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10302 /* FIXME: use matrix-type input source selection */
10303 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10304 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10307 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10308 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10312 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10313 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10323 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10325 * Unmute ADC0-2 and set the default input to mic-in
10327 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10329 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10330 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10331 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10332 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10334 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10336 * Note: PASD motherboards uses the Line In 2 as the input for
10337 * front panel mic (mic 2)
10339 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10349 * Set up output mixers (0x0c - 0x0e)
10351 /* set vol=0 to output mixers */
10352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10356 /* set up input amps for analog loopback */
10357 /* Amp Indices: DAC = 0, mixer = 1 */
10358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10362 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10363 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10367 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10369 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10370 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10372 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10373 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10377 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10378 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10379 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10381 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10382 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10383 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10384 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10385 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10386 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10389 /* FIXME: use matrix-type input source selection */
10390 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10391 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10407 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10412 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10414 * Unmute ADC0-2 and set the default input to mic-in
10416 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10418 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10419 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10420 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10421 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10423 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10425 * Note: PASD motherboards uses the Line In 2 as the input for front
10426 * panel mic (mic 2)
10428 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10429 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10430 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10431 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10432 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10433 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10434 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10438 * Set up output mixers (0x0c - 0x0e)
10440 /* set vol=0 to output mixers */
10441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10442 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10443 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10445 /* set up input amps for analog loopback */
10446 /* Amp Indices: DAC = 0, mixer = 1 */
10447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10451 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10452 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10456 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10457 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10458 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10459 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10460 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10461 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10463 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10464 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10466 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10467 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10469 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10470 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10471 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10472 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10473 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10474 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10476 /* FIXME: use matrix-type input source selection */
10477 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10478 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10480 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10482 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10483 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10484 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10485 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10492 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10497 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10498 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10499 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10500 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10503 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10508 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10512 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10514 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10515 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10516 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10517 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10521 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10526 #ifdef CONFIG_SND_HDA_POWER_SAVE
10527 #define alc262_loopbacks alc880_loopbacks
10530 /* pcm configuration: identiacal with ALC880 */
10531 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10532 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10533 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10534 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10537 * BIOS auto configuration
10539 static int alc262_parse_auto_config(struct hda_codec *codec)
10541 struct alc_spec *spec = codec->spec;
10543 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10545 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10549 if (!spec->autocfg.line_outs) {
10550 if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) {
10551 spec->multiout.max_channels = 2;
10552 spec->no_analog = 1;
10555 return 0; /* can't find valid BIOS pin config */
10557 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10560 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10564 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10567 if (spec->autocfg.dig_out_pin) {
10568 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10569 spec->dig_out_type = spec->autocfg.dig_out_type;
10571 if (spec->autocfg.dig_in_pin)
10572 spec->dig_in_nid = ALC262_DIGIN_NID;
10574 if (spec->kctls.list)
10575 add_mixer(spec, spec->kctls.list);
10577 add_verb(spec, alc262_volume_init_verbs);
10578 spec->num_mux_defs = 1;
10579 spec->input_mux = &spec->private_imux[0];
10581 err = alc_auto_add_mic_boost(codec);
10585 store_pin_configs(codec);
10589 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10590 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10591 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10592 #define alc262_auto_init_input_src alc882_auto_init_input_src
10595 /* init callback for auto-configuration model -- overriding the default init */
10596 static void alc262_auto_init(struct hda_codec *codec)
10598 struct alc_spec *spec = codec->spec;
10599 alc262_auto_init_multi_out(codec);
10600 alc262_auto_init_hp_out(codec);
10601 alc262_auto_init_analog_input(codec);
10602 alc262_auto_init_input_src(codec);
10603 if (spec->unsol_event)
10604 alc_inithook(codec);
10608 * configuration and preset
10610 static const char *alc262_models[ALC262_MODEL_LAST] = {
10611 [ALC262_BASIC] = "basic",
10612 [ALC262_HIPPO] = "hippo",
10613 [ALC262_HIPPO_1] = "hippo_1",
10614 [ALC262_FUJITSU] = "fujitsu",
10615 [ALC262_HP_BPC] = "hp-bpc",
10616 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10617 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10618 [ALC262_HP_RP5700] = "hp-rp5700",
10619 [ALC262_BENQ_ED8] = "benq",
10620 [ALC262_BENQ_T31] = "benq-t31",
10621 [ALC262_SONY_ASSAMD] = "sony-assamd",
10622 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10623 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10624 [ALC262_ULTRA] = "ultra",
10625 [ALC262_LENOVO_3000] = "lenovo-3000",
10626 [ALC262_NEC] = "nec",
10627 [ALC262_AUTO] = "auto",
10630 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10631 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10632 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10633 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10634 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10635 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10636 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10637 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10638 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10639 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10640 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10641 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10642 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10643 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10644 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10645 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10646 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10647 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10648 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10649 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10650 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10651 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10652 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10653 ALC262_HP_TC_T5735),
10654 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10655 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10656 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10657 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10658 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10659 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10660 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10661 ALC262_SONY_ASSAMD),
10662 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10663 ALC262_TOSHIBA_RX1),
10664 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10665 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10666 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10667 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10668 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10669 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10670 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10671 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10672 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10673 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10677 static struct alc_config_preset alc262_presets[] = {
10679 .mixers = { alc262_base_mixer },
10680 .init_verbs = { alc262_init_verbs },
10681 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10682 .dac_nids = alc262_dac_nids,
10684 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10685 .channel_mode = alc262_modes,
10686 .input_mux = &alc262_capture_source,
10689 .mixers = { alc262_base_mixer },
10690 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10691 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10692 .dac_nids = alc262_dac_nids,
10694 .dig_out_nid = ALC262_DIGOUT_NID,
10695 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10696 .channel_mode = alc262_modes,
10697 .input_mux = &alc262_capture_source,
10698 .unsol_event = alc262_hippo_unsol_event,
10699 .init_hook = alc262_hippo_automute,
10701 [ALC262_HIPPO_1] = {
10702 .mixers = { alc262_hippo1_mixer },
10703 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10704 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10705 .dac_nids = alc262_dac_nids,
10707 .dig_out_nid = ALC262_DIGOUT_NID,
10708 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10709 .channel_mode = alc262_modes,
10710 .input_mux = &alc262_capture_source,
10711 .unsol_event = alc262_hippo1_unsol_event,
10712 .init_hook = alc262_hippo1_automute,
10714 [ALC262_FUJITSU] = {
10715 .mixers = { alc262_fujitsu_mixer },
10716 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10717 alc262_fujitsu_unsol_verbs },
10718 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10719 .dac_nids = alc262_dac_nids,
10721 .dig_out_nid = ALC262_DIGOUT_NID,
10722 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10723 .channel_mode = alc262_modes,
10724 .input_mux = &alc262_fujitsu_capture_source,
10725 .unsol_event = alc262_fujitsu_unsol_event,
10726 .init_hook = alc262_fujitsu_init_hook,
10728 [ALC262_HP_BPC] = {
10729 .mixers = { alc262_HP_BPC_mixer },
10730 .init_verbs = { alc262_HP_BPC_init_verbs },
10731 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10732 .dac_nids = alc262_dac_nids,
10734 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10735 .channel_mode = alc262_modes,
10736 .input_mux = &alc262_HP_capture_source,
10737 .unsol_event = alc262_hp_bpc_unsol_event,
10738 .init_hook = alc262_hp_bpc_automute,
10740 [ALC262_HP_BPC_D7000_WF] = {
10741 .mixers = { alc262_HP_BPC_WildWest_mixer },
10742 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10743 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10744 .dac_nids = alc262_dac_nids,
10746 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10747 .channel_mode = alc262_modes,
10748 .input_mux = &alc262_HP_D7000_capture_source,
10749 .unsol_event = alc262_hp_wildwest_unsol_event,
10750 .init_hook = alc262_hp_wildwest_automute,
10752 [ALC262_HP_BPC_D7000_WL] = {
10753 .mixers = { alc262_HP_BPC_WildWest_mixer,
10754 alc262_HP_BPC_WildWest_option_mixer },
10755 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10756 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10757 .dac_nids = alc262_dac_nids,
10759 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10760 .channel_mode = alc262_modes,
10761 .input_mux = &alc262_HP_D7000_capture_source,
10762 .unsol_event = alc262_hp_wildwest_unsol_event,
10763 .init_hook = alc262_hp_wildwest_automute,
10765 [ALC262_HP_TC_T5735] = {
10766 .mixers = { alc262_hp_t5735_mixer },
10767 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10768 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10769 .dac_nids = alc262_dac_nids,
10771 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10772 .channel_mode = alc262_modes,
10773 .input_mux = &alc262_capture_source,
10774 .unsol_event = alc262_hp_t5735_unsol_event,
10775 .init_hook = alc262_hp_t5735_init_hook,
10777 [ALC262_HP_RP5700] = {
10778 .mixers = { alc262_hp_rp5700_mixer },
10779 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10780 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10781 .dac_nids = alc262_dac_nids,
10782 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10783 .channel_mode = alc262_modes,
10784 .input_mux = &alc262_hp_rp5700_capture_source,
10786 [ALC262_BENQ_ED8] = {
10787 .mixers = { alc262_base_mixer },
10788 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10789 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10790 .dac_nids = alc262_dac_nids,
10792 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10793 .channel_mode = alc262_modes,
10794 .input_mux = &alc262_capture_source,
10796 [ALC262_SONY_ASSAMD] = {
10797 .mixers = { alc262_sony_mixer },
10798 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10799 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10800 .dac_nids = alc262_dac_nids,
10802 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10803 .channel_mode = alc262_modes,
10804 .input_mux = &alc262_capture_source,
10805 .unsol_event = alc262_hippo_unsol_event,
10806 .init_hook = alc262_hippo_automute,
10808 [ALC262_BENQ_T31] = {
10809 .mixers = { alc262_benq_t31_mixer },
10810 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10811 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10812 .dac_nids = alc262_dac_nids,
10814 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10815 .channel_mode = alc262_modes,
10816 .input_mux = &alc262_capture_source,
10817 .unsol_event = alc262_hippo_unsol_event,
10818 .init_hook = alc262_hippo_automute,
10821 .mixers = { alc262_ultra_mixer },
10822 .cap_mixer = alc262_ultra_capture_mixer,
10823 .init_verbs = { alc262_ultra_verbs },
10824 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10825 .dac_nids = alc262_dac_nids,
10826 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10827 .channel_mode = alc262_modes,
10828 .input_mux = &alc262_ultra_capture_source,
10829 .adc_nids = alc262_adc_nids, /* ADC0 */
10830 .capsrc_nids = alc262_capsrc_nids,
10831 .num_adc_nids = 1, /* single ADC */
10832 .unsol_event = alc262_ultra_unsol_event,
10833 .init_hook = alc262_ultra_automute,
10835 [ALC262_LENOVO_3000] = {
10836 .mixers = { alc262_lenovo_3000_mixer },
10837 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10838 alc262_lenovo_3000_unsol_verbs },
10839 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10840 .dac_nids = alc262_dac_nids,
10842 .dig_out_nid = ALC262_DIGOUT_NID,
10843 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10844 .channel_mode = alc262_modes,
10845 .input_mux = &alc262_fujitsu_capture_source,
10846 .unsol_event = alc262_lenovo_3000_unsol_event,
10849 .mixers = { alc262_nec_mixer },
10850 .init_verbs = { alc262_nec_verbs },
10851 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10852 .dac_nids = alc262_dac_nids,
10854 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10855 .channel_mode = alc262_modes,
10856 .input_mux = &alc262_capture_source,
10858 [ALC262_TOSHIBA_S06] = {
10859 .mixers = { alc262_toshiba_s06_mixer },
10860 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10861 alc262_eapd_verbs },
10862 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10863 .capsrc_nids = alc262_dmic_capsrc_nids,
10864 .dac_nids = alc262_dac_nids,
10865 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10866 .dig_out_nid = ALC262_DIGOUT_NID,
10867 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10868 .channel_mode = alc262_modes,
10869 .input_mux = &alc262_dmic_capture_source,
10870 .unsol_event = alc262_toshiba_s06_unsol_event,
10871 .init_hook = alc262_toshiba_s06_init_hook,
10873 [ALC262_TOSHIBA_RX1] = {
10874 .mixers = { alc262_toshiba_rx1_mixer },
10875 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10876 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10877 .dac_nids = alc262_dac_nids,
10879 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10880 .channel_mode = alc262_modes,
10881 .input_mux = &alc262_capture_source,
10882 .unsol_event = alc262_hippo_unsol_event,
10883 .init_hook = alc262_hippo_automute,
10887 static int patch_alc262(struct hda_codec *codec)
10889 struct alc_spec *spec;
10893 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10897 codec->spec = spec;
10899 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10904 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10905 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10906 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10907 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10911 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10913 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10917 if (board_config < 0) {
10918 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10919 "trying auto-probe from BIOS...\n");
10920 board_config = ALC262_AUTO;
10923 if (board_config == ALC262_AUTO) {
10924 /* automatic parse from the BIOS config */
10925 err = alc262_parse_auto_config(codec);
10931 "hda_codec: Cannot set up configuration "
10932 "from BIOS. Using base mode...\n");
10933 board_config = ALC262_BASIC;
10937 if (board_config != ALC262_AUTO)
10938 setup_preset(spec, &alc262_presets[board_config]);
10940 spec->stream_name_analog = "ALC262 Analog";
10941 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10942 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10944 spec->stream_name_digital = "ALC262 Digital";
10945 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10946 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10948 spec->capture_style = CAPT_MIX;
10949 if (!spec->adc_nids && spec->input_mux) {
10950 /* check whether NID 0x07 is valid */
10951 unsigned int wcap = get_wcaps(codec, 0x07);
10954 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10955 if (wcap != AC_WID_AUD_IN) {
10956 spec->adc_nids = alc262_adc_nids_alt;
10957 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10958 spec->capsrc_nids = alc262_capsrc_nids_alt;
10960 spec->adc_nids = alc262_adc_nids;
10961 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10962 spec->capsrc_nids = alc262_capsrc_nids;
10965 if (!spec->cap_mixer && !spec->no_analog)
10966 set_capture_mixer(spec);
10968 spec->vmaster_nid = 0x0c;
10970 codec->patch_ops = alc_patch_ops;
10971 if (board_config == ALC262_AUTO)
10972 spec->init_hook = alc262_auto_init;
10973 #ifdef CONFIG_SND_HDA_POWER_SAVE
10974 if (!spec->loopback.amplist)
10975 spec->loopback.amplist = alc262_loopbacks;
10977 codec->proc_widget_hook = print_realtek_coef;
10983 * ALC268 channel source setting (2 channel)
10985 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10986 #define alc268_modes alc260_modes
10988 static hda_nid_t alc268_dac_nids[2] = {
10993 static hda_nid_t alc268_adc_nids[2] = {
10998 static hda_nid_t alc268_adc_nids_alt[1] = {
11003 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11005 static struct snd_kcontrol_new alc268_base_mixer[] = {
11006 /* output mixer control */
11007 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11008 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11009 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11012 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11013 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11017 /* bind Beep switches of both NID 0x0f and 0x10 */
11018 static struct hda_bind_ctls alc268_bind_beep_sw = {
11019 .ops = &snd_hda_bind_sw,
11021 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11022 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11027 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11028 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11029 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11033 static struct hda_verb alc268_eapd_verbs[] = {
11034 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11035 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11039 /* Toshiba specific */
11040 #define alc268_toshiba_automute alc262_hippo_automute
11042 static struct hda_verb alc268_toshiba_verbs[] = {
11043 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11047 static struct hda_input_mux alc268_acer_lc_capture_source = {
11055 /* Acer specific */
11056 /* bind volumes of both NID 0x02 and 0x03 */
11057 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11058 .ops = &snd_hda_bind_vol,
11060 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11061 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11066 /* mute/unmute internal speaker according to the hp jack and mute state */
11067 static void alc268_acer_automute(struct hda_codec *codec, int force)
11069 struct alc_spec *spec = codec->spec;
11072 if (force || !spec->sense_updated) {
11073 unsigned int present;
11074 present = snd_hda_codec_read(codec, 0x14, 0,
11075 AC_VERB_GET_PIN_SENSE, 0);
11076 spec->jack_present = (present & 0x80000000) != 0;
11077 spec->sense_updated = 1;
11079 if (spec->jack_present)
11080 mute = HDA_AMP_MUTE; /* mute internal speaker */
11081 else /* unmute internal speaker if necessary */
11082 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11083 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11084 HDA_AMP_MUTE, mute);
11088 /* bind hp and internal speaker mute (with plug check) */
11089 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11090 struct snd_ctl_elem_value *ucontrol)
11092 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11093 long *valp = ucontrol->value.integer.value;
11096 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11098 valp[0] ? 0 : HDA_AMP_MUTE);
11099 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11101 valp[1] ? 0 : HDA_AMP_MUTE);
11103 alc268_acer_automute(codec, 0);
11107 static struct snd_kcontrol_new alc268_acer_aspire_one_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 Capture Volume", 0x18, 0, HDA_INPUT),
11122 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11123 /* output mixer control */
11124 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11126 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11127 .name = "Master Playback Switch",
11128 .info = snd_hda_mixer_amp_switch_info,
11129 .get = snd_hda_mixer_amp_switch_get,
11130 .put = alc268_acer_master_sw_put,
11131 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11133 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11134 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11135 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11139 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11140 /* output mixer control */
11141 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11143 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11144 .name = "Master Playback Switch",
11145 .info = snd_hda_mixer_amp_switch_info,
11146 .get = snd_hda_mixer_amp_switch_get,
11147 .put = alc268_acer_master_sw_put,
11148 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11150 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11151 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11155 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11156 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11158 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11159 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11160 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11161 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11165 static struct hda_verb alc268_acer_verbs[] = {
11166 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11167 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11168 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11170 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11171 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11172 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11176 /* unsolicited event for HP jack sensing */
11177 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11180 if ((res >> 26) != ALC880_HP_EVENT)
11182 alc268_toshiba_automute(codec);
11185 static void alc268_acer_unsol_event(struct hda_codec *codec,
11188 if ((res >> 26) != ALC880_HP_EVENT)
11190 alc268_acer_automute(codec, 1);
11193 static void alc268_acer_init_hook(struct hda_codec *codec)
11195 alc268_acer_automute(codec, 1);
11198 /* toggle speaker-output according to the hp-jack state */
11199 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11201 unsigned int present;
11202 unsigned char bits;
11204 present = snd_hda_codec_read(codec, 0x15, 0,
11205 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11206 bits = present ? AMP_IN_MUTE(0) : 0;
11207 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11208 AMP_IN_MUTE(0), bits);
11209 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11210 AMP_IN_MUTE(0), bits);
11214 static void alc268_acer_mic_automute(struct hda_codec *codec)
11216 unsigned int present;
11218 present = snd_hda_codec_read(codec, 0x18, 0,
11219 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11220 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11221 present ? 0x0 : 0x6);
11224 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11227 if ((res >> 26) == ALC880_HP_EVENT)
11228 alc268_aspire_one_speaker_automute(codec);
11229 if ((res >> 26) == ALC880_MIC_EVENT)
11230 alc268_acer_mic_automute(codec);
11233 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11235 alc268_aspire_one_speaker_automute(codec);
11236 alc268_acer_mic_automute(codec);
11239 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11240 /* output mixer control */
11241 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11242 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11243 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11245 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11246 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11250 static struct hda_verb alc268_dell_verbs[] = {
11251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11257 /* mute/unmute internal speaker according to the hp jack and mute state */
11258 static void alc268_dell_automute(struct hda_codec *codec)
11260 unsigned int present;
11263 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11264 if (present & 0x80000000)
11265 mute = HDA_AMP_MUTE;
11267 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11268 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11269 HDA_AMP_MUTE, mute);
11272 static void alc268_dell_unsol_event(struct hda_codec *codec,
11275 if ((res >> 26) != ALC880_HP_EVENT)
11277 alc268_dell_automute(codec);
11280 #define alc268_dell_init_hook alc268_dell_automute
11282 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11283 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11284 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11285 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11286 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11287 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11288 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11289 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11290 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11294 static struct hda_verb alc267_quanta_il1_verbs[] = {
11295 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11296 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11300 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11302 unsigned int present;
11304 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11305 & AC_PINSENSE_PRESENCE;
11306 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11307 present ? 0 : PIN_OUT);
11310 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11312 unsigned int present;
11314 present = snd_hda_codec_read(codec, 0x18, 0,
11315 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11316 snd_hda_codec_write(codec, 0x23, 0,
11317 AC_VERB_SET_CONNECT_SEL,
11318 present ? 0x00 : 0x01);
11321 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11323 alc267_quanta_il1_hp_automute(codec);
11324 alc267_quanta_il1_mic_automute(codec);
11327 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11330 switch (res >> 26) {
11331 case ALC880_HP_EVENT:
11332 alc267_quanta_il1_hp_automute(codec);
11334 case ALC880_MIC_EVENT:
11335 alc267_quanta_il1_mic_automute(codec);
11341 * generic initialization of ADC, input mixers and output mixers
11343 static struct hda_verb alc268_base_init_verbs[] = {
11344 /* Unmute DAC0-1 and set vol = 0 */
11345 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11346 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11349 * Set up output mixers (0x0c - 0x0e)
11351 /* set vol=0 to output mixers */
11352 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11353 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11355 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11356 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11360 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11361 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11362 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11363 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11364 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11365 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11367 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11369 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11370 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11371 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11373 /* set PCBEEP vol = 0, mute connections */
11374 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11375 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11376 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11378 /* Unmute Selector 23h,24h and set the default input to mic-in */
11380 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11382 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11389 * generic initialization of ADC, input mixers and output mixers
11391 static struct hda_verb alc268_volume_init_verbs[] = {
11392 /* set output DAC */
11393 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11394 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11396 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11397 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11398 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11399 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11400 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11402 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11403 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11404 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11409 /* set PCBEEP vol = 0, mute connections */
11410 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11412 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11417 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11418 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11419 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11422 /* The multiple "Capture Source" controls confuse alsamixer
11423 * So call somewhat different..
11425 /* .name = "Capture Source", */
11426 .name = "Input Source",
11428 .info = alc_mux_enum_info,
11429 .get = alc_mux_enum_get,
11430 .put = alc_mux_enum_put,
11435 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11436 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11437 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11438 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11439 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11441 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11442 /* The multiple "Capture Source" controls confuse alsamixer
11443 * So call somewhat different..
11445 /* .name = "Capture Source", */
11446 .name = "Input Source",
11448 .info = alc_mux_enum_info,
11449 .get = alc_mux_enum_get,
11450 .put = alc_mux_enum_put,
11455 static struct hda_input_mux alc268_capture_source = {
11459 { "Front Mic", 0x1 },
11465 static struct hda_input_mux alc268_acer_capture_source = {
11469 { "Internal Mic", 0x1 },
11474 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11478 { "Internal Mic", 0x6 },
11483 #ifdef CONFIG_SND_DEBUG
11484 static struct snd_kcontrol_new alc268_test_mixer[] = {
11485 /* Volume widgets */
11486 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11487 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11488 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11489 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11490 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11491 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11492 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11493 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11494 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11495 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11496 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11497 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11498 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11499 /* The below appears problematic on some hardwares */
11500 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11501 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11502 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11503 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11504 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11506 /* Modes for retasking pin widgets */
11507 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11508 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11509 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11510 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11512 /* Controls for GPIO pins, assuming they are configured as outputs */
11513 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11514 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11515 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11516 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11518 /* Switches to allow the digital SPDIF output pin to be enabled.
11519 * The ALC268 does not have an SPDIF input.
11521 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11523 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11524 * this output to turn on an external amplifier.
11526 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11527 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11533 /* create input playback/capture controls for the given pin */
11534 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11535 const char *ctlname, int idx)
11540 sprintf(name, "%s Playback Volume", ctlname);
11542 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11543 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11547 } else if (nid == 0x15) {
11548 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11549 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11555 sprintf(name, "%s Playback Switch", ctlname);
11556 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11557 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11563 /* add playback controls from the parsed DAC table */
11564 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11565 const struct auto_pin_cfg *cfg)
11570 spec->multiout.num_dacs = 2; /* only use one dac */
11571 spec->multiout.dac_nids = spec->private_dac_nids;
11572 spec->multiout.dac_nids[0] = 2;
11573 spec->multiout.dac_nids[1] = 3;
11575 nid = cfg->line_out_pins[0];
11577 alc268_new_analog_output(spec, nid, "Front", 0);
11579 nid = cfg->speaker_pins[0];
11581 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11582 "Speaker Playback Volume",
11583 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11587 nid = cfg->hp_pins[0];
11589 alc268_new_analog_output(spec, nid, "Headphone", 0);
11591 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11593 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11594 "Mono Playback Switch",
11595 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11602 /* create playback/capture controls for input pins */
11603 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11604 const struct auto_pin_cfg *cfg)
11606 struct hda_input_mux *imux = &spec->private_imux[0];
11609 for (i = 0; i < AUTO_PIN_LAST; i++) {
11610 switch(cfg->input_pins[i]) {
11612 idx1 = 0; /* Mic 1 */
11615 idx1 = 1; /* Mic 2 */
11618 idx1 = 2; /* Line In */
11625 idx1 = 6; /* digital mics */
11630 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11631 imux->items[imux->num_items].index = idx1;
11637 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11639 struct alc_spec *spec = codec->spec;
11640 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11641 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11642 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11643 unsigned int dac_vol1, dac_vol2;
11646 snd_hda_codec_write(codec, speaker_nid, 0,
11647 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11648 snd_hda_codec_write(codec, 0x0f, 0,
11649 AC_VERB_SET_AMP_GAIN_MUTE,
11651 snd_hda_codec_write(codec, 0x10, 0,
11652 AC_VERB_SET_AMP_GAIN_MUTE,
11655 snd_hda_codec_write(codec, 0x0f, 0,
11656 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11657 snd_hda_codec_write(codec, 0x10, 0,
11658 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11661 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11662 if (line_nid == 0x14)
11663 dac_vol2 = AMP_OUT_ZERO;
11664 else if (line_nid == 0x15)
11665 dac_vol1 = AMP_OUT_ZERO;
11666 if (hp_nid == 0x14)
11667 dac_vol2 = AMP_OUT_ZERO;
11668 else if (hp_nid == 0x15)
11669 dac_vol1 = AMP_OUT_ZERO;
11670 if (line_nid != 0x16 || hp_nid != 0x16 ||
11671 spec->autocfg.line_out_pins[1] != 0x16 ||
11672 spec->autocfg.line_out_pins[2] != 0x16)
11673 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11675 snd_hda_codec_write(codec, 0x02, 0,
11676 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11677 snd_hda_codec_write(codec, 0x03, 0,
11678 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11681 /* pcm configuration: identiacal with ALC880 */
11682 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11683 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11684 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11685 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11688 * BIOS auto configuration
11690 static int alc268_parse_auto_config(struct hda_codec *codec)
11692 struct alc_spec *spec = codec->spec;
11694 static hda_nid_t alc268_ignore[] = { 0 };
11696 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11700 if (!spec->autocfg.line_outs)
11701 return 0; /* can't find valid BIOS pin config */
11703 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11706 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11710 spec->multiout.max_channels = 2;
11712 /* digital only support output */
11713 if (spec->autocfg.dig_out_pin)
11714 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11716 if (spec->kctls.list)
11717 add_mixer(spec, spec->kctls.list);
11719 if (spec->autocfg.speaker_pins[0] != 0x1d)
11720 add_mixer(spec, alc268_beep_mixer);
11722 add_verb(spec, alc268_volume_init_verbs);
11723 spec->num_mux_defs = 1;
11724 spec->input_mux = &spec->private_imux[0];
11726 err = alc_auto_add_mic_boost(codec);
11730 store_pin_configs(codec);
11734 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11735 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11736 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11738 /* init callback for auto-configuration model -- overriding the default init */
11739 static void alc268_auto_init(struct hda_codec *codec)
11741 struct alc_spec *spec = codec->spec;
11742 alc268_auto_init_multi_out(codec);
11743 alc268_auto_init_hp_out(codec);
11744 alc268_auto_init_mono_speaker_out(codec);
11745 alc268_auto_init_analog_input(codec);
11746 if (spec->unsol_event)
11747 alc_inithook(codec);
11751 * configuration and preset
11753 static const char *alc268_models[ALC268_MODEL_LAST] = {
11754 [ALC267_QUANTA_IL1] = "quanta-il1",
11755 [ALC268_3ST] = "3stack",
11756 [ALC268_TOSHIBA] = "toshiba",
11757 [ALC268_ACER] = "acer",
11758 [ALC268_ACER_DMIC] = "acer-dmic",
11759 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11760 [ALC268_DELL] = "dell",
11761 [ALC268_ZEPTO] = "zepto",
11762 #ifdef CONFIG_SND_DEBUG
11763 [ALC268_TEST] = "test",
11765 [ALC268_AUTO] = "auto",
11768 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11769 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11770 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11771 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11772 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11773 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11774 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11775 ALC268_ACER_ASPIRE_ONE),
11776 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11777 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11778 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11779 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11780 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11781 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11782 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11783 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11784 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11785 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11786 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11790 static struct alc_config_preset alc268_presets[] = {
11791 [ALC267_QUANTA_IL1] = {
11792 .mixers = { alc267_quanta_il1_mixer },
11793 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11794 alc267_quanta_il1_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,
11800 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11801 .channel_mode = alc268_modes,
11802 .input_mux = &alc268_capture_source,
11803 .unsol_event = alc267_quanta_il1_unsol_event,
11804 .init_hook = alc267_quanta_il1_automute,
11807 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11808 alc268_beep_mixer },
11809 .init_verbs = { alc268_base_init_verbs },
11810 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11811 .dac_nids = alc268_dac_nids,
11812 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11813 .adc_nids = alc268_adc_nids_alt,
11814 .capsrc_nids = alc268_capsrc_nids,
11816 .dig_out_nid = ALC268_DIGOUT_NID,
11817 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11818 .channel_mode = alc268_modes,
11819 .input_mux = &alc268_capture_source,
11821 [ALC268_TOSHIBA] = {
11822 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11823 alc268_beep_mixer },
11824 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11825 alc268_toshiba_verbs },
11826 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11827 .dac_nids = alc268_dac_nids,
11828 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11829 .adc_nids = alc268_adc_nids_alt,
11830 .capsrc_nids = alc268_capsrc_nids,
11832 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11833 .channel_mode = alc268_modes,
11834 .input_mux = &alc268_capture_source,
11835 .unsol_event = alc268_toshiba_unsol_event,
11836 .init_hook = alc268_toshiba_automute,
11839 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11840 alc268_beep_mixer },
11841 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11842 alc268_acer_verbs },
11843 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11844 .dac_nids = alc268_dac_nids,
11845 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11846 .adc_nids = alc268_adc_nids_alt,
11847 .capsrc_nids = alc268_capsrc_nids,
11849 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11850 .channel_mode = alc268_modes,
11851 .input_mux = &alc268_acer_capture_source,
11852 .unsol_event = alc268_acer_unsol_event,
11853 .init_hook = alc268_acer_init_hook,
11855 [ALC268_ACER_DMIC] = {
11856 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11857 alc268_beep_mixer },
11858 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11859 alc268_acer_verbs },
11860 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11861 .dac_nids = alc268_dac_nids,
11862 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11863 .adc_nids = alc268_adc_nids_alt,
11864 .capsrc_nids = alc268_capsrc_nids,
11866 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11867 .channel_mode = alc268_modes,
11868 .input_mux = &alc268_acer_dmic_capture_source,
11869 .unsol_event = alc268_acer_unsol_event,
11870 .init_hook = alc268_acer_init_hook,
11872 [ALC268_ACER_ASPIRE_ONE] = {
11873 .mixers = { alc268_acer_aspire_one_mixer,
11874 alc268_capture_alt_mixer },
11875 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11876 alc268_acer_aspire_one_verbs },
11877 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11878 .dac_nids = alc268_dac_nids,
11879 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11880 .adc_nids = alc268_adc_nids_alt,
11881 .capsrc_nids = alc268_capsrc_nids,
11883 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11884 .channel_mode = alc268_modes,
11885 .input_mux = &alc268_acer_lc_capture_source,
11886 .unsol_event = alc268_acer_lc_unsol_event,
11887 .init_hook = alc268_acer_lc_init_hook,
11890 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11891 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11892 alc268_dell_verbs },
11893 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11894 .dac_nids = alc268_dac_nids,
11896 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11897 .channel_mode = alc268_modes,
11898 .unsol_event = alc268_dell_unsol_event,
11899 .init_hook = alc268_dell_init_hook,
11900 .input_mux = &alc268_capture_source,
11903 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11904 alc268_beep_mixer },
11905 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11906 alc268_toshiba_verbs },
11907 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11908 .dac_nids = alc268_dac_nids,
11909 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11910 .adc_nids = alc268_adc_nids_alt,
11911 .capsrc_nids = alc268_capsrc_nids,
11913 .dig_out_nid = ALC268_DIGOUT_NID,
11914 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11915 .channel_mode = alc268_modes,
11916 .input_mux = &alc268_capture_source,
11917 .unsol_event = alc268_toshiba_unsol_event,
11918 .init_hook = alc268_toshiba_automute
11920 #ifdef CONFIG_SND_DEBUG
11922 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11923 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11924 alc268_volume_init_verbs },
11925 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11926 .dac_nids = alc268_dac_nids,
11927 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11928 .adc_nids = alc268_adc_nids_alt,
11929 .capsrc_nids = alc268_capsrc_nids,
11931 .dig_out_nid = ALC268_DIGOUT_NID,
11932 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11933 .channel_mode = alc268_modes,
11934 .input_mux = &alc268_capture_source,
11939 static int patch_alc268(struct hda_codec *codec)
11941 struct alc_spec *spec;
11945 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11949 codec->spec = spec;
11951 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11955 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11956 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11957 "trying auto-probe from BIOS...\n");
11958 board_config = ALC268_AUTO;
11961 if (board_config == ALC268_AUTO) {
11962 /* automatic parse from the BIOS config */
11963 err = alc268_parse_auto_config(codec);
11969 "hda_codec: Cannot set up configuration "
11970 "from BIOS. Using base mode...\n");
11971 board_config = ALC268_3ST;
11975 if (board_config != ALC268_AUTO)
11976 setup_preset(spec, &alc268_presets[board_config]);
11978 if (codec->vendor_id == 0x10ec0267) {
11979 spec->stream_name_analog = "ALC267 Analog";
11980 spec->stream_name_digital = "ALC267 Digital";
11982 spec->stream_name_analog = "ALC268 Analog";
11983 spec->stream_name_digital = "ALC268 Digital";
11986 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11987 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11988 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11990 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11992 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11993 /* override the amp caps for beep generator */
11994 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11995 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11996 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11997 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11998 (0 << AC_AMPCAP_MUTE_SHIFT));
12000 if (!spec->adc_nids && spec->input_mux) {
12001 /* check whether NID 0x07 is valid */
12002 unsigned int wcap = get_wcaps(codec, 0x07);
12006 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12007 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12008 spec->adc_nids = alc268_adc_nids_alt;
12009 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12010 add_mixer(spec, alc268_capture_alt_mixer);
12012 spec->adc_nids = alc268_adc_nids;
12013 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12014 add_mixer(spec, alc268_capture_mixer);
12016 spec->capsrc_nids = alc268_capsrc_nids;
12017 /* set default input source */
12018 for (i = 0; i < spec->num_adc_nids; i++)
12019 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12020 0, AC_VERB_SET_CONNECT_SEL,
12021 spec->input_mux->items[0].index);
12024 spec->vmaster_nid = 0x02;
12026 codec->patch_ops = alc_patch_ops;
12027 if (board_config == ALC268_AUTO)
12028 spec->init_hook = alc268_auto_init;
12030 codec->proc_widget_hook = print_realtek_coef;
12036 * ALC269 channel source setting (2 channel)
12038 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12040 #define alc269_dac_nids alc260_dac_nids
12042 static hda_nid_t alc269_adc_nids[1] = {
12047 static hda_nid_t alc269_capsrc_nids[1] = {
12051 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12055 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12063 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12071 #define alc269_modes alc260_modes
12072 #define alc269_capture_source alc880_lg_lw_capture_source
12074 static struct snd_kcontrol_new alc269_base_mixer[] = {
12075 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12076 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12077 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12078 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12081 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12082 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12083 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12084 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12085 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12086 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12088 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12092 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12093 /* output mixer control */
12094 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12096 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12097 .name = "Master Playback Switch",
12098 .info = snd_hda_mixer_amp_switch_info,
12099 .get = snd_hda_mixer_amp_switch_get,
12100 .put = alc268_acer_master_sw_put,
12101 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12105 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12106 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12107 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12108 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12109 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12110 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12114 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12115 /* output mixer control */
12116 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12119 .name = "Master Playback Switch",
12120 .info = snd_hda_mixer_amp_switch_info,
12121 .get = snd_hda_mixer_amp_switch_get,
12122 .put = alc268_acer_master_sw_put,
12123 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12125 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12126 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12127 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12128 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12129 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12130 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12131 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12132 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12133 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12134 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12135 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12139 /* bind volumes of both NID 0x0c and 0x0d */
12140 static struct hda_bind_ctls alc269_epc_bind_vol = {
12141 .ops = &snd_hda_bind_vol,
12143 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12144 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12149 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12150 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12151 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12152 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12156 /* capture mixer elements */
12157 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12158 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12159 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12160 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12165 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12166 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12167 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12168 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12173 static struct snd_kcontrol_new alc269_beep_mixer[] = {
12174 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12175 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12179 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12180 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12181 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12183 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12184 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12185 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12189 static struct hda_verb alc269_lifebook_verbs[] = {
12190 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12191 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12192 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12193 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12194 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12195 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12196 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12197 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12198 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12199 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12203 /* toggle speaker-output according to the hp-jack state */
12204 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12206 unsigned int present;
12207 unsigned char bits;
12209 present = snd_hda_codec_read(codec, 0x15, 0,
12210 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12211 bits = present ? AMP_IN_MUTE(0) : 0;
12212 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12213 AMP_IN_MUTE(0), bits);
12214 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12215 AMP_IN_MUTE(0), bits);
12217 snd_hda_codec_write(codec, 0x20, 0,
12218 AC_VERB_SET_COEF_INDEX, 0x0c);
12219 snd_hda_codec_write(codec, 0x20, 0,
12220 AC_VERB_SET_PROC_COEF, 0x680);
12222 snd_hda_codec_write(codec, 0x20, 0,
12223 AC_VERB_SET_COEF_INDEX, 0x0c);
12224 snd_hda_codec_write(codec, 0x20, 0,
12225 AC_VERB_SET_PROC_COEF, 0x480);
12228 /* toggle speaker-output according to the hp-jacks state */
12229 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12231 unsigned int present;
12232 unsigned char bits;
12234 /* Check laptop headphone socket */
12235 present = snd_hda_codec_read(codec, 0x15, 0,
12236 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12238 /* Check port replicator headphone socket */
12239 present |= snd_hda_codec_read(codec, 0x1a, 0,
12240 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12242 bits = present ? AMP_IN_MUTE(0) : 0;
12243 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12244 AMP_IN_MUTE(0), bits);
12245 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12246 AMP_IN_MUTE(0), bits);
12248 snd_hda_codec_write(codec, 0x20, 0,
12249 AC_VERB_SET_COEF_INDEX, 0x0c);
12250 snd_hda_codec_write(codec, 0x20, 0,
12251 AC_VERB_SET_PROC_COEF, 0x680);
12253 snd_hda_codec_write(codec, 0x20, 0,
12254 AC_VERB_SET_COEF_INDEX, 0x0c);
12255 snd_hda_codec_write(codec, 0x20, 0,
12256 AC_VERB_SET_PROC_COEF, 0x480);
12259 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12261 unsigned int present;
12263 present = snd_hda_codec_read(codec, 0x18, 0,
12264 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12265 snd_hda_codec_write(codec, 0x23, 0,
12266 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12269 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12271 unsigned int present_laptop;
12272 unsigned int present_dock;
12274 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12275 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12277 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12278 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12280 /* Laptop mic port overrides dock mic port, design decision */
12282 snd_hda_codec_write(codec, 0x23, 0,
12283 AC_VERB_SET_CONNECT_SEL, 0x3);
12284 if (present_laptop)
12285 snd_hda_codec_write(codec, 0x23, 0,
12286 AC_VERB_SET_CONNECT_SEL, 0x0);
12287 if (!present_dock && !present_laptop)
12288 snd_hda_codec_write(codec, 0x23, 0,
12289 AC_VERB_SET_CONNECT_SEL, 0x1);
12292 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12295 if ((res >> 26) == ALC880_HP_EVENT)
12296 alc269_quanta_fl1_speaker_automute(codec);
12297 if ((res >> 26) == ALC880_MIC_EVENT)
12298 alc269_quanta_fl1_mic_automute(codec);
12301 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12304 if ((res >> 26) == ALC880_HP_EVENT)
12305 alc269_lifebook_speaker_automute(codec);
12306 if ((res >> 26) == ALC880_MIC_EVENT)
12307 alc269_lifebook_mic_autoswitch(codec);
12310 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12312 alc269_quanta_fl1_speaker_automute(codec);
12313 alc269_quanta_fl1_mic_automute(codec);
12316 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12318 alc269_lifebook_speaker_automute(codec);
12319 alc269_lifebook_mic_autoswitch(codec);
12322 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12323 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12324 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12325 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12326 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12327 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12328 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12333 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12334 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12335 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12336 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12337 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12338 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12339 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12343 /* toggle speaker-output according to the hp-jack state */
12344 static void alc269_speaker_automute(struct hda_codec *codec)
12346 unsigned int present;
12347 unsigned char bits;
12349 present = snd_hda_codec_read(codec, 0x15, 0,
12350 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12351 bits = present ? AMP_IN_MUTE(0) : 0;
12352 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12353 AMP_IN_MUTE(0), bits);
12354 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12355 AMP_IN_MUTE(0), bits);
12358 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12360 unsigned int present;
12362 present = snd_hda_codec_read(codec, 0x18, 0,
12363 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12364 snd_hda_codec_write(codec, 0x23, 0,
12365 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12368 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12370 unsigned int present;
12372 present = snd_hda_codec_read(codec, 0x18, 0,
12373 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12374 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12375 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12376 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12377 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12380 /* unsolicited event for HP jack sensing */
12381 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12384 if ((res >> 26) == ALC880_HP_EVENT)
12385 alc269_speaker_automute(codec);
12387 if ((res >> 26) == ALC880_MIC_EVENT)
12388 alc269_eeepc_dmic_automute(codec);
12391 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12393 alc269_speaker_automute(codec);
12394 alc269_eeepc_dmic_automute(codec);
12397 /* unsolicited event for HP jack sensing */
12398 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12401 if ((res >> 26) == ALC880_HP_EVENT)
12402 alc269_speaker_automute(codec);
12404 if ((res >> 26) == ALC880_MIC_EVENT)
12405 alc269_eeepc_amic_automute(codec);
12408 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12410 alc269_speaker_automute(codec);
12411 alc269_eeepc_amic_automute(codec);
12415 * generic initialization of ADC, input mixers and output mixers
12417 static struct hda_verb alc269_init_verbs[] = {
12419 * Unmute ADC0 and set the default input to mic-in
12421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12423 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12424 * analog-loopback mixer widget
12425 * Note: PASD motherboards uses the Line In 2 as the input for
12426 * front panel mic (mic 2)
12428 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12429 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12430 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12431 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12432 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12433 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12436 * Set up output mixers (0x0c - 0x0e)
12438 /* set vol=0 to output mixers */
12439 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12440 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12442 /* set up input amps for analog loopback */
12443 /* Amp Indices: DAC = 0, mixer = 1 */
12444 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12445 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12446 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12447 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12448 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12449 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12451 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12452 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12453 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12454 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12455 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12456 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12457 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12460 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12461 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12462 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12463 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12464 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12465 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12467 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12468 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12470 /* FIXME: use matrix-type input source selection */
12471 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12472 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12479 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12480 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12484 /* add playback controls from the parsed DAC table */
12485 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12486 const struct auto_pin_cfg *cfg)
12491 spec->multiout.num_dacs = 1; /* only use one dac */
12492 spec->multiout.dac_nids = spec->private_dac_nids;
12493 spec->multiout.dac_nids[0] = 2;
12495 nid = cfg->line_out_pins[0];
12497 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12498 "Front Playback Volume",
12499 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12502 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12503 "Front Playback Switch",
12504 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12509 nid = cfg->speaker_pins[0];
12511 if (!cfg->line_out_pins[0]) {
12512 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12513 "Speaker Playback Volume",
12514 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12520 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12521 "Speaker Playback Switch",
12522 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12527 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12528 "Speaker Playback Switch",
12529 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12535 nid = cfg->hp_pins[0];
12537 /* spec->multiout.hp_nid = 2; */
12538 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12539 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12540 "Headphone Playback Volume",
12541 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12547 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12548 "Headphone Playback Switch",
12549 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12554 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12555 "Headphone Playback Switch",
12556 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12565 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12566 const struct auto_pin_cfg *cfg)
12570 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12573 /* digital-mic input pin is excluded in alc880_auto_create..()
12574 * because it's under 0x18
12576 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12577 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12578 struct hda_input_mux *imux = &spec->private_imux[0];
12579 imux->items[imux->num_items].label = "Int Mic";
12580 imux->items[imux->num_items].index = 0x05;
12586 #ifdef CONFIG_SND_HDA_POWER_SAVE
12587 #define alc269_loopbacks alc880_loopbacks
12590 /* pcm configuration: identiacal with ALC880 */
12591 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12592 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12593 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12594 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12597 * BIOS auto configuration
12599 static int alc269_parse_auto_config(struct hda_codec *codec)
12601 struct alc_spec *spec = codec->spec;
12603 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12605 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12610 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12613 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12617 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12619 if (spec->autocfg.dig_out_pin)
12620 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12622 if (spec->kctls.list)
12623 add_mixer(spec, spec->kctls.list);
12625 /* create a beep mixer control if the pin 0x1d isn't assigned */
12626 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12627 if (spec->autocfg.input_pins[i] == 0x1d)
12629 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12630 add_mixer(spec, alc269_beep_mixer);
12632 add_verb(spec, alc269_init_verbs);
12633 spec->num_mux_defs = 1;
12634 spec->input_mux = &spec->private_imux[0];
12635 /* set default input source */
12636 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12637 0, AC_VERB_SET_CONNECT_SEL,
12638 spec->input_mux->items[0].index);
12640 err = alc_auto_add_mic_boost(codec);
12644 if (!spec->cap_mixer)
12645 set_capture_mixer(spec);
12647 store_pin_configs(codec);
12651 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12652 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12653 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12656 /* init callback for auto-configuration model -- overriding the default init */
12657 static void alc269_auto_init(struct hda_codec *codec)
12659 struct alc_spec *spec = codec->spec;
12660 alc269_auto_init_multi_out(codec);
12661 alc269_auto_init_hp_out(codec);
12662 alc269_auto_init_analog_input(codec);
12663 if (spec->unsol_event)
12664 alc_inithook(codec);
12668 * configuration and preset
12670 static const char *alc269_models[ALC269_MODEL_LAST] = {
12671 [ALC269_BASIC] = "basic",
12672 [ALC269_QUANTA_FL1] = "quanta",
12673 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12674 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12675 [ALC269_FUJITSU] = "fujitsu",
12676 [ALC269_LIFEBOOK] = "lifebook"
12679 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12680 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12681 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12682 ALC269_ASUS_EEEPC_P703),
12683 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12684 ALC269_ASUS_EEEPC_P901),
12685 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12686 ALC269_ASUS_EEEPC_P901),
12687 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12688 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12692 static struct alc_config_preset alc269_presets[] = {
12694 .mixers = { alc269_base_mixer },
12695 .init_verbs = { alc269_init_verbs },
12696 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12697 .dac_nids = alc269_dac_nids,
12699 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12700 .channel_mode = alc269_modes,
12701 .input_mux = &alc269_capture_source,
12703 [ALC269_QUANTA_FL1] = {
12704 .mixers = { alc269_quanta_fl1_mixer },
12705 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12706 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12707 .dac_nids = alc269_dac_nids,
12709 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12710 .channel_mode = alc269_modes,
12711 .input_mux = &alc269_capture_source,
12712 .unsol_event = alc269_quanta_fl1_unsol_event,
12713 .init_hook = alc269_quanta_fl1_init_hook,
12715 [ALC269_ASUS_EEEPC_P703] = {
12716 .mixers = { alc269_eeepc_mixer },
12717 .cap_mixer = alc269_epc_capture_mixer,
12718 .init_verbs = { alc269_init_verbs,
12719 alc269_eeepc_amic_init_verbs },
12720 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12721 .dac_nids = alc269_dac_nids,
12723 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12724 .channel_mode = alc269_modes,
12725 .input_mux = &alc269_eeepc_amic_capture_source,
12726 .unsol_event = alc269_eeepc_amic_unsol_event,
12727 .init_hook = alc269_eeepc_amic_inithook,
12729 [ALC269_ASUS_EEEPC_P901] = {
12730 .mixers = { alc269_eeepc_mixer },
12731 .cap_mixer = alc269_epc_capture_mixer,
12732 .init_verbs = { alc269_init_verbs,
12733 alc269_eeepc_dmic_init_verbs },
12734 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12735 .dac_nids = alc269_dac_nids,
12737 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12738 .channel_mode = alc269_modes,
12739 .input_mux = &alc269_eeepc_dmic_capture_source,
12740 .unsol_event = alc269_eeepc_dmic_unsol_event,
12741 .init_hook = alc269_eeepc_dmic_inithook,
12743 [ALC269_FUJITSU] = {
12744 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12745 .cap_mixer = alc269_epc_capture_mixer,
12746 .init_verbs = { alc269_init_verbs,
12747 alc269_eeepc_dmic_init_verbs },
12748 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12749 .dac_nids = alc269_dac_nids,
12751 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12752 .channel_mode = alc269_modes,
12753 .input_mux = &alc269_eeepc_dmic_capture_source,
12754 .unsol_event = alc269_eeepc_dmic_unsol_event,
12755 .init_hook = alc269_eeepc_dmic_inithook,
12757 [ALC269_LIFEBOOK] = {
12758 .mixers = { alc269_lifebook_mixer },
12759 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12760 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12761 .dac_nids = alc269_dac_nids,
12763 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12764 .channel_mode = alc269_modes,
12765 .input_mux = &alc269_capture_source,
12766 .unsol_event = alc269_lifebook_unsol_event,
12767 .init_hook = alc269_lifebook_init_hook,
12771 static int patch_alc269(struct hda_codec *codec)
12773 struct alc_spec *spec;
12777 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12781 codec->spec = spec;
12783 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12785 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12789 if (board_config < 0) {
12790 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12791 "trying auto-probe from BIOS...\n");
12792 board_config = ALC269_AUTO;
12795 if (board_config == ALC269_AUTO) {
12796 /* automatic parse from the BIOS config */
12797 err = alc269_parse_auto_config(codec);
12803 "hda_codec: Cannot set up configuration "
12804 "from BIOS. Using base mode...\n");
12805 board_config = ALC269_BASIC;
12809 if (board_config != ALC269_AUTO)
12810 setup_preset(spec, &alc269_presets[board_config]);
12812 spec->stream_name_analog = "ALC269 Analog";
12813 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12814 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12816 spec->stream_name_digital = "ALC269 Digital";
12817 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12818 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12820 spec->adc_nids = alc269_adc_nids;
12821 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12822 spec->capsrc_nids = alc269_capsrc_nids;
12823 if (!spec->cap_mixer)
12824 set_capture_mixer(spec);
12826 codec->patch_ops = alc_patch_ops;
12827 if (board_config == ALC269_AUTO)
12828 spec->init_hook = alc269_auto_init;
12829 #ifdef CONFIG_SND_HDA_POWER_SAVE
12830 if (!spec->loopback.amplist)
12831 spec->loopback.amplist = alc269_loopbacks;
12833 codec->proc_widget_hook = print_realtek_coef;
12839 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12843 * set the path ways for 2 channel output
12844 * need to set the codec line out and mic 1 pin widgets to inputs
12846 static struct hda_verb alc861_threestack_ch2_init[] = {
12847 /* set pin widget 1Ah (line in) for input */
12848 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12849 /* set pin widget 18h (mic1/2) for input, for mic also enable
12852 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12854 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12856 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12857 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12863 * need to set the codec line out and mic 1 pin widgets to outputs
12865 static struct hda_verb alc861_threestack_ch6_init[] = {
12866 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12867 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12868 /* set pin widget 18h (mic1) for output (CLFE)*/
12869 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12871 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12872 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12874 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12876 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12877 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12882 static struct hda_channel_mode alc861_threestack_modes[2] = {
12883 { 2, alc861_threestack_ch2_init },
12884 { 6, alc861_threestack_ch6_init },
12886 /* Set mic1 as input and unmute the mixer */
12887 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12888 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12889 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12892 /* Set mic1 as output and mute mixer */
12893 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12894 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12895 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12899 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12900 { 2, alc861_uniwill_m31_ch2_init },
12901 { 4, alc861_uniwill_m31_ch4_init },
12904 /* Set mic1 and line-in as input and unmute the mixer */
12905 static struct hda_verb alc861_asus_ch2_init[] = {
12906 /* set pin widget 1Ah (line in) for input */
12907 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12908 /* set pin widget 18h (mic1/2) for input, for mic also enable
12911 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12913 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12915 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12916 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12920 /* Set mic1 nad line-in as output and mute mixer */
12921 static struct hda_verb alc861_asus_ch6_init[] = {
12922 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12923 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12924 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12925 /* set pin widget 18h (mic1) for output (CLFE)*/
12926 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12927 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12928 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12929 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12931 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12933 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12934 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12939 static struct hda_channel_mode alc861_asus_modes[2] = {
12940 { 2, alc861_asus_ch2_init },
12941 { 6, alc861_asus_ch6_init },
12946 static struct snd_kcontrol_new alc861_base_mixer[] = {
12947 /* output mixer control */
12948 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12949 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12950 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12951 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12952 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12954 /*Input mixer control */
12955 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12956 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12957 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12958 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12959 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12960 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12961 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12962 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12963 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12964 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12969 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12970 /* output mixer control */
12971 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12972 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12973 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12974 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12975 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12977 /* Input mixer control */
12978 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12979 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12980 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12981 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12982 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12983 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12984 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12985 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12986 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12990 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12991 .name = "Channel Mode",
12992 .info = alc_ch_mode_info,
12993 .get = alc_ch_mode_get,
12994 .put = alc_ch_mode_put,
12995 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13000 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13001 /* output mixer control */
13002 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13003 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13004 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13009 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13010 /* output mixer control */
13011 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13012 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13013 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13014 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13015 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13017 /* Input mixer control */
13018 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13019 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13020 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13021 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13022 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13023 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13025 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13026 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13027 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13030 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13031 .name = "Channel Mode",
13032 .info = alc_ch_mode_info,
13033 .get = alc_ch_mode_get,
13034 .put = alc_ch_mode_put,
13035 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13040 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13041 /* output mixer control */
13042 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13043 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13044 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13045 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13046 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13048 /* Input mixer control */
13049 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13050 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13051 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13052 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13053 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13054 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13056 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13057 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13061 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13062 .name = "Channel Mode",
13063 .info = alc_ch_mode_info,
13064 .get = alc_ch_mode_get,
13065 .put = alc_ch_mode_put,
13066 .private_value = ARRAY_SIZE(alc861_asus_modes),
13071 /* additional mixer */
13072 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13073 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13074 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13075 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
13076 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
13081 * generic initialization of ADC, input mixers and output mixers
13083 static struct hda_verb alc861_base_init_verbs[] = {
13085 * Unmute ADC0 and set the default input to mic-in
13087 /* port-A for surround (rear panel) */
13088 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13089 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13090 /* port-B for mic-in (rear panel) with vref */
13091 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13092 /* port-C for line-in (rear panel) */
13093 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13094 /* port-D for Front */
13095 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13096 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13097 /* port-E for HP out (front panel) */
13098 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13099 /* route front PCM to HP */
13100 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13101 /* port-F for mic-in (front panel) with vref */
13102 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13103 /* port-G for CLFE (rear panel) */
13104 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13105 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13106 /* port-H for side (rear panel) */
13107 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13108 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13110 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13111 /* route front mic to ADC1*/
13112 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13113 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13115 /* Unmute DAC0~3 & spdif out*/
13116 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13117 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13118 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13119 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13122 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13123 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13124 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13125 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13126 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13128 /* Unmute Stereo Mixer 15 */
13129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13130 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13132 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13134 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13135 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13136 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13137 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13138 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13139 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13140 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13142 /* hp used DAC 3 (Front) */
13143 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13144 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13149 static struct hda_verb alc861_threestack_init_verbs[] = {
13151 * Unmute ADC0 and set the default input to mic-in
13153 /* port-A for surround (rear panel) */
13154 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13155 /* port-B for mic-in (rear panel) with vref */
13156 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13157 /* port-C for line-in (rear panel) */
13158 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13159 /* port-D for Front */
13160 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13161 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13162 /* port-E for HP out (front panel) */
13163 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13164 /* route front PCM to HP */
13165 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13166 /* port-F for mic-in (front panel) with vref */
13167 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13168 /* port-G for CLFE (rear panel) */
13169 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13170 /* port-H for side (rear panel) */
13171 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13173 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13174 /* route front mic to ADC1*/
13175 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13176 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13177 /* Unmute DAC0~3 & spdif out*/
13178 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13179 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13180 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13181 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13184 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13185 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13186 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13187 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13188 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13190 /* Unmute Stereo Mixer 15 */
13191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13193 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13194 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13196 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13197 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13198 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13199 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13201 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13202 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13203 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13204 /* hp used DAC 3 (Front) */
13205 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13206 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13210 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13212 * Unmute ADC0 and set the default input to mic-in
13214 /* port-A for surround (rear panel) */
13215 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13216 /* port-B for mic-in (rear panel) with vref */
13217 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13218 /* port-C for line-in (rear panel) */
13219 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13220 /* port-D for Front */
13221 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13222 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13223 /* port-E for HP out (front panel) */
13224 /* this has to be set to VREF80 */
13225 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13226 /* route front PCM to HP */
13227 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13228 /* port-F for mic-in (front panel) with vref */
13229 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13230 /* port-G for CLFE (rear panel) */
13231 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13232 /* port-H for side (rear panel) */
13233 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13235 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13236 /* route front mic to ADC1*/
13237 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13238 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13239 /* Unmute DAC0~3 & spdif out*/
13240 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13241 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13242 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13243 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13244 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13246 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13247 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13248 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13249 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13250 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13252 /* Unmute Stereo Mixer 15 */
13253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13254 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13258 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13259 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13260 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13262 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13263 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13264 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13265 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13266 /* hp used DAC 3 (Front) */
13267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13272 static struct hda_verb alc861_asus_init_verbs[] = {
13274 * Unmute ADC0 and set the default input to mic-in
13276 /* port-A for surround (rear panel)
13277 * according to codec#0 this is the HP jack
13279 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13280 /* route front PCM to HP */
13281 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13282 /* port-B for mic-in (rear panel) with vref */
13283 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13284 /* port-C for line-in (rear panel) */
13285 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13286 /* port-D for Front */
13287 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13288 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13289 /* port-E for HP out (front panel) */
13290 /* this has to be set to VREF80 */
13291 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13292 /* route front PCM to HP */
13293 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13294 /* port-F for mic-in (front panel) with vref */
13295 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13296 /* port-G for CLFE (rear panel) */
13297 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13298 /* port-H for side (rear panel) */
13299 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13301 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13302 /* route front mic to ADC1*/
13303 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13305 /* Unmute DAC0~3 & spdif out*/
13306 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13307 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13308 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13309 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13311 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13312 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13313 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13314 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13315 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13317 /* Unmute Stereo Mixer 15 */
13318 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13321 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13323 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13324 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13325 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13326 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13327 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13329 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13330 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13331 /* hp used DAC 3 (Front) */
13332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13333 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13337 /* additional init verbs for ASUS laptops */
13338 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13339 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13340 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13345 * generic initialization of ADC, input mixers and output mixers
13347 static struct hda_verb alc861_auto_init_verbs[] = {
13349 * Unmute ADC0 and set the default input to mic-in
13351 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13354 /* Unmute DAC0~3 & spdif out*/
13355 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13356 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13357 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13358 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13361 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13362 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13363 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13364 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13365 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13367 /* Unmute Stereo Mixer 15 */
13368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13370 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13371 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13373 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13374 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13375 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13376 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13378 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13379 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13380 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13382 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13383 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13384 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13385 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13386 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13387 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13388 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13389 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13391 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13396 static struct hda_verb alc861_toshiba_init_verbs[] = {
13397 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13402 /* toggle speaker-output according to the hp-jack state */
13403 static void alc861_toshiba_automute(struct hda_codec *codec)
13405 unsigned int present;
13407 present = snd_hda_codec_read(codec, 0x0f, 0,
13408 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13409 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13410 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13411 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13412 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13415 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13418 if ((res >> 26) == ALC880_HP_EVENT)
13419 alc861_toshiba_automute(codec);
13422 /* pcm configuration: identiacal with ALC880 */
13423 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13424 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13425 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13426 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13429 #define ALC861_DIGOUT_NID 0x07
13431 static struct hda_channel_mode alc861_8ch_modes[1] = {
13435 static hda_nid_t alc861_dac_nids[4] = {
13436 /* front, surround, clfe, side */
13437 0x03, 0x06, 0x05, 0x04
13440 static hda_nid_t alc660_dac_nids[3] = {
13441 /* front, clfe, surround */
13445 static hda_nid_t alc861_adc_nids[1] = {
13450 static struct hda_input_mux alc861_capture_source = {
13454 { "Front Mic", 0x3 },
13461 /* fill in the dac_nids table from the parsed pin configuration */
13462 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13463 const struct auto_pin_cfg *cfg)
13468 spec->multiout.dac_nids = spec->private_dac_nids;
13469 for (i = 0; i < cfg->line_outs; i++) {
13470 nid = cfg->line_out_pins[i];
13472 if (i >= ARRAY_SIZE(alc861_dac_nids))
13474 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13477 spec->multiout.num_dacs = cfg->line_outs;
13481 /* add playback controls from the parsed DAC table */
13482 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13483 const struct auto_pin_cfg *cfg)
13486 static const char *chname[4] = {
13487 "Front", "Surround", NULL /*CLFE*/, "Side"
13492 for (i = 0; i < cfg->line_outs; i++) {
13493 nid = spec->multiout.dac_nids[i];
13498 err = add_control(spec, ALC_CTL_BIND_MUTE,
13499 "Center Playback Switch",
13500 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13504 err = add_control(spec, ALC_CTL_BIND_MUTE,
13505 "LFE Playback Switch",
13506 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13511 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13513 if (nid == alc861_dac_nids[idx])
13515 sprintf(name, "%s Playback Switch", chname[idx]);
13516 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13517 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13526 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13534 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13536 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13537 "Headphone Playback Switch",
13538 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13541 spec->multiout.hp_nid = nid;
13546 /* create playback/capture controls for input pins */
13547 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13548 const struct auto_pin_cfg *cfg)
13550 struct hda_input_mux *imux = &spec->private_imux[0];
13551 int i, err, idx, idx1;
13553 for (i = 0; i < AUTO_PIN_LAST; i++) {
13554 switch (cfg->input_pins[i]) {
13557 idx = 2; /* Line In */
13561 idx = 2; /* Line In */
13565 idx = 1; /* Mic In */
13569 idx = 1; /* Mic In */
13579 err = new_analog_input(spec, cfg->input_pins[i],
13580 auto_pin_cfg_labels[i], idx, 0x15);
13584 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13585 imux->items[imux->num_items].index = idx1;
13591 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13593 int pin_type, int dac_idx)
13595 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13597 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13601 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13603 struct alc_spec *spec = codec->spec;
13606 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13607 for (i = 0; i < spec->autocfg.line_outs; i++) {
13608 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13609 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13611 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13612 spec->multiout.dac_nids[i]);
13616 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13618 struct alc_spec *spec = codec->spec;
13621 pin = spec->autocfg.hp_pins[0];
13622 if (pin) /* connect to front */
13623 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13624 spec->multiout.dac_nids[0]);
13625 pin = spec->autocfg.speaker_pins[0];
13627 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13630 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13632 struct alc_spec *spec = codec->spec;
13635 for (i = 0; i < AUTO_PIN_LAST; i++) {
13636 hda_nid_t nid = spec->autocfg.input_pins[i];
13637 if (nid >= 0x0c && nid <= 0x11) {
13638 snd_hda_codec_write(codec, nid, 0,
13639 AC_VERB_SET_PIN_WIDGET_CONTROL,
13640 i <= AUTO_PIN_FRONT_MIC ?
13641 PIN_VREF80 : PIN_IN);
13646 /* parse the BIOS configuration and set up the alc_spec */
13647 /* return 1 if successful, 0 if the proper config is not found,
13648 * or a negative error code
13650 static int alc861_parse_auto_config(struct hda_codec *codec)
13652 struct alc_spec *spec = codec->spec;
13654 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13656 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13660 if (!spec->autocfg.line_outs)
13661 return 0; /* can't find valid BIOS pin config */
13663 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13666 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13669 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13672 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13676 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13678 if (spec->autocfg.dig_out_pin)
13679 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13681 if (spec->kctls.list)
13682 add_mixer(spec, spec->kctls.list);
13684 add_verb(spec, alc861_auto_init_verbs);
13686 spec->num_mux_defs = 1;
13687 spec->input_mux = &spec->private_imux[0];
13689 spec->adc_nids = alc861_adc_nids;
13690 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13691 set_capture_mixer(spec);
13693 store_pin_configs(codec);
13697 /* additional initialization for auto-configuration model */
13698 static void alc861_auto_init(struct hda_codec *codec)
13700 struct alc_spec *spec = codec->spec;
13701 alc861_auto_init_multi_out(codec);
13702 alc861_auto_init_hp_out(codec);
13703 alc861_auto_init_analog_input(codec);
13704 if (spec->unsol_event)
13705 alc_inithook(codec);
13708 #ifdef CONFIG_SND_HDA_POWER_SAVE
13709 static struct hda_amp_list alc861_loopbacks[] = {
13710 { 0x15, HDA_INPUT, 0 },
13711 { 0x15, HDA_INPUT, 1 },
13712 { 0x15, HDA_INPUT, 2 },
13713 { 0x15, HDA_INPUT, 3 },
13720 * configuration and preset
13722 static const char *alc861_models[ALC861_MODEL_LAST] = {
13723 [ALC861_3ST] = "3stack",
13724 [ALC660_3ST] = "3stack-660",
13725 [ALC861_3ST_DIG] = "3stack-dig",
13726 [ALC861_6ST_DIG] = "6stack-dig",
13727 [ALC861_UNIWILL_M31] = "uniwill-m31",
13728 [ALC861_TOSHIBA] = "toshiba",
13729 [ALC861_ASUS] = "asus",
13730 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13731 [ALC861_AUTO] = "auto",
13734 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13735 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13736 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13737 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13738 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13739 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13740 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13741 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13742 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13743 * Any other models that need this preset?
13745 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13746 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13747 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13748 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13749 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13750 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13751 /* FIXME: the below seems conflict */
13752 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13753 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13754 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13758 static struct alc_config_preset alc861_presets[] = {
13760 .mixers = { alc861_3ST_mixer },
13761 .init_verbs = { alc861_threestack_init_verbs },
13762 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13763 .dac_nids = alc861_dac_nids,
13764 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13765 .channel_mode = alc861_threestack_modes,
13767 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13768 .adc_nids = alc861_adc_nids,
13769 .input_mux = &alc861_capture_source,
13771 [ALC861_3ST_DIG] = {
13772 .mixers = { alc861_base_mixer },
13773 .init_verbs = { alc861_threestack_init_verbs },
13774 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13775 .dac_nids = alc861_dac_nids,
13776 .dig_out_nid = ALC861_DIGOUT_NID,
13777 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13778 .channel_mode = alc861_threestack_modes,
13780 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13781 .adc_nids = alc861_adc_nids,
13782 .input_mux = &alc861_capture_source,
13784 [ALC861_6ST_DIG] = {
13785 .mixers = { alc861_base_mixer },
13786 .init_verbs = { alc861_base_init_verbs },
13787 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13788 .dac_nids = alc861_dac_nids,
13789 .dig_out_nid = ALC861_DIGOUT_NID,
13790 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13791 .channel_mode = alc861_8ch_modes,
13792 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13793 .adc_nids = alc861_adc_nids,
13794 .input_mux = &alc861_capture_source,
13797 .mixers = { alc861_3ST_mixer },
13798 .init_verbs = { alc861_threestack_init_verbs },
13799 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13800 .dac_nids = alc660_dac_nids,
13801 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13802 .channel_mode = alc861_threestack_modes,
13804 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13805 .adc_nids = alc861_adc_nids,
13806 .input_mux = &alc861_capture_source,
13808 [ALC861_UNIWILL_M31] = {
13809 .mixers = { alc861_uniwill_m31_mixer },
13810 .init_verbs = { alc861_uniwill_m31_init_verbs },
13811 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13812 .dac_nids = alc861_dac_nids,
13813 .dig_out_nid = ALC861_DIGOUT_NID,
13814 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13815 .channel_mode = alc861_uniwill_m31_modes,
13817 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13818 .adc_nids = alc861_adc_nids,
13819 .input_mux = &alc861_capture_source,
13821 [ALC861_TOSHIBA] = {
13822 .mixers = { alc861_toshiba_mixer },
13823 .init_verbs = { alc861_base_init_verbs,
13824 alc861_toshiba_init_verbs },
13825 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13826 .dac_nids = alc861_dac_nids,
13827 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13828 .channel_mode = alc883_3ST_2ch_modes,
13829 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13830 .adc_nids = alc861_adc_nids,
13831 .input_mux = &alc861_capture_source,
13832 .unsol_event = alc861_toshiba_unsol_event,
13833 .init_hook = alc861_toshiba_automute,
13836 .mixers = { alc861_asus_mixer },
13837 .init_verbs = { alc861_asus_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(alc861_asus_modes),
13842 .channel_mode = alc861_asus_modes,
13845 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13846 .adc_nids = alc861_adc_nids,
13847 .input_mux = &alc861_capture_source,
13849 [ALC861_ASUS_LAPTOP] = {
13850 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13851 .init_verbs = { alc861_asus_init_verbs,
13852 alc861_asus_laptop_init_verbs },
13853 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13854 .dac_nids = alc861_dac_nids,
13855 .dig_out_nid = ALC861_DIGOUT_NID,
13856 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13857 .channel_mode = alc883_3ST_2ch_modes,
13859 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13860 .adc_nids = alc861_adc_nids,
13861 .input_mux = &alc861_capture_source,
13866 static int patch_alc861(struct hda_codec *codec)
13868 struct alc_spec *spec;
13872 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13876 codec->spec = spec;
13878 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13882 if (board_config < 0) {
13883 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13884 "trying auto-probe from BIOS...\n");
13885 board_config = ALC861_AUTO;
13888 if (board_config == ALC861_AUTO) {
13889 /* automatic parse from the BIOS config */
13890 err = alc861_parse_auto_config(codec);
13896 "hda_codec: Cannot set up configuration "
13897 "from BIOS. Using base mode...\n");
13898 board_config = ALC861_3ST_DIG;
13902 if (board_config != ALC861_AUTO)
13903 setup_preset(spec, &alc861_presets[board_config]);
13905 spec->stream_name_analog = "ALC861 Analog";
13906 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13907 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13909 spec->stream_name_digital = "ALC861 Digital";
13910 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13911 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13913 spec->vmaster_nid = 0x03;
13915 codec->patch_ops = alc_patch_ops;
13916 if (board_config == ALC861_AUTO)
13917 spec->init_hook = alc861_auto_init;
13918 #ifdef CONFIG_SND_HDA_POWER_SAVE
13919 if (!spec->loopback.amplist)
13920 spec->loopback.amplist = alc861_loopbacks;
13922 codec->proc_widget_hook = print_realtek_coef;
13928 * ALC861-VD support
13932 * In addition, an independent DAC
13934 #define ALC861VD_DIGOUT_NID 0x06
13936 static hda_nid_t alc861vd_dac_nids[4] = {
13937 /* front, surr, clfe, side surr */
13938 0x02, 0x03, 0x04, 0x05
13941 /* dac_nids for ALC660vd are in a different order - according to
13942 * Realtek's driver.
13943 * This should probably tesult in a different mixer for 6stack models
13944 * of ALC660vd codecs, but for now there is only 3stack mixer
13945 * - and it is the same as in 861vd.
13946 * adc_nids in ALC660vd are (is) the same as in 861vd
13948 static hda_nid_t alc660vd_dac_nids[3] = {
13949 /* front, rear, clfe, rear_surr */
13953 static hda_nid_t alc861vd_adc_nids[1] = {
13958 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13961 /* FIXME: should be a matrix-type input source selection */
13962 static struct hda_input_mux alc861vd_capture_source = {
13966 { "Front Mic", 0x1 },
13972 static struct hda_input_mux alc861vd_dallas_capture_source = {
13975 { "Ext Mic", 0x0 },
13976 { "Int Mic", 0x1 },
13980 static struct hda_input_mux alc861vd_hp_capture_source = {
13983 { "Front Mic", 0x0 },
13984 { "ATAPI Mic", 0x1 },
13991 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13998 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13999 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14000 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14001 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14002 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14009 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14010 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14011 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14012 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14013 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14017 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14018 { 6, alc861vd_6stack_ch6_init },
14019 { 8, alc861vd_6stack_ch8_init },
14022 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14024 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14025 .name = "Channel Mode",
14026 .info = alc_ch_mode_info,
14027 .get = alc_ch_mode_get,
14028 .put = alc_ch_mode_put,
14033 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14034 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14036 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14037 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14038 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14040 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14041 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14043 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14045 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14047 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14048 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14050 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14051 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14053 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14055 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14057 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14059 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14060 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14061 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14066 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14067 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14069 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14070 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14075 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14076 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14077 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14085 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14086 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14087 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14095 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14096 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14101 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14102 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14103 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14104 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14106 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14108 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14110 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14112 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14113 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14114 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14116 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14117 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14122 /* Pin assignment: Speaker=0x14, HP = 0x15,
14123 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14125 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14126 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14127 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14128 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14129 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14130 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14131 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14132 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14133 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14134 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14135 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14136 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
14137 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
14141 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14142 * Front Mic=0x18, ATAPI Mic = 0x19,
14144 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14145 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14146 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14147 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14148 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14149 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14150 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14151 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14152 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14158 * generic initialization of ADC, input mixers and output mixers
14160 static struct hda_verb alc861vd_volume_init_verbs[] = {
14162 * Unmute ADC0 and set the default input to mic-in
14164 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14165 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14167 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14168 * the analog-loopback mixer widget
14170 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14177 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14181 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14184 * Set up output mixers (0x02 - 0x05)
14186 /* set vol=0 to output mixers */
14187 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14188 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14189 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14190 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14192 /* set up input amps for analog loopback */
14193 /* Amp Indices: DAC = 0, mixer = 1 */
14194 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14196 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14198 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14200 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14201 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14207 * 3-stack pin configuration:
14208 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14210 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14212 * Set pin mode and muting
14214 /* set front pin widgets 0x14 for output */
14215 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14216 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14217 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14219 /* Mic (rear) pin: input vref at 80% */
14220 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14221 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14222 /* Front Mic pin: input vref at 80% */
14223 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14224 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14225 /* Line In pin: input */
14226 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14227 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14228 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14229 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14230 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14231 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14232 /* CD pin widget for input */
14233 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14239 * 6-stack pin configuration:
14241 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14243 * Set pin mode and muting
14245 /* set front pin widgets 0x14 for output */
14246 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14247 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14248 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14250 /* Rear Pin: output 1 (0x0d) */
14251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14253 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14254 /* CLFE Pin: output 2 (0x0e) */
14255 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14256 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14257 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14258 /* Side Pin: output 3 (0x0f) */
14259 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14260 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14261 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14263 /* Mic (rear) pin: input vref at 80% */
14264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14265 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14266 /* Front Mic pin: input vref at 80% */
14267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14269 /* Line In pin: input */
14270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14272 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14273 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14274 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14275 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14276 /* CD pin widget for input */
14277 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14282 static struct hda_verb alc861vd_eapd_verbs[] = {
14283 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14287 static struct hda_verb alc660vd_eapd_verbs[] = {
14288 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14289 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14293 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14297 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14298 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14302 /* toggle speaker-output according to the hp-jack state */
14303 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14305 unsigned int present;
14306 unsigned char bits;
14308 present = snd_hda_codec_read(codec, 0x1b, 0,
14309 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14310 bits = present ? HDA_AMP_MUTE : 0;
14311 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14312 HDA_AMP_MUTE, bits);
14315 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14317 unsigned int present;
14318 unsigned char bits;
14320 present = snd_hda_codec_read(codec, 0x18, 0,
14321 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14322 bits = present ? HDA_AMP_MUTE : 0;
14323 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14324 HDA_AMP_MUTE, bits);
14327 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14329 alc861vd_lenovo_hp_automute(codec);
14330 alc861vd_lenovo_mic_automute(codec);
14333 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14336 switch (res >> 26) {
14337 case ALC880_HP_EVENT:
14338 alc861vd_lenovo_hp_automute(codec);
14340 case ALC880_MIC_EVENT:
14341 alc861vd_lenovo_mic_automute(codec);
14346 static struct hda_verb alc861vd_dallas_verbs[] = {
14347 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14348 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14349 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14350 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14362 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14366 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14367 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14368 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14370 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14371 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14372 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14373 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14374 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14375 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14376 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14377 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14379 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14385 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14386 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14391 /* toggle speaker-output according to the hp-jack state */
14392 static void alc861vd_dallas_automute(struct hda_codec *codec)
14394 unsigned int present;
14396 present = snd_hda_codec_read(codec, 0x15, 0,
14397 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14398 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14399 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14402 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14404 if ((res >> 26) == ALC880_HP_EVENT)
14405 alc861vd_dallas_automute(codec);
14408 #ifdef CONFIG_SND_HDA_POWER_SAVE
14409 #define alc861vd_loopbacks alc880_loopbacks
14412 /* pcm configuration: identiacal with ALC880 */
14413 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14414 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14415 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14416 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14419 * configuration and preset
14421 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14422 [ALC660VD_3ST] = "3stack-660",
14423 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14424 [ALC660VD_ASUS_V1S] = "asus-v1s",
14425 [ALC861VD_3ST] = "3stack",
14426 [ALC861VD_3ST_DIG] = "3stack-digout",
14427 [ALC861VD_6ST_DIG] = "6stack-digout",
14428 [ALC861VD_LENOVO] = "lenovo",
14429 [ALC861VD_DALLAS] = "dallas",
14430 [ALC861VD_HP] = "hp",
14431 [ALC861VD_AUTO] = "auto",
14434 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14435 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14436 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14437 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14438 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14439 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14440 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14441 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14442 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14443 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14444 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14445 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14446 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14447 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14448 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14449 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14450 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14451 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14455 static struct alc_config_preset alc861vd_presets[] = {
14457 .mixers = { alc861vd_3st_mixer },
14458 .init_verbs = { alc861vd_volume_init_verbs,
14459 alc861vd_3stack_init_verbs },
14460 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14461 .dac_nids = alc660vd_dac_nids,
14462 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14463 .channel_mode = alc861vd_3stack_2ch_modes,
14464 .input_mux = &alc861vd_capture_source,
14466 [ALC660VD_3ST_DIG] = {
14467 .mixers = { alc861vd_3st_mixer },
14468 .init_verbs = { alc861vd_volume_init_verbs,
14469 alc861vd_3stack_init_verbs },
14470 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14471 .dac_nids = alc660vd_dac_nids,
14472 .dig_out_nid = ALC861VD_DIGOUT_NID,
14473 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14474 .channel_mode = alc861vd_3stack_2ch_modes,
14475 .input_mux = &alc861vd_capture_source,
14478 .mixers = { alc861vd_3st_mixer },
14479 .init_verbs = { alc861vd_volume_init_verbs,
14480 alc861vd_3stack_init_verbs },
14481 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14482 .dac_nids = alc861vd_dac_nids,
14483 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14484 .channel_mode = alc861vd_3stack_2ch_modes,
14485 .input_mux = &alc861vd_capture_source,
14487 [ALC861VD_3ST_DIG] = {
14488 .mixers = { alc861vd_3st_mixer },
14489 .init_verbs = { alc861vd_volume_init_verbs,
14490 alc861vd_3stack_init_verbs },
14491 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14492 .dac_nids = alc861vd_dac_nids,
14493 .dig_out_nid = ALC861VD_DIGOUT_NID,
14494 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14495 .channel_mode = alc861vd_3stack_2ch_modes,
14496 .input_mux = &alc861vd_capture_source,
14498 [ALC861VD_6ST_DIG] = {
14499 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14500 .init_verbs = { alc861vd_volume_init_verbs,
14501 alc861vd_6stack_init_verbs },
14502 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14503 .dac_nids = alc861vd_dac_nids,
14504 .dig_out_nid = ALC861VD_DIGOUT_NID,
14505 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14506 .channel_mode = alc861vd_6stack_modes,
14507 .input_mux = &alc861vd_capture_source,
14509 [ALC861VD_LENOVO] = {
14510 .mixers = { alc861vd_lenovo_mixer },
14511 .init_verbs = { alc861vd_volume_init_verbs,
14512 alc861vd_3stack_init_verbs,
14513 alc861vd_eapd_verbs,
14514 alc861vd_lenovo_unsol_verbs },
14515 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14516 .dac_nids = alc660vd_dac_nids,
14517 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14518 .channel_mode = alc861vd_3stack_2ch_modes,
14519 .input_mux = &alc861vd_capture_source,
14520 .unsol_event = alc861vd_lenovo_unsol_event,
14521 .init_hook = alc861vd_lenovo_automute,
14523 [ALC861VD_DALLAS] = {
14524 .mixers = { alc861vd_dallas_mixer },
14525 .init_verbs = { alc861vd_dallas_verbs },
14526 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14527 .dac_nids = alc861vd_dac_nids,
14528 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14529 .channel_mode = alc861vd_3stack_2ch_modes,
14530 .input_mux = &alc861vd_dallas_capture_source,
14531 .unsol_event = alc861vd_dallas_unsol_event,
14532 .init_hook = alc861vd_dallas_automute,
14535 .mixers = { alc861vd_hp_mixer },
14536 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14537 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14538 .dac_nids = alc861vd_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_hp_capture_source,
14543 .unsol_event = alc861vd_dallas_unsol_event,
14544 .init_hook = alc861vd_dallas_automute,
14546 [ALC660VD_ASUS_V1S] = {
14547 .mixers = { alc861vd_lenovo_mixer },
14548 .init_verbs = { alc861vd_volume_init_verbs,
14549 alc861vd_3stack_init_verbs,
14550 alc861vd_eapd_verbs,
14551 alc861vd_lenovo_unsol_verbs },
14552 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14553 .dac_nids = alc660vd_dac_nids,
14554 .dig_out_nid = ALC861VD_DIGOUT_NID,
14555 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14556 .channel_mode = alc861vd_3stack_2ch_modes,
14557 .input_mux = &alc861vd_capture_source,
14558 .unsol_event = alc861vd_lenovo_unsol_event,
14559 .init_hook = alc861vd_lenovo_automute,
14564 * BIOS auto configuration
14566 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14567 hda_nid_t nid, int pin_type, int dac_idx)
14569 alc_set_pin_output(codec, nid, pin_type);
14572 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14574 struct alc_spec *spec = codec->spec;
14577 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14578 for (i = 0; i <= HDA_SIDE; i++) {
14579 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14580 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14582 alc861vd_auto_set_output_and_unmute(codec, nid,
14588 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14590 struct alc_spec *spec = codec->spec;
14593 pin = spec->autocfg.hp_pins[0];
14594 if (pin) /* connect to front and use dac 0 */
14595 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14596 pin = spec->autocfg.speaker_pins[0];
14598 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14601 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14602 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14604 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14606 struct alc_spec *spec = codec->spec;
14609 for (i = 0; i < AUTO_PIN_LAST; i++) {
14610 hda_nid_t nid = spec->autocfg.input_pins[i];
14611 if (alc861vd_is_input_pin(nid)) {
14612 snd_hda_codec_write(codec, nid, 0,
14613 AC_VERB_SET_PIN_WIDGET_CONTROL,
14614 i <= AUTO_PIN_FRONT_MIC ?
14615 PIN_VREF80 : PIN_IN);
14616 if (nid != ALC861VD_PIN_CD_NID)
14617 snd_hda_codec_write(codec, nid, 0,
14618 AC_VERB_SET_AMP_GAIN_MUTE,
14624 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14626 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14627 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14629 /* add playback controls from the parsed DAC table */
14630 /* Based on ALC880 version. But ALC861VD has separate,
14631 * different NIDs for mute/unmute switch and volume control */
14632 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14633 const struct auto_pin_cfg *cfg)
14636 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14637 hda_nid_t nid_v, nid_s;
14640 for (i = 0; i < cfg->line_outs; i++) {
14641 if (!spec->multiout.dac_nids[i])
14643 nid_v = alc861vd_idx_to_mixer_vol(
14645 spec->multiout.dac_nids[i]));
14646 nid_s = alc861vd_idx_to_mixer_switch(
14648 spec->multiout.dac_nids[i]));
14652 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14653 "Center Playback Volume",
14654 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14658 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14659 "LFE Playback Volume",
14660 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14664 err = add_control(spec, ALC_CTL_BIND_MUTE,
14665 "Center Playback Switch",
14666 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14670 err = add_control(spec, ALC_CTL_BIND_MUTE,
14671 "LFE Playback Switch",
14672 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14677 sprintf(name, "%s Playback Volume", chname[i]);
14678 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14679 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14683 sprintf(name, "%s Playback Switch", chname[i]);
14684 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14685 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14694 /* add playback controls for speaker and HP outputs */
14695 /* Based on ALC880 version. But ALC861VD has separate,
14696 * different NIDs for mute/unmute switch and volume control */
14697 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14698 hda_nid_t pin, const char *pfx)
14700 hda_nid_t nid_v, nid_s;
14707 if (alc880_is_fixed_pin(pin)) {
14708 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14709 /* specify the DAC as the extra output */
14710 if (!spec->multiout.hp_nid)
14711 spec->multiout.hp_nid = nid_v;
14713 spec->multiout.extra_out_nid[0] = nid_v;
14714 /* control HP volume/switch on the output mixer amp */
14715 nid_v = alc861vd_idx_to_mixer_vol(
14716 alc880_fixed_pin_idx(pin));
14717 nid_s = alc861vd_idx_to_mixer_switch(
14718 alc880_fixed_pin_idx(pin));
14720 sprintf(name, "%s Playback Volume", pfx);
14721 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14722 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14725 sprintf(name, "%s Playback Switch", pfx);
14726 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14727 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14730 } else if (alc880_is_multi_pin(pin)) {
14731 /* set manual connection */
14732 /* we have only a switch on HP-out PIN */
14733 sprintf(name, "%s Playback Switch", pfx);
14734 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14735 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14742 /* parse the BIOS configuration and set up the alc_spec
14743 * return 1 if successful, 0 if the proper config is not found,
14744 * or a negative error code
14745 * Based on ALC880 version - had to change it to override
14746 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14747 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14749 struct alc_spec *spec = codec->spec;
14751 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14753 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14757 if (!spec->autocfg.line_outs)
14758 return 0; /* can't find valid BIOS pin config */
14760 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14763 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14766 err = alc861vd_auto_create_extra_out(spec,
14767 spec->autocfg.speaker_pins[0],
14771 err = alc861vd_auto_create_extra_out(spec,
14772 spec->autocfg.hp_pins[0],
14776 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14780 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14782 if (spec->autocfg.dig_out_pin)
14783 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14785 if (spec->kctls.list)
14786 add_mixer(spec, spec->kctls.list);
14788 add_verb(spec, alc861vd_volume_init_verbs);
14790 spec->num_mux_defs = 1;
14791 spec->input_mux = &spec->private_imux[0];
14793 err = alc_auto_add_mic_boost(codec);
14797 store_pin_configs(codec);
14801 /* additional initialization for auto-configuration model */
14802 static void alc861vd_auto_init(struct hda_codec *codec)
14804 struct alc_spec *spec = codec->spec;
14805 alc861vd_auto_init_multi_out(codec);
14806 alc861vd_auto_init_hp_out(codec);
14807 alc861vd_auto_init_analog_input(codec);
14808 alc861vd_auto_init_input_src(codec);
14809 if (spec->unsol_event)
14810 alc_inithook(codec);
14813 static int patch_alc861vd(struct hda_codec *codec)
14815 struct alc_spec *spec;
14816 int err, board_config;
14818 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14822 codec->spec = spec;
14824 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14828 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14829 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14830 "ALC861VD, trying auto-probe from BIOS...\n");
14831 board_config = ALC861VD_AUTO;
14834 if (board_config == ALC861VD_AUTO) {
14835 /* automatic parse from the BIOS config */
14836 err = alc861vd_parse_auto_config(codec);
14842 "hda_codec: Cannot set up configuration "
14843 "from BIOS. Using base mode...\n");
14844 board_config = ALC861VD_3ST;
14848 if (board_config != ALC861VD_AUTO)
14849 setup_preset(spec, &alc861vd_presets[board_config]);
14851 if (codec->vendor_id == 0x10ec0660) {
14852 spec->stream_name_analog = "ALC660-VD Analog";
14853 spec->stream_name_digital = "ALC660-VD Digital";
14854 /* always turn on EAPD */
14855 add_verb(spec, alc660vd_eapd_verbs);
14857 spec->stream_name_analog = "ALC861VD Analog";
14858 spec->stream_name_digital = "ALC861VD Digital";
14861 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14862 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14864 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14865 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14867 spec->adc_nids = alc861vd_adc_nids;
14868 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14869 spec->capsrc_nids = alc861vd_capsrc_nids;
14870 spec->capture_style = CAPT_MIX;
14872 set_capture_mixer(spec);
14874 spec->vmaster_nid = 0x02;
14876 codec->patch_ops = alc_patch_ops;
14878 if (board_config == ALC861VD_AUTO)
14879 spec->init_hook = alc861vd_auto_init;
14880 #ifdef CONFIG_SND_HDA_POWER_SAVE
14881 if (!spec->loopback.amplist)
14882 spec->loopback.amplist = alc861vd_loopbacks;
14884 codec->proc_widget_hook = print_realtek_coef;
14892 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14893 * configuration. Each pin widget can choose any input DACs and a mixer.
14894 * Each ADC is connected from a mixer of all inputs. This makes possible
14895 * 6-channel independent captures.
14897 * In addition, an independent DAC for the multi-playback (not used in this
14900 #define ALC662_DIGOUT_NID 0x06
14901 #define ALC662_DIGIN_NID 0x0a
14903 static hda_nid_t alc662_dac_nids[4] = {
14904 /* front, rear, clfe, rear_surr */
14908 static hda_nid_t alc662_adc_nids[1] = {
14913 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14916 /* FIXME: should be a matrix-type input source selection */
14917 static struct hda_input_mux alc662_capture_source = {
14921 { "Front Mic", 0x1 },
14927 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14935 static struct hda_input_mux alc662_eeepc_capture_source = {
14943 static struct hda_input_mux alc663_capture_source = {
14947 { "Front Mic", 0x1 },
14952 static struct hda_input_mux alc663_m51va_capture_source = {
14955 { "Ext-Mic", 0x0 },
14963 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14970 static struct hda_verb alc662_3ST_ch2_init[] = {
14971 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14972 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14973 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14974 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14981 static struct hda_verb alc662_3ST_ch6_init[] = {
14982 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14983 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14984 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14985 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14986 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14987 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14991 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14992 { 2, alc662_3ST_ch2_init },
14993 { 6, alc662_3ST_ch6_init },
14999 static struct hda_verb alc662_sixstack_ch6_init[] = {
15000 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15001 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15002 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15009 static struct hda_verb alc662_sixstack_ch8_init[] = {
15010 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15011 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15012 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15016 static struct hda_channel_mode alc662_5stack_modes[2] = {
15017 { 2, alc662_sixstack_ch6_init },
15018 { 6, alc662_sixstack_ch8_init },
15021 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15022 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15025 static struct snd_kcontrol_new alc662_base_mixer[] = {
15026 /* output mixer control */
15027 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15028 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15029 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15030 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15031 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15032 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15033 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15034 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15035 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15037 /*Input mixer control */
15038 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15039 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15040 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15041 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15042 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15043 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15044 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15045 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15049 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15050 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15051 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15052 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15053 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15054 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15055 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15056 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15059 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15060 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15061 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
15062 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15066 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15067 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15068 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15069 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15070 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15071 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15072 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15073 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15074 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15075 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15076 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15077 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15078 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15079 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15082 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15083 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15084 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
15085 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15089 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15090 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15091 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15092 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15093 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15102 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15103 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15105 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15106 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15108 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15109 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15110 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15112 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15113 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15114 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15118 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15119 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15120 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15121 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15122 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15123 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15124 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15125 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15126 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15127 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15128 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15136 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15137 .ops = &snd_hda_bind_vol,
15139 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15140 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15145 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15146 .ops = &snd_hda_bind_sw,
15148 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15149 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15154 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15155 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15156 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15157 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15158 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15162 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15163 .ops = &snd_hda_bind_sw,
15165 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15166 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15167 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15172 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15173 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15174 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15177 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15178 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15183 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15184 .ops = &snd_hda_bind_sw,
15186 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15187 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15188 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15193 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15194 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15195 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15198 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15199 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15203 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15204 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15205 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15208 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15209 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15210 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15214 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15215 .ops = &snd_hda_bind_vol,
15217 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15218 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15223 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15224 .ops = &snd_hda_bind_sw,
15226 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15227 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15232 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15233 HDA_BIND_VOL("Master Playback Volume",
15234 &alc663_asus_two_bind_master_vol),
15235 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15236 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15237 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15243 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15244 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15245 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15246 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15253 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15254 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15255 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15256 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15257 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15260 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15261 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15262 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15263 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15267 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15268 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15269 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15270 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15274 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15275 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15276 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15277 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15281 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15283 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15284 .name = "Channel Mode",
15285 .info = alc_ch_mode_info,
15286 .get = alc_ch_mode_get,
15287 .put = alc_ch_mode_put,
15292 static struct hda_verb alc662_init_verbs[] = {
15293 /* ADC: mute amp left and right */
15294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15295 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15296 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15306 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15307 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15308 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15309 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15311 /* Front Pin: output 0 (0x0c) */
15312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15313 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15315 /* Rear Pin: output 1 (0x0d) */
15316 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15317 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15319 /* CLFE Pin: output 2 (0x0e) */
15320 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15321 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15323 /* Mic (rear) pin: input vref at 80% */
15324 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15325 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15326 /* Front Mic pin: input vref at 80% */
15327 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15328 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15329 /* Line In pin: input */
15330 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15331 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15332 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15333 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15334 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15335 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15336 /* CD pin widget for input */
15337 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15339 /* FIXME: use matrix-type input source selection */
15340 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15350 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15352 /* always trun on EAPD */
15353 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15354 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15359 static struct hda_verb alc662_sue_init_verbs[] = {
15360 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15361 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15365 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15366 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15367 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15371 /* Set Unsolicited Event*/
15372 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15373 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15374 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15379 * generic initialization of ADC, input mixers and output mixers
15381 static struct hda_verb alc662_auto_init_verbs[] = {
15383 * Unmute ADC and set the default input to mic-in
15385 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15386 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15388 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15390 * Note: PASD motherboards uses the Line In 2 as the input for front
15391 * panel mic (mic 2)
15393 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15394 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15395 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15401 * Set up output mixers (0x0c - 0x0f)
15403 /* set vol=0 to output mixers */
15404 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15405 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15406 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15408 /* set up input amps for analog loopback */
15409 /* Amp Indices: DAC = 0, mixer = 1 */
15410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15411 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15412 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15413 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15415 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15418 /* FIXME: use matrix-type input source selection */
15419 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15422 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15426 /* additional verbs for ALC663 */
15427 static struct hda_verb alc663_auto_init_verbs[] = {
15428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15429 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15433 static struct hda_verb alc663_m51va_init_verbs[] = {
15434 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15435 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15436 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15437 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15438 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15439 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15441 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15442 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15446 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15447 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15448 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15449 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15452 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15453 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15457 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15458 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15459 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15460 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15461 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15464 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15465 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15469 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
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, 0x01}, /* 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 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15480 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15481 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15482 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15483 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15484 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15486 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15490 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15491 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15492 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15496 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15497 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15498 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15499 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15500 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15501 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15502 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15503 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15506 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15507 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15508 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15512 static struct hda_verb alc663_g71v_init_verbs[] = {
15513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15514 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15515 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15517 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15518 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15519 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15521 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15522 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15523 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15527 static struct hda_verb alc663_g50v_init_verbs[] = {
15528 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15529 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15530 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15532 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15533 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15537 static struct hda_verb alc662_ecs_init_verbs[] = {
15538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15539 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15540 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15541 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15545 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15546 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15547 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15551 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15553 unsigned int present;
15554 unsigned char bits;
15556 present = snd_hda_codec_read(codec, 0x14, 0,
15557 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15558 bits = present ? HDA_AMP_MUTE : 0;
15559 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15560 HDA_AMP_MUTE, bits);
15563 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15565 unsigned int present;
15566 unsigned char bits;
15568 present = snd_hda_codec_read(codec, 0x1b, 0,
15569 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15570 bits = present ? HDA_AMP_MUTE : 0;
15571 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15572 HDA_AMP_MUTE, bits);
15573 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15574 HDA_AMP_MUTE, bits);
15577 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15580 if ((res >> 26) == ALC880_HP_EVENT)
15581 alc662_lenovo_101e_all_automute(codec);
15582 if ((res >> 26) == ALC880_FRONT_EVENT)
15583 alc662_lenovo_101e_ispeaker_automute(codec);
15586 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15588 unsigned int present;
15590 present = snd_hda_codec_read(codec, 0x18, 0,
15591 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15592 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15593 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15594 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15595 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15596 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15597 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15598 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15599 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15602 /* unsolicited event for HP jack sensing */
15603 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15606 if ((res >> 26) == ALC880_HP_EVENT)
15607 alc262_hippo1_automute( codec );
15609 if ((res >> 26) == ALC880_MIC_EVENT)
15610 alc662_eeepc_mic_automute(codec);
15613 static void alc662_eeepc_inithook(struct hda_codec *codec)
15615 alc262_hippo1_automute( codec );
15616 alc662_eeepc_mic_automute(codec);
15619 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15622 unsigned int present;
15624 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15625 present = snd_hda_codec_read(codec, 0x14, 0,
15626 AC_VERB_GET_PIN_SENSE, 0);
15627 present = (present & 0x80000000) != 0;
15629 /* mute internal speaker */
15630 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15631 HDA_AMP_MUTE, HDA_AMP_MUTE);
15633 /* unmute internal speaker if necessary */
15634 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15635 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15636 HDA_AMP_MUTE, mute);
15640 /* unsolicited event for HP jack sensing */
15641 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15644 if ((res >> 26) == ALC880_HP_EVENT)
15645 alc662_eeepc_ep20_automute(codec);
15648 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15650 alc662_eeepc_ep20_automute(codec);
15653 static void alc663_m51va_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);
15668 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15670 unsigned int present;
15671 unsigned char bits;
15673 present = snd_hda_codec_read(codec, 0x21, 0,
15674 AC_VERB_GET_PIN_SENSE, 0)
15675 & AC_PINSENSE_PRESENCE;
15676 bits = present ? HDA_AMP_MUTE : 0;
15677 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15678 AMP_IN_MUTE(0), bits);
15679 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15680 AMP_IN_MUTE(0), bits);
15681 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15682 AMP_IN_MUTE(0), bits);
15683 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15684 AMP_IN_MUTE(0), bits);
15687 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15689 unsigned int present;
15690 unsigned char bits;
15692 present = snd_hda_codec_read(codec, 0x15, 0,
15693 AC_VERB_GET_PIN_SENSE, 0)
15694 & AC_PINSENSE_PRESENCE;
15695 bits = present ? HDA_AMP_MUTE : 0;
15696 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15697 AMP_IN_MUTE(0), bits);
15698 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15699 AMP_IN_MUTE(0), bits);
15700 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15701 AMP_IN_MUTE(0), bits);
15702 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15703 AMP_IN_MUTE(0), bits);
15706 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15708 unsigned int present;
15709 unsigned char bits;
15711 present = snd_hda_codec_read(codec, 0x1b, 0,
15712 AC_VERB_GET_PIN_SENSE, 0)
15713 & AC_PINSENSE_PRESENCE;
15714 bits = present ? 0 : PIN_OUT;
15715 snd_hda_codec_write(codec, 0x14, 0,
15716 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15719 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15721 unsigned int present1, present2;
15723 present1 = snd_hda_codec_read(codec, 0x21, 0,
15724 AC_VERB_GET_PIN_SENSE, 0)
15725 & AC_PINSENSE_PRESENCE;
15726 present2 = snd_hda_codec_read(codec, 0x15, 0,
15727 AC_VERB_GET_PIN_SENSE, 0)
15728 & AC_PINSENSE_PRESENCE;
15730 if (present1 || present2) {
15731 snd_hda_codec_write_cache(codec, 0x14, 0,
15732 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15734 snd_hda_codec_write_cache(codec, 0x14, 0,
15735 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15739 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15741 unsigned int present1, present2;
15743 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15744 AC_VERB_GET_PIN_SENSE, 0)
15745 & AC_PINSENSE_PRESENCE;
15746 present2 = snd_hda_codec_read(codec, 0x15, 0,
15747 AC_VERB_GET_PIN_SENSE, 0)
15748 & AC_PINSENSE_PRESENCE;
15750 if (present1 || present2) {
15751 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15752 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15753 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15754 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15756 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15757 AMP_IN_MUTE(0), 0);
15758 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15759 AMP_IN_MUTE(0), 0);
15763 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15765 unsigned int present;
15767 present = snd_hda_codec_read(codec, 0x18, 0,
15768 AC_VERB_GET_PIN_SENSE, 0)
15769 & AC_PINSENSE_PRESENCE;
15770 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15771 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15772 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15773 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15774 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15775 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15776 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15777 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15780 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15783 switch (res >> 26) {
15784 case ALC880_HP_EVENT:
15785 alc663_m51va_speaker_automute(codec);
15787 case ALC880_MIC_EVENT:
15788 alc663_m51va_mic_automute(codec);
15793 static void alc663_m51va_inithook(struct hda_codec *codec)
15795 alc663_m51va_speaker_automute(codec);
15796 alc663_m51va_mic_automute(codec);
15799 /* ***************** Mode1 ******************************/
15800 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15803 switch (res >> 26) {
15804 case ALC880_HP_EVENT:
15805 alc663_m51va_speaker_automute(codec);
15807 case ALC880_MIC_EVENT:
15808 alc662_eeepc_mic_automute(codec);
15813 static void alc663_mode1_inithook(struct hda_codec *codec)
15815 alc663_m51va_speaker_automute(codec);
15816 alc662_eeepc_mic_automute(codec);
15818 /* ***************** Mode2 ******************************/
15819 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15822 switch (res >> 26) {
15823 case ALC880_HP_EVENT:
15824 alc662_f5z_speaker_automute(codec);
15826 case ALC880_MIC_EVENT:
15827 alc662_eeepc_mic_automute(codec);
15832 static void alc662_mode2_inithook(struct hda_codec *codec)
15834 alc662_f5z_speaker_automute(codec);
15835 alc662_eeepc_mic_automute(codec);
15837 /* ***************** Mode3 ******************************/
15838 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15841 switch (res >> 26) {
15842 case ALC880_HP_EVENT:
15843 alc663_two_hp_m1_speaker_automute(codec);
15845 case ALC880_MIC_EVENT:
15846 alc662_eeepc_mic_automute(codec);
15851 static void alc663_mode3_inithook(struct hda_codec *codec)
15853 alc663_two_hp_m1_speaker_automute(codec);
15854 alc662_eeepc_mic_automute(codec);
15856 /* ***************** Mode4 ******************************/
15857 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15860 switch (res >> 26) {
15861 case ALC880_HP_EVENT:
15862 alc663_21jd_two_speaker_automute(codec);
15864 case ALC880_MIC_EVENT:
15865 alc662_eeepc_mic_automute(codec);
15870 static void alc663_mode4_inithook(struct hda_codec *codec)
15872 alc663_21jd_two_speaker_automute(codec);
15873 alc662_eeepc_mic_automute(codec);
15875 /* ***************** Mode5 ******************************/
15876 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15879 switch (res >> 26) {
15880 case ALC880_HP_EVENT:
15881 alc663_15jd_two_speaker_automute(codec);
15883 case ALC880_MIC_EVENT:
15884 alc662_eeepc_mic_automute(codec);
15889 static void alc663_mode5_inithook(struct hda_codec *codec)
15891 alc663_15jd_two_speaker_automute(codec);
15892 alc662_eeepc_mic_automute(codec);
15894 /* ***************** Mode6 ******************************/
15895 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15898 switch (res >> 26) {
15899 case ALC880_HP_EVENT:
15900 alc663_two_hp_m2_speaker_automute(codec);
15902 case ALC880_MIC_EVENT:
15903 alc662_eeepc_mic_automute(codec);
15908 static void alc663_mode6_inithook(struct hda_codec *codec)
15910 alc663_two_hp_m2_speaker_automute(codec);
15911 alc662_eeepc_mic_automute(codec);
15914 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15916 unsigned int present;
15917 unsigned char bits;
15919 present = snd_hda_codec_read(codec, 0x21, 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, 0x15, HDA_OUTPUT, 0,
15924 HDA_AMP_MUTE, bits);
15925 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15926 HDA_AMP_MUTE, bits);
15929 static void alc663_g71v_front_automute(struct hda_codec *codec)
15931 unsigned int present;
15932 unsigned char bits;
15934 present = snd_hda_codec_read(codec, 0x15, 0,
15935 AC_VERB_GET_PIN_SENSE, 0)
15936 & AC_PINSENSE_PRESENCE;
15937 bits = present ? HDA_AMP_MUTE : 0;
15938 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15939 HDA_AMP_MUTE, bits);
15942 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15945 switch (res >> 26) {
15946 case ALC880_HP_EVENT:
15947 alc663_g71v_hp_automute(codec);
15949 case ALC880_FRONT_EVENT:
15950 alc663_g71v_front_automute(codec);
15952 case ALC880_MIC_EVENT:
15953 alc662_eeepc_mic_automute(codec);
15958 static void alc663_g71v_inithook(struct hda_codec *codec)
15960 alc663_g71v_front_automute(codec);
15961 alc663_g71v_hp_automute(codec);
15962 alc662_eeepc_mic_automute(codec);
15965 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15968 switch (res >> 26) {
15969 case ALC880_HP_EVENT:
15970 alc663_m51va_speaker_automute(codec);
15972 case ALC880_MIC_EVENT:
15973 alc662_eeepc_mic_automute(codec);
15978 static void alc663_g50v_inithook(struct hda_codec *codec)
15980 alc663_m51va_speaker_automute(codec);
15981 alc662_eeepc_mic_automute(codec);
15984 /* bind hp and internal speaker mute (with plug check) */
15985 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15986 struct snd_ctl_elem_value *ucontrol)
15988 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15989 long *valp = ucontrol->value.integer.value;
15992 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15994 valp[0] ? 0 : HDA_AMP_MUTE);
15995 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15997 valp[1] ? 0 : HDA_AMP_MUTE);
15999 alc262_hippo1_automute(codec);
16003 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16004 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16007 .name = "Master Playback Switch",
16008 .info = snd_hda_mixer_amp_switch_info,
16009 .get = snd_hda_mixer_amp_switch_get,
16010 .put = alc662_ecs_master_sw_put,
16011 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16014 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16015 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16016 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16018 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16019 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16020 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16024 #ifdef CONFIG_SND_HDA_POWER_SAVE
16025 #define alc662_loopbacks alc880_loopbacks
16029 /* pcm configuration: identiacal with ALC880 */
16030 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16031 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16032 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16033 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16036 * configuration and preset
16038 static const char *alc662_models[ALC662_MODEL_LAST] = {
16039 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16040 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16041 [ALC662_3ST_6ch] = "3stack-6ch",
16042 [ALC662_5ST_DIG] = "6stack-dig",
16043 [ALC662_LENOVO_101E] = "lenovo-101e",
16044 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16045 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16046 [ALC662_ECS] = "ecs",
16047 [ALC663_ASUS_M51VA] = "m51va",
16048 [ALC663_ASUS_G71V] = "g71v",
16049 [ALC663_ASUS_H13] = "h13",
16050 [ALC663_ASUS_G50V] = "g50v",
16051 [ALC663_ASUS_MODE1] = "asus-mode1",
16052 [ALC662_ASUS_MODE2] = "asus-mode2",
16053 [ALC663_ASUS_MODE3] = "asus-mode3",
16054 [ALC663_ASUS_MODE4] = "asus-mode4",
16055 [ALC663_ASUS_MODE5] = "asus-mode5",
16056 [ALC663_ASUS_MODE6] = "asus-mode6",
16057 [ALC662_AUTO] = "auto",
16060 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16061 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16062 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16063 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16064 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16065 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16066 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16067 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
16068 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16069 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16070 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16071 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
16072 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16073 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16074 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16075 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16076 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16077 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16078 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16079 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16080 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16081 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16082 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16083 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16084 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16085 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16086 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16087 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16088 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16089 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16090 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16091 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16092 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16093 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16094 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16095 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16096 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16097 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16098 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16099 ALC662_3ST_6ch_DIG),
16100 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16101 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16102 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16103 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16104 ALC662_3ST_6ch_DIG),
16105 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16106 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16107 ALC662_3ST_6ch_DIG),
16108 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
16109 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
16110 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
16114 static struct alc_config_preset alc662_presets[] = {
16115 [ALC662_3ST_2ch_DIG] = {
16116 .mixers = { alc662_3ST_2ch_mixer },
16117 .init_verbs = { alc662_init_verbs },
16118 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16119 .dac_nids = alc662_dac_nids,
16120 .dig_out_nid = ALC662_DIGOUT_NID,
16121 .dig_in_nid = ALC662_DIGIN_NID,
16122 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16123 .channel_mode = alc662_3ST_2ch_modes,
16124 .input_mux = &alc662_capture_source,
16126 [ALC662_3ST_6ch_DIG] = {
16127 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16128 .init_verbs = { alc662_init_verbs },
16129 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16130 .dac_nids = alc662_dac_nids,
16131 .dig_out_nid = ALC662_DIGOUT_NID,
16132 .dig_in_nid = ALC662_DIGIN_NID,
16133 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16134 .channel_mode = alc662_3ST_6ch_modes,
16136 .input_mux = &alc662_capture_source,
16138 [ALC662_3ST_6ch] = {
16139 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16140 .init_verbs = { alc662_init_verbs },
16141 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16142 .dac_nids = alc662_dac_nids,
16143 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16144 .channel_mode = alc662_3ST_6ch_modes,
16146 .input_mux = &alc662_capture_source,
16148 [ALC662_5ST_DIG] = {
16149 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16150 .init_verbs = { alc662_init_verbs },
16151 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16152 .dac_nids = alc662_dac_nids,
16153 .dig_out_nid = ALC662_DIGOUT_NID,
16154 .dig_in_nid = ALC662_DIGIN_NID,
16155 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16156 .channel_mode = alc662_5stack_modes,
16157 .input_mux = &alc662_capture_source,
16159 [ALC662_LENOVO_101E] = {
16160 .mixers = { alc662_lenovo_101e_mixer },
16161 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16162 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16163 .dac_nids = alc662_dac_nids,
16164 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16165 .channel_mode = alc662_3ST_2ch_modes,
16166 .input_mux = &alc662_lenovo_101e_capture_source,
16167 .unsol_event = alc662_lenovo_101e_unsol_event,
16168 .init_hook = alc662_lenovo_101e_all_automute,
16170 [ALC662_ASUS_EEEPC_P701] = {
16171 .mixers = { alc662_eeepc_p701_mixer },
16172 .init_verbs = { alc662_init_verbs,
16173 alc662_eeepc_sue_init_verbs },
16174 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16175 .dac_nids = alc662_dac_nids,
16176 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16177 .channel_mode = alc662_3ST_2ch_modes,
16178 .input_mux = &alc662_eeepc_capture_source,
16179 .unsol_event = alc662_eeepc_unsol_event,
16180 .init_hook = alc662_eeepc_inithook,
16182 [ALC662_ASUS_EEEPC_EP20] = {
16183 .mixers = { alc662_eeepc_ep20_mixer,
16184 alc662_chmode_mixer },
16185 .init_verbs = { alc662_init_verbs,
16186 alc662_eeepc_ep20_sue_init_verbs },
16187 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16188 .dac_nids = alc662_dac_nids,
16189 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16190 .channel_mode = alc662_3ST_6ch_modes,
16191 .input_mux = &alc662_lenovo_101e_capture_source,
16192 .unsol_event = alc662_eeepc_ep20_unsol_event,
16193 .init_hook = alc662_eeepc_ep20_inithook,
16196 .mixers = { alc662_ecs_mixer },
16197 .init_verbs = { alc662_init_verbs,
16198 alc662_ecs_init_verbs },
16199 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16200 .dac_nids = alc662_dac_nids,
16201 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16202 .channel_mode = alc662_3ST_2ch_modes,
16203 .input_mux = &alc662_eeepc_capture_source,
16204 .unsol_event = alc662_eeepc_unsol_event,
16205 .init_hook = alc662_eeepc_inithook,
16207 [ALC663_ASUS_M51VA] = {
16208 .mixers = { alc663_m51va_mixer },
16209 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16210 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16211 .dac_nids = alc662_dac_nids,
16212 .dig_out_nid = ALC662_DIGOUT_NID,
16213 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16214 .channel_mode = alc662_3ST_2ch_modes,
16215 .input_mux = &alc663_m51va_capture_source,
16216 .unsol_event = alc663_m51va_unsol_event,
16217 .init_hook = alc663_m51va_inithook,
16219 [ALC663_ASUS_G71V] = {
16220 .mixers = { alc663_g71v_mixer },
16221 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16222 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16223 .dac_nids = alc662_dac_nids,
16224 .dig_out_nid = ALC662_DIGOUT_NID,
16225 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16226 .channel_mode = alc662_3ST_2ch_modes,
16227 .input_mux = &alc662_eeepc_capture_source,
16228 .unsol_event = alc663_g71v_unsol_event,
16229 .init_hook = alc663_g71v_inithook,
16231 [ALC663_ASUS_H13] = {
16232 .mixers = { alc663_m51va_mixer },
16233 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16234 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16235 .dac_nids = alc662_dac_nids,
16236 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16237 .channel_mode = alc662_3ST_2ch_modes,
16238 .input_mux = &alc663_m51va_capture_source,
16239 .unsol_event = alc663_m51va_unsol_event,
16240 .init_hook = alc663_m51va_inithook,
16242 [ALC663_ASUS_G50V] = {
16243 .mixers = { alc663_g50v_mixer },
16244 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16245 .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_6ch_modes),
16249 .channel_mode = alc662_3ST_6ch_modes,
16250 .input_mux = &alc663_capture_source,
16251 .unsol_event = alc663_g50v_unsol_event,
16252 .init_hook = alc663_g50v_inithook,
16254 [ALC663_ASUS_MODE1] = {
16255 .mixers = { alc663_m51va_mixer },
16256 .cap_mixer = alc662_auto_capture_mixer,
16257 .init_verbs = { alc662_init_verbs,
16258 alc663_21jd_amic_init_verbs },
16259 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16261 .dac_nids = alc662_dac_nids,
16262 .dig_out_nid = ALC662_DIGOUT_NID,
16263 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16264 .channel_mode = alc662_3ST_2ch_modes,
16265 .input_mux = &alc662_eeepc_capture_source,
16266 .unsol_event = alc663_mode1_unsol_event,
16267 .init_hook = alc663_mode1_inithook,
16269 [ALC662_ASUS_MODE2] = {
16270 .mixers = { alc662_1bjd_mixer },
16271 .cap_mixer = alc662_auto_capture_mixer,
16272 .init_verbs = { alc662_init_verbs,
16273 alc662_1bjd_amic_init_verbs },
16274 .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 = alc662_mode2_unsol_event,
16281 .init_hook = alc662_mode2_inithook,
16283 [ALC663_ASUS_MODE3] = {
16284 .mixers = { alc663_two_hp_m1_mixer },
16285 .cap_mixer = alc662_auto_capture_mixer,
16286 .init_verbs = { alc662_init_verbs,
16287 alc663_two_hp_amic_m1_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_mode3_unsol_event,
16296 .init_hook = alc663_mode3_inithook,
16298 [ALC663_ASUS_MODE4] = {
16299 .mixers = { alc663_asus_21jd_clfe_mixer },
16300 .cap_mixer = alc662_auto_capture_mixer,
16301 .init_verbs = { alc662_init_verbs,
16302 alc663_21jd_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_mode4_unsol_event,
16311 .init_hook = alc663_mode4_inithook,
16313 [ALC663_ASUS_MODE5] = {
16314 .mixers = { alc663_asus_15jd_clfe_mixer },
16315 .cap_mixer = alc662_auto_capture_mixer,
16316 .init_verbs = { alc662_init_verbs,
16317 alc663_15jd_amic_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_mode5_unsol_event,
16326 .init_hook = alc663_mode5_inithook,
16328 [ALC663_ASUS_MODE6] = {
16329 .mixers = { alc663_two_hp_m2_mixer },
16330 .cap_mixer = alc662_auto_capture_mixer,
16331 .init_verbs = { alc662_init_verbs,
16332 alc663_two_hp_amic_m2_init_verbs },
16333 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16335 .dac_nids = alc662_dac_nids,
16336 .dig_out_nid = ALC662_DIGOUT_NID,
16337 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16338 .channel_mode = alc662_3ST_2ch_modes,
16339 .input_mux = &alc662_eeepc_capture_source,
16340 .unsol_event = alc663_mode6_unsol_event,
16341 .init_hook = alc663_mode6_inithook,
16347 * BIOS auto configuration
16350 /* add playback controls from the parsed DAC table */
16351 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16352 const struct auto_pin_cfg *cfg)
16355 static const char *chname[4] = {
16356 "Front", "Surround", NULL /*CLFE*/, "Side"
16361 for (i = 0; i < cfg->line_outs; i++) {
16362 if (!spec->multiout.dac_nids[i])
16364 nid = alc880_idx_to_dac(i);
16367 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16368 "Center Playback Volume",
16369 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16373 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16374 "LFE Playback Volume",
16375 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16379 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16380 "Center Playback Switch",
16381 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16385 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16386 "LFE Playback Switch",
16387 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16392 sprintf(name, "%s Playback Volume", chname[i]);
16393 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16394 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16398 sprintf(name, "%s Playback Switch", chname[i]);
16399 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16400 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16409 /* add playback controls for speaker and HP outputs */
16410 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16421 /* ALC663 has a mono output pin on 0x17 */
16422 sprintf(name, "%s Playback Switch", pfx);
16423 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16424 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16428 if (alc880_is_fixed_pin(pin)) {
16429 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16430 /* printk("DAC nid=%x\n",nid); */
16431 /* specify the DAC as the extra output */
16432 if (!spec->multiout.hp_nid)
16433 spec->multiout.hp_nid = nid;
16435 spec->multiout.extra_out_nid[0] = nid;
16436 /* control HP volume/switch on the output mixer amp */
16437 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16438 sprintf(name, "%s Playback Volume", pfx);
16439 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16440 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16443 sprintf(name, "%s Playback Switch", pfx);
16444 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16445 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16448 } else if (alc880_is_multi_pin(pin)) {
16449 /* set manual connection */
16450 /* we have only a switch on HP-out PIN */
16451 sprintf(name, "%s Playback Switch", pfx);
16452 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16453 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16460 /* create playback/capture controls for input pins */
16461 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16462 const struct auto_pin_cfg *cfg)
16464 struct hda_input_mux *imux = &spec->private_imux[0];
16467 for (i = 0; i < AUTO_PIN_LAST; i++) {
16468 if (alc880_is_input_pin(cfg->input_pins[i])) {
16469 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16470 err = new_analog_input(spec, cfg->input_pins[i],
16471 auto_pin_cfg_labels[i],
16475 imux->items[imux->num_items].label =
16476 auto_pin_cfg_labels[i];
16477 imux->items[imux->num_items].index =
16478 alc880_input_pin_idx(cfg->input_pins[i]);
16485 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16486 hda_nid_t nid, int pin_type,
16489 alc_set_pin_output(codec, nid, pin_type);
16490 /* need the manual connection? */
16491 if (alc880_is_multi_pin(nid)) {
16492 struct alc_spec *spec = codec->spec;
16493 int idx = alc880_multi_pin_idx(nid);
16494 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16495 AC_VERB_SET_CONNECT_SEL,
16496 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16500 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16502 struct alc_spec *spec = codec->spec;
16505 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16506 for (i = 0; i <= HDA_SIDE; i++) {
16507 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16508 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16510 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16515 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16517 struct alc_spec *spec = codec->spec;
16520 pin = spec->autocfg.hp_pins[0];
16521 if (pin) /* connect to front */
16523 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16524 pin = spec->autocfg.speaker_pins[0];
16526 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16529 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16530 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16532 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16534 struct alc_spec *spec = codec->spec;
16537 for (i = 0; i < AUTO_PIN_LAST; i++) {
16538 hda_nid_t nid = spec->autocfg.input_pins[i];
16539 if (alc662_is_input_pin(nid)) {
16540 snd_hda_codec_write(codec, nid, 0,
16541 AC_VERB_SET_PIN_WIDGET_CONTROL,
16542 (i <= AUTO_PIN_FRONT_MIC ?
16543 PIN_VREF80 : PIN_IN));
16544 if (nid != ALC662_PIN_CD_NID)
16545 snd_hda_codec_write(codec, nid, 0,
16546 AC_VERB_SET_AMP_GAIN_MUTE,
16552 #define alc662_auto_init_input_src alc882_auto_init_input_src
16554 static int alc662_parse_auto_config(struct hda_codec *codec)
16556 struct alc_spec *spec = codec->spec;
16558 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16560 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16564 if (!spec->autocfg.line_outs)
16565 return 0; /* can't find valid BIOS pin config */
16567 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16570 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16573 err = alc662_auto_create_extra_out(spec,
16574 spec->autocfg.speaker_pins[0],
16578 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16582 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16586 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16588 if (spec->autocfg.dig_out_pin)
16589 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16591 if (spec->kctls.list)
16592 add_mixer(spec, spec->kctls.list);
16594 spec->num_mux_defs = 1;
16595 spec->input_mux = &spec->private_imux[0];
16597 add_verb(spec, alc662_auto_init_verbs);
16598 if (codec->vendor_id == 0x10ec0663)
16599 add_verb(spec, alc663_auto_init_verbs);
16601 err = alc_auto_add_mic_boost(codec);
16605 store_pin_configs(codec);
16609 /* additional initialization for auto-configuration model */
16610 static void alc662_auto_init(struct hda_codec *codec)
16612 struct alc_spec *spec = codec->spec;
16613 alc662_auto_init_multi_out(codec);
16614 alc662_auto_init_hp_out(codec);
16615 alc662_auto_init_analog_input(codec);
16616 alc662_auto_init_input_src(codec);
16617 if (spec->unsol_event)
16618 alc_inithook(codec);
16621 static int patch_alc662(struct hda_codec *codec)
16623 struct alc_spec *spec;
16624 int err, board_config;
16626 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16630 codec->spec = spec;
16632 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16634 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16637 if (board_config < 0) {
16638 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16639 "trying auto-probe from BIOS...\n");
16640 board_config = ALC662_AUTO;
16643 if (board_config == ALC662_AUTO) {
16644 /* automatic parse from the BIOS config */
16645 err = alc662_parse_auto_config(codec);
16651 "hda_codec: Cannot set up configuration "
16652 "from BIOS. Using base mode...\n");
16653 board_config = ALC662_3ST_2ch_DIG;
16657 if (board_config != ALC662_AUTO)
16658 setup_preset(spec, &alc662_presets[board_config]);
16660 if (codec->vendor_id == 0x10ec0663) {
16661 spec->stream_name_analog = "ALC663 Analog";
16662 spec->stream_name_digital = "ALC663 Digital";
16663 } else if (codec->vendor_id == 0x10ec0272) {
16664 spec->stream_name_analog = "ALC272 Analog";
16665 spec->stream_name_digital = "ALC272 Digital";
16667 spec->stream_name_analog = "ALC662 Analog";
16668 spec->stream_name_digital = "ALC662 Digital";
16671 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16672 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16674 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16675 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16677 spec->adc_nids = alc662_adc_nids;
16678 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16679 spec->capsrc_nids = alc662_capsrc_nids;
16680 spec->capture_style = CAPT_MIX;
16682 if (!spec->cap_mixer)
16683 set_capture_mixer(spec);
16685 spec->vmaster_nid = 0x02;
16687 codec->patch_ops = alc_patch_ops;
16688 if (board_config == ALC662_AUTO)
16689 spec->init_hook = alc662_auto_init;
16690 #ifdef CONFIG_SND_HDA_POWER_SAVE
16691 if (!spec->loopback.amplist)
16692 spec->loopback.amplist = alc662_loopbacks;
16694 codec->proc_widget_hook = print_realtek_coef;
16702 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16703 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16704 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16705 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16706 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16707 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16708 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16709 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16710 .patch = patch_alc861 },
16711 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16712 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16713 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16714 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16715 .patch = patch_alc883 },
16716 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16717 .patch = patch_alc662 },
16718 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16719 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16720 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16721 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16722 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16723 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16724 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16725 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16726 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16727 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16728 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16729 .patch = patch_alc883 },
16730 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16731 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16732 {} /* terminator */
16735 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16737 MODULE_LICENSE("GPL");
16738 MODULE_DESCRIPTION("Realtek HD-audio codec");
16740 static struct hda_codec_preset_list realtek_list = {
16741 .preset = snd_hda_preset_realtek,
16742 .owner = THIS_MODULE,
16745 static int __init patch_realtek_init(void)
16747 return snd_hda_add_codec_preset(&realtek_list);
16750 static void __exit patch_realtek_exit(void)
16752 snd_hda_delete_codec_preset(&realtek_list);
16755 module_init(patch_realtek_init)
16756 module_exit(patch_realtek_exit)