2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
218 ALC883_TARGA_2ch_DIG,
221 ALC888_ACER_ASPIRE_4930G,
225 ALC883_LENOVO_101E_2ch,
226 ALC883_LENOVO_NB0763,
227 ALC888_LENOVO_MS7195_DIG,
234 ALC883_FUJITSU_PI2515,
235 ALC888_FUJITSU_XA3530,
236 ALC883_3ST_6ch_INTEL,
244 /* styles of capture selection */
246 CAPT_MUX = 0, /* only mux based */
247 CAPT_MIX, /* only mixer based */
248 CAPT_1MUX_MIX, /* first mux and other mixers */
252 #define GPIO_MASK 0x03
255 /* codec parameterization */
256 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
257 unsigned int num_mixers;
258 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
259 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
261 const struct hda_verb *init_verbs[5]; /* initialization verbs
265 unsigned int num_init_verbs;
267 char *stream_name_analog; /* analog PCM stream */
268 struct hda_pcm_stream *stream_analog_playback;
269 struct hda_pcm_stream *stream_analog_capture;
270 struct hda_pcm_stream *stream_analog_alt_playback;
271 struct hda_pcm_stream *stream_analog_alt_capture;
273 char *stream_name_digital; /* digital PCM stream */
274 struct hda_pcm_stream *stream_digital_playback;
275 struct hda_pcm_stream *stream_digital_capture;
278 struct hda_multi_out multiout; /* playback set-up
279 * max_channels, dacs must be set
280 * dig_out_nid and hp_nid are optional
282 hda_nid_t alt_dac_nid;
283 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
287 unsigned int num_adc_nids;
289 hda_nid_t *capsrc_nids;
290 hda_nid_t dig_in_nid; /* digital-in NID; optional */
291 int capture_style; /* capture style (CAPT_*) */
294 unsigned int num_mux_defs;
295 const struct hda_input_mux *input_mux;
296 unsigned int cur_mux[3];
299 const struct hda_channel_mode *channel_mode;
300 int num_channel_mode;
303 /* PCM information */
304 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
306 /* dynamic controls, init_verbs and input_mux */
307 struct auto_pin_cfg autocfg;
308 struct snd_array kctls;
309 struct hda_input_mux private_imux[3];
310 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
313 void (*init_hook)(struct hda_codec *codec);
314 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
316 /* for pin sensing */
317 unsigned int sense_updated: 1;
318 unsigned int jack_present: 1;
319 unsigned int master_sw: 1;
322 unsigned int no_analog :1; /* digital I/O only */
324 /* for virtual master */
325 hda_nid_t vmaster_nid;
326 #ifdef CONFIG_SND_HDA_POWER_SAVE
327 struct hda_loopback_check loopback;
332 unsigned int pll_coef_idx, pll_coef_bit;
336 * configuration template - to be copied to the spec instance
338 struct alc_config_preset {
339 struct snd_kcontrol_new *mixers[5]; /* should be identical size
342 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
343 const struct hda_verb *init_verbs[5];
344 unsigned int num_dacs;
346 hda_nid_t dig_out_nid; /* optional */
347 hda_nid_t hp_nid; /* optional */
348 hda_nid_t *slave_dig_outs;
349 unsigned int num_adc_nids;
351 hda_nid_t *capsrc_nids;
352 hda_nid_t dig_in_nid;
353 unsigned int num_channel_mode;
354 const struct hda_channel_mode *channel_mode;
356 unsigned int num_mux_defs;
357 const struct hda_input_mux *input_mux;
358 void (*unsol_event)(struct hda_codec *, unsigned int);
359 void (*init_hook)(struct hda_codec *);
360 #ifdef CONFIG_SND_HDA_POWER_SAVE
361 struct hda_amp_list *loopbacks;
369 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
370 struct snd_ctl_elem_info *uinfo)
372 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
373 struct alc_spec *spec = codec->spec;
374 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
375 if (mux_idx >= spec->num_mux_defs)
377 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
380 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
381 struct snd_ctl_elem_value *ucontrol)
383 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
384 struct alc_spec *spec = codec->spec;
385 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
387 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
391 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
392 struct snd_ctl_elem_value *ucontrol)
394 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
395 struct alc_spec *spec = codec->spec;
396 const struct hda_input_mux *imux;
397 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
398 unsigned int mux_idx;
399 hda_nid_t nid = spec->capsrc_nids ?
400 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
402 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
403 imux = &spec->input_mux[mux_idx];
405 if (spec->capture_style &&
406 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
407 /* Matrix-mixer style (e.g. ALC882) */
408 unsigned int *cur_val = &spec->cur_mux[adc_idx];
411 idx = ucontrol->value.enumerated.item[0];
412 if (idx >= imux->num_items)
413 idx = imux->num_items - 1;
416 for (i = 0; i < imux->num_items; i++) {
417 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
418 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
419 imux->items[i].index,
425 /* MUX style (e.g. ALC880) */
426 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
427 &spec->cur_mux[adc_idx]);
432 * channel mode setting
434 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_info *uinfo)
437 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
438 struct alc_spec *spec = codec->spec;
439 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
440 spec->num_channel_mode);
443 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
444 struct snd_ctl_elem_value *ucontrol)
446 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
447 struct alc_spec *spec = codec->spec;
448 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
449 spec->num_channel_mode,
450 spec->multiout.max_channels);
453 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
454 struct snd_ctl_elem_value *ucontrol)
456 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
457 struct alc_spec *spec = codec->spec;
458 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
459 spec->num_channel_mode,
460 &spec->multiout.max_channels);
461 if (err >= 0 && spec->need_dac_fix)
462 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
467 * Control the mode of pin widget settings via the mixer. "pc" is used
468 * instead of "%" to avoid consequences of accidently treating the % as
469 * being part of a format specifier. Maximum allowed length of a value is
470 * 63 characters plus NULL terminator.
472 * Note: some retasking pin complexes seem to ignore requests for input
473 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
474 * are requested. Therefore order this list so that this behaviour will not
475 * cause problems when mixer clients move through the enum sequentially.
476 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
479 static char *alc_pin_mode_names[] = {
480 "Mic 50pc bias", "Mic 80pc bias",
481 "Line in", "Line out", "Headphone out",
483 static unsigned char alc_pin_mode_values[] = {
484 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
486 /* The control can present all 5 options, or it can limit the options based
487 * in the pin being assumed to be exclusively an input or an output pin. In
488 * addition, "input" pins may or may not process the mic bias option
489 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
490 * accept requests for bias as of chip versions up to March 2006) and/or
491 * wiring in the computer.
493 #define ALC_PIN_DIR_IN 0x00
494 #define ALC_PIN_DIR_OUT 0x01
495 #define ALC_PIN_DIR_INOUT 0x02
496 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
497 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
499 /* Info about the pin modes supported by the different pin direction modes.
500 * For each direction the minimum and maximum values are given.
502 static signed char alc_pin_mode_dir_info[5][2] = {
503 { 0, 2 }, /* ALC_PIN_DIR_IN */
504 { 3, 4 }, /* ALC_PIN_DIR_OUT */
505 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
506 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
507 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
509 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
510 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
511 #define alc_pin_mode_n_items(_dir) \
512 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
514 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
515 struct snd_ctl_elem_info *uinfo)
517 unsigned int item_num = uinfo->value.enumerated.item;
518 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
520 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
522 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
524 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
525 item_num = alc_pin_mode_min(dir);
526 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
530 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
531 struct snd_ctl_elem_value *ucontrol)
534 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
535 hda_nid_t nid = kcontrol->private_value & 0xffff;
536 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
537 long *valp = ucontrol->value.integer.value;
538 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
539 AC_VERB_GET_PIN_WIDGET_CONTROL,
542 /* Find enumerated value for current pinctl setting */
543 i = alc_pin_mode_min(dir);
544 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
546 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
550 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
551 struct snd_ctl_elem_value *ucontrol)
554 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
555 hda_nid_t nid = kcontrol->private_value & 0xffff;
556 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
557 long val = *ucontrol->value.integer.value;
558 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
559 AC_VERB_GET_PIN_WIDGET_CONTROL,
562 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
563 val = alc_pin_mode_min(dir);
565 change = pinctl != alc_pin_mode_values[val];
567 /* Set pin mode to that requested */
568 snd_hda_codec_write_cache(codec, nid, 0,
569 AC_VERB_SET_PIN_WIDGET_CONTROL,
570 alc_pin_mode_values[val]);
572 /* Also enable the retasking pin's input/output as required
573 * for the requested pin mode. Enum values of 2 or less are
576 * Dynamically switching the input/output buffers probably
577 * reduces noise slightly (particularly on input) so we'll
578 * do it. However, having both input and output buffers
579 * enabled simultaneously doesn't seem to be problematic if
580 * this turns out to be necessary in the future.
583 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
584 HDA_AMP_MUTE, HDA_AMP_MUTE);
585 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
588 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
589 HDA_AMP_MUTE, HDA_AMP_MUTE);
590 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
597 #define ALC_PIN_MODE(xname, nid, dir) \
598 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
599 .info = alc_pin_mode_info, \
600 .get = alc_pin_mode_get, \
601 .put = alc_pin_mode_put, \
602 .private_value = nid | (dir<<16) }
604 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
605 * together using a mask with more than one bit set. This control is
606 * currently used only by the ALC260 test model. At this stage they are not
607 * needed for any "production" models.
609 #ifdef CONFIG_SND_DEBUG
610 #define alc_gpio_data_info snd_ctl_boolean_mono_info
612 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
613 struct snd_ctl_elem_value *ucontrol)
615 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
616 hda_nid_t nid = kcontrol->private_value & 0xffff;
617 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
618 long *valp = ucontrol->value.integer.value;
619 unsigned int val = snd_hda_codec_read(codec, nid, 0,
620 AC_VERB_GET_GPIO_DATA, 0x00);
622 *valp = (val & mask) != 0;
625 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
626 struct snd_ctl_elem_value *ucontrol)
629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
630 hda_nid_t nid = kcontrol->private_value & 0xffff;
631 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
632 long val = *ucontrol->value.integer.value;
633 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
634 AC_VERB_GET_GPIO_DATA,
637 /* Set/unset the masked GPIO bit(s) as needed */
638 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
643 snd_hda_codec_write_cache(codec, nid, 0,
644 AC_VERB_SET_GPIO_DATA, gpio_data);
648 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
649 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
650 .info = alc_gpio_data_info, \
651 .get = alc_gpio_data_get, \
652 .put = alc_gpio_data_put, \
653 .private_value = nid | (mask<<16) }
654 #endif /* CONFIG_SND_DEBUG */
656 /* A switch control to allow the enabling of the digital IO pins on the
657 * ALC260. This is incredibly simplistic; the intention of this control is
658 * to provide something in the test model allowing digital outputs to be
659 * identified if present. If models are found which can utilise these
660 * outputs a more complete mixer control can be devised for those models if
663 #ifdef CONFIG_SND_DEBUG
664 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
666 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
667 struct snd_ctl_elem_value *ucontrol)
669 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
670 hda_nid_t nid = kcontrol->private_value & 0xffff;
671 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
672 long *valp = ucontrol->value.integer.value;
673 unsigned int val = snd_hda_codec_read(codec, nid, 0,
674 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
676 *valp = (val & mask) != 0;
679 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
680 struct snd_ctl_elem_value *ucontrol)
683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
684 hda_nid_t nid = kcontrol->private_value & 0xffff;
685 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
686 long val = *ucontrol->value.integer.value;
687 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
688 AC_VERB_GET_DIGI_CONVERT_1,
691 /* Set/unset the masked control bit(s) as needed */
692 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
697 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
702 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
703 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
704 .info = alc_spdif_ctrl_info, \
705 .get = alc_spdif_ctrl_get, \
706 .put = alc_spdif_ctrl_put, \
707 .private_value = nid | (mask<<16) }
708 #endif /* CONFIG_SND_DEBUG */
710 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
711 * Again, this is only used in the ALC26x test models to help identify when
712 * the EAPD line must be asserted for features to work.
714 #ifdef CONFIG_SND_DEBUG
715 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
717 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
718 struct snd_ctl_elem_value *ucontrol)
720 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
721 hda_nid_t nid = kcontrol->private_value & 0xffff;
722 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
723 long *valp = ucontrol->value.integer.value;
724 unsigned int val = snd_hda_codec_read(codec, nid, 0,
725 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
727 *valp = (val & mask) != 0;
731 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
732 struct snd_ctl_elem_value *ucontrol)
735 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
736 hda_nid_t nid = kcontrol->private_value & 0xffff;
737 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
738 long val = *ucontrol->value.integer.value;
739 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
740 AC_VERB_GET_EAPD_BTLENABLE,
743 /* Set/unset the masked control bit(s) as needed */
744 change = (!val ? 0 : mask) != (ctrl_data & mask);
749 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
755 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
756 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
757 .info = alc_eapd_ctrl_info, \
758 .get = alc_eapd_ctrl_get, \
759 .put = alc_eapd_ctrl_put, \
760 .private_value = nid | (mask<<16) }
761 #endif /* CONFIG_SND_DEBUG */
764 * set up the input pin config (depending on the given auto-pin type)
766 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
769 unsigned int val = PIN_IN;
771 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
773 pincap = snd_hda_query_pin_caps(codec, nid);
774 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
775 if (pincap & AC_PINCAP_VREF_80)
778 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
783 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
785 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
787 spec->mixers[spec->num_mixers++] = mix;
790 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
792 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
794 spec->init_verbs[spec->num_init_verbs++] = verb;
797 #ifdef CONFIG_PROC_FS
801 static void print_realtek_coef(struct snd_info_buffer *buffer,
802 struct hda_codec *codec, hda_nid_t nid)
808 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
809 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
810 coeff = snd_hda_codec_read(codec, nid, 0,
811 AC_VERB_GET_COEF_INDEX, 0);
812 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
815 #define print_realtek_coef NULL
819 * set up from the preset table
821 static void setup_preset(struct alc_spec *spec,
822 const struct alc_config_preset *preset)
826 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
827 add_mixer(spec, preset->mixers[i]);
828 spec->cap_mixer = preset->cap_mixer;
829 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
831 add_verb(spec, preset->init_verbs[i]);
833 spec->channel_mode = preset->channel_mode;
834 spec->num_channel_mode = preset->num_channel_mode;
835 spec->need_dac_fix = preset->need_dac_fix;
837 spec->multiout.max_channels = spec->channel_mode[0].channels;
839 spec->multiout.num_dacs = preset->num_dacs;
840 spec->multiout.dac_nids = preset->dac_nids;
841 spec->multiout.dig_out_nid = preset->dig_out_nid;
842 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
843 spec->multiout.hp_nid = preset->hp_nid;
845 spec->num_mux_defs = preset->num_mux_defs;
846 if (!spec->num_mux_defs)
847 spec->num_mux_defs = 1;
848 spec->input_mux = preset->input_mux;
850 spec->num_adc_nids = preset->num_adc_nids;
851 spec->adc_nids = preset->adc_nids;
852 spec->capsrc_nids = preset->capsrc_nids;
853 spec->dig_in_nid = preset->dig_in_nid;
855 spec->unsol_event = preset->unsol_event;
856 spec->init_hook = preset->init_hook;
857 #ifdef CONFIG_SND_HDA_POWER_SAVE
858 spec->loopback.amplist = preset->loopbacks;
862 /* Enable GPIO mask and set output */
863 static struct hda_verb alc_gpio1_init_verbs[] = {
864 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
865 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
866 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
870 static struct hda_verb alc_gpio2_init_verbs[] = {
871 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
872 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
873 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
877 static struct hda_verb alc_gpio3_init_verbs[] = {
878 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
879 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
880 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
885 * Fix hardware PLL issue
886 * On some codecs, the analog PLL gating control must be off while
887 * the default value is 1.
889 static void alc_fix_pll(struct hda_codec *codec)
891 struct alc_spec *spec = codec->spec;
896 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
898 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
899 AC_VERB_GET_PROC_COEF, 0);
900 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
902 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
903 val & ~(1 << spec->pll_coef_bit));
906 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
907 unsigned int coef_idx, unsigned int coef_bit)
909 struct alc_spec *spec = codec->spec;
911 spec->pll_coef_idx = coef_idx;
912 spec->pll_coef_bit = coef_bit;
916 static void alc_sku_automute(struct hda_codec *codec)
918 struct alc_spec *spec = codec->spec;
919 unsigned int present;
920 unsigned int hp_nid = spec->autocfg.hp_pins[0];
921 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
923 /* need to execute and sync at first */
924 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
925 present = snd_hda_codec_read(codec, hp_nid, 0,
926 AC_VERB_GET_PIN_SENSE, 0);
927 spec->jack_present = (present & 0x80000000) != 0;
928 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
929 spec->jack_present ? 0 : PIN_OUT);
932 #if 0 /* it's broken in some acses -- temporarily disabled */
933 static void alc_mic_automute(struct hda_codec *codec)
935 struct alc_spec *spec = codec->spec;
936 unsigned int present;
937 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
938 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
939 unsigned int mix_nid = spec->capsrc_nids[0];
940 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
942 capsrc_idx_mic = mic_nid - 0x18;
943 capsrc_idx_fmic = fmic_nid - 0x18;
944 present = snd_hda_codec_read(codec, mic_nid, 0,
945 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
946 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
947 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
948 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
949 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
950 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
951 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
954 #define alc_mic_automute(codec) do {} while(0) /* NOP */
955 #endif /* disabled */
957 /* unsolicited event for HP jack sensing */
958 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
960 if (codec->vendor_id == 0x10ec0880)
964 if (res == ALC880_HP_EVENT)
965 alc_sku_automute(codec);
967 if (res == ALC880_MIC_EVENT)
968 alc_mic_automute(codec);
971 static void alc_inithook(struct hda_codec *codec)
973 alc_sku_automute(codec);
974 alc_mic_automute(codec);
977 /* additional initialization for ALC888 variants */
978 static void alc888_coef_init(struct hda_codec *codec)
982 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
983 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
984 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
985 if ((tmp & 0xf0) == 0x20)
987 snd_hda_codec_read(codec, 0x20, 0,
988 AC_VERB_SET_PROC_COEF, 0x830);
991 snd_hda_codec_read(codec, 0x20, 0,
992 AC_VERB_SET_PROC_COEF, 0x3030);
995 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
996 * 31 ~ 16 : Manufacture ID
998 * 7 ~ 0 : Assembly ID
999 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1001 static void alc_subsystem_id(struct hda_codec *codec,
1002 unsigned int porta, unsigned int porte,
1005 unsigned int ass, tmp, i;
1007 struct alc_spec *spec = codec->spec;
1009 ass = codec->subsystem_id & 0xffff;
1010 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1014 * 31~30 : port conetcivity
1017 * 19~16 : Check sum (15:1)
1022 if (codec->vendor_id == 0x10ec0260)
1024 ass = snd_hda_codec_get_pincfg(codec, nid);
1025 snd_printd("realtek: No valid SSID, "
1026 "checking pincfg 0x%08x for NID 0x%x\n",
1028 if (!(ass & 1) && !(ass & 0x100000))
1030 if ((ass >> 30) != 1) /* no physical connection */
1035 for (i = 1; i < 16; i++) {
1039 if (((ass >> 16) & 0xf) != tmp)
1042 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1043 ass & 0xffff, codec->vendor_id);
1047 * 2 : 0 --> Desktop, 1 --> Laptop
1048 * 3~5 : External Amplifier control
1051 tmp = (ass & 0x38) >> 3; /* external Amp control */
1054 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1057 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1060 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1062 case 5: /* set EAPD output high */
1063 switch (codec->vendor_id) {
1065 snd_hda_codec_write(codec, 0x0f, 0,
1066 AC_VERB_SET_EAPD_BTLENABLE, 2);
1067 snd_hda_codec_write(codec, 0x10, 0,
1068 AC_VERB_SET_EAPD_BTLENABLE, 2);
1080 snd_hda_codec_write(codec, 0x14, 0,
1081 AC_VERB_SET_EAPD_BTLENABLE, 2);
1082 snd_hda_codec_write(codec, 0x15, 0,
1083 AC_VERB_SET_EAPD_BTLENABLE, 2);
1086 switch (codec->vendor_id) {
1088 snd_hda_codec_write(codec, 0x1a, 0,
1089 AC_VERB_SET_COEF_INDEX, 7);
1090 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1091 AC_VERB_GET_PROC_COEF, 0);
1092 snd_hda_codec_write(codec, 0x1a, 0,
1093 AC_VERB_SET_COEF_INDEX, 7);
1094 snd_hda_codec_write(codec, 0x1a, 0,
1095 AC_VERB_SET_PROC_COEF,
1105 snd_hda_codec_write(codec, 0x20, 0,
1106 AC_VERB_SET_COEF_INDEX, 7);
1107 tmp = snd_hda_codec_read(codec, 0x20, 0,
1108 AC_VERB_GET_PROC_COEF, 0);
1109 snd_hda_codec_write(codec, 0x20, 0,
1110 AC_VERB_SET_COEF_INDEX, 7);
1111 snd_hda_codec_write(codec, 0x20, 0,
1112 AC_VERB_SET_PROC_COEF,
1116 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1120 snd_hda_codec_write(codec, 0x20, 0,
1121 AC_VERB_SET_COEF_INDEX, 7);
1122 tmp = snd_hda_codec_read(codec, 0x20, 0,
1123 AC_VERB_GET_PROC_COEF, 0);
1124 snd_hda_codec_write(codec, 0x20, 0,
1125 AC_VERB_SET_COEF_INDEX, 7);
1126 snd_hda_codec_write(codec, 0x20, 0,
1127 AC_VERB_SET_PROC_COEF,
1135 /* is laptop or Desktop and enable the function "Mute internal speaker
1136 * when the external headphone out jack is plugged"
1138 if (!(ass & 0x8000))
1141 * 10~8 : Jack location
1142 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1144 * 15 : 1 --> enable the function "Mute internal speaker
1145 * when the external headphone out jack is plugged"
1147 if (!spec->autocfg.speaker_pins[0]) {
1148 if (spec->autocfg.line_out_pins[0])
1149 spec->autocfg.speaker_pins[0] =
1150 spec->autocfg.line_out_pins[0];
1155 if (!spec->autocfg.hp_pins[0]) {
1156 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1158 spec->autocfg.hp_pins[0] = porta;
1160 spec->autocfg.hp_pins[0] = porte;
1162 spec->autocfg.hp_pins[0] = portd;
1166 if (spec->autocfg.hp_pins[0])
1167 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1168 AC_VERB_SET_UNSOLICITED_ENABLE,
1169 AC_USRSP_EN | ALC880_HP_EVENT);
1171 #if 0 /* it's broken in some acses -- temporarily disabled */
1172 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1173 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1174 snd_hda_codec_write(codec,
1175 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1176 AC_VERB_SET_UNSOLICITED_ENABLE,
1177 AC_USRSP_EN | ALC880_MIC_EVENT);
1178 #endif /* disabled */
1180 spec->unsol_event = alc_sku_unsol_event;
1184 * Fix-up pin default configurations
1192 static void alc_fix_pincfg(struct hda_codec *codec,
1193 const struct snd_pci_quirk *quirk,
1194 const struct alc_pincfg **pinfix)
1196 const struct alc_pincfg *cfg;
1198 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1202 cfg = pinfix[quirk->value];
1203 for (; cfg->nid; cfg++)
1204 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1214 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1215 /* Mic-in jack as mic in */
1216 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1217 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1218 /* Line-in jack as Line in */
1219 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1220 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1221 /* Line-Out as Front */
1222 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1229 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1230 /* Mic-in jack as mic in */
1231 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1232 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1233 /* Line-in jack as Surround */
1234 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1235 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1236 /* Line-Out as Front */
1237 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1244 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1245 /* Mic-in jack as CLFE */
1246 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1247 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1248 /* Line-in jack as Surround */
1249 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1250 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1251 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1252 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1259 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1260 /* Mic-in jack as CLFE */
1261 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1262 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1263 /* Line-in jack as Surround */
1264 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1265 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1266 /* Line-Out as Side */
1267 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1271 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1272 { 2, alc888_4ST_ch2_intel_init },
1273 { 4, alc888_4ST_ch4_intel_init },
1274 { 6, alc888_4ST_ch6_intel_init },
1275 { 8, alc888_4ST_ch8_intel_init },
1279 * ALC888 Fujitsu Siemens Amillo xa3530
1282 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1283 /* Front Mic: set to PIN_IN (empty by default) */
1284 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1285 /* Connect Internal HP to Front */
1286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1287 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1288 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1289 /* Connect Bass HP to Front */
1290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1291 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1292 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1293 /* Connect Line-Out side jack (SPDIF) to Side */
1294 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1295 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1296 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1297 /* Connect Mic jack to CLFE */
1298 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1299 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1300 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1301 /* Connect Line-in jack to Surround */
1302 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1303 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1304 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1305 /* Connect HP out jack to Front */
1306 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1307 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1308 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1309 /* Enable unsolicited event for HP jack and Line-out jack */
1310 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1311 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1315 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1317 unsigned int present;
1319 /* Line out presence */
1320 present = snd_hda_codec_read(codec, 0x17, 0,
1321 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1322 /* HP out presence */
1323 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1324 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1325 bits = present ? HDA_AMP_MUTE : 0;
1326 /* Toggle internal speakers muting */
1327 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1328 HDA_AMP_MUTE, bits);
1329 /* Toggle internal bass muting */
1330 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1331 HDA_AMP_MUTE, bits);
1334 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1337 if (res >> 26 == ALC880_HP_EVENT)
1338 alc888_fujitsu_xa3530_automute(codec);
1343 * ALC888 Acer Aspire 4930G model
1346 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1347 /* Front Mic: set to PIN_IN (empty by default) */
1348 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1349 /* Unselect Front Mic by default in input mixer 3 */
1350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1351 /* Enable unsolicited event for HP jack */
1352 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1353 /* Connect Internal HP to front */
1354 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1355 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1356 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1357 /* Connect HP out to front */
1358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1359 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1360 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1364 static struct hda_input_mux alc888_2_capture_sources[2] = {
1365 /* Front mic only available on one ADC */
1372 { "Front Mic", 0xb },
1385 static struct snd_kcontrol_new alc888_base_mixer[] = {
1386 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1387 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1388 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1389 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1390 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1392 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1393 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1394 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1395 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1396 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1397 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1398 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1399 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1400 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1402 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1407 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1409 unsigned int present;
1411 present = snd_hda_codec_read(codec, 0x15, 0,
1412 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1413 bits = present ? HDA_AMP_MUTE : 0;
1414 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1415 HDA_AMP_MUTE, bits);
1418 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1421 if (res >> 26 == ALC880_HP_EVENT)
1422 alc888_acer_aspire_4930g_automute(codec);
1426 * ALC880 3-stack model
1428 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1429 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1430 * F-Mic = 0x1b, HP = 0x19
1433 static hda_nid_t alc880_dac_nids[4] = {
1434 /* front, rear, clfe, rear_surr */
1435 0x02, 0x05, 0x04, 0x03
1438 static hda_nid_t alc880_adc_nids[3] = {
1443 /* The datasheet says the node 0x07 is connected from inputs,
1444 * but it shows zero connection in the real implementation on some devices.
1445 * Note: this is a 915GAV bug, fixed on 915GLV
1447 static hda_nid_t alc880_adc_nids_alt[2] = {
1452 #define ALC880_DIGOUT_NID 0x06
1453 #define ALC880_DIGIN_NID 0x0a
1455 static struct hda_input_mux alc880_capture_source = {
1459 { "Front Mic", 0x3 },
1465 /* channel source setting (2/6 channel selection for 3-stack) */
1467 static struct hda_verb alc880_threestack_ch2_init[] = {
1468 /* set line-in to input, mute it */
1469 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1470 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1471 /* set mic-in to input vref 80%, mute it */
1472 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1473 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1478 static struct hda_verb alc880_threestack_ch6_init[] = {
1479 /* set line-in to output, unmute it */
1480 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1481 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1482 /* set mic-in to output, unmute it */
1483 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1484 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1488 static struct hda_channel_mode alc880_threestack_modes[2] = {
1489 { 2, alc880_threestack_ch2_init },
1490 { 6, alc880_threestack_ch6_init },
1493 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1495 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1496 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1497 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1498 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1499 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1500 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1501 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1502 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1503 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1504 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1505 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1508 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1509 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1512 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1513 .name = "Channel Mode",
1514 .info = alc_ch_mode_info,
1515 .get = alc_ch_mode_get,
1516 .put = alc_ch_mode_put,
1521 /* capture mixer elements */
1522 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1523 struct snd_ctl_elem_info *uinfo)
1525 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1526 struct alc_spec *spec = codec->spec;
1529 mutex_lock(&codec->control_mutex);
1530 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1532 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1533 mutex_unlock(&codec->control_mutex);
1537 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1538 unsigned int size, unsigned int __user *tlv)
1540 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1541 struct alc_spec *spec = codec->spec;
1544 mutex_lock(&codec->control_mutex);
1545 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1547 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1548 mutex_unlock(&codec->control_mutex);
1552 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1553 struct snd_ctl_elem_value *ucontrol);
1555 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1556 struct snd_ctl_elem_value *ucontrol,
1559 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1560 struct alc_spec *spec = codec->spec;
1561 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1564 mutex_lock(&codec->control_mutex);
1565 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1567 err = func(kcontrol, ucontrol);
1568 mutex_unlock(&codec->control_mutex);
1572 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1573 struct snd_ctl_elem_value *ucontrol)
1575 return alc_cap_getput_caller(kcontrol, ucontrol,
1576 snd_hda_mixer_amp_volume_get);
1579 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1580 struct snd_ctl_elem_value *ucontrol)
1582 return alc_cap_getput_caller(kcontrol, ucontrol,
1583 snd_hda_mixer_amp_volume_put);
1586 /* capture mixer elements */
1587 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1589 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1590 struct snd_ctl_elem_value *ucontrol)
1592 return alc_cap_getput_caller(kcontrol, ucontrol,
1593 snd_hda_mixer_amp_switch_get);
1596 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1597 struct snd_ctl_elem_value *ucontrol)
1599 return alc_cap_getput_caller(kcontrol, ucontrol,
1600 snd_hda_mixer_amp_switch_put);
1603 #define _DEFINE_CAPMIX(num) \
1605 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1606 .name = "Capture Switch", \
1607 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1609 .info = alc_cap_sw_info, \
1610 .get = alc_cap_sw_get, \
1611 .put = alc_cap_sw_put, \
1614 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1615 .name = "Capture Volume", \
1616 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1617 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1618 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1620 .info = alc_cap_vol_info, \
1621 .get = alc_cap_vol_get, \
1622 .put = alc_cap_vol_put, \
1623 .tlv = { .c = alc_cap_vol_tlv }, \
1626 #define _DEFINE_CAPSRC(num) \
1628 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1629 /* .name = "Capture Source", */ \
1630 .name = "Input Source", \
1632 .info = alc_mux_enum_info, \
1633 .get = alc_mux_enum_get, \
1634 .put = alc_mux_enum_put, \
1637 #define DEFINE_CAPMIX(num) \
1638 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1639 _DEFINE_CAPMIX(num), \
1640 _DEFINE_CAPSRC(num), \
1644 #define DEFINE_CAPMIX_NOSRC(num) \
1645 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1646 _DEFINE_CAPMIX(num), \
1650 /* up to three ADCs */
1654 DEFINE_CAPMIX_NOSRC(1);
1655 DEFINE_CAPMIX_NOSRC(2);
1656 DEFINE_CAPMIX_NOSRC(3);
1659 * ALC880 5-stack model
1661 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1663 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1664 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1667 /* additional mixers to alc880_three_stack_mixer */
1668 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1669 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1670 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1674 /* channel source setting (6/8 channel selection for 5-stack) */
1676 static struct hda_verb alc880_fivestack_ch6_init[] = {
1677 /* set line-in to input, mute it */
1678 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1679 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1684 static struct hda_verb alc880_fivestack_ch8_init[] = {
1685 /* set line-in to output, unmute it */
1686 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1687 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1691 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1692 { 6, alc880_fivestack_ch6_init },
1693 { 8, alc880_fivestack_ch8_init },
1698 * ALC880 6-stack model
1700 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1701 * Side = 0x05 (0x0f)
1702 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1703 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1706 static hda_nid_t alc880_6st_dac_nids[4] = {
1707 /* front, rear, clfe, rear_surr */
1708 0x02, 0x03, 0x04, 0x05
1711 static struct hda_input_mux alc880_6stack_capture_source = {
1715 { "Front Mic", 0x1 },
1721 /* fixed 8-channels */
1722 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1726 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1727 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1728 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1729 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1730 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1731 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1732 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1733 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1734 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1735 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1736 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1737 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1738 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1739 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1740 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1743 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1744 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1746 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1747 .name = "Channel Mode",
1748 .info = alc_ch_mode_info,
1749 .get = alc_ch_mode_get,
1750 .put = alc_ch_mode_put,
1759 * W810 has rear IO for:
1762 * Center/LFE (DAC 04)
1765 * The system also has a pair of internal speakers, and a headphone jack.
1766 * These are both connected to Line2 on the codec, hence to DAC 02.
1768 * There is a variable resistor to control the speaker or headphone
1769 * volume. This is a hardware-only device without a software API.
1771 * Plugging headphones in will disable the internal speakers. This is
1772 * implemented in hardware, not via the driver using jack sense. In
1773 * a similar fashion, plugging into the rear socket marked "front" will
1774 * disable both the speakers and headphones.
1776 * For input, there's a microphone jack, and an "audio in" jack.
1777 * These may not do anything useful with this driver yet, because I
1778 * haven't setup any initialization verbs for these yet...
1781 static hda_nid_t alc880_w810_dac_nids[3] = {
1782 /* front, rear/surround, clfe */
1786 /* fixed 6 channels */
1787 static struct hda_channel_mode alc880_w810_modes[1] = {
1791 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1792 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1793 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1794 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1796 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1797 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1798 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1799 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1800 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1801 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1809 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1810 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1814 static hda_nid_t alc880_z71v_dac_nids[1] = {
1817 #define ALC880_Z71V_HP_DAC 0x03
1819 /* fixed 2 channels */
1820 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1824 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1825 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1826 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1827 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1828 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1838 * ALC880 F1734 model
1840 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1841 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1844 static hda_nid_t alc880_f1734_dac_nids[1] = {
1847 #define ALC880_F1734_HP_DAC 0x02
1849 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1850 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1851 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1852 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1853 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1854 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1855 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1861 static struct hda_input_mux alc880_f1734_capture_source = {
1873 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1874 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1875 * Mic = 0x18, Line = 0x1a
1878 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1879 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1881 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1882 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1883 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1884 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1885 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1886 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1887 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1888 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1889 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1890 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1891 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1897 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1898 .name = "Channel Mode",
1899 .info = alc_ch_mode_info,
1900 .get = alc_ch_mode_get,
1901 .put = alc_ch_mode_put,
1907 * ALC880 ASUS W1V model
1909 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1910 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1911 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1914 /* additional mixers to alc880_asus_mixer */
1915 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1916 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1917 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1922 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1923 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1924 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1927 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1930 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1931 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1936 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1937 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1938 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1939 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1940 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1941 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1942 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1943 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1944 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1945 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1946 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1947 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1948 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1949 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1950 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1951 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1954 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1955 .name = "Channel Mode",
1956 .info = alc_ch_mode_info,
1957 .get = alc_ch_mode_get,
1958 .put = alc_ch_mode_put,
1963 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1964 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1965 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1966 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1967 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1968 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1969 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1970 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1971 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1972 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1973 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1977 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1978 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1979 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1980 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1981 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1988 * virtual master controls
1992 * slave controls for virtual master
1994 static const char *alc_slave_vols[] = {
1995 "Front Playback Volume",
1996 "Surround Playback Volume",
1997 "Center Playback Volume",
1998 "LFE Playback Volume",
1999 "Side Playback Volume",
2000 "Headphone Playback Volume",
2001 "Speaker Playback Volume",
2002 "Mono Playback Volume",
2003 "Line-Out Playback Volume",
2004 "PCM Playback Volume",
2008 static const char *alc_slave_sws[] = {
2009 "Front Playback Switch",
2010 "Surround Playback Switch",
2011 "Center Playback Switch",
2012 "LFE Playback Switch",
2013 "Side Playback Switch",
2014 "Headphone Playback Switch",
2015 "Speaker Playback Switch",
2016 "Mono Playback Switch",
2017 "IEC958 Playback Switch",
2022 * build control elements
2025 static void alc_free_kctls(struct hda_codec *codec);
2027 /* additional beep mixers; the actual parameters are overwritten at build */
2028 static struct snd_kcontrol_new alc_beep_mixer[] = {
2029 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2030 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2034 static int alc_build_controls(struct hda_codec *codec)
2036 struct alc_spec *spec = codec->spec;
2040 for (i = 0; i < spec->num_mixers; i++) {
2041 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2045 if (spec->cap_mixer) {
2046 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2050 if (spec->multiout.dig_out_nid) {
2051 err = snd_hda_create_spdif_out_ctls(codec,
2052 spec->multiout.dig_out_nid);
2055 if (!spec->no_analog) {
2056 err = snd_hda_create_spdif_share_sw(codec,
2060 spec->multiout.share_spdif = 1;
2063 if (spec->dig_in_nid) {
2064 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2069 /* create beep controls if needed */
2070 if (spec->beep_amp) {
2071 struct snd_kcontrol_new *knew;
2072 for (knew = alc_beep_mixer; knew->name; knew++) {
2073 struct snd_kcontrol *kctl;
2074 kctl = snd_ctl_new1(knew, codec);
2077 kctl->private_value = spec->beep_amp;
2078 err = snd_hda_ctl_add(codec, kctl);
2084 /* if we have no master control, let's create it */
2085 if (!spec->no_analog &&
2086 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2087 unsigned int vmaster_tlv[4];
2088 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2089 HDA_OUTPUT, vmaster_tlv);
2090 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2091 vmaster_tlv, alc_slave_vols);
2095 if (!spec->no_analog &&
2096 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2097 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2098 NULL, alc_slave_sws);
2103 alc_free_kctls(codec); /* no longer needed */
2109 * initialize the codec volumes, etc
2113 * generic initialization of ADC, input mixers and output mixers
2115 static struct hda_verb alc880_volume_init_verbs[] = {
2117 * Unmute ADC0-2 and set the default input to mic-in
2119 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2121 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2122 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2123 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2126 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2128 * Note: PASD motherboards uses the Line In 2 as the input for front
2131 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2141 * Set up output mixers (0x0c - 0x0f)
2143 /* set vol=0 to output mixers */
2144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2145 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2147 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2148 /* set up input amps for analog loopback */
2149 /* Amp Indices: DAC = 0, mixer = 1 */
2150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2153 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2154 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2156 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2157 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2163 * 3-stack pin configuration:
2164 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2166 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2168 * preset connection lists of input pins
2169 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2171 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2172 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2173 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2176 * Set pin mode and muting
2178 /* set front pin widgets 0x14 for output */
2179 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2180 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2181 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2182 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2183 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2184 /* Mic2 (as headphone out) for HP output */
2185 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2187 /* Line In pin widget for input */
2188 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2189 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2190 /* Line2 (as front mic) pin widget for input and vref at 80% */
2191 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2192 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2193 /* CD pin widget for input */
2194 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2200 * 5-stack pin configuration:
2201 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2202 * line-in/side = 0x1a, f-mic = 0x1b
2204 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2206 * preset connection lists of input pins
2207 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2209 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2210 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2213 * Set pin mode and muting
2215 /* set pin widgets 0x14-0x17 for output */
2216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2218 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2219 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2220 /* unmute pins for output (no gain on this amp) */
2221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2223 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2224 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2226 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2227 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2229 /* Mic2 (as headphone out) for HP output */
2230 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2231 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2232 /* Line In pin widget for input */
2233 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2234 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2235 /* Line2 (as front mic) pin widget for input and vref at 80% */
2236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2238 /* CD pin widget for input */
2239 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2245 * W810 pin configuration:
2246 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2248 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2249 /* hphone/speaker input selector: front DAC */
2250 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2253 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2256 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2257 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2259 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2260 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2266 * Z71V pin configuration:
2267 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2269 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2275 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2276 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2277 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2278 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2284 * 6-stack pin configuration:
2285 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2286 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2288 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2289 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2292 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2295 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2296 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2297 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2298 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2302 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2303 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2306 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2307 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2308 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2314 * Uniwill pin configuration:
2315 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2318 static struct hda_verb alc880_uniwill_init_verbs[] = {
2319 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2321 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2322 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2324 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2325 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2326 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2327 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2328 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2336 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2337 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2338 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2339 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2342 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2343 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2344 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2346 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2347 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2354 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2356 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2357 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2359 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2360 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2362 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2363 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2364 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2373 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2376 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2379 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2380 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2385 static struct hda_verb alc880_beep_init_verbs[] = {
2386 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2390 /* toggle speaker-output according to the hp-jack state */
2391 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2393 unsigned int present;
2396 present = snd_hda_codec_read(codec, 0x14, 0,
2397 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2398 bits = present ? HDA_AMP_MUTE : 0;
2399 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2400 HDA_AMP_MUTE, bits);
2401 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2402 HDA_AMP_MUTE, bits);
2405 /* auto-toggle front mic */
2406 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2408 unsigned int present;
2411 present = snd_hda_codec_read(codec, 0x18, 0,
2412 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2413 bits = present ? HDA_AMP_MUTE : 0;
2414 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2417 static void alc880_uniwill_automute(struct hda_codec *codec)
2419 alc880_uniwill_hp_automute(codec);
2420 alc880_uniwill_mic_automute(codec);
2423 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2426 /* Looks like the unsol event is incompatible with the standard
2427 * definition. 4bit tag is placed at 28 bit!
2429 switch (res >> 28) {
2430 case ALC880_HP_EVENT:
2431 alc880_uniwill_hp_automute(codec);
2433 case ALC880_MIC_EVENT:
2434 alc880_uniwill_mic_automute(codec);
2439 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2441 unsigned int present;
2444 present = snd_hda_codec_read(codec, 0x14, 0,
2445 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2446 bits = present ? HDA_AMP_MUTE : 0;
2447 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2450 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2452 unsigned int present;
2454 present = snd_hda_codec_read(codec, 0x21, 0,
2455 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2456 present &= HDA_AMP_VOLMASK;
2457 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2458 HDA_AMP_VOLMASK, present);
2459 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2460 HDA_AMP_VOLMASK, present);
2463 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2466 /* Looks like the unsol event is incompatible with the standard
2467 * definition. 4bit tag is placed at 28 bit!
2469 if ((res >> 28) == ALC880_HP_EVENT)
2470 alc880_uniwill_p53_hp_automute(codec);
2471 if ((res >> 28) == ALC880_DCVOL_EVENT)
2472 alc880_uniwill_p53_dcvol_automute(codec);
2476 * F1734 pin configuration:
2477 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2479 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2480 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2481 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2482 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2483 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2484 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2489 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2491 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2492 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2493 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2494 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2495 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2496 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2497 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2498 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2499 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2501 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2502 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2508 * ASUS pin configuration:
2509 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2511 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2512 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2513 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2514 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2515 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2517 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2518 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2520 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2521 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2522 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2523 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2524 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2526 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2528 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2529 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2531 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2533 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2534 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2539 /* Enable GPIO mask and set output */
2540 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2541 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2543 /* Clevo m520g init */
2544 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2545 /* headphone output */
2546 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2549 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2551 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2552 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2554 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2555 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2556 /* Mic1 (rear panel) */
2557 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2558 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2559 /* Mic2 (front panel) */
2560 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2561 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2563 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2564 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2565 /* change to EAPD mode */
2566 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2567 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2572 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2573 /* change to EAPD mode */
2574 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2575 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2577 /* Headphone output */
2578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2580 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2581 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2583 /* Line In pin widget for input */
2584 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2585 /* CD pin widget for input */
2586 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2587 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2588 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2590 /* change to EAPD mode */
2591 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2592 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2598 * LG m1 express dual
2601 * Rear Line-In/Out (blue): 0x14
2602 * Build-in Mic-In: 0x15
2604 * HP-Out (green): 0x1b
2605 * Mic-In/Out (red): 0x19
2609 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2610 static hda_nid_t alc880_lg_dac_nids[3] = {
2614 /* seems analog CD is not working */
2615 static struct hda_input_mux alc880_lg_capture_source = {
2620 { "Internal Mic", 0x6 },
2624 /* 2,4,6 channel modes */
2625 static struct hda_verb alc880_lg_ch2_init[] = {
2626 /* set line-in and mic-in to input */
2627 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2628 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2632 static struct hda_verb alc880_lg_ch4_init[] = {
2633 /* set line-in to out and mic-in to input */
2634 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2635 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2639 static struct hda_verb alc880_lg_ch6_init[] = {
2640 /* set line-in and mic-in to output */
2641 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2642 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2646 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2647 { 2, alc880_lg_ch2_init },
2648 { 4, alc880_lg_ch4_init },
2649 { 6, alc880_lg_ch6_init },
2652 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2653 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2654 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2655 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2656 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2657 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2658 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2659 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2660 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2661 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2662 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2663 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2664 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2665 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2666 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2668 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2669 .name = "Channel Mode",
2670 .info = alc_ch_mode_info,
2671 .get = alc_ch_mode_get,
2672 .put = alc_ch_mode_put,
2677 static struct hda_verb alc880_lg_init_verbs[] = {
2678 /* set capture source to mic-in */
2679 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2681 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2682 /* mute all amp mixer inputs */
2683 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2684 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2685 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2686 /* line-in to input */
2687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2688 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2693 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2694 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2695 /* mic-in to input */
2696 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2697 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2700 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2701 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2702 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2704 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2708 /* toggle speaker-output according to the hp-jack state */
2709 static void alc880_lg_automute(struct hda_codec *codec)
2711 unsigned int present;
2714 present = snd_hda_codec_read(codec, 0x1b, 0,
2715 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2716 bits = present ? HDA_AMP_MUTE : 0;
2717 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2718 HDA_AMP_MUTE, bits);
2721 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2723 /* Looks like the unsol event is incompatible with the standard
2724 * definition. 4bit tag is placed at 28 bit!
2726 if ((res >> 28) == 0x01)
2727 alc880_lg_automute(codec);
2736 * Built-in Mic-In: 0x19
2742 static struct hda_input_mux alc880_lg_lw_capture_source = {
2746 { "Internal Mic", 0x1 },
2751 #define alc880_lg_lw_modes alc880_threestack_modes
2753 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2754 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2755 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2756 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2757 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2758 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2759 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2760 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2761 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2762 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2763 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2766 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2767 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2769 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2770 .name = "Channel Mode",
2771 .info = alc_ch_mode_info,
2772 .get = alc_ch_mode_get,
2773 .put = alc_ch_mode_put,
2778 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2779 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2780 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2781 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2783 /* set capture source to mic-in */
2784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2786 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2787 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2792 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2793 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2794 /* mic-in to input */
2795 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2796 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2798 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2799 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2801 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2805 /* toggle speaker-output according to the hp-jack state */
2806 static void alc880_lg_lw_automute(struct hda_codec *codec)
2808 unsigned int present;
2811 present = snd_hda_codec_read(codec, 0x1b, 0,
2812 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2813 bits = present ? HDA_AMP_MUTE : 0;
2814 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2815 HDA_AMP_MUTE, bits);
2818 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2820 /* Looks like the unsol event is incompatible with the standard
2821 * definition. 4bit tag is placed at 28 bit!
2823 if ((res >> 28) == 0x01)
2824 alc880_lg_lw_automute(codec);
2827 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2828 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2829 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2832 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2833 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2837 static struct hda_input_mux alc880_medion_rim_capture_source = {
2841 { "Internal Mic", 0x1 },
2845 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2846 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2848 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2849 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2851 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2853 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2854 /* Mic2 (as headphone out) for HP output */
2855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2856 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2857 /* Internal Speaker */
2858 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2859 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2861 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2862 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2864 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2868 /* toggle speaker-output according to the hp-jack state */
2869 static void alc880_medion_rim_automute(struct hda_codec *codec)
2871 unsigned int present;
2874 present = snd_hda_codec_read(codec, 0x14, 0,
2875 AC_VERB_GET_PIN_SENSE, 0)
2876 & AC_PINSENSE_PRESENCE;
2877 bits = present ? HDA_AMP_MUTE : 0;
2878 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2879 HDA_AMP_MUTE, bits);
2881 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2883 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2886 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2889 /* Looks like the unsol event is incompatible with the standard
2890 * definition. 4bit tag is placed at 28 bit!
2892 if ((res >> 28) == ALC880_HP_EVENT)
2893 alc880_medion_rim_automute(codec);
2896 #ifdef CONFIG_SND_HDA_POWER_SAVE
2897 static struct hda_amp_list alc880_loopbacks[] = {
2898 { 0x0b, HDA_INPUT, 0 },
2899 { 0x0b, HDA_INPUT, 1 },
2900 { 0x0b, HDA_INPUT, 2 },
2901 { 0x0b, HDA_INPUT, 3 },
2902 { 0x0b, HDA_INPUT, 4 },
2906 static struct hda_amp_list alc880_lg_loopbacks[] = {
2907 { 0x0b, HDA_INPUT, 1 },
2908 { 0x0b, HDA_INPUT, 6 },
2909 { 0x0b, HDA_INPUT, 7 },
2918 static int alc_init(struct hda_codec *codec)
2920 struct alc_spec *spec = codec->spec;
2924 if (codec->vendor_id == 0x10ec0888)
2925 alc888_coef_init(codec);
2927 for (i = 0; i < spec->num_init_verbs; i++)
2928 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2930 if (spec->init_hook)
2931 spec->init_hook(codec);
2936 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2938 struct alc_spec *spec = codec->spec;
2940 if (spec->unsol_event)
2941 spec->unsol_event(codec, res);
2944 #ifdef CONFIG_SND_HDA_POWER_SAVE
2945 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2947 struct alc_spec *spec = codec->spec;
2948 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2953 * Analog playback callbacks
2955 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2956 struct hda_codec *codec,
2957 struct snd_pcm_substream *substream)
2959 struct alc_spec *spec = codec->spec;
2960 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2964 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2965 struct hda_codec *codec,
2966 unsigned int stream_tag,
2967 unsigned int format,
2968 struct snd_pcm_substream *substream)
2970 struct alc_spec *spec = codec->spec;
2971 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2972 stream_tag, format, substream);
2975 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2976 struct hda_codec *codec,
2977 struct snd_pcm_substream *substream)
2979 struct alc_spec *spec = codec->spec;
2980 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2986 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2987 struct hda_codec *codec,
2988 struct snd_pcm_substream *substream)
2990 struct alc_spec *spec = codec->spec;
2991 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2994 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2995 struct hda_codec *codec,
2996 unsigned int stream_tag,
2997 unsigned int format,
2998 struct snd_pcm_substream *substream)
3000 struct alc_spec *spec = codec->spec;
3001 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3002 stream_tag, format, substream);
3005 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3006 struct hda_codec *codec,
3007 struct snd_pcm_substream *substream)
3009 struct alc_spec *spec = codec->spec;
3010 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3013 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3014 struct hda_codec *codec,
3015 struct snd_pcm_substream *substream)
3017 struct alc_spec *spec = codec->spec;
3018 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3024 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3025 struct hda_codec *codec,
3026 unsigned int stream_tag,
3027 unsigned int format,
3028 struct snd_pcm_substream *substream)
3030 struct alc_spec *spec = codec->spec;
3032 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3033 stream_tag, 0, format);
3037 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3038 struct hda_codec *codec,
3039 struct snd_pcm_substream *substream)
3041 struct alc_spec *spec = codec->spec;
3043 snd_hda_codec_cleanup_stream(codec,
3044 spec->adc_nids[substream->number + 1]);
3051 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3055 /* NID is set in alc_build_pcms */
3057 .open = alc880_playback_pcm_open,
3058 .prepare = alc880_playback_pcm_prepare,
3059 .cleanup = alc880_playback_pcm_cleanup
3063 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3067 /* NID is set in alc_build_pcms */
3070 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3074 /* NID is set in alc_build_pcms */
3077 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3078 .substreams = 2, /* can be overridden */
3081 /* NID is set in alc_build_pcms */
3083 .prepare = alc880_alt_capture_pcm_prepare,
3084 .cleanup = alc880_alt_capture_pcm_cleanup
3088 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3092 /* NID is set in alc_build_pcms */
3094 .open = alc880_dig_playback_pcm_open,
3095 .close = alc880_dig_playback_pcm_close,
3096 .prepare = alc880_dig_playback_pcm_prepare,
3097 .cleanup = alc880_dig_playback_pcm_cleanup
3101 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3105 /* NID is set in alc_build_pcms */
3108 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3109 static struct hda_pcm_stream alc_pcm_null_stream = {
3115 static int alc_build_pcms(struct hda_codec *codec)
3117 struct alc_spec *spec = codec->spec;
3118 struct hda_pcm *info = spec->pcm_rec;
3121 codec->num_pcms = 1;
3122 codec->pcm_info = info;
3124 if (spec->no_analog)
3127 info->name = spec->stream_name_analog;
3128 if (spec->stream_analog_playback) {
3129 if (snd_BUG_ON(!spec->multiout.dac_nids))
3131 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3132 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3134 if (spec->stream_analog_capture) {
3135 if (snd_BUG_ON(!spec->adc_nids))
3137 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3138 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3141 if (spec->channel_mode) {
3142 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3143 for (i = 0; i < spec->num_channel_mode; i++) {
3144 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3145 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3151 /* SPDIF for stream index #1 */
3152 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3153 codec->num_pcms = 2;
3154 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3155 info = spec->pcm_rec + 1;
3156 info->name = spec->stream_name_digital;
3157 if (spec->dig_out_type)
3158 info->pcm_type = spec->dig_out_type;
3160 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3161 if (spec->multiout.dig_out_nid &&
3162 spec->stream_digital_playback) {
3163 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3164 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3166 if (spec->dig_in_nid &&
3167 spec->stream_digital_capture) {
3168 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3169 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3171 /* FIXME: do we need this for all Realtek codec models? */
3172 codec->spdif_status_reset = 1;
3175 if (spec->no_analog)
3178 /* If the use of more than one ADC is requested for the current
3179 * model, configure a second analog capture-only PCM.
3181 /* Additional Analaog capture for index #2 */
3182 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3183 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3184 codec->num_pcms = 3;
3185 info = spec->pcm_rec + 2;
3186 info->name = spec->stream_name_analog;
3187 if (spec->alt_dac_nid) {
3188 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3189 *spec->stream_analog_alt_playback;
3190 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3193 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3194 alc_pcm_null_stream;
3195 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3197 if (spec->num_adc_nids > 1) {
3198 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3199 *spec->stream_analog_alt_capture;
3200 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3202 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3203 spec->num_adc_nids - 1;
3205 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3206 alc_pcm_null_stream;
3207 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3214 static void alc_free_kctls(struct hda_codec *codec)
3216 struct alc_spec *spec = codec->spec;
3218 if (spec->kctls.list) {
3219 struct snd_kcontrol_new *kctl = spec->kctls.list;
3221 for (i = 0; i < spec->kctls.used; i++)
3222 kfree(kctl[i].name);
3224 snd_array_free(&spec->kctls);
3227 static void alc_free(struct hda_codec *codec)
3229 struct alc_spec *spec = codec->spec;
3234 alc_free_kctls(codec);
3236 snd_hda_detach_beep_device(codec);
3239 #ifdef SND_HDA_NEEDS_RESUME
3240 static int alc_resume(struct hda_codec *codec)
3242 codec->patch_ops.init(codec);
3243 snd_hda_codec_resume_amp(codec);
3244 snd_hda_codec_resume_cache(codec);
3251 static struct hda_codec_ops alc_patch_ops = {
3252 .build_controls = alc_build_controls,
3253 .build_pcms = alc_build_pcms,
3256 .unsol_event = alc_unsol_event,
3257 #ifdef SND_HDA_NEEDS_RESUME
3258 .resume = alc_resume,
3260 #ifdef CONFIG_SND_HDA_POWER_SAVE
3261 .check_power_status = alc_check_power_status,
3267 * Test configuration for debugging
3269 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3272 #ifdef CONFIG_SND_DEBUG
3273 static hda_nid_t alc880_test_dac_nids[4] = {
3274 0x02, 0x03, 0x04, 0x05
3277 static struct hda_input_mux alc880_test_capture_source = {
3286 { "Surround", 0x6 },
3290 static struct hda_channel_mode alc880_test_modes[4] = {
3297 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3298 struct snd_ctl_elem_info *uinfo)
3300 static char *texts[] = {
3301 "N/A", "Line Out", "HP Out",
3302 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3304 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3306 uinfo->value.enumerated.items = 8;
3307 if (uinfo->value.enumerated.item >= 8)
3308 uinfo->value.enumerated.item = 7;
3309 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3313 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3314 struct snd_ctl_elem_value *ucontrol)
3316 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3317 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3318 unsigned int pin_ctl, item = 0;
3320 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3321 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3322 if (pin_ctl & AC_PINCTL_OUT_EN) {
3323 if (pin_ctl & AC_PINCTL_HP_EN)
3327 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3328 switch (pin_ctl & AC_PINCTL_VREFEN) {
3329 case AC_PINCTL_VREF_HIZ: item = 3; break;
3330 case AC_PINCTL_VREF_50: item = 4; break;
3331 case AC_PINCTL_VREF_GRD: item = 5; break;
3332 case AC_PINCTL_VREF_80: item = 6; break;
3333 case AC_PINCTL_VREF_100: item = 7; break;
3336 ucontrol->value.enumerated.item[0] = item;
3340 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3341 struct snd_ctl_elem_value *ucontrol)
3343 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3344 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3345 static unsigned int ctls[] = {
3346 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3347 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3348 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3349 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3350 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3351 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3353 unsigned int old_ctl, new_ctl;
3355 old_ctl = snd_hda_codec_read(codec, nid, 0,
3356 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3357 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3358 if (old_ctl != new_ctl) {
3360 snd_hda_codec_write_cache(codec, nid, 0,
3361 AC_VERB_SET_PIN_WIDGET_CONTROL,
3363 val = ucontrol->value.enumerated.item[0] >= 3 ?
3365 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3372 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3373 struct snd_ctl_elem_info *uinfo)
3375 static char *texts[] = {
3376 "Front", "Surround", "CLFE", "Side"
3378 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3380 uinfo->value.enumerated.items = 4;
3381 if (uinfo->value.enumerated.item >= 4)
3382 uinfo->value.enumerated.item = 3;
3383 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3387 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3388 struct snd_ctl_elem_value *ucontrol)
3390 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3391 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3394 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3395 ucontrol->value.enumerated.item[0] = sel & 3;
3399 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3400 struct snd_ctl_elem_value *ucontrol)
3402 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3403 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3406 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3407 if (ucontrol->value.enumerated.item[0] != sel) {
3408 sel = ucontrol->value.enumerated.item[0] & 3;
3409 snd_hda_codec_write_cache(codec, nid, 0,
3410 AC_VERB_SET_CONNECT_SEL, sel);
3416 #define PIN_CTL_TEST(xname,nid) { \
3417 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3419 .info = alc_test_pin_ctl_info, \
3420 .get = alc_test_pin_ctl_get, \
3421 .put = alc_test_pin_ctl_put, \
3422 .private_value = nid \
3425 #define PIN_SRC_TEST(xname,nid) { \
3426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3428 .info = alc_test_pin_src_info, \
3429 .get = alc_test_pin_src_get, \
3430 .put = alc_test_pin_src_put, \
3431 .private_value = nid \
3434 static struct snd_kcontrol_new alc880_test_mixer[] = {
3435 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3436 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3437 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3438 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3439 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3440 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3441 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3442 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3443 PIN_CTL_TEST("Front Pin Mode", 0x14),
3444 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3445 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3446 PIN_CTL_TEST("Side Pin Mode", 0x17),
3447 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3448 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3449 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3450 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3451 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3452 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3453 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3454 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3455 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3456 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3457 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3458 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3459 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3460 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3461 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3462 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3463 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3464 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3466 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3467 .name = "Channel Mode",
3468 .info = alc_ch_mode_info,
3469 .get = alc_ch_mode_get,
3470 .put = alc_ch_mode_put,
3475 static struct hda_verb alc880_test_init_verbs[] = {
3476 /* Unmute inputs of 0x0c - 0x0f */
3477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3478 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3479 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3483 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3485 /* Vol output for 0x0c-0x0f */
3486 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3487 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3488 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3489 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3490 /* Set output pins 0x14-0x17 */
3491 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3493 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3494 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3495 /* Unmute output pins 0x14-0x17 */
3496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3498 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3499 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3500 /* Set input pins 0x18-0x1c */
3501 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3502 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3503 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3504 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3505 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3506 /* Mute input pins 0x18-0x1b */
3507 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3508 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3509 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3513 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3515 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3516 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3517 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3518 /* Analog input/passthru */
3519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3531 static const char *alc880_models[ALC880_MODEL_LAST] = {
3532 [ALC880_3ST] = "3stack",
3533 [ALC880_TCL_S700] = "tcl",
3534 [ALC880_3ST_DIG] = "3stack-digout",
3535 [ALC880_CLEVO] = "clevo",
3536 [ALC880_5ST] = "5stack",
3537 [ALC880_5ST_DIG] = "5stack-digout",
3538 [ALC880_W810] = "w810",
3539 [ALC880_Z71V] = "z71v",
3540 [ALC880_6ST] = "6stack",
3541 [ALC880_6ST_DIG] = "6stack-digout",
3542 [ALC880_ASUS] = "asus",
3543 [ALC880_ASUS_W1V] = "asus-w1v",
3544 [ALC880_ASUS_DIG] = "asus-dig",
3545 [ALC880_ASUS_DIG2] = "asus-dig2",
3546 [ALC880_UNIWILL_DIG] = "uniwill",
3547 [ALC880_UNIWILL_P53] = "uniwill-p53",
3548 [ALC880_FUJITSU] = "fujitsu",
3549 [ALC880_F1734] = "F1734",
3551 [ALC880_LG_LW] = "lg-lw",
3552 [ALC880_MEDION_RIM] = "medion",
3553 #ifdef CONFIG_SND_DEBUG
3554 [ALC880_TEST] = "test",
3556 [ALC880_AUTO] = "auto",
3559 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3560 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3561 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3562 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3563 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3564 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3565 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3566 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3567 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3568 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3569 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3570 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3571 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3572 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3573 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3574 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3575 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3576 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3577 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3578 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3579 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3580 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3581 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3582 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3583 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3584 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3585 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3586 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3587 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3588 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3589 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3590 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3591 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3592 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3593 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3594 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3595 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3596 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3597 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3598 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3599 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3600 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3601 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3602 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3603 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3604 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3605 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3606 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3607 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3608 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3609 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3610 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3611 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3612 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3613 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3614 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3615 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3616 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3617 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3618 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3619 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3620 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3621 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3622 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3623 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3624 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3625 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3626 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3627 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3629 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
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 },
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 .init_verbs = { alc880_volume_init_verbs,
3849 alc880_uniwill_p53_init_verbs,
3850 alc880_beep_init_verbs },
3851 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3852 .dac_nids = alc880_dac_nids,
3853 .dig_out_nid = ALC880_DIGOUT_NID,
3854 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3855 .channel_mode = alc880_2_jack_modes,
3856 .input_mux = &alc880_capture_source,
3857 .unsol_event = alc880_uniwill_p53_unsol_event,
3858 .init_hook = alc880_uniwill_p53_hp_automute,
3861 .mixers = { alc880_three_stack_mixer },
3862 .init_verbs = { alc880_volume_init_verbs,
3863 alc880_pin_clevo_init_verbs },
3864 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3865 .dac_nids = alc880_dac_nids,
3867 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3868 .channel_mode = alc880_threestack_modes,
3870 .input_mux = &alc880_capture_source,
3873 .mixers = { alc880_lg_mixer },
3874 .init_verbs = { alc880_volume_init_verbs,
3875 alc880_lg_init_verbs },
3876 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3877 .dac_nids = alc880_lg_dac_nids,
3878 .dig_out_nid = ALC880_DIGOUT_NID,
3879 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3880 .channel_mode = alc880_lg_ch_modes,
3882 .input_mux = &alc880_lg_capture_source,
3883 .unsol_event = alc880_lg_unsol_event,
3884 .init_hook = alc880_lg_automute,
3885 #ifdef CONFIG_SND_HDA_POWER_SAVE
3886 .loopbacks = alc880_lg_loopbacks,
3890 .mixers = { alc880_lg_lw_mixer },
3891 .init_verbs = { alc880_volume_init_verbs,
3892 alc880_lg_lw_init_verbs },
3893 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3894 .dac_nids = alc880_dac_nids,
3895 .dig_out_nid = ALC880_DIGOUT_NID,
3896 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3897 .channel_mode = alc880_lg_lw_modes,
3898 .input_mux = &alc880_lg_lw_capture_source,
3899 .unsol_event = alc880_lg_lw_unsol_event,
3900 .init_hook = alc880_lg_lw_automute,
3902 [ALC880_MEDION_RIM] = {
3903 .mixers = { alc880_medion_rim_mixer },
3904 .init_verbs = { alc880_volume_init_verbs,
3905 alc880_medion_rim_init_verbs,
3906 alc_gpio2_init_verbs },
3907 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3908 .dac_nids = alc880_dac_nids,
3909 .dig_out_nid = ALC880_DIGOUT_NID,
3910 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3911 .channel_mode = alc880_2_jack_modes,
3912 .input_mux = &alc880_medion_rim_capture_source,
3913 .unsol_event = alc880_medion_rim_unsol_event,
3914 .init_hook = alc880_medion_rim_automute,
3916 #ifdef CONFIG_SND_DEBUG
3918 .mixers = { alc880_test_mixer },
3919 .init_verbs = { alc880_test_init_verbs },
3920 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3921 .dac_nids = alc880_test_dac_nids,
3922 .dig_out_nid = ALC880_DIGOUT_NID,
3923 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3924 .channel_mode = alc880_test_modes,
3925 .input_mux = &alc880_test_capture_source,
3931 * Automatic parse of I/O pins from the BIOS configuration
3936 ALC_CTL_WIDGET_MUTE,
3939 static struct snd_kcontrol_new alc880_control_templates[] = {
3940 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3941 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3942 HDA_BIND_MUTE(NULL, 0, 0, 0),
3945 /* add dynamic controls */
3946 static int add_control(struct alc_spec *spec, int type, const char *name,
3949 struct snd_kcontrol_new *knew;
3951 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3952 knew = snd_array_new(&spec->kctls);
3955 *knew = alc880_control_templates[type];
3956 knew->name = kstrdup(name, GFP_KERNEL);
3959 knew->private_value = val;
3963 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3964 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3965 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3966 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3967 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3968 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3969 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3970 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3971 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3972 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3973 #define ALC880_PIN_CD_NID 0x1c
3975 /* fill in the dac_nids table from the parsed pin configuration */
3976 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3977 const struct auto_pin_cfg *cfg)
3983 memset(assigned, 0, sizeof(assigned));
3984 spec->multiout.dac_nids = spec->private_dac_nids;
3986 /* check the pins hardwired to audio widget */
3987 for (i = 0; i < cfg->line_outs; i++) {
3988 nid = cfg->line_out_pins[i];
3989 if (alc880_is_fixed_pin(nid)) {
3990 int idx = alc880_fixed_pin_idx(nid);
3991 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3995 /* left pins can be connect to any audio widget */
3996 for (i = 0; i < cfg->line_outs; i++) {
3997 nid = cfg->line_out_pins[i];
3998 if (alc880_is_fixed_pin(nid))
4000 /* search for an empty channel */
4001 for (j = 0; j < cfg->line_outs; j++) {
4003 spec->multiout.dac_nids[i] =
4004 alc880_idx_to_dac(j);
4010 spec->multiout.num_dacs = cfg->line_outs;
4014 /* add playback controls from the parsed DAC table */
4015 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4016 const struct auto_pin_cfg *cfg)
4019 static const char *chname[4] = {
4020 "Front", "Surround", NULL /*CLFE*/, "Side"
4025 for (i = 0; i < cfg->line_outs; i++) {
4026 if (!spec->multiout.dac_nids[i])
4028 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4031 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4032 "Center Playback Volume",
4033 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4037 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4038 "LFE Playback Volume",
4039 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4043 err = add_control(spec, ALC_CTL_BIND_MUTE,
4044 "Center Playback Switch",
4045 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4049 err = add_control(spec, ALC_CTL_BIND_MUTE,
4050 "LFE Playback Switch",
4051 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4056 sprintf(name, "%s Playback Volume", chname[i]);
4057 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4058 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4062 sprintf(name, "%s Playback Switch", chname[i]);
4063 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4064 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4073 /* add playback controls for speaker and HP outputs */
4074 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4084 if (alc880_is_fixed_pin(pin)) {
4085 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4086 /* specify the DAC as the extra output */
4087 if (!spec->multiout.hp_nid)
4088 spec->multiout.hp_nid = nid;
4090 spec->multiout.extra_out_nid[0] = nid;
4091 /* control HP volume/switch on the output mixer amp */
4092 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4093 sprintf(name, "%s Playback Volume", pfx);
4094 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4095 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4098 sprintf(name, "%s Playback Switch", pfx);
4099 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4100 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4103 } else if (alc880_is_multi_pin(pin)) {
4104 /* set manual connection */
4105 /* we have only a switch on HP-out PIN */
4106 sprintf(name, "%s Playback Switch", pfx);
4107 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4108 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4115 /* create input playback/capture controls for the given pin */
4116 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4117 const char *ctlname,
4118 int idx, hda_nid_t mix_nid)
4123 sprintf(name, "%s Playback Volume", ctlname);
4124 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4125 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4128 sprintf(name, "%s Playback Switch", ctlname);
4129 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4130 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4136 /* create playback/capture controls for input pins */
4137 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4138 const struct auto_pin_cfg *cfg)
4140 struct hda_input_mux *imux = &spec->private_imux[0];
4143 for (i = 0; i < AUTO_PIN_LAST; i++) {
4144 if (alc880_is_input_pin(cfg->input_pins[i])) {
4145 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4146 err = new_analog_input(spec, cfg->input_pins[i],
4147 auto_pin_cfg_labels[i],
4151 imux->items[imux->num_items].label =
4152 auto_pin_cfg_labels[i];
4153 imux->items[imux->num_items].index =
4154 alc880_input_pin_idx(cfg->input_pins[i]);
4161 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4162 unsigned int pin_type)
4164 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4167 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4171 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4172 hda_nid_t nid, int pin_type,
4175 alc_set_pin_output(codec, nid, pin_type);
4176 /* need the manual connection? */
4177 if (alc880_is_multi_pin(nid)) {
4178 struct alc_spec *spec = codec->spec;
4179 int idx = alc880_multi_pin_idx(nid);
4180 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4181 AC_VERB_SET_CONNECT_SEL,
4182 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4186 static int get_pin_type(int line_out_type)
4188 if (line_out_type == AUTO_PIN_HP_OUT)
4194 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4196 struct alc_spec *spec = codec->spec;
4199 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4200 for (i = 0; i < spec->autocfg.line_outs; i++) {
4201 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4202 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4203 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4207 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4209 struct alc_spec *spec = codec->spec;
4212 pin = spec->autocfg.speaker_pins[0];
4213 if (pin) /* connect to front */
4214 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4215 pin = spec->autocfg.hp_pins[0];
4216 if (pin) /* connect to front */
4217 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4220 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4222 struct alc_spec *spec = codec->spec;
4225 for (i = 0; i < AUTO_PIN_LAST; i++) {
4226 hda_nid_t nid = spec->autocfg.input_pins[i];
4227 if (alc880_is_input_pin(nid)) {
4228 alc_set_input_pin(codec, nid, i);
4229 if (nid != ALC880_PIN_CD_NID &&
4230 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4231 snd_hda_codec_write(codec, nid, 0,
4232 AC_VERB_SET_AMP_GAIN_MUTE,
4238 /* parse the BIOS configuration and set up the alc_spec */
4239 /* return 1 if successful, 0 if the proper config is not found,
4240 * or a negative error code
4242 static int alc880_parse_auto_config(struct hda_codec *codec)
4244 struct alc_spec *spec = codec->spec;
4246 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4248 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4252 if (!spec->autocfg.line_outs)
4253 return 0; /* can't find valid BIOS pin config */
4255 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4258 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4261 err = alc880_auto_create_extra_out(spec,
4262 spec->autocfg.speaker_pins[0],
4266 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4270 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4274 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4276 /* check multiple SPDIF-out (for recent codecs) */
4277 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4279 err = snd_hda_get_connections(codec,
4280 spec->autocfg.dig_out_pins[i],
4285 spec->multiout.dig_out_nid = dig_nid;
4287 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4288 spec->slave_dig_outs[i - 1] = dig_nid;
4289 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4293 if (spec->autocfg.dig_in_pin)
4294 spec->dig_in_nid = ALC880_DIGIN_NID;
4296 if (spec->kctls.list)
4297 add_mixer(spec, spec->kctls.list);
4299 add_verb(spec, alc880_volume_init_verbs);
4301 spec->num_mux_defs = 1;
4302 spec->input_mux = &spec->private_imux[0];
4307 /* additional initialization for auto-configuration model */
4308 static void alc880_auto_init(struct hda_codec *codec)
4310 struct alc_spec *spec = codec->spec;
4311 alc880_auto_init_multi_out(codec);
4312 alc880_auto_init_extra_out(codec);
4313 alc880_auto_init_analog_input(codec);
4314 if (spec->unsol_event)
4315 alc_inithook(codec);
4318 static void set_capture_mixer(struct alc_spec *spec)
4320 static struct snd_kcontrol_new *caps[2][3] = {
4321 { alc_capture_mixer_nosrc1,
4322 alc_capture_mixer_nosrc2,
4323 alc_capture_mixer_nosrc3 },
4324 { alc_capture_mixer1,
4326 alc_capture_mixer3 },
4328 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4330 if (spec->input_mux && spec->input_mux->num_items > 1)
4334 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4338 #define set_beep_amp(spec, nid, idx, dir) \
4339 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4342 * OK, here we have finally the patch for ALC880
4345 static int patch_alc880(struct hda_codec *codec)
4347 struct alc_spec *spec;
4351 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4357 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4360 if (board_config < 0) {
4361 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4362 "trying auto-probe from BIOS...\n");
4363 board_config = ALC880_AUTO;
4366 if (board_config == ALC880_AUTO) {
4367 /* automatic parse from the BIOS config */
4368 err = alc880_parse_auto_config(codec);
4374 "hda_codec: Cannot set up configuration "
4375 "from BIOS. Using 3-stack mode...\n");
4376 board_config = ALC880_3ST;
4380 err = snd_hda_attach_beep_device(codec, 0x1);
4386 if (board_config != ALC880_AUTO)
4387 setup_preset(spec, &alc880_presets[board_config]);
4389 spec->stream_name_analog = "ALC880 Analog";
4390 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4391 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4392 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4394 spec->stream_name_digital = "ALC880 Digital";
4395 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4396 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4398 if (!spec->adc_nids && spec->input_mux) {
4399 /* check whether NID 0x07 is valid */
4400 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4402 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4403 if (wcap != AC_WID_AUD_IN) {
4404 spec->adc_nids = alc880_adc_nids_alt;
4405 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4407 spec->adc_nids = alc880_adc_nids;
4408 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4411 set_capture_mixer(spec);
4412 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4414 spec->vmaster_nid = 0x0c;
4416 codec->patch_ops = alc_patch_ops;
4417 if (board_config == ALC880_AUTO)
4418 spec->init_hook = alc880_auto_init;
4419 #ifdef CONFIG_SND_HDA_POWER_SAVE
4420 if (!spec->loopback.amplist)
4421 spec->loopback.amplist = alc880_loopbacks;
4423 codec->proc_widget_hook = print_realtek_coef;
4433 static hda_nid_t alc260_dac_nids[1] = {
4438 static hda_nid_t alc260_adc_nids[1] = {
4443 static hda_nid_t alc260_adc_nids_alt[1] = {
4448 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4449 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4451 static hda_nid_t alc260_dual_adc_nids[2] = {
4456 #define ALC260_DIGOUT_NID 0x03
4457 #define ALC260_DIGIN_NID 0x06
4459 static struct hda_input_mux alc260_capture_source = {
4463 { "Front Mic", 0x1 },
4469 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4470 * headphone jack and the internal CD lines since these are the only pins at
4471 * which audio can appear. For flexibility, also allow the option of
4472 * recording the mixer output on the second ADC (ADC0 doesn't have a
4473 * connection to the mixer output).
4475 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4479 { "Mic/Line", 0x0 },
4481 { "Headphone", 0x2 },
4487 { "Mic/Line", 0x0 },
4489 { "Headphone", 0x2 },
4496 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4497 * the Fujitsu S702x, but jacks are marked differently.
4499 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4506 { "Headphone", 0x5 },
4515 { "Headphone", 0x6 },
4521 /* Maxdata Favorit 100XS */
4522 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4526 { "Line/Mic", 0x0 },
4533 { "Line/Mic", 0x0 },
4541 * This is just place-holder, so there's something for alc_build_pcms to look
4542 * at when it calculates the maximum number of channels. ALC260 has no mixer
4543 * element which allows changing the channel mode, so the verb list is
4546 static struct hda_channel_mode alc260_modes[1] = {
4551 /* Mixer combinations
4553 * basic: base_output + input + pc_beep + capture
4554 * HP: base_output + input + capture_alt
4555 * HP_3013: hp_3013 + input + capture
4556 * fujitsu: fujitsu + capture
4557 * acer: acer + capture
4560 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4561 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4562 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4563 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4564 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4565 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4566 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4570 static struct snd_kcontrol_new alc260_input_mixer[] = {
4571 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4572 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4573 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4574 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4576 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4577 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4578 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4582 /* update HP, line and mono out pins according to the master switch */
4583 static void alc260_hp_master_update(struct hda_codec *codec,
4584 hda_nid_t hp, hda_nid_t line,
4587 struct alc_spec *spec = codec->spec;
4588 unsigned int val = spec->master_sw ? PIN_HP : 0;
4589 /* change HP and line-out pins */
4590 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4592 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4594 /* mono (speaker) depending on the HP jack sense */
4595 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4596 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4600 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4601 struct snd_ctl_elem_value *ucontrol)
4603 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4604 struct alc_spec *spec = codec->spec;
4605 *ucontrol->value.integer.value = spec->master_sw;
4609 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4610 struct snd_ctl_elem_value *ucontrol)
4612 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4613 struct alc_spec *spec = codec->spec;
4614 int val = !!*ucontrol->value.integer.value;
4615 hda_nid_t hp, line, mono;
4617 if (val == spec->master_sw)
4619 spec->master_sw = val;
4620 hp = (kcontrol->private_value >> 16) & 0xff;
4621 line = (kcontrol->private_value >> 8) & 0xff;
4622 mono = kcontrol->private_value & 0xff;
4623 alc260_hp_master_update(codec, hp, line, mono);
4627 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4629 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4630 .name = "Master Playback Switch",
4631 .info = snd_ctl_boolean_mono_info,
4632 .get = alc260_hp_master_sw_get,
4633 .put = alc260_hp_master_sw_put,
4634 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4636 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4637 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4638 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4639 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4640 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4642 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4646 static struct hda_verb alc260_hp_unsol_verbs[] = {
4647 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4651 static void alc260_hp_automute(struct hda_codec *codec)
4653 struct alc_spec *spec = codec->spec;
4654 unsigned int present;
4656 present = snd_hda_codec_read(codec, 0x10, 0,
4657 AC_VERB_GET_PIN_SENSE, 0);
4658 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4659 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4662 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4664 if ((res >> 26) == ALC880_HP_EVENT)
4665 alc260_hp_automute(codec);
4668 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4670 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4671 .name = "Master Playback Switch",
4672 .info = snd_ctl_boolean_mono_info,
4673 .get = alc260_hp_master_sw_get,
4674 .put = alc260_hp_master_sw_put,
4675 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4677 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4678 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4679 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4680 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4681 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4683 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4684 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4688 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4689 .ops = &snd_hda_bind_vol,
4691 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4692 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4693 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4698 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4699 .ops = &snd_hda_bind_sw,
4701 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4702 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4707 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4708 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4709 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4710 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4711 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4715 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4716 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4720 static void alc260_hp_3013_automute(struct hda_codec *codec)
4722 struct alc_spec *spec = codec->spec;
4723 unsigned int present;
4725 present = snd_hda_codec_read(codec, 0x15, 0,
4726 AC_VERB_GET_PIN_SENSE, 0);
4727 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4728 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4731 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4734 if ((res >> 26) == ALC880_HP_EVENT)
4735 alc260_hp_3013_automute(codec);
4738 static void alc260_hp_3012_automute(struct hda_codec *codec)
4740 unsigned int present, bits;
4742 present = snd_hda_codec_read(codec, 0x10, 0,
4743 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4745 bits = present ? 0 : PIN_OUT;
4746 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4748 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4750 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4754 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4757 if ((res >> 26) == ALC880_HP_EVENT)
4758 alc260_hp_3012_automute(codec);
4761 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4762 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4764 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4765 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4766 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4767 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4768 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4769 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4770 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4771 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4772 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4773 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4774 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4778 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4779 * versions of the ALC260 don't act on requests to enable mic bias from NID
4780 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4781 * datasheet doesn't mention this restriction. At this stage it's not clear
4782 * whether this behaviour is intentional or is a hardware bug in chip
4783 * revisions available in early 2006. Therefore for now allow the
4784 * "Headphone Jack Mode" control to span all choices, but if it turns out
4785 * that the lack of mic bias for this NID is intentional we could change the
4786 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4788 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4789 * don't appear to make the mic bias available from the "line" jack, even
4790 * though the NID used for this jack (0x14) can supply it. The theory is
4791 * that perhaps Acer have included blocking capacitors between the ALC260
4792 * and the output jack. If this turns out to be the case for all such
4793 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4794 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4796 * The C20x Tablet series have a mono internal speaker which is controlled
4797 * via the chip's Mono sum widget and pin complex, so include the necessary
4798 * controls for such models. On models without a "mono speaker" the control
4799 * won't do anything.
4801 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4802 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4803 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4804 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4805 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4807 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4809 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4810 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4812 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4813 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4814 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4815 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4816 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4820 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4822 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4823 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4824 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4825 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4826 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4827 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4828 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4832 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4833 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4835 static struct snd_kcontrol_new alc260_will_mixer[] = {
4836 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4837 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4839 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4840 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4841 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4842 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4843 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4844 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4845 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4849 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4850 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4852 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4853 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4854 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4856 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4857 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4858 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4859 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4860 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4861 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4862 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4867 * initialization verbs
4869 static struct hda_verb alc260_init_verbs[] = {
4870 /* Line In pin widget for input */
4871 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4872 /* CD pin widget for input */
4873 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4874 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4875 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4876 /* Mic2 (front panel) pin widget for input and vref at 80% */
4877 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4878 /* LINE-2 is used for line-out in rear */
4879 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4880 /* select line-out */
4881 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4883 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4885 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4887 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4888 /* mute capture amp left and right */
4889 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4890 /* set connection select to line in (default select for this ADC) */
4891 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4892 /* mute capture amp left and right */
4893 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4894 /* set connection select to line in (default select for this ADC) */
4895 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4896 /* set vol=0 Line-Out mixer amp left and right */
4897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4898 /* unmute pin widget amp left and right (no gain on this amp) */
4899 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4900 /* set vol=0 HP mixer amp left and right */
4901 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4902 /* unmute pin widget amp left and right (no gain on this amp) */
4903 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4904 /* set vol=0 Mono mixer amp left and right */
4905 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4906 /* unmute pin widget amp left and right (no gain on this amp) */
4907 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4908 /* unmute LINE-2 out pin */
4909 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
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 /* mute Front out path */
4921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4922 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4923 /* mute Headphone out path */
4924 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4925 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4926 /* mute Mono out path */
4927 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4928 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4932 #if 0 /* should be identical with alc260_init_verbs? */
4933 static struct hda_verb alc260_hp_init_verbs[] = {
4934 /* Headphone and output */
4935 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
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 /* Line-2 pin widget for output */
4945 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
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))},
4983 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4984 /* Line out and output */
4985 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4987 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4988 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4989 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4990 /* Mic2 (front panel) pin widget for input and vref at 80% */
4991 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4992 /* Line In pin widget for input */
4993 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4994 /* Headphone pin widget for output */
4995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4996 /* CD pin widget for input */
4997 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4998 /* unmute amp left and right */
4999 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5000 /* set connection select to line in (default select for this ADC) */
5001 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5002 /* unmute Line-Out mixer amp left and right (volume = 0) */
5003 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5004 /* mute pin widget amp left and right (no gain on this amp) */
5005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5006 /* unmute HP mixer amp left and right (volume = 0) */
5007 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5008 /* mute pin widget amp left and right (no gain on this amp) */
5009 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5010 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5013 /* mute analog inputs */
5014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5019 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5020 /* Unmute Front out path */
5021 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5022 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5023 /* Unmute Headphone out path */
5024 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5025 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5026 /* Unmute Mono out path */
5027 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5028 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5032 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5033 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5034 * audio = 0x16, internal speaker = 0x10.
5036 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5037 /* Disable all GPIOs */
5038 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5039 /* Internal speaker is connected to headphone pin */
5040 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5041 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5042 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5043 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5044 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5045 /* Ensure all other unused pins are disabled and muted. */
5046 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5047 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5048 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5049 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5050 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5051 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5055 /* Disable digital (SPDIF) pins */
5056 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5057 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5059 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5060 * when acting as an output.
5062 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5064 /* Start with output sum widgets muted and their output gains at min */
5065 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5066 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5067 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5068 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5069 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5071 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5072 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5073 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5075 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5076 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5077 /* Unmute Line1 pin widget output buffer since it starts as an output.
5078 * If the pin mode is changed by the user the pin mode control will
5079 * take care of enabling the pin's input/output buffers as needed.
5080 * Therefore there's no need to enable the input buffer at this
5083 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5084 /* Unmute input buffer of pin widget used for Line-in (no equiv
5087 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5089 /* Mute capture amp left and right */
5090 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5091 /* Set ADC connection select to match default mixer setting - line
5094 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5096 /* Do the same for the second ADC: mute capture input amp and
5097 * set ADC connection to line in (on mic1 pin)
5099 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5100 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5102 /* Mute all inputs to mixer widget (even unconnected ones) */
5103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5104 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5106 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5115 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5116 * similar laptops (adapted from Fujitsu init verbs).
5118 static struct hda_verb alc260_acer_init_verbs[] = {
5119 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5120 * the headphone jack. Turn this on and rely on the standard mute
5121 * methods whenever the user wants to turn these outputs off.
5123 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5124 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5125 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5126 /* Internal speaker/Headphone jack is connected to Line-out pin */
5127 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5128 /* Internal microphone/Mic jack is connected to Mic1 pin */
5129 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5130 /* Line In jack is connected to Line1 pin */
5131 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5132 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5133 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5134 /* Ensure all other unused pins are disabled and muted. */
5135 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5136 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5137 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5138 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5141 /* Disable digital (SPDIF) pins */
5142 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5143 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5145 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5146 * bus when acting as outputs.
5148 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5149 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5151 /* Start with output sum widgets muted and their output gains at min */
5152 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5153 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5155 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5156 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5158 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5159 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5160 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5162 /* Unmute Line-out pin widget amp left and right
5163 * (no equiv mixer ctrl)
5165 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5166 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5167 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5168 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5169 * inputs. If the pin mode is changed by the user the pin mode control
5170 * will take care of enabling the pin's input/output buffers as needed.
5171 * Therefore there's no need to enable the input buffer at this
5174 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5175 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5177 /* Mute capture amp left and right */
5178 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5179 /* Set ADC connection select to match default mixer setting - mic
5182 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5184 /* Do similar with the second ADC: mute capture input amp and
5185 * set ADC connection to mic to match ALSA's default state.
5187 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5188 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5190 /* Mute all inputs to mixer widget (even unconnected ones) */
5191 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5192 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5193 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5194 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5196 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5203 /* Initialisation sequence for Maxdata Favorit 100XS
5204 * (adapted from Acer init verbs).
5206 static struct hda_verb alc260_favorit100_init_verbs[] = {
5207 /* GPIO 0 enables the output jack.
5208 * Turn this on and rely on the standard mute
5209 * methods whenever the user wants to turn these outputs off.
5211 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5212 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5213 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5214 /* Line/Mic input jack is connected to Mic1 pin */
5215 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5216 /* Ensure all other unused pins are disabled and muted. */
5217 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5218 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5219 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5220 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5221 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5222 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5223 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5224 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5225 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5226 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5227 /* Disable digital (SPDIF) pins */
5228 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5229 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5231 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5232 * bus when acting as outputs.
5234 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5235 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5237 /* Start with output sum widgets muted and their output gains at min */
5238 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5239 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5241 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5242 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5244 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5245 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5246 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5248 /* Unmute Line-out pin widget amp left and right
5249 * (no equiv mixer ctrl)
5251 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5252 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5253 * inputs. If the pin mode is changed by the user the pin mode control
5254 * will take care of enabling the pin's input/output buffers as needed.
5255 * Therefore there's no need to enable the input buffer at this
5258 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5260 /* Mute capture amp left and right */
5261 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5262 /* Set ADC connection select to match default mixer setting - mic
5265 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5267 /* Do similar with the second ADC: mute capture input amp and
5268 * set ADC connection to mic to match ALSA's default state.
5270 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5271 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5273 /* Mute all inputs to mixer widget (even unconnected ones) */
5274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5286 static struct hda_verb alc260_will_verbs[] = {
5287 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5288 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5289 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5290 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5291 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5292 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5296 static struct hda_verb alc260_replacer_672v_verbs[] = {
5297 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5298 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5299 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5301 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5302 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5303 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5305 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5309 /* toggle speaker-output according to the hp-jack state */
5310 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5312 unsigned int present;
5314 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5315 present = snd_hda_codec_read(codec, 0x0f, 0,
5316 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5318 snd_hda_codec_write_cache(codec, 0x01, 0,
5319 AC_VERB_SET_GPIO_DATA, 1);
5320 snd_hda_codec_write_cache(codec, 0x0f, 0,
5321 AC_VERB_SET_PIN_WIDGET_CONTROL,
5324 snd_hda_codec_write_cache(codec, 0x01, 0,
5325 AC_VERB_SET_GPIO_DATA, 0);
5326 snd_hda_codec_write_cache(codec, 0x0f, 0,
5327 AC_VERB_SET_PIN_WIDGET_CONTROL,
5332 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5335 if ((res >> 26) == ALC880_HP_EVENT)
5336 alc260_replacer_672v_automute(codec);
5339 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5340 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5341 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5342 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5343 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5344 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5345 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5346 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5347 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5348 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5353 /* Test configuration for debugging, modelled after the ALC880 test
5356 #ifdef CONFIG_SND_DEBUG
5357 static hda_nid_t alc260_test_dac_nids[1] = {
5360 static hda_nid_t alc260_test_adc_nids[2] = {
5363 /* For testing the ALC260, each input MUX needs its own definition since
5364 * the signal assignments are different. This assumes that the first ADC
5367 static struct hda_input_mux alc260_test_capture_sources[2] = {
5371 { "MIC1 pin", 0x0 },
5372 { "MIC2 pin", 0x1 },
5373 { "LINE1 pin", 0x2 },
5374 { "LINE2 pin", 0x3 },
5376 { "LINE-OUT pin", 0x5 },
5377 { "HP-OUT pin", 0x6 },
5383 { "MIC1 pin", 0x0 },
5384 { "MIC2 pin", 0x1 },
5385 { "LINE1 pin", 0x2 },
5386 { "LINE2 pin", 0x3 },
5389 { "LINE-OUT pin", 0x6 },
5390 { "HP-OUT pin", 0x7 },
5394 static struct snd_kcontrol_new alc260_test_mixer[] = {
5395 /* Output driver widgets */
5396 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5397 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5398 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5399 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5400 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5401 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5403 /* Modes for retasking pin widgets
5404 * Note: the ALC260 doesn't seem to act on requests to enable mic
5405 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5406 * mention this restriction. At this stage it's not clear whether
5407 * this behaviour is intentional or is a hardware bug in chip
5408 * revisions available at least up until early 2006. Therefore for
5409 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5410 * choices, but if it turns out that the lack of mic bias for these
5411 * NIDs is intentional we could change their modes from
5412 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5414 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5415 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5416 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5417 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5418 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5419 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5421 /* Loopback mixer controls */
5422 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5423 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5424 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5425 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5426 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5427 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5428 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5429 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5430 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5431 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5432 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5433 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5434 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5435 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5437 /* Controls for GPIO pins, assuming they are configured as outputs */
5438 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5439 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5440 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5441 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5443 /* Switches to allow the digital IO pins to be enabled. The datasheet
5444 * is ambigious as to which NID is which; testing on laptops which
5445 * make this output available should provide clarification.
5447 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5448 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5450 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5451 * this output to turn on an external amplifier.
5453 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5454 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5458 static struct hda_verb alc260_test_init_verbs[] = {
5459 /* Enable all GPIOs as outputs with an initial value of 0 */
5460 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5461 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5462 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5464 /* Enable retasking pins as output, initially without power amp */
5465 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5466 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5469 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5470 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5472 /* Disable digital (SPDIF) pins initially, but users can enable
5473 * them via a mixer switch. In the case of SPDIF-out, this initverb
5474 * payload also sets the generation to 0, output to be in "consumer"
5475 * PCM format, copyright asserted, no pre-emphasis and no validity
5478 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5479 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5481 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5482 * OUT1 sum bus when acting as an output.
5484 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5485 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5486 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5487 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5489 /* Start with output sum widgets muted and their output gains at min */
5490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5494 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5496 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5497 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5498 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5500 /* Unmute retasking pin widget output buffers since the default
5501 * state appears to be output. As the pin mode is changed by the
5502 * user the pin mode control will take care of enabling the pin's
5503 * input/output buffers as needed.
5505 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5506 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5507 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5509 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5510 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5511 /* Also unmute the mono-out pin widget */
5512 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5514 /* Mute capture amp left and right */
5515 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5516 /* Set ADC connection select to match default mixer setting (mic1
5519 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5521 /* Do the same for the second ADC: mute capture input amp and
5522 * set ADC connection to mic1 pin
5524 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5525 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5527 /* Mute all inputs to mixer widget (even unconnected ones) */
5528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5541 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5542 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5544 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5545 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5548 * for BIOS auto-configuration
5551 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5552 const char *pfx, int *vol_bits)
5555 unsigned long vol_val, sw_val;
5559 if (nid >= 0x0f && nid < 0x11) {
5560 nid_vol = nid - 0x7;
5561 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5562 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5563 } else if (nid == 0x11) {
5564 nid_vol = nid - 0x7;
5565 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5566 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5567 } else if (nid >= 0x12 && nid <= 0x15) {
5569 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5570 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5574 if (!(*vol_bits & (1 << nid_vol))) {
5575 /* first control for the volume widget */
5576 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5577 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5580 *vol_bits |= (1 << nid_vol);
5582 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5583 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5589 /* add playback controls from the parsed DAC table */
5590 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5591 const struct auto_pin_cfg *cfg)
5597 spec->multiout.num_dacs = 1;
5598 spec->multiout.dac_nids = spec->private_dac_nids;
5599 spec->multiout.dac_nids[0] = 0x02;
5601 nid = cfg->line_out_pins[0];
5603 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5608 nid = cfg->speaker_pins[0];
5610 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5615 nid = cfg->hp_pins[0];
5617 err = alc260_add_playback_controls(spec, nid, "Headphone",
5625 /* create playback/capture controls for input pins */
5626 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5627 const struct auto_pin_cfg *cfg)
5629 struct hda_input_mux *imux = &spec->private_imux[0];
5632 for (i = 0; i < AUTO_PIN_LAST; i++) {
5633 if (cfg->input_pins[i] >= 0x12) {
5634 idx = cfg->input_pins[i] - 0x12;
5635 err = new_analog_input(spec, cfg->input_pins[i],
5636 auto_pin_cfg_labels[i], idx,
5640 imux->items[imux->num_items].label =
5641 auto_pin_cfg_labels[i];
5642 imux->items[imux->num_items].index = idx;
5645 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5646 idx = cfg->input_pins[i] - 0x09;
5647 err = new_analog_input(spec, cfg->input_pins[i],
5648 auto_pin_cfg_labels[i], idx,
5652 imux->items[imux->num_items].label =
5653 auto_pin_cfg_labels[i];
5654 imux->items[imux->num_items].index = idx;
5661 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5662 hda_nid_t nid, int pin_type,
5665 alc_set_pin_output(codec, nid, pin_type);
5666 /* need the manual connection? */
5668 int idx = nid - 0x12;
5669 snd_hda_codec_write(codec, idx + 0x0b, 0,
5670 AC_VERB_SET_CONNECT_SEL, sel_idx);
5674 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5676 struct alc_spec *spec = codec->spec;
5679 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5680 nid = spec->autocfg.line_out_pins[0];
5682 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5683 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5686 nid = spec->autocfg.speaker_pins[0];
5688 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5690 nid = spec->autocfg.hp_pins[0];
5692 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5695 #define ALC260_PIN_CD_NID 0x16
5696 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5698 struct alc_spec *spec = codec->spec;
5701 for (i = 0; i < AUTO_PIN_LAST; i++) {
5702 hda_nid_t nid = spec->autocfg.input_pins[i];
5704 alc_set_input_pin(codec, nid, i);
5705 if (nid != ALC260_PIN_CD_NID &&
5706 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5707 snd_hda_codec_write(codec, nid, 0,
5708 AC_VERB_SET_AMP_GAIN_MUTE,
5715 * generic initialization of ADC, input mixers and output mixers
5717 static struct hda_verb alc260_volume_init_verbs[] = {
5719 * Unmute ADC0-1 and set the default input to mic-in
5721 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5722 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5723 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5724 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5726 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5728 * Note: PASD motherboards uses the Line In 2 as the input for
5729 * front panel mic (mic 2)
5731 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5732 /* mute analog inputs */
5733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5734 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5740 * Set up output mixers (0x08 - 0x0a)
5742 /* set vol=0 to output mixers */
5743 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5744 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5745 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5746 /* set up input amps for analog loopback */
5747 /* Amp Indices: DAC = 0, mixer = 1 */
5748 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5749 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5750 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5751 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5752 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5753 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5758 static int alc260_parse_auto_config(struct hda_codec *codec)
5760 struct alc_spec *spec = codec->spec;
5762 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5764 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5768 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5771 if (!spec->kctls.list)
5772 return 0; /* can't find valid BIOS pin config */
5773 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5777 spec->multiout.max_channels = 2;
5779 if (spec->autocfg.dig_outs)
5780 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5781 if (spec->kctls.list)
5782 add_mixer(spec, spec->kctls.list);
5784 add_verb(spec, alc260_volume_init_verbs);
5786 spec->num_mux_defs = 1;
5787 spec->input_mux = &spec->private_imux[0];
5792 /* additional initialization for auto-configuration model */
5793 static void alc260_auto_init(struct hda_codec *codec)
5795 struct alc_spec *spec = codec->spec;
5796 alc260_auto_init_multi_out(codec);
5797 alc260_auto_init_analog_input(codec);
5798 if (spec->unsol_event)
5799 alc_inithook(codec);
5802 #ifdef CONFIG_SND_HDA_POWER_SAVE
5803 static struct hda_amp_list alc260_loopbacks[] = {
5804 { 0x07, HDA_INPUT, 0 },
5805 { 0x07, HDA_INPUT, 1 },
5806 { 0x07, HDA_INPUT, 2 },
5807 { 0x07, HDA_INPUT, 3 },
5808 { 0x07, HDA_INPUT, 4 },
5814 * ALC260 configurations
5816 static const char *alc260_models[ALC260_MODEL_LAST] = {
5817 [ALC260_BASIC] = "basic",
5819 [ALC260_HP_3013] = "hp-3013",
5820 [ALC260_HP_DC7600] = "hp-dc7600",
5821 [ALC260_FUJITSU_S702X] = "fujitsu",
5822 [ALC260_ACER] = "acer",
5823 [ALC260_WILL] = "will",
5824 [ALC260_REPLACER_672V] = "replacer",
5825 [ALC260_FAVORIT100] = "favorit100",
5826 #ifdef CONFIG_SND_DEBUG
5827 [ALC260_TEST] = "test",
5829 [ALC260_AUTO] = "auto",
5832 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5833 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5834 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5835 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5836 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5837 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5838 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5839 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5840 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5841 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5842 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5843 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5844 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5845 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5846 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5847 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5848 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5849 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5850 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5851 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5855 static struct alc_config_preset alc260_presets[] = {
5857 .mixers = { alc260_base_output_mixer,
5858 alc260_input_mixer },
5859 .init_verbs = { alc260_init_verbs },
5860 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5861 .dac_nids = alc260_dac_nids,
5862 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5863 .adc_nids = alc260_adc_nids,
5864 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5865 .channel_mode = alc260_modes,
5866 .input_mux = &alc260_capture_source,
5869 .mixers = { alc260_hp_output_mixer,
5870 alc260_input_mixer },
5871 .init_verbs = { alc260_init_verbs,
5872 alc260_hp_unsol_verbs },
5873 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5874 .dac_nids = alc260_dac_nids,
5875 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5876 .adc_nids = alc260_adc_nids_alt,
5877 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5878 .channel_mode = alc260_modes,
5879 .input_mux = &alc260_capture_source,
5880 .unsol_event = alc260_hp_unsol_event,
5881 .init_hook = alc260_hp_automute,
5883 [ALC260_HP_DC7600] = {
5884 .mixers = { alc260_hp_dc7600_mixer,
5885 alc260_input_mixer },
5886 .init_verbs = { alc260_init_verbs,
5887 alc260_hp_dc7600_verbs },
5888 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5889 .dac_nids = alc260_dac_nids,
5890 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5891 .adc_nids = alc260_adc_nids_alt,
5892 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5893 .channel_mode = alc260_modes,
5894 .input_mux = &alc260_capture_source,
5895 .unsol_event = alc260_hp_3012_unsol_event,
5896 .init_hook = alc260_hp_3012_automute,
5898 [ALC260_HP_3013] = {
5899 .mixers = { alc260_hp_3013_mixer,
5900 alc260_input_mixer },
5901 .init_verbs = { alc260_hp_3013_init_verbs,
5902 alc260_hp_3013_unsol_verbs },
5903 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5904 .dac_nids = alc260_dac_nids,
5905 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5906 .adc_nids = alc260_adc_nids_alt,
5907 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5908 .channel_mode = alc260_modes,
5909 .input_mux = &alc260_capture_source,
5910 .unsol_event = alc260_hp_3013_unsol_event,
5911 .init_hook = alc260_hp_3013_automute,
5913 [ALC260_FUJITSU_S702X] = {
5914 .mixers = { alc260_fujitsu_mixer },
5915 .init_verbs = { alc260_fujitsu_init_verbs },
5916 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5917 .dac_nids = alc260_dac_nids,
5918 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5919 .adc_nids = alc260_dual_adc_nids,
5920 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5921 .channel_mode = alc260_modes,
5922 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5923 .input_mux = alc260_fujitsu_capture_sources,
5926 .mixers = { alc260_acer_mixer },
5927 .init_verbs = { alc260_acer_init_verbs },
5928 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5929 .dac_nids = alc260_dac_nids,
5930 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5931 .adc_nids = alc260_dual_adc_nids,
5932 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5933 .channel_mode = alc260_modes,
5934 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5935 .input_mux = alc260_acer_capture_sources,
5937 [ALC260_FAVORIT100] = {
5938 .mixers = { alc260_favorit100_mixer },
5939 .init_verbs = { alc260_favorit100_init_verbs },
5940 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5941 .dac_nids = alc260_dac_nids,
5942 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5943 .adc_nids = alc260_dual_adc_nids,
5944 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5945 .channel_mode = alc260_modes,
5946 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
5947 .input_mux = alc260_favorit100_capture_sources,
5950 .mixers = { alc260_will_mixer },
5951 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5952 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5953 .dac_nids = alc260_dac_nids,
5954 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5955 .adc_nids = alc260_adc_nids,
5956 .dig_out_nid = ALC260_DIGOUT_NID,
5957 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5958 .channel_mode = alc260_modes,
5959 .input_mux = &alc260_capture_source,
5961 [ALC260_REPLACER_672V] = {
5962 .mixers = { alc260_replacer_672v_mixer },
5963 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5964 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5965 .dac_nids = alc260_dac_nids,
5966 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5967 .adc_nids = alc260_adc_nids,
5968 .dig_out_nid = ALC260_DIGOUT_NID,
5969 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5970 .channel_mode = alc260_modes,
5971 .input_mux = &alc260_capture_source,
5972 .unsol_event = alc260_replacer_672v_unsol_event,
5973 .init_hook = alc260_replacer_672v_automute,
5975 #ifdef CONFIG_SND_DEBUG
5977 .mixers = { alc260_test_mixer },
5978 .init_verbs = { alc260_test_init_verbs },
5979 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5980 .dac_nids = alc260_test_dac_nids,
5981 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5982 .adc_nids = alc260_test_adc_nids,
5983 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5984 .channel_mode = alc260_modes,
5985 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5986 .input_mux = alc260_test_capture_sources,
5991 static int patch_alc260(struct hda_codec *codec)
5993 struct alc_spec *spec;
5994 int err, board_config;
5996 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6002 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6005 if (board_config < 0) {
6006 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
6007 "trying auto-probe from BIOS...\n");
6008 board_config = ALC260_AUTO;
6011 if (board_config == ALC260_AUTO) {
6012 /* automatic parse from the BIOS config */
6013 err = alc260_parse_auto_config(codec);
6019 "hda_codec: Cannot set up configuration "
6020 "from BIOS. Using base mode...\n");
6021 board_config = ALC260_BASIC;
6025 err = snd_hda_attach_beep_device(codec, 0x1);
6031 if (board_config != ALC260_AUTO)
6032 setup_preset(spec, &alc260_presets[board_config]);
6034 spec->stream_name_analog = "ALC260 Analog";
6035 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6036 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6038 spec->stream_name_digital = "ALC260 Digital";
6039 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6040 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6042 if (!spec->adc_nids && spec->input_mux) {
6043 /* check whether NID 0x04 is valid */
6044 unsigned int wcap = get_wcaps(codec, 0x04);
6045 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6047 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6048 spec->adc_nids = alc260_adc_nids_alt;
6049 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6051 spec->adc_nids = alc260_adc_nids;
6052 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6055 set_capture_mixer(spec);
6056 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6058 spec->vmaster_nid = 0x08;
6060 codec->patch_ops = alc_patch_ops;
6061 if (board_config == ALC260_AUTO)
6062 spec->init_hook = alc260_auto_init;
6063 #ifdef CONFIG_SND_HDA_POWER_SAVE
6064 if (!spec->loopback.amplist)
6065 spec->loopback.amplist = alc260_loopbacks;
6067 codec->proc_widget_hook = print_realtek_coef;
6076 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6077 * configuration. Each pin widget can choose any input DACs and a mixer.
6078 * Each ADC is connected from a mixer of all inputs. This makes possible
6079 * 6-channel independent captures.
6081 * In addition, an independent DAC for the multi-playback (not used in this
6084 #define ALC882_DIGOUT_NID 0x06
6085 #define ALC882_DIGIN_NID 0x0a
6087 static struct hda_channel_mode alc882_ch_modes[1] = {
6091 static hda_nid_t alc882_dac_nids[4] = {
6092 /* front, rear, clfe, rear_surr */
6093 0x02, 0x03, 0x04, 0x05
6096 /* identical with ALC880 */
6097 #define alc882_adc_nids alc880_adc_nids
6098 #define alc882_adc_nids_alt alc880_adc_nids_alt
6100 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6101 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6104 /* FIXME: should be a matrix-type input source selection */
6106 static struct hda_input_mux alc882_capture_source = {
6110 { "Front Mic", 0x1 },
6118 static struct hda_verb alc882_3ST_ch2_init[] = {
6119 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6120 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6121 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6122 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6129 static struct hda_verb alc882_3ST_ch6_init[] = {
6130 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6131 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6132 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6133 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6134 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6135 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6139 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6140 { 2, alc882_3ST_ch2_init },
6141 { 6, alc882_3ST_ch6_init },
6147 static struct hda_verb alc882_sixstack_ch6_init[] = {
6148 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6149 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6150 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6151 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6158 static struct hda_verb alc882_sixstack_ch8_init[] = {
6159 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6160 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6161 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6162 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6166 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6167 { 6, alc882_sixstack_ch6_init },
6168 { 8, alc882_sixstack_ch8_init },
6172 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6178 static struct hda_verb alc885_mbp_ch2_init[] = {
6179 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6180 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6181 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6188 static struct hda_verb alc885_mbp_ch6_init[] = {
6189 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6190 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6191 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6192 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6193 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6197 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6198 { 2, alc885_mbp_ch2_init },
6199 { 6, alc885_mbp_ch6_init },
6203 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6204 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6206 static struct snd_kcontrol_new alc882_base_mixer[] = {
6207 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6208 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6209 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6210 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6211 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6212 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6213 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6214 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6215 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6216 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6218 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6219 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6220 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6221 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6223 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6225 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6226 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6227 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6231 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6233 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6234 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6235 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6236 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6237 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6239 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6240 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6241 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6244 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6246 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6250 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6257 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6261 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6262 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6264 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6267 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6268 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6269 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6270 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6274 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6275 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6277 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6278 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6279 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6280 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6281 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6282 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6283 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6286 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6287 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6290 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6294 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6295 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6296 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6297 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6299 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6300 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6301 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6302 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6303 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6308 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6311 .name = "Channel Mode",
6312 .info = alc_ch_mode_info,
6313 .get = alc_ch_mode_get,
6314 .put = alc_ch_mode_put,
6319 static struct hda_verb alc882_init_verbs[] = {
6320 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6322 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6326 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6329 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6330 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6331 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6333 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6334 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6335 {0x0f, 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 /* Rear Pin: output 1 (0x0d) */
6342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6343 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6345 /* CLFE Pin: output 2 (0x0e) */
6346 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6347 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6348 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6349 /* Side Pin: output 3 (0x0f) */
6350 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6351 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6352 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6353 /* Mic (rear) pin: input vref at 80% */
6354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6356 /* Front Mic pin: input vref at 80% */
6357 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6358 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6359 /* Line In pin: input */
6360 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6361 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6362 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6363 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6364 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6365 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6366 /* CD pin widget for input */
6367 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6369 /* FIXME: use matrix-type input source selection */
6370 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6371 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6386 /* ADC1: mute amp left and right */
6387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6388 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6389 /* ADC2: mute amp left and right */
6390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6391 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6392 /* ADC3: mute amp left and right */
6393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6394 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6399 static struct hda_verb alc882_eapd_verbs[] = {
6400 /* change to EAPD mode */
6401 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6402 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6407 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6408 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6409 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6411 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6412 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6413 /* FIXME: this looks suspicious...
6414 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6415 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6420 static struct hda_verb alc882_macpro_init_verbs[] = {
6421 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6422 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6423 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6425 /* Front Pin: output 0 (0x0c) */
6426 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6427 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6428 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6429 /* Front Mic pin: input vref at 80% */
6430 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6431 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6432 /* Speaker: output */
6433 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6434 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6435 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6436 /* Headphone output (output 0 - 0x0c) */
6437 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6438 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6439 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6441 /* FIXME: use matrix-type input source selection */
6442 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6443 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6444 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6449 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6450 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6458 /* ADC1: mute amp left and right */
6459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6460 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6461 /* ADC2: mute amp left and right */
6462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6463 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6464 /* ADC3: mute amp left and right */
6465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6466 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6471 /* Macbook Pro rev3 */
6472 static struct hda_verb alc885_mbp3_init_verbs[] = {
6473 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6479 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6481 /* Front Pin: output 0 (0x0c) */
6482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6484 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6485 /* HP Pin: output 0 (0x0d) */
6486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6487 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6489 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6490 /* Mic (rear) pin: input vref at 80% */
6491 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6492 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6493 /* Front Mic pin: input vref at 80% */
6494 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6495 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6496 /* Line In pin: use output 1 when in LineOut mode */
6497 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6498 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6499 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6501 /* FIXME: use matrix-type input source selection */
6502 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6503 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6504 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6505 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6511 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6512 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6517 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6518 /* ADC1: mute amp left and right */
6519 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6520 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6521 /* ADC2: mute amp left and right */
6522 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6523 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6524 /* ADC3: mute amp left and right */
6525 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6526 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6531 /* iMac 24 mixer. */
6532 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6533 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6534 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6538 /* iMac 24 init verbs. */
6539 static struct hda_verb alc885_imac24_init_verbs[] = {
6540 /* Internal speakers: output 0 (0x0c) */
6541 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6542 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6543 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6544 /* Internal speakers: output 0 (0x0c) */
6545 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6546 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6547 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6548 /* Headphone: output 0 (0x0c) */
6549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6550 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6551 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6552 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6553 /* Front Mic: input vref at 80% */
6554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6555 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6559 /* Toggle speaker-output according to the hp-jack state */
6560 static void alc885_imac24_automute(struct hda_codec *codec)
6562 unsigned int present;
6564 present = snd_hda_codec_read(codec, 0x14, 0,
6565 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6566 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6567 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6568 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6569 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6572 /* Processes unsolicited events. */
6573 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6576 /* Headphone insertion or removal. */
6577 if ((res >> 26) == ALC880_HP_EVENT)
6578 alc885_imac24_automute(codec);
6581 static void alc885_mbp3_automute(struct hda_codec *codec)
6583 unsigned int present;
6585 present = snd_hda_codec_read(codec, 0x15, 0,
6586 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6587 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6588 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6589 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6590 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6593 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6596 /* Headphone insertion or removal. */
6597 if ((res >> 26) == ALC880_HP_EVENT)
6598 alc885_mbp3_automute(codec);
6602 static struct hda_verb alc882_targa_verbs[] = {
6603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6607 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6609 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6610 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6611 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6613 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6614 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6615 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6616 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6620 /* toggle speaker-output according to the hp-jack state */
6621 static void alc882_targa_automute(struct hda_codec *codec)
6623 unsigned int present;
6625 present = snd_hda_codec_read(codec, 0x14, 0,
6626 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6627 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6628 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6629 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6633 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6635 /* Looks like the unsol event is incompatible with the standard
6636 * definition. 4bit tag is placed at 26 bit!
6638 if (((res >> 26) == ALC880_HP_EVENT)) {
6639 alc882_targa_automute(codec);
6643 static struct hda_verb alc882_asus_a7j_verbs[] = {
6644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6647 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6649 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6651 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6652 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6653 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6655 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6656 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6657 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6661 static struct hda_verb alc882_asus_a7m_verbs[] = {
6662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6667 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6669 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6670 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6671 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6673 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6674 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6675 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6679 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6681 unsigned int gpiostate, gpiomask, gpiodir;
6683 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6684 AC_VERB_GET_GPIO_DATA, 0);
6687 gpiostate |= (1 << pin);
6689 gpiostate &= ~(1 << pin);
6691 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6692 AC_VERB_GET_GPIO_MASK, 0);
6693 gpiomask |= (1 << pin);
6695 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6696 AC_VERB_GET_GPIO_DIRECTION, 0);
6697 gpiodir |= (1 << pin);
6700 snd_hda_codec_write(codec, codec->afg, 0,
6701 AC_VERB_SET_GPIO_MASK, gpiomask);
6702 snd_hda_codec_write(codec, codec->afg, 0,
6703 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6707 snd_hda_codec_write(codec, codec->afg, 0,
6708 AC_VERB_SET_GPIO_DATA, gpiostate);
6711 /* set up GPIO at initialization */
6712 static void alc885_macpro_init_hook(struct hda_codec *codec)
6714 alc882_gpio_mute(codec, 0, 0);
6715 alc882_gpio_mute(codec, 1, 0);
6718 /* set up GPIO and update auto-muting at initialization */
6719 static void alc885_imac24_init_hook(struct hda_codec *codec)
6721 alc885_macpro_init_hook(codec);
6722 alc885_imac24_automute(codec);
6726 * generic initialization of ADC, input mixers and output mixers
6728 static struct hda_verb alc882_auto_init_verbs[] = {
6730 * Unmute ADC0-2 and set the default input to mic-in
6732 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6734 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6736 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6737 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6739 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6741 * Note: PASD motherboards uses the Line In 2 as the input for
6742 * front panel mic (mic 2)
6744 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6745 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6747 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6748 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6749 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6752 * Set up output mixers (0x0c - 0x0f)
6754 /* set vol=0 to output mixers */
6755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6756 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6759 /* set up input amps for analog loopback */
6760 /* Amp Indices: DAC = 0, mixer = 1 */
6761 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6763 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6764 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6765 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6766 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6767 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6769 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6770 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6772 /* FIXME: use matrix-type input source selection */
6773 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6774 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6793 #ifdef CONFIG_SND_HDA_POWER_SAVE
6794 #define alc882_loopbacks alc880_loopbacks
6797 /* pcm configuration: identiacal with ALC880 */
6798 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6799 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6800 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6801 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6804 * configuration and preset
6806 static const char *alc882_models[ALC882_MODEL_LAST] = {
6807 [ALC882_3ST_DIG] = "3stack-dig",
6808 [ALC882_6ST_DIG] = "6stack-dig",
6809 [ALC882_ARIMA] = "arima",
6810 [ALC882_W2JC] = "w2jc",
6811 [ALC882_TARGA] = "targa",
6812 [ALC882_ASUS_A7J] = "asus-a7j",
6813 [ALC882_ASUS_A7M] = "asus-a7m",
6814 [ALC885_MACPRO] = "macpro",
6815 [ALC885_MBP3] = "mbp3",
6816 [ALC885_IMAC24] = "imac24",
6817 [ALC882_AUTO] = "auto",
6820 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6821 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6822 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6823 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6824 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6825 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6826 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6827 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6828 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6829 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6830 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6831 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6832 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6836 static struct alc_config_preset alc882_presets[] = {
6837 [ALC882_3ST_DIG] = {
6838 .mixers = { alc882_base_mixer },
6839 .init_verbs = { alc882_init_verbs },
6840 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6841 .dac_nids = alc882_dac_nids,
6842 .dig_out_nid = ALC882_DIGOUT_NID,
6843 .dig_in_nid = ALC882_DIGIN_NID,
6844 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6845 .channel_mode = alc882_ch_modes,
6847 .input_mux = &alc882_capture_source,
6849 [ALC882_6ST_DIG] = {
6850 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6851 .init_verbs = { alc882_init_verbs },
6852 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6853 .dac_nids = alc882_dac_nids,
6854 .dig_out_nid = ALC882_DIGOUT_NID,
6855 .dig_in_nid = ALC882_DIGIN_NID,
6856 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6857 .channel_mode = alc882_sixstack_modes,
6858 .input_mux = &alc882_capture_source,
6861 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6862 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6863 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6864 .dac_nids = alc882_dac_nids,
6865 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6866 .channel_mode = alc882_sixstack_modes,
6867 .input_mux = &alc882_capture_source,
6870 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6871 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6872 alc880_gpio1_init_verbs },
6873 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6874 .dac_nids = alc882_dac_nids,
6875 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6876 .channel_mode = alc880_threestack_modes,
6878 .input_mux = &alc882_capture_source,
6879 .dig_out_nid = ALC882_DIGOUT_NID,
6882 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6883 .init_verbs = { alc885_mbp3_init_verbs,
6884 alc880_gpio1_init_verbs },
6885 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6886 .dac_nids = alc882_dac_nids,
6887 .channel_mode = alc885_mbp_6ch_modes,
6888 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6889 .input_mux = &alc882_capture_source,
6890 .dig_out_nid = ALC882_DIGOUT_NID,
6891 .dig_in_nid = ALC882_DIGIN_NID,
6892 .unsol_event = alc885_mbp3_unsol_event,
6893 .init_hook = alc885_mbp3_automute,
6896 .mixers = { alc882_macpro_mixer },
6897 .init_verbs = { alc882_macpro_init_verbs },
6898 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6899 .dac_nids = alc882_dac_nids,
6900 .dig_out_nid = ALC882_DIGOUT_NID,
6901 .dig_in_nid = ALC882_DIGIN_NID,
6902 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6903 .channel_mode = alc882_ch_modes,
6904 .input_mux = &alc882_capture_source,
6905 .init_hook = alc885_macpro_init_hook,
6908 .mixers = { alc885_imac24_mixer },
6909 .init_verbs = { alc885_imac24_init_verbs },
6910 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6911 .dac_nids = alc882_dac_nids,
6912 .dig_out_nid = ALC882_DIGOUT_NID,
6913 .dig_in_nid = ALC882_DIGIN_NID,
6914 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6915 .channel_mode = alc882_ch_modes,
6916 .input_mux = &alc882_capture_source,
6917 .unsol_event = alc885_imac24_unsol_event,
6918 .init_hook = alc885_imac24_init_hook,
6921 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6922 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6923 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6924 .dac_nids = alc882_dac_nids,
6925 .dig_out_nid = ALC882_DIGOUT_NID,
6926 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6927 .adc_nids = alc882_adc_nids,
6928 .capsrc_nids = alc882_capsrc_nids,
6929 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6930 .channel_mode = alc882_3ST_6ch_modes,
6932 .input_mux = &alc882_capture_source,
6933 .unsol_event = alc882_targa_unsol_event,
6934 .init_hook = alc882_targa_automute,
6936 [ALC882_ASUS_A7J] = {
6937 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6938 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6939 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6940 .dac_nids = alc882_dac_nids,
6941 .dig_out_nid = ALC882_DIGOUT_NID,
6942 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6943 .adc_nids = alc882_adc_nids,
6944 .capsrc_nids = alc882_capsrc_nids,
6945 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6946 .channel_mode = alc882_3ST_6ch_modes,
6948 .input_mux = &alc882_capture_source,
6950 [ALC882_ASUS_A7M] = {
6951 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6952 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6953 alc880_gpio1_init_verbs,
6954 alc882_asus_a7m_verbs },
6955 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6956 .dac_nids = alc882_dac_nids,
6957 .dig_out_nid = ALC882_DIGOUT_NID,
6958 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6959 .channel_mode = alc880_threestack_modes,
6961 .input_mux = &alc882_capture_source,
6970 PINFIX_ABIT_AW9D_MAX
6973 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6974 { 0x15, 0x01080104 }, /* side */
6975 { 0x16, 0x01011012 }, /* rear */
6976 { 0x17, 0x01016011 }, /* clfe */
6980 static const struct alc_pincfg *alc882_pin_fixes[] = {
6981 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6984 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6985 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6990 * BIOS auto configuration
6992 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6993 hda_nid_t nid, int pin_type,
6997 struct alc_spec *spec = codec->spec;
7000 alc_set_pin_output(codec, nid, pin_type);
7001 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7004 idx = spec->multiout.dac_nids[dac_idx] - 2;
7005 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7009 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7011 struct alc_spec *spec = codec->spec;
7014 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7015 for (i = 0; i <= HDA_SIDE; i++) {
7016 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7017 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7019 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7024 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7026 struct alc_spec *spec = codec->spec;
7029 pin = spec->autocfg.hp_pins[0];
7030 if (pin) /* connect to front */
7032 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7033 pin = spec->autocfg.speaker_pins[0];
7035 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7038 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7039 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7041 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7043 struct alc_spec *spec = codec->spec;
7046 for (i = 0; i < AUTO_PIN_LAST; i++) {
7047 hda_nid_t nid = spec->autocfg.input_pins[i];
7050 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7051 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7052 snd_hda_codec_write(codec, nid, 0,
7053 AC_VERB_SET_AMP_GAIN_MUTE,
7058 static void alc882_auto_init_input_src(struct hda_codec *codec)
7060 struct alc_spec *spec = codec->spec;
7063 for (c = 0; c < spec->num_adc_nids; c++) {
7064 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7065 hda_nid_t nid = spec->capsrc_nids[c];
7066 unsigned int mux_idx;
7067 const struct hda_input_mux *imux;
7068 int conns, mute, idx, item;
7070 conns = snd_hda_get_connections(codec, nid, conn_list,
7071 ARRAY_SIZE(conn_list));
7074 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7075 imux = &spec->input_mux[mux_idx];
7076 for (idx = 0; idx < conns; idx++) {
7077 /* if the current connection is the selected one,
7078 * unmute it as default - otherwise mute it
7080 mute = AMP_IN_MUTE(idx);
7081 for (item = 0; item < imux->num_items; item++) {
7082 if (imux->items[item].index == idx) {
7083 if (spec->cur_mux[c] == item)
7084 mute = AMP_IN_UNMUTE(idx);
7088 /* check if we have a selector or mixer
7089 * we could check for the widget type instead, but
7090 * just check for Amp-In presence (in case of mixer
7091 * without amp-in there is something wrong, this
7092 * function shouldn't be used or capsrc nid is wrong)
7094 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7095 snd_hda_codec_write(codec, nid, 0,
7096 AC_VERB_SET_AMP_GAIN_MUTE,
7098 else if (mute != AMP_IN_MUTE(idx))
7099 snd_hda_codec_write(codec, nid, 0,
7100 AC_VERB_SET_CONNECT_SEL,
7106 /* add mic boosts if needed */
7107 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7109 struct alc_spec *spec = codec->spec;
7113 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7114 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7115 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7117 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7121 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7122 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7123 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7125 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7132 /* almost identical with ALC880 parser... */
7133 static int alc882_parse_auto_config(struct hda_codec *codec)
7135 struct alc_spec *spec = codec->spec;
7136 int err = alc880_parse_auto_config(codec);
7141 return 0; /* no config found */
7143 err = alc_auto_add_mic_boost(codec);
7147 /* hack - override the init verbs */
7148 spec->init_verbs[0] = alc882_auto_init_verbs;
7150 return 1; /* config found */
7153 /* additional initialization for auto-configuration model */
7154 static void alc882_auto_init(struct hda_codec *codec)
7156 struct alc_spec *spec = codec->spec;
7157 alc882_auto_init_multi_out(codec);
7158 alc882_auto_init_hp_out(codec);
7159 alc882_auto_init_analog_input(codec);
7160 alc882_auto_init_input_src(codec);
7161 if (spec->unsol_event)
7162 alc_inithook(codec);
7165 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7167 static int patch_alc882(struct hda_codec *codec)
7169 struct alc_spec *spec;
7170 int err, board_config;
7172 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7178 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7182 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7183 /* Pick up systems that don't supply PCI SSID */
7184 switch (codec->subsystem_id) {
7185 case 0x106b0c00: /* Mac Pro */
7186 board_config = ALC885_MACPRO;
7188 case 0x106b1000: /* iMac 24 */
7189 case 0x106b2800: /* AppleTV */
7190 case 0x106b3e00: /* iMac 24 Aluminium */
7191 board_config = ALC885_IMAC24;
7193 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7194 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7195 case 0x106b00a4: /* MacbookPro4,1 */
7196 case 0x106b2c00: /* Macbook Pro rev3 */
7197 case 0x106b3600: /* Macbook 3.1 */
7198 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7199 board_config = ALC885_MBP3;
7202 /* ALC889A is handled better as ALC888-compatible */
7203 if (codec->revision_id == 0x100101 ||
7204 codec->revision_id == 0x100103) {
7206 return patch_alc883(codec);
7208 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7209 "trying auto-probe from BIOS...\n");
7210 board_config = ALC882_AUTO;
7214 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7216 if (board_config == ALC882_AUTO) {
7217 /* automatic parse from the BIOS config */
7218 err = alc882_parse_auto_config(codec);
7224 "hda_codec: Cannot set up configuration "
7225 "from BIOS. Using base mode...\n");
7226 board_config = ALC882_3ST_DIG;
7230 err = snd_hda_attach_beep_device(codec, 0x1);
7236 if (board_config != ALC882_AUTO)
7237 setup_preset(spec, &alc882_presets[board_config]);
7239 if (codec->vendor_id == 0x10ec0885) {
7240 spec->stream_name_analog = "ALC885 Analog";
7241 spec->stream_name_digital = "ALC885 Digital";
7243 spec->stream_name_analog = "ALC882 Analog";
7244 spec->stream_name_digital = "ALC882 Digital";
7247 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7248 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7249 /* FIXME: setup DAC5 */
7250 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7251 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7253 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7254 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7256 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7257 if (!spec->adc_nids && spec->input_mux) {
7258 /* check whether NID 0x07 is valid */
7259 unsigned int wcap = get_wcaps(codec, 0x07);
7261 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7262 if (wcap != AC_WID_AUD_IN) {
7263 spec->adc_nids = alc882_adc_nids_alt;
7264 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7265 spec->capsrc_nids = alc882_capsrc_nids_alt;
7267 spec->adc_nids = alc882_adc_nids;
7268 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7269 spec->capsrc_nids = alc882_capsrc_nids;
7272 set_capture_mixer(spec);
7273 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7275 spec->vmaster_nid = 0x0c;
7277 codec->patch_ops = alc_patch_ops;
7278 if (board_config == ALC882_AUTO)
7279 spec->init_hook = alc882_auto_init;
7280 #ifdef CONFIG_SND_HDA_POWER_SAVE
7281 if (!spec->loopback.amplist)
7282 spec->loopback.amplist = alc882_loopbacks;
7284 codec->proc_widget_hook = print_realtek_coef;
7292 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7293 * configuration. Each pin widget can choose any input DACs and a mixer.
7294 * Each ADC is connected from a mixer of all inputs. This makes possible
7295 * 6-channel independent captures.
7297 * In addition, an independent DAC for the multi-playback (not used in this
7300 #define ALC883_DIGOUT_NID 0x06
7301 #define ALC883_DIGIN_NID 0x0a
7303 #define ALC1200_DIGOUT_NID 0x10
7305 static hda_nid_t alc883_dac_nids[4] = {
7306 /* front, rear, clfe, rear_surr */
7307 0x02, 0x03, 0x04, 0x05
7310 static hda_nid_t alc883_adc_nids[2] = {
7315 static hda_nid_t alc883_adc_nids_alt[1] = {
7320 static hda_nid_t alc883_adc_nids_rev[2] = {
7325 #define alc889_adc_nids alc880_adc_nids
7327 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7329 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7331 #define alc889_capsrc_nids alc882_capsrc_nids
7334 /* FIXME: should be a matrix-type input source selection */
7336 static struct hda_input_mux alc883_capture_source = {
7340 { "Front Mic", 0x1 },
7346 static struct hda_input_mux alc883_3stack_6ch_intel = {
7350 { "Front Mic", 0x0 },
7356 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7364 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7374 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7382 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7386 { "Front Mic", 0x1 },
7391 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7402 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7409 static struct hda_verb alc883_3ST_ch2_init[] = {
7410 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7411 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7412 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7413 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7420 static struct hda_verb alc883_3ST_ch4_init[] = {
7421 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7422 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7423 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7424 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7425 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7432 static struct hda_verb alc883_3ST_ch6_init[] = {
7433 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7434 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7435 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7436 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7437 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7438 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7442 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7443 { 2, alc883_3ST_ch2_init },
7444 { 4, alc883_3ST_ch4_init },
7445 { 6, alc883_3ST_ch6_init },
7451 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7452 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7453 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7454 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7455 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7462 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7463 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7464 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7465 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7466 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7467 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7474 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7475 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7476 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7477 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7478 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7479 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7480 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7484 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7485 { 2, alc883_3ST_ch2_intel_init },
7486 { 4, alc883_3ST_ch4_intel_init },
7487 { 6, alc883_3ST_ch6_intel_init },
7493 static struct hda_verb alc883_sixstack_ch6_init[] = {
7494 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7495 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7496 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7497 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7504 static struct hda_verb alc883_sixstack_ch8_init[] = {
7505 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7506 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7507 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7508 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7512 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7513 { 6, alc883_sixstack_ch6_init },
7514 { 8, alc883_sixstack_ch8_init },
7517 static struct hda_verb alc883_medion_eapd_verbs[] = {
7518 /* eanable EAPD on medion laptop */
7519 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7520 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7524 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7525 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7528 static struct snd_kcontrol_new alc883_base_mixer[] = {
7529 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7530 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7531 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7532 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7533 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7534 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7535 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7536 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7537 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7538 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7539 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7540 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7541 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7542 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7543 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7545 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7547 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7548 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7549 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7553 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7554 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7555 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7556 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7557 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7558 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7559 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7562 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7563 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7564 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7565 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7566 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7570 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7571 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7572 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7573 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7574 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7576 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7577 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7579 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7580 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7584 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7585 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7586 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7587 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7588 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7591 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7592 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7593 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7594 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7598 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7599 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7600 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7601 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7605 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7607 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7609 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7610 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7611 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7615 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7616 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7617 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7618 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7619 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7620 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7621 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7622 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7623 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7624 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7625 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7626 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7627 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7628 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7631 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7632 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7633 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7634 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7638 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7639 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7640 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7642 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7643 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7645 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7646 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7647 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7649 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7650 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7651 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7652 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7654 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7655 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7656 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7657 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7658 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7662 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7665 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7666 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7667 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7668 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7669 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7670 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7672 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7673 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7674 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7675 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7676 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7677 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7678 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7679 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7680 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7681 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7685 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7686 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7688 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7689 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7690 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7691 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7692 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7693 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7694 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7695 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7696 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7697 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7698 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7699 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7700 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7701 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7705 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7706 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7707 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7708 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7709 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7710 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7714 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7715 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7716 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7720 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7721 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7722 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7723 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7724 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7725 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7726 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7727 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7728 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7732 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7733 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7734 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7736 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7737 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7740 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7741 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7745 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7746 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7748 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7749 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7750 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7751 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7752 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7753 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7754 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7758 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7759 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7760 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7761 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7762 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7763 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7765 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7766 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7770 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7771 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7772 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7774 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7775 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7776 0x0d, 1, 0x0, HDA_OUTPUT),
7777 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7778 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7779 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7780 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7781 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7783 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7784 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7785 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7786 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7787 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7789 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7791 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7792 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7793 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7797 static struct hda_bind_ctls alc883_bind_cap_vol = {
7798 .ops = &snd_hda_bind_vol,
7800 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7801 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7806 static struct hda_bind_ctls alc883_bind_cap_switch = {
7807 .ops = &snd_hda_bind_sw,
7809 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7810 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7815 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7816 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7817 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7818 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7819 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7820 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7822 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7823 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7827 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7828 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7829 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7831 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7832 /* .name = "Capture Source", */
7833 .name = "Input Source",
7835 .info = alc_mux_enum_info,
7836 .get = alc_mux_enum_get,
7837 .put = alc_mux_enum_put,
7842 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7844 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7845 .name = "Channel Mode",
7846 .info = alc_ch_mode_info,
7847 .get = alc_ch_mode_get,
7848 .put = alc_ch_mode_put,
7853 static struct hda_verb alc883_init_verbs[] = {
7854 /* ADC1: mute amp left and right */
7855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7856 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7857 /* ADC2: mute amp left and right */
7858 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7859 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7860 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7861 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7865 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7866 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7867 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7869 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7870 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7871 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7873 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7874 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7875 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7877 /* mute analog input loopbacks */
7878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7884 /* Front Pin: output 0 (0x0c) */
7885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7887 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7888 /* Rear Pin: output 1 (0x0d) */
7889 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7891 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7892 /* CLFE Pin: output 2 (0x0e) */
7893 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7894 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7895 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7896 /* Side Pin: output 3 (0x0f) */
7897 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7898 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7899 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7900 /* Mic (rear) pin: input vref at 80% */
7901 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7902 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7903 /* Front Mic pin: input vref at 80% */
7904 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7905 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7906 /* Line In pin: input */
7907 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7908 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7909 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7910 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7911 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7912 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7913 /* CD pin widget for input */
7914 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7916 /* FIXME: use matrix-type input source selection */
7917 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7919 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7921 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7922 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7927 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7931 /* toggle speaker-output according to the hp-jack state */
7932 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7934 unsigned int present;
7936 present = snd_hda_codec_read(codec, 0x15, 0,
7937 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7938 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7939 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7940 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7941 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7944 /* auto-toggle front mic */
7946 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7948 unsigned int present;
7951 present = snd_hda_codec_read(codec, 0x18, 0,
7952 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7953 bits = present ? HDA_AMP_MUTE : 0;
7954 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7958 static void alc883_mitac_automute(struct hda_codec *codec)
7960 alc883_mitac_hp_automute(codec);
7961 /* alc883_mitac_mic_automute(codec); */
7964 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7967 switch (res >> 26) {
7968 case ALC880_HP_EVENT:
7969 alc883_mitac_hp_automute(codec);
7971 case ALC880_MIC_EVENT:
7972 /* alc883_mitac_mic_automute(codec); */
7977 static struct hda_verb alc883_mitac_verbs[] = {
7979 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7980 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7982 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7983 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7985 /* enable unsolicited event */
7986 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7987 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7992 static struct hda_verb alc883_clevo_m720_verbs[] = {
7994 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7997 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7998 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8000 /* enable unsolicited event */
8001 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8002 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8007 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8009 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8013 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8015 /* enable unsolicited event */
8016 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8021 static struct hda_verb alc883_tagra_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},
8026 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8028 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8029 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8030 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8032 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8033 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8034 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8035 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8040 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8041 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8042 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8043 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8047 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8048 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8049 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8050 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8051 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8055 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8056 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8058 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8059 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8064 static struct hda_verb alc883_haier_w66_verbs[] = {
8065 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8066 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8068 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8070 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8071 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8072 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8077 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8080 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8083 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8084 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8085 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8089 static struct hda_verb alc888_6st_dell_verbs[] = {
8090 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8094 static void alc888_3st_hp_front_automute(struct hda_codec *codec)
8096 unsigned int present, bits;
8098 present = snd_hda_codec_read(codec, 0x1b, 0,
8099 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8100 bits = present ? HDA_AMP_MUTE : 0;
8101 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8102 HDA_AMP_MUTE, bits);
8103 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8104 HDA_AMP_MUTE, bits);
8105 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
8106 HDA_AMP_MUTE, bits);
8109 static void alc888_3st_hp_unsol_event(struct hda_codec *codec,
8112 switch (res >> 26) {
8113 case ALC880_HP_EVENT:
8114 alc888_3st_hp_front_automute(codec);
8119 static struct hda_verb alc888_3st_hp_verbs[] = {
8120 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8121 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8122 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8123 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8130 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8131 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8132 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8133 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8134 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8141 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8142 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8143 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8144 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8145 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8146 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8153 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8154 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8155 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8156 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8157 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8158 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8159 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8163 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8164 { 2, alc888_3st_hp_2ch_init },
8165 { 4, alc888_3st_hp_4ch_init },
8166 { 6, alc888_3st_hp_6ch_init },
8169 /* toggle front-jack and RCA according to the hp-jack state */
8170 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8172 unsigned int present;
8174 present = snd_hda_codec_read(codec, 0x1b, 0,
8175 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8176 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8177 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8178 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8179 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8182 /* toggle RCA according to the front-jack state */
8183 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8185 unsigned int present;
8187 present = snd_hda_codec_read(codec, 0x14, 0,
8188 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8189 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8190 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8193 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8196 if ((res >> 26) == ALC880_HP_EVENT)
8197 alc888_lenovo_ms7195_front_automute(codec);
8198 if ((res >> 26) == ALC880_FRONT_EVENT)
8199 alc888_lenovo_ms7195_rca_automute(codec);
8202 static struct hda_verb alc883_medion_md2_verbs[] = {
8203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8208 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8212 /* toggle speaker-output according to the hp-jack state */
8213 static void alc883_medion_md2_automute(struct hda_codec *codec)
8215 unsigned int present;
8217 present = snd_hda_codec_read(codec, 0x14, 0,
8218 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8219 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8220 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8223 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8226 if ((res >> 26) == ALC880_HP_EVENT)
8227 alc883_medion_md2_automute(codec);
8230 /* toggle speaker-output according to the hp-jack state */
8231 static void alc883_tagra_automute(struct hda_codec *codec)
8233 unsigned int present;
8236 present = snd_hda_codec_read(codec, 0x14, 0,
8237 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8238 bits = present ? HDA_AMP_MUTE : 0;
8239 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8240 HDA_AMP_MUTE, bits);
8241 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8245 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8247 if ((res >> 26) == ALC880_HP_EVENT)
8248 alc883_tagra_automute(codec);
8251 /* toggle speaker-output according to the hp-jack state */
8252 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8254 unsigned int present;
8257 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8258 & AC_PINSENSE_PRESENCE;
8259 bits = present ? HDA_AMP_MUTE : 0;
8260 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8261 HDA_AMP_MUTE, bits);
8264 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8266 unsigned int present;
8268 present = snd_hda_codec_read(codec, 0x18, 0,
8269 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8270 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8271 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8274 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8276 alc883_clevo_m720_hp_automute(codec);
8277 alc883_clevo_m720_mic_automute(codec);
8280 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8283 switch (res >> 26) {
8284 case ALC880_HP_EVENT:
8285 alc883_clevo_m720_hp_automute(codec);
8287 case ALC880_MIC_EVENT:
8288 alc883_clevo_m720_mic_automute(codec);
8293 /* toggle speaker-output according to the hp-jack state */
8294 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8296 unsigned int present;
8299 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8300 & AC_PINSENSE_PRESENCE;
8301 bits = present ? HDA_AMP_MUTE : 0;
8302 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8303 HDA_AMP_MUTE, bits);
8306 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8309 if ((res >> 26) == ALC880_HP_EVENT)
8310 alc883_2ch_fujitsu_pi2515_automute(codec);
8313 static void alc883_haier_w66_automute(struct hda_codec *codec)
8315 unsigned int present;
8318 present = snd_hda_codec_read(codec, 0x1b, 0,
8319 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8320 bits = present ? 0x80 : 0;
8321 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8325 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8328 if ((res >> 26) == ALC880_HP_EVENT)
8329 alc883_haier_w66_automute(codec);
8332 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8334 unsigned int present;
8337 present = snd_hda_codec_read(codec, 0x14, 0,
8338 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8339 bits = present ? HDA_AMP_MUTE : 0;
8340 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8341 HDA_AMP_MUTE, bits);
8344 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8346 unsigned int present;
8349 present = snd_hda_codec_read(codec, 0x1b, 0,
8350 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8351 bits = present ? HDA_AMP_MUTE : 0;
8352 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8353 HDA_AMP_MUTE, bits);
8354 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8355 HDA_AMP_MUTE, bits);
8358 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8361 if ((res >> 26) == ALC880_HP_EVENT)
8362 alc883_lenovo_101e_all_automute(codec);
8363 if ((res >> 26) == ALC880_FRONT_EVENT)
8364 alc883_lenovo_101e_ispeaker_automute(codec);
8367 /* toggle speaker-output according to the hp-jack state */
8368 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8370 unsigned int present;
8372 present = snd_hda_codec_read(codec, 0x14, 0,
8373 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8374 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8375 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8376 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8377 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8380 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8383 if ((res >> 26) == ALC880_HP_EVENT)
8384 alc883_acer_aspire_automute(codec);
8387 static struct hda_verb alc883_acer_eapd_verbs[] = {
8388 /* HP Pin: output 0 (0x0c) */
8389 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8390 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8391 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8392 /* Front Pin: output 0 (0x0c) */
8393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8394 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8395 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8396 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8397 /* eanable EAPD on medion laptop */
8398 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8399 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8400 /* enable unsolicited event */
8401 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8405 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8407 unsigned int present;
8409 present = snd_hda_codec_read(codec, 0x1b, 0,
8410 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8411 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8412 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8413 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8414 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8415 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8416 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8417 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8418 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8421 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8424 switch (res >> 26) {
8425 case ALC880_HP_EVENT:
8426 /* printk(KERN_DEBUG "hp_event\n"); */
8427 alc888_6st_dell_front_automute(codec);
8432 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8435 unsigned int present;
8437 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8438 present = snd_hda_codec_read(codec, 0x1b, 0,
8439 AC_VERB_GET_PIN_SENSE, 0);
8440 present = (present & 0x80000000) != 0;
8442 /* mute internal speaker */
8443 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8444 HDA_AMP_MUTE, HDA_AMP_MUTE);
8445 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8446 HDA_AMP_MUTE, HDA_AMP_MUTE);
8447 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8448 HDA_AMP_MUTE, HDA_AMP_MUTE);
8449 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8450 HDA_AMP_MUTE, HDA_AMP_MUTE);
8451 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8452 HDA_AMP_MUTE, HDA_AMP_MUTE);
8454 /* unmute internal speaker if necessary */
8455 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8456 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8457 HDA_AMP_MUTE, mute);
8458 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8459 HDA_AMP_MUTE, mute);
8460 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8461 HDA_AMP_MUTE, mute);
8462 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8463 HDA_AMP_MUTE, mute);
8464 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8465 HDA_AMP_MUTE, mute);
8469 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8472 if ((res >> 26) == ALC880_HP_EVENT)
8473 alc888_lenovo_sky_front_automute(codec);
8477 * generic initialization of ADC, input mixers and output mixers
8479 static struct hda_verb alc883_auto_init_verbs[] = {
8481 * Unmute ADC0-2 and set the default input to mic-in
8483 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8485 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8488 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8490 * Note: PASD motherboards uses the Line In 2 as the input for
8491 * front panel mic (mic 2)
8493 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8494 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8495 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8496 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8497 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8498 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8501 * Set up output mixers (0x0c - 0x0f)
8503 /* set vol=0 to output mixers */
8504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8507 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8508 /* set up input amps for analog loopback */
8509 /* Amp Indices: DAC = 0, mixer = 1 */
8510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8516 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8517 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8518 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8519 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8521 /* FIXME: use matrix-type input source selection */
8522 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8527 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8530 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8533 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8539 static struct hda_verb alc888_asus_m90v_verbs[] = {
8540 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8541 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8542 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8543 /* enable unsolicited event */
8544 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8545 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8549 static void alc883_nb_mic_automute(struct hda_codec *codec)
8551 unsigned int present;
8553 present = snd_hda_codec_read(codec, 0x18, 0,
8554 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8555 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8556 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8557 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8558 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8561 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8563 unsigned int present;
8566 present = snd_hda_codec_read(codec, 0x1b, 0,
8567 AC_VERB_GET_PIN_SENSE, 0)
8568 & AC_PINSENSE_PRESENCE;
8569 bits = present ? 0 : PIN_OUT;
8570 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8572 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8574 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8578 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8581 switch (res >> 26) {
8582 case ALC880_HP_EVENT:
8583 alc883_M90V_speaker_automute(codec);
8585 case ALC880_MIC_EVENT:
8586 alc883_nb_mic_automute(codec);
8591 static void alc883_mode2_inithook(struct hda_codec *codec)
8593 alc883_M90V_speaker_automute(codec);
8594 alc883_nb_mic_automute(codec);
8597 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8598 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8603 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8604 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8605 /* enable unsolicited event */
8606 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8610 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8612 unsigned int present;
8615 present = snd_hda_codec_read(codec, 0x14, 0,
8616 AC_VERB_GET_PIN_SENSE, 0)
8617 & AC_PINSENSE_PRESENCE;
8618 bits = present ? 0 : PIN_OUT;
8619 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8623 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8626 switch (res >> 26) {
8627 case ALC880_HP_EVENT:
8628 alc883_eee1601_speaker_automute(codec);
8633 static void alc883_eee1601_inithook(struct hda_codec *codec)
8635 alc883_eee1601_speaker_automute(codec);
8638 #ifdef CONFIG_SND_HDA_POWER_SAVE
8639 #define alc883_loopbacks alc880_loopbacks
8642 /* pcm configuration: identiacal with ALC880 */
8643 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8644 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8645 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8646 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8647 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8650 * configuration and preset
8652 static const char *alc883_models[ALC883_MODEL_LAST] = {
8653 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8654 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8655 [ALC883_3ST_6ch] = "3stack-6ch",
8656 [ALC883_6ST_DIG] = "6stack-dig",
8657 [ALC883_TARGA_DIG] = "targa-dig",
8658 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8659 [ALC883_ACER] = "acer",
8660 [ALC883_ACER_ASPIRE] = "acer-aspire",
8661 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8662 [ALC883_MEDION] = "medion",
8663 [ALC883_MEDION_MD2] = "medion-md2",
8664 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8665 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8666 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8667 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8668 [ALC888_LENOVO_SKY] = "lenovo-sky",
8669 [ALC883_HAIER_W66] = "haier-w66",
8670 [ALC888_3ST_HP] = "3stack-hp",
8671 [ALC888_6ST_DELL] = "6stack-dell",
8672 [ALC883_MITAC] = "mitac",
8673 [ALC883_CLEVO_M720] = "clevo-m720",
8674 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8675 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8676 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8677 [ALC1200_ASUS_P5Q] = "asus-p5q",
8678 [ALC883_AUTO] = "auto",
8681 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8682 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8683 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8684 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8685 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8686 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8687 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8688 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8689 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8690 ALC888_ACER_ASPIRE_4930G),
8691 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8692 ALC888_ACER_ASPIRE_4930G),
8693 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8694 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8695 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8696 ALC888_ACER_ASPIRE_4930G),
8697 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8698 ALC888_ACER_ASPIRE_4930G),
8700 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8701 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8702 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8703 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8704 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8705 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8706 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8707 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8708 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8709 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8710 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8711 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8712 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8713 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8714 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8715 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8716 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8717 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8718 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8719 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8720 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8721 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8722 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8723 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8724 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8725 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8726 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8727 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8728 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8729 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8730 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8734 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8736 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8737 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8740 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8741 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8742 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8743 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8744 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8745 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8746 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8747 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8748 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8749 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8750 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
8751 ALC883_FUJITSU_PI2515),
8752 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8753 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8754 ALC888_FUJITSU_XA3530),
8755 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8756 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8757 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8758 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8759 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8760 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8761 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8762 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8763 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8764 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8765 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8766 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8767 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8768 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8772 static hda_nid_t alc1200_slave_dig_outs[] = {
8773 ALC883_DIGOUT_NID, 0,
8776 static struct alc_config_preset alc883_presets[] = {
8777 [ALC883_3ST_2ch_DIG] = {
8778 .mixers = { alc883_3ST_2ch_mixer },
8779 .init_verbs = { alc883_init_verbs },
8780 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8781 .dac_nids = alc883_dac_nids,
8782 .dig_out_nid = ALC883_DIGOUT_NID,
8783 .dig_in_nid = ALC883_DIGIN_NID,
8784 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8785 .channel_mode = alc883_3ST_2ch_modes,
8786 .input_mux = &alc883_capture_source,
8788 [ALC883_3ST_6ch_DIG] = {
8789 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8790 .init_verbs = { alc883_init_verbs },
8791 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8792 .dac_nids = alc883_dac_nids,
8793 .dig_out_nid = ALC883_DIGOUT_NID,
8794 .dig_in_nid = ALC883_DIGIN_NID,
8795 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8796 .channel_mode = alc883_3ST_6ch_modes,
8798 .input_mux = &alc883_capture_source,
8800 [ALC883_3ST_6ch] = {
8801 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8802 .init_verbs = { alc883_init_verbs },
8803 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8804 .dac_nids = alc883_dac_nids,
8805 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8806 .channel_mode = alc883_3ST_6ch_modes,
8808 .input_mux = &alc883_capture_source,
8810 [ALC883_3ST_6ch_INTEL] = {
8811 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8812 .init_verbs = { alc883_init_verbs },
8813 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8814 .dac_nids = alc883_dac_nids,
8815 .dig_out_nid = ALC883_DIGOUT_NID,
8816 .dig_in_nid = ALC883_DIGIN_NID,
8817 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8818 .channel_mode = alc883_3ST_6ch_intel_modes,
8820 .input_mux = &alc883_3stack_6ch_intel,
8822 [ALC883_6ST_DIG] = {
8823 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8824 .init_verbs = { alc883_init_verbs },
8825 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8826 .dac_nids = alc883_dac_nids,
8827 .dig_out_nid = ALC883_DIGOUT_NID,
8828 .dig_in_nid = ALC883_DIGIN_NID,
8829 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8830 .channel_mode = alc883_sixstack_modes,
8831 .input_mux = &alc883_capture_source,
8833 [ALC883_TARGA_DIG] = {
8834 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8835 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8836 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8837 .dac_nids = alc883_dac_nids,
8838 .dig_out_nid = ALC883_DIGOUT_NID,
8839 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8840 .channel_mode = alc883_3ST_6ch_modes,
8842 .input_mux = &alc883_capture_source,
8843 .unsol_event = alc883_tagra_unsol_event,
8844 .init_hook = alc883_tagra_automute,
8846 [ALC883_TARGA_2ch_DIG] = {
8847 .mixers = { alc883_tagra_2ch_mixer},
8848 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8849 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8850 .dac_nids = alc883_dac_nids,
8851 .adc_nids = alc883_adc_nids_alt,
8852 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8853 .dig_out_nid = ALC883_DIGOUT_NID,
8854 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8855 .channel_mode = alc883_3ST_2ch_modes,
8856 .input_mux = &alc883_capture_source,
8857 .unsol_event = alc883_tagra_unsol_event,
8858 .init_hook = alc883_tagra_automute,
8861 .mixers = { alc883_base_mixer },
8862 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8863 * and the headphone jack. Turn this on and rely on the
8864 * standard mute methods whenever the user wants to turn
8865 * these outputs off.
8867 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8868 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8869 .dac_nids = alc883_dac_nids,
8870 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8871 .channel_mode = alc883_3ST_2ch_modes,
8872 .input_mux = &alc883_capture_source,
8874 [ALC883_ACER_ASPIRE] = {
8875 .mixers = { alc883_acer_aspire_mixer },
8876 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8877 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8878 .dac_nids = alc883_dac_nids,
8879 .dig_out_nid = ALC883_DIGOUT_NID,
8880 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8881 .channel_mode = alc883_3ST_2ch_modes,
8882 .input_mux = &alc883_capture_source,
8883 .unsol_event = alc883_acer_aspire_unsol_event,
8884 .init_hook = alc883_acer_aspire_automute,
8886 [ALC888_ACER_ASPIRE_4930G] = {
8887 .mixers = { alc888_base_mixer,
8888 alc883_chmode_mixer },
8889 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8890 alc888_acer_aspire_4930g_verbs },
8891 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8892 .dac_nids = alc883_dac_nids,
8893 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8894 .adc_nids = alc883_adc_nids_rev,
8895 .capsrc_nids = alc883_capsrc_nids_rev,
8896 .dig_out_nid = ALC883_DIGOUT_NID,
8897 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8898 .channel_mode = alc883_3ST_6ch_modes,
8901 ARRAY_SIZE(alc888_2_capture_sources),
8902 .input_mux = alc888_2_capture_sources,
8903 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8904 .init_hook = alc888_acer_aspire_4930g_automute,
8907 .mixers = { alc883_fivestack_mixer,
8908 alc883_chmode_mixer },
8909 .init_verbs = { alc883_init_verbs,
8910 alc883_medion_eapd_verbs },
8911 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8912 .dac_nids = alc883_dac_nids,
8913 .adc_nids = alc883_adc_nids_alt,
8914 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8915 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8916 .channel_mode = alc883_sixstack_modes,
8917 .input_mux = &alc883_capture_source,
8919 [ALC883_MEDION_MD2] = {
8920 .mixers = { alc883_medion_md2_mixer},
8921 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8922 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8923 .dac_nids = alc883_dac_nids,
8924 .dig_out_nid = ALC883_DIGOUT_NID,
8925 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8926 .channel_mode = alc883_3ST_2ch_modes,
8927 .input_mux = &alc883_capture_source,
8928 .unsol_event = alc883_medion_md2_unsol_event,
8929 .init_hook = alc883_medion_md2_automute,
8931 [ALC883_LAPTOP_EAPD] = {
8932 .mixers = { alc883_base_mixer },
8933 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8934 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8935 .dac_nids = alc883_dac_nids,
8936 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8937 .channel_mode = alc883_3ST_2ch_modes,
8938 .input_mux = &alc883_capture_source,
8940 [ALC883_CLEVO_M720] = {
8941 .mixers = { alc883_clevo_m720_mixer },
8942 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8943 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8944 .dac_nids = alc883_dac_nids,
8945 .dig_out_nid = ALC883_DIGOUT_NID,
8946 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8947 .channel_mode = alc883_3ST_2ch_modes,
8948 .input_mux = &alc883_capture_source,
8949 .unsol_event = alc883_clevo_m720_unsol_event,
8950 .init_hook = alc883_clevo_m720_automute,
8952 [ALC883_LENOVO_101E_2ch] = {
8953 .mixers = { alc883_lenovo_101e_2ch_mixer},
8954 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8955 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8956 .dac_nids = alc883_dac_nids,
8957 .adc_nids = alc883_adc_nids_alt,
8958 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8959 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8960 .channel_mode = alc883_3ST_2ch_modes,
8961 .input_mux = &alc883_lenovo_101e_capture_source,
8962 .unsol_event = alc883_lenovo_101e_unsol_event,
8963 .init_hook = alc883_lenovo_101e_all_automute,
8965 [ALC883_LENOVO_NB0763] = {
8966 .mixers = { alc883_lenovo_nb0763_mixer },
8967 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8968 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8969 .dac_nids = alc883_dac_nids,
8970 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8971 .channel_mode = alc883_3ST_2ch_modes,
8973 .input_mux = &alc883_lenovo_nb0763_capture_source,
8974 .unsol_event = alc883_medion_md2_unsol_event,
8975 .init_hook = alc883_medion_md2_automute,
8977 [ALC888_LENOVO_MS7195_DIG] = {
8978 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8979 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8980 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8981 .dac_nids = alc883_dac_nids,
8982 .dig_out_nid = ALC883_DIGOUT_NID,
8983 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8984 .channel_mode = alc883_3ST_6ch_modes,
8986 .input_mux = &alc883_capture_source,
8987 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8988 .init_hook = alc888_lenovo_ms7195_front_automute,
8990 [ALC883_HAIER_W66] = {
8991 .mixers = { alc883_tagra_2ch_mixer},
8992 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8993 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8994 .dac_nids = alc883_dac_nids,
8995 .dig_out_nid = ALC883_DIGOUT_NID,
8996 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8997 .channel_mode = alc883_3ST_2ch_modes,
8998 .input_mux = &alc883_capture_source,
8999 .unsol_event = alc883_haier_w66_unsol_event,
9000 .init_hook = alc883_haier_w66_automute,
9003 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9004 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9005 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9006 .dac_nids = alc883_dac_nids,
9007 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9008 .channel_mode = alc888_3st_hp_modes,
9010 .input_mux = &alc883_capture_source,
9011 .unsol_event = alc888_3st_hp_unsol_event,
9012 .init_hook = alc888_3st_hp_front_automute,
9014 [ALC888_6ST_DELL] = {
9015 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9016 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9017 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9018 .dac_nids = alc883_dac_nids,
9019 .dig_out_nid = ALC883_DIGOUT_NID,
9020 .dig_in_nid = ALC883_DIGIN_NID,
9021 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9022 .channel_mode = alc883_sixstack_modes,
9023 .input_mux = &alc883_capture_source,
9024 .unsol_event = alc888_6st_dell_unsol_event,
9025 .init_hook = alc888_6st_dell_front_automute,
9028 .mixers = { alc883_mitac_mixer },
9029 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9030 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9031 .dac_nids = alc883_dac_nids,
9032 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9033 .channel_mode = alc883_3ST_2ch_modes,
9034 .input_mux = &alc883_capture_source,
9035 .unsol_event = alc883_mitac_unsol_event,
9036 .init_hook = alc883_mitac_automute,
9038 [ALC883_FUJITSU_PI2515] = {
9039 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9040 .init_verbs = { alc883_init_verbs,
9041 alc883_2ch_fujitsu_pi2515_verbs},
9042 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9043 .dac_nids = alc883_dac_nids,
9044 .dig_out_nid = ALC883_DIGOUT_NID,
9045 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9046 .channel_mode = alc883_3ST_2ch_modes,
9047 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9048 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
9049 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
9051 [ALC888_FUJITSU_XA3530] = {
9052 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9053 .init_verbs = { alc883_init_verbs,
9054 alc888_fujitsu_xa3530_verbs },
9055 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9056 .dac_nids = alc883_dac_nids,
9057 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9058 .adc_nids = alc883_adc_nids_rev,
9059 .capsrc_nids = alc883_capsrc_nids_rev,
9060 .dig_out_nid = ALC883_DIGOUT_NID,
9061 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9062 .channel_mode = alc888_4ST_8ch_intel_modes,
9064 ARRAY_SIZE(alc888_2_capture_sources),
9065 .input_mux = alc888_2_capture_sources,
9066 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
9067 .init_hook = alc888_fujitsu_xa3530_automute,
9069 [ALC888_LENOVO_SKY] = {
9070 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9071 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9072 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9073 .dac_nids = alc883_dac_nids,
9074 .dig_out_nid = ALC883_DIGOUT_NID,
9075 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9076 .channel_mode = alc883_sixstack_modes,
9078 .input_mux = &alc883_lenovo_sky_capture_source,
9079 .unsol_event = alc883_lenovo_sky_unsol_event,
9080 .init_hook = alc888_lenovo_sky_front_automute,
9082 [ALC888_ASUS_M90V] = {
9083 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9084 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9086 .dac_nids = alc883_dac_nids,
9087 .dig_out_nid = ALC883_DIGOUT_NID,
9088 .dig_in_nid = ALC883_DIGIN_NID,
9089 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9090 .channel_mode = alc883_3ST_6ch_modes,
9092 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9093 .unsol_event = alc883_mode2_unsol_event,
9094 .init_hook = alc883_mode2_inithook,
9096 [ALC888_ASUS_EEE1601] = {
9097 .mixers = { alc883_asus_eee1601_mixer },
9098 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9099 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9100 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9101 .dac_nids = alc883_dac_nids,
9102 .dig_out_nid = ALC883_DIGOUT_NID,
9103 .dig_in_nid = ALC883_DIGIN_NID,
9104 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9105 .channel_mode = alc883_3ST_2ch_modes,
9107 .input_mux = &alc883_asus_eee1601_capture_source,
9108 .unsol_event = alc883_eee1601_unsol_event,
9109 .init_hook = alc883_eee1601_inithook,
9111 [ALC1200_ASUS_P5Q] = {
9112 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9113 .init_verbs = { alc883_init_verbs },
9114 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9115 .dac_nids = alc883_dac_nids,
9116 .dig_out_nid = ALC1200_DIGOUT_NID,
9117 .dig_in_nid = ALC883_DIGIN_NID,
9118 .slave_dig_outs = alc1200_slave_dig_outs,
9119 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9120 .channel_mode = alc883_sixstack_modes,
9121 .input_mux = &alc883_capture_source,
9127 * BIOS auto configuration
9129 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9130 hda_nid_t nid, int pin_type,
9134 struct alc_spec *spec = codec->spec;
9137 alc_set_pin_output(codec, nid, pin_type);
9138 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9141 idx = spec->multiout.dac_nids[dac_idx] - 2;
9142 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9146 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9148 struct alc_spec *spec = codec->spec;
9151 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
9152 for (i = 0; i <= HDA_SIDE; i++) {
9153 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9154 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9156 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9161 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9163 struct alc_spec *spec = codec->spec;
9166 pin = spec->autocfg.hp_pins[0];
9167 if (pin) /* connect to front */
9169 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9170 pin = spec->autocfg.speaker_pins[0];
9172 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9175 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9176 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9178 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9180 struct alc_spec *spec = codec->spec;
9183 for (i = 0; i < AUTO_PIN_LAST; i++) {
9184 hda_nid_t nid = spec->autocfg.input_pins[i];
9185 if (alc883_is_input_pin(nid)) {
9186 alc_set_input_pin(codec, nid, i);
9187 if (nid != ALC883_PIN_CD_NID &&
9188 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9189 snd_hda_codec_write(codec, nid, 0,
9190 AC_VERB_SET_AMP_GAIN_MUTE,
9196 #define alc883_auto_init_input_src alc882_auto_init_input_src
9198 /* almost identical with ALC880 parser... */
9199 static int alc883_parse_auto_config(struct hda_codec *codec)
9201 struct alc_spec *spec = codec->spec;
9202 int err = alc880_parse_auto_config(codec);
9203 struct auto_pin_cfg *cfg = &spec->autocfg;
9209 return 0; /* no config found */
9211 err = alc_auto_add_mic_boost(codec);
9215 /* hack - override the init verbs */
9216 spec->init_verbs[0] = alc883_auto_init_verbs;
9218 /* setup input_mux for ALC889 */
9219 if (codec->vendor_id == 0x10ec0889) {
9220 /* digital-mic input pin is excluded in alc880_auto_create..()
9221 * because it's under 0x18
9223 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9224 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9225 struct hda_input_mux *imux = &spec->private_imux[0];
9226 for (i = 1; i < 3; i++)
9227 memcpy(&spec->private_imux[i],
9228 &spec->private_imux[0],
9229 sizeof(spec->private_imux[0]));
9230 imux->items[imux->num_items].label = "Int DMic";
9231 imux->items[imux->num_items].index = 0x0b;
9233 spec->num_mux_defs = 3;
9234 spec->input_mux = spec->private_imux;
9238 return 1; /* config found */
9241 /* additional initialization for auto-configuration model */
9242 static void alc883_auto_init(struct hda_codec *codec)
9244 struct alc_spec *spec = codec->spec;
9245 alc883_auto_init_multi_out(codec);
9246 alc883_auto_init_hp_out(codec);
9247 alc883_auto_init_analog_input(codec);
9248 alc883_auto_init_input_src(codec);
9249 if (spec->unsol_event)
9250 alc_inithook(codec);
9253 static int patch_alc883(struct hda_codec *codec)
9255 struct alc_spec *spec;
9256 int err, board_config;
9258 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9264 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9266 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9269 if (board_config < 0) {
9270 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9271 "trying auto-probe from BIOS...\n");
9272 board_config = ALC883_AUTO;
9275 if (board_config == ALC883_AUTO) {
9276 /* automatic parse from the BIOS config */
9277 err = alc883_parse_auto_config(codec);
9283 "hda_codec: Cannot set up configuration "
9284 "from BIOS. Using base mode...\n");
9285 board_config = ALC883_3ST_2ch_DIG;
9289 err = snd_hda_attach_beep_device(codec, 0x1);
9295 if (board_config != ALC883_AUTO)
9296 setup_preset(spec, &alc883_presets[board_config]);
9298 switch (codec->vendor_id) {
9300 if (codec->revision_id == 0x100101) {
9301 spec->stream_name_analog = "ALC1200 Analog";
9302 spec->stream_name_digital = "ALC1200 Digital";
9304 spec->stream_name_analog = "ALC888 Analog";
9305 spec->stream_name_digital = "ALC888 Digital";
9307 if (!spec->num_adc_nids) {
9308 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9309 spec->adc_nids = alc883_adc_nids;
9311 if (!spec->capsrc_nids)
9312 spec->capsrc_nids = alc883_capsrc_nids;
9313 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9316 spec->stream_name_analog = "ALC889 Analog";
9317 spec->stream_name_digital = "ALC889 Digital";
9318 if (!spec->num_adc_nids) {
9319 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9320 spec->adc_nids = alc889_adc_nids;
9322 if (!spec->capsrc_nids)
9323 spec->capsrc_nids = alc889_capsrc_nids;
9324 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9328 spec->stream_name_analog = "ALC883 Analog";
9329 spec->stream_name_digital = "ALC883 Digital";
9330 if (!spec->num_adc_nids) {
9331 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9332 spec->adc_nids = alc883_adc_nids;
9334 if (!spec->capsrc_nids)
9335 spec->capsrc_nids = alc883_capsrc_nids;
9336 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9340 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9341 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9342 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9344 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9345 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9347 if (!spec->cap_mixer)
9348 set_capture_mixer(spec);
9349 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9351 spec->vmaster_nid = 0x0c;
9353 codec->patch_ops = alc_patch_ops;
9354 if (board_config == ALC883_AUTO)
9355 spec->init_hook = alc883_auto_init;
9357 #ifdef CONFIG_SND_HDA_POWER_SAVE
9358 if (!spec->loopback.amplist)
9359 spec->loopback.amplist = alc883_loopbacks;
9361 codec->proc_widget_hook = print_realtek_coef;
9370 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9371 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9373 #define alc262_dac_nids alc260_dac_nids
9374 #define alc262_adc_nids alc882_adc_nids
9375 #define alc262_adc_nids_alt alc882_adc_nids_alt
9376 #define alc262_capsrc_nids alc882_capsrc_nids
9377 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9379 #define alc262_modes alc260_modes
9380 #define alc262_capture_source alc882_capture_source
9382 static hda_nid_t alc262_dmic_adc_nids[1] = {
9387 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9389 static struct snd_kcontrol_new alc262_base_mixer[] = {
9390 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9391 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9392 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9393 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9394 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9395 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9397 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9398 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9399 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9400 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9401 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9402 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9404 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9405 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9409 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9410 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9411 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9412 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9413 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9414 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9415 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9416 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9417 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9418 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9419 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9420 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9421 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9422 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9427 /* update HP, line and mono-out pins according to the master switch */
9428 static void alc262_hp_master_update(struct hda_codec *codec)
9430 struct alc_spec *spec = codec->spec;
9431 int val = spec->master_sw;
9434 snd_hda_codec_write_cache(codec, 0x1b, 0,
9435 AC_VERB_SET_PIN_WIDGET_CONTROL,
9437 snd_hda_codec_write_cache(codec, 0x15, 0,
9438 AC_VERB_SET_PIN_WIDGET_CONTROL,
9440 /* mono (speaker) depending on the HP jack sense */
9441 val = val && !spec->jack_present;
9442 snd_hda_codec_write_cache(codec, 0x16, 0,
9443 AC_VERB_SET_PIN_WIDGET_CONTROL,
9447 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9449 struct alc_spec *spec = codec->spec;
9450 unsigned int presence;
9451 presence = snd_hda_codec_read(codec, 0x1b, 0,
9452 AC_VERB_GET_PIN_SENSE, 0);
9453 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9454 alc262_hp_master_update(codec);
9457 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9459 if ((res >> 26) != ALC880_HP_EVENT)
9461 alc262_hp_bpc_automute(codec);
9464 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9466 struct alc_spec *spec = codec->spec;
9467 unsigned int presence;
9468 presence = snd_hda_codec_read(codec, 0x15, 0,
9469 AC_VERB_GET_PIN_SENSE, 0);
9470 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9471 alc262_hp_master_update(codec);
9474 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9477 if ((res >> 26) != ALC880_HP_EVENT)
9479 alc262_hp_wildwest_automute(codec);
9482 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9483 struct snd_ctl_elem_value *ucontrol)
9485 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9486 struct alc_spec *spec = codec->spec;
9487 *ucontrol->value.integer.value = spec->master_sw;
9491 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9492 struct snd_ctl_elem_value *ucontrol)
9494 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9495 struct alc_spec *spec = codec->spec;
9496 int val = !!*ucontrol->value.integer.value;
9498 if (val == spec->master_sw)
9500 spec->master_sw = val;
9501 alc262_hp_master_update(codec);
9505 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9508 .name = "Master Playback Switch",
9509 .info = snd_ctl_boolean_mono_info,
9510 .get = alc262_hp_master_sw_get,
9511 .put = alc262_hp_master_sw_put,
9513 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9514 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9516 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9518 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9522 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9523 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9524 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9525 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9526 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9527 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9528 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9529 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9530 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9531 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9535 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9538 .name = "Master Playback Switch",
9539 .info = snd_ctl_boolean_mono_info,
9540 .get = alc262_hp_master_sw_get,
9541 .put = alc262_hp_master_sw_put,
9543 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9544 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9545 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9547 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9549 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9551 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9552 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9553 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9554 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9555 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9556 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9557 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9561 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9562 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9563 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9564 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9568 /* mute/unmute internal speaker according to the hp jack and mute state */
9569 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9571 struct alc_spec *spec = codec->spec;
9573 if (force || !spec->sense_updated) {
9574 unsigned int present;
9575 present = snd_hda_codec_read(codec, 0x15, 0,
9576 AC_VERB_GET_PIN_SENSE, 0);
9577 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9578 spec->sense_updated = 1;
9580 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9581 spec->jack_present ? HDA_AMP_MUTE : 0);
9584 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9587 if ((res >> 26) != ALC880_HP_EVENT)
9589 alc262_hp_t5735_automute(codec, 1);
9592 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9594 alc262_hp_t5735_automute(codec, 1);
9597 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9598 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9599 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9600 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9601 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9603 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9604 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9608 static struct hda_verb alc262_hp_t5735_verbs[] = {
9609 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9612 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9616 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9617 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9618 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9619 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9620 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9621 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9622 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9626 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9627 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9628 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9629 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9631 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9632 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9633 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9634 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9635 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9636 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9640 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9647 /* bind hp and internal speaker mute (with plug check) */
9648 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9649 struct snd_ctl_elem_value *ucontrol)
9651 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9652 long *valp = ucontrol->value.integer.value;
9655 /* change hp mute */
9656 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9658 valp[0] ? 0 : HDA_AMP_MUTE);
9659 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9661 valp[1] ? 0 : HDA_AMP_MUTE);
9663 /* change speaker according to HP jack state */
9664 struct alc_spec *spec = codec->spec;
9666 if (spec->jack_present)
9667 mute = HDA_AMP_MUTE;
9669 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9671 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9672 HDA_AMP_MUTE, mute);
9677 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9678 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9680 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9681 .name = "Master Playback Switch",
9682 .info = snd_hda_mixer_amp_switch_info,
9683 .get = snd_hda_mixer_amp_switch_get,
9684 .put = alc262_sony_master_sw_put,
9685 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9689 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9690 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9694 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9695 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9696 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9697 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9698 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9699 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9700 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9701 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9705 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9706 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9707 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9708 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9709 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9710 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9711 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9714 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9715 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9716 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9717 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9721 static struct hda_verb alc262_tyan_verbs[] = {
9722 /* Headphone automute */
9723 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9724 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9725 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9727 /* P11 AUX_IN, white 4-pin connector */
9728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9729 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9730 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9731 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9736 /* unsolicited event for HP jack sensing */
9737 static void alc262_tyan_automute(struct hda_codec *codec)
9740 unsigned int present;
9742 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9743 present = snd_hda_codec_read(codec, 0x1b, 0,
9744 AC_VERB_GET_PIN_SENSE, 0);
9745 present = (present & 0x80000000) != 0;
9747 /* mute line output on ATX panel */
9748 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9749 HDA_AMP_MUTE, HDA_AMP_MUTE);
9751 /* unmute line output if necessary */
9752 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9753 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9754 HDA_AMP_MUTE, mute);
9758 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9761 if ((res >> 26) != ALC880_HP_EVENT)
9763 alc262_tyan_automute(codec);
9766 #define alc262_capture_mixer alc882_capture_mixer
9767 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9770 * generic initialization of ADC, input mixers and output mixers
9772 static struct hda_verb alc262_init_verbs[] = {
9774 * Unmute ADC0-2 and set the default input to mic-in
9776 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9778 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9779 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9780 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9781 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9783 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9785 * Note: PASD motherboards uses the Line In 2 as the input for
9786 * front panel mic (mic 2)
9788 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9789 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9790 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9791 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9792 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9796 * Set up output mixers (0x0c - 0x0e)
9798 /* set vol=0 to output mixers */
9799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9800 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9801 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9802 /* set up input amps for analog loopback */
9803 /* Amp Indices: DAC = 0, mixer = 1 */
9804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9808 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9813 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9814 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9815 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9816 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9818 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9824 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9825 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9827 /* FIXME: use matrix-type input source selection */
9828 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9829 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9830 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9831 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9832 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9833 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9835 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9836 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9837 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9838 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9842 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9848 static struct hda_verb alc262_eapd_verbs[] = {
9849 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9850 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9854 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9855 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9856 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9860 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9861 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9862 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9863 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9865 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9866 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9870 static struct hda_verb alc262_sony_unsol_verbs[] = {
9871 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9872 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9873 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9875 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9880 static struct hda_input_mux alc262_dmic_capture_source = {
9883 { "Int DMic", 0x9 },
9888 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9889 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9890 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9891 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9897 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9898 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9901 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9902 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9904 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9905 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9909 static void alc262_dmic_automute(struct hda_codec *codec)
9911 unsigned int present;
9913 present = snd_hda_codec_read(codec, 0x18, 0,
9914 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9915 snd_hda_codec_write(codec, 0x22, 0,
9916 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9919 /* toggle speaker-output according to the hp-jack state */
9920 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9922 unsigned int present;
9925 present = snd_hda_codec_read(codec, 0x15, 0,
9926 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9927 bits = present ? 0 : PIN_OUT;
9928 snd_hda_codec_write(codec, 0x14, 0,
9929 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9934 /* unsolicited event for HP jack sensing */
9935 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9938 if ((res >> 26) == ALC880_HP_EVENT)
9939 alc262_toshiba_s06_speaker_automute(codec);
9940 if ((res >> 26) == ALC880_MIC_EVENT)
9941 alc262_dmic_automute(codec);
9945 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9947 alc262_toshiba_s06_speaker_automute(codec);
9948 alc262_dmic_automute(codec);
9951 /* mute/unmute internal speaker according to the hp jack and mute state */
9952 static void alc262_hippo_automute(struct hda_codec *codec)
9954 struct alc_spec *spec = codec->spec;
9956 unsigned int present;
9958 /* need to execute and sync at first */
9959 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9960 present = snd_hda_codec_read(codec, 0x15, 0,
9961 AC_VERB_GET_PIN_SENSE, 0);
9962 spec->jack_present = (present & 0x80000000) != 0;
9963 if (spec->jack_present) {
9964 /* mute internal speaker */
9965 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9966 HDA_AMP_MUTE, HDA_AMP_MUTE);
9968 /* unmute internal speaker if necessary */
9969 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9970 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9971 HDA_AMP_MUTE, mute);
9975 /* unsolicited event for HP jack sensing */
9976 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9979 if ((res >> 26) != ALC880_HP_EVENT)
9981 alc262_hippo_automute(codec);
9984 static void alc262_hippo1_automute(struct hda_codec *codec)
9987 unsigned int present;
9989 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9990 present = snd_hda_codec_read(codec, 0x1b, 0,
9991 AC_VERB_GET_PIN_SENSE, 0);
9992 present = (present & 0x80000000) != 0;
9994 /* mute internal speaker */
9995 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9996 HDA_AMP_MUTE, HDA_AMP_MUTE);
9998 /* unmute internal speaker if necessary */
9999 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10000 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10001 HDA_AMP_MUTE, mute);
10005 /* unsolicited event for HP jack sensing */
10006 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
10009 if ((res >> 26) != ALC880_HP_EVENT)
10011 alc262_hippo1_automute(codec);
10017 * 0x16 = internal speaker
10018 * 0x18 = external mic
10021 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10022 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10023 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10029 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10034 static struct hda_verb alc262_nec_verbs[] = {
10035 /* Unmute Speaker */
10036 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10039 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10042 /* External mic to headphone */
10043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10044 /* External mic to speaker */
10045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10051 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10052 * 0x1b = port replicator headphone out
10055 #define ALC_HP_EVENT 0x37
10057 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10058 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10065 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10066 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10067 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10071 static struct hda_input_mux alc262_fujitsu_capture_source = {
10075 { "Int Mic", 0x1 },
10080 static struct hda_input_mux alc262_HP_capture_source = {
10084 { "Front Mic", 0x1 },
10091 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10095 { "Front Mic", 0x2 },
10101 /* mute/unmute internal speaker according to the hp jacks and mute state */
10102 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10104 struct alc_spec *spec = codec->spec;
10107 if (force || !spec->sense_updated) {
10108 unsigned int present;
10109 /* need to execute and sync at first */
10110 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10111 /* check laptop HP jack */
10112 present = snd_hda_codec_read(codec, 0x14, 0,
10113 AC_VERB_GET_PIN_SENSE, 0);
10114 /* need to execute and sync at first */
10115 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10116 /* check docking HP jack */
10117 present |= snd_hda_codec_read(codec, 0x1b, 0,
10118 AC_VERB_GET_PIN_SENSE, 0);
10119 if (present & AC_PINSENSE_PRESENCE)
10120 spec->jack_present = 1;
10122 spec->jack_present = 0;
10123 spec->sense_updated = 1;
10125 /* unmute internal speaker only if both HPs are unplugged and
10126 * master switch is on
10128 if (spec->jack_present)
10129 mute = HDA_AMP_MUTE;
10131 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10132 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10133 HDA_AMP_MUTE, mute);
10136 /* unsolicited event for HP jack sensing */
10137 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10140 if ((res >> 26) != ALC_HP_EVENT)
10142 alc262_fujitsu_automute(codec, 1);
10145 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10147 alc262_fujitsu_automute(codec, 1);
10150 /* bind volumes of both NID 0x0c and 0x0d */
10151 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10152 .ops = &snd_hda_bind_vol,
10154 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10155 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10160 /* mute/unmute internal speaker according to the hp jack and mute state */
10161 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10163 struct alc_spec *spec = codec->spec;
10166 if (force || !spec->sense_updated) {
10167 unsigned int present_int_hp;
10168 /* need to execute and sync at first */
10169 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10170 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10171 AC_VERB_GET_PIN_SENSE, 0);
10172 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10173 spec->sense_updated = 1;
10175 if (spec->jack_present) {
10176 /* mute internal speaker */
10177 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10178 HDA_AMP_MUTE, HDA_AMP_MUTE);
10179 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10180 HDA_AMP_MUTE, HDA_AMP_MUTE);
10182 /* unmute internal speaker if necessary */
10183 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10184 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10185 HDA_AMP_MUTE, mute);
10186 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10187 HDA_AMP_MUTE, mute);
10191 /* unsolicited event for HP jack sensing */
10192 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10195 if ((res >> 26) != ALC_HP_EVENT)
10197 alc262_lenovo_3000_automute(codec, 1);
10200 /* bind hp and internal speaker mute (with plug check) */
10201 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10202 struct snd_ctl_elem_value *ucontrol)
10204 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10205 long *valp = ucontrol->value.integer.value;
10208 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10210 valp ? 0 : HDA_AMP_MUTE);
10211 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10213 valp ? 0 : HDA_AMP_MUTE);
10216 alc262_fujitsu_automute(codec, 0);
10220 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10221 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10223 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10224 .name = "Master Playback Switch",
10225 .info = snd_hda_mixer_amp_switch_info,
10226 .get = snd_hda_mixer_amp_switch_get,
10227 .put = alc262_fujitsu_master_sw_put,
10228 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10230 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10231 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10232 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10235 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10236 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10237 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10241 /* bind hp and internal speaker mute (with plug check) */
10242 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10243 struct snd_ctl_elem_value *ucontrol)
10245 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10246 long *valp = ucontrol->value.integer.value;
10249 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10251 valp ? 0 : HDA_AMP_MUTE);
10254 alc262_lenovo_3000_automute(codec, 0);
10258 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10259 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10261 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10262 .name = "Master Playback Switch",
10263 .info = snd_hda_mixer_amp_switch_info,
10264 .get = snd_hda_mixer_amp_switch_get,
10265 .put = alc262_lenovo_3000_master_sw_put,
10266 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10268 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10269 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10270 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10273 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10274 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10275 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10279 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10280 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10282 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10283 .name = "Master Playback Switch",
10284 .info = snd_hda_mixer_amp_switch_info,
10285 .get = snd_hda_mixer_amp_switch_get,
10286 .put = alc262_sony_master_sw_put,
10287 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10291 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10292 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10293 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10294 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10298 /* additional init verbs for Benq laptops */
10299 static struct hda_verb alc262_EAPD_verbs[] = {
10300 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10301 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10305 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10306 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10307 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10309 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10310 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10314 /* Samsung Q1 Ultra Vista model setup */
10315 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10316 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10317 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10320 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10321 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10325 static struct hda_verb alc262_ultra_verbs[] = {
10327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10331 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10332 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10333 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10334 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10337 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10338 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10339 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10340 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10342 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10344 /* ADC, choose mic */
10345 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10348 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10349 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10358 /* mute/unmute internal speaker according to the hp jack and mute state */
10359 static void alc262_ultra_automute(struct hda_codec *codec)
10361 struct alc_spec *spec = codec->spec;
10365 /* auto-mute only when HP is used as HP */
10366 if (!spec->cur_mux[0]) {
10367 unsigned int present;
10368 /* need to execute and sync at first */
10369 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10370 present = snd_hda_codec_read(codec, 0x15, 0,
10371 AC_VERB_GET_PIN_SENSE, 0);
10372 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10373 if (spec->jack_present)
10374 mute = HDA_AMP_MUTE;
10376 /* mute/unmute internal speaker */
10377 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10378 HDA_AMP_MUTE, mute);
10379 /* mute/unmute HP */
10380 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10381 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10384 /* unsolicited event for HP jack sensing */
10385 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10388 if ((res >> 26) != ALC880_HP_EVENT)
10390 alc262_ultra_automute(codec);
10393 static struct hda_input_mux alc262_ultra_capture_source = {
10397 { "Headphone", 0x7 },
10401 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10402 struct snd_ctl_elem_value *ucontrol)
10404 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10405 struct alc_spec *spec = codec->spec;
10408 ret = alc_mux_enum_put(kcontrol, ucontrol);
10411 /* reprogram the HP pin as mic or HP according to the input source */
10412 snd_hda_codec_write_cache(codec, 0x15, 0,
10413 AC_VERB_SET_PIN_WIDGET_CONTROL,
10414 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10415 alc262_ultra_automute(codec); /* mute/unmute HP */
10419 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10420 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10421 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10423 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10424 .name = "Capture Source",
10425 .info = alc_mux_enum_info,
10426 .get = alc_mux_enum_get,
10427 .put = alc262_ultra_mux_enum_put,
10432 /* add playback controls from the parsed DAC table */
10433 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10434 const struct auto_pin_cfg *cfg)
10439 spec->multiout.num_dacs = 1; /* only use one dac */
10440 spec->multiout.dac_nids = spec->private_dac_nids;
10441 spec->multiout.dac_nids[0] = 2;
10443 nid = cfg->line_out_pins[0];
10445 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10446 "Front Playback Volume",
10447 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10450 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10451 "Front Playback Switch",
10452 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10457 nid = cfg->speaker_pins[0];
10460 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10461 "Speaker Playback Volume",
10462 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10466 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10467 "Speaker Playback Switch",
10468 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10473 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10474 "Speaker Playback Switch",
10475 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10481 nid = cfg->hp_pins[0];
10483 /* spec->multiout.hp_nid = 2; */
10485 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10486 "Headphone Playback Volume",
10487 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10491 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10492 "Headphone Playback Switch",
10493 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10498 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10499 "Headphone Playback Switch",
10500 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10509 /* identical with ALC880 */
10510 #define alc262_auto_create_analog_input_ctls \
10511 alc880_auto_create_analog_input_ctls
10514 * generic initialization of ADC, input mixers and output mixers
10516 static struct hda_verb alc262_volume_init_verbs[] = {
10518 * Unmute ADC0-2 and set the default input to mic-in
10520 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10522 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10523 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10524 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10525 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10527 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10529 * Note: PASD motherboards uses the Line In 2 as the input for
10530 * front panel mic (mic 2)
10532 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10533 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10535 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10536 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10540 * Set up output mixers (0x0c - 0x0f)
10542 /* set vol=0 to output mixers */
10543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10545 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10547 /* set up input amps for analog loopback */
10548 /* Amp Indices: DAC = 0, mixer = 1 */
10549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10550 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10552 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10553 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10554 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10556 /* FIXME: use matrix-type input source selection */
10557 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10558 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10577 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10579 * Unmute ADC0-2 and set the default input to mic-in
10581 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10583 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10584 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10585 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10586 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10588 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10590 * Note: PASD motherboards uses the Line In 2 as the input for
10591 * front panel mic (mic 2)
10593 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10594 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10596 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10597 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10598 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10599 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10603 * Set up output mixers (0x0c - 0x0e)
10605 /* set vol=0 to output mixers */
10606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10607 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10608 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10610 /* set up input amps for analog loopback */
10611 /* Amp Indices: DAC = 0, mixer = 1 */
10612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10614 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10616 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10619 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10620 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10621 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10623 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10626 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10627 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10629 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10630 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10631 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10632 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10633 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10636 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10637 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10639 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10640 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10643 /* FIXME: use matrix-type input source selection */
10644 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10645 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10661 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10666 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10668 * Unmute ADC0-2 and set the default input to mic-in
10670 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10671 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10672 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10673 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10674 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10675 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10677 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10679 * Note: PASD motherboards uses the Line In 2 as the input for front
10680 * panel mic (mic 2)
10682 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10683 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10684 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10685 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10692 * Set up output mixers (0x0c - 0x0e)
10694 /* set vol=0 to output mixers */
10695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10696 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10697 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10699 /* set up input amps for analog loopback */
10700 /* Amp Indices: DAC = 0, mixer = 1 */
10701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10703 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10705 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10710 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10712 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10713 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10714 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10715 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10717 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10720 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10721 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10723 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10724 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10725 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10726 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10727 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10728 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10730 /* FIXME: use matrix-type input source selection */
10731 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10732 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10733 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10734 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10735 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10736 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10737 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10738 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10739 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10741 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10742 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10745 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10746 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10747 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10750 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10752 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10753 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10754 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10755 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10757 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10762 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10764 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10765 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10766 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10768 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10769 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10770 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10771 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10774 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10775 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10780 #ifdef CONFIG_SND_HDA_POWER_SAVE
10781 #define alc262_loopbacks alc880_loopbacks
10784 /* pcm configuration: identiacal with ALC880 */
10785 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10786 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10787 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10788 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10791 * BIOS auto configuration
10793 static int alc262_parse_auto_config(struct hda_codec *codec)
10795 struct alc_spec *spec = codec->spec;
10797 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10799 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10803 if (!spec->autocfg.line_outs) {
10804 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10805 spec->multiout.max_channels = 2;
10806 spec->no_analog = 1;
10809 return 0; /* can't find valid BIOS pin config */
10811 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10814 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10818 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10821 if (spec->autocfg.dig_outs) {
10822 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10823 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10825 if (spec->autocfg.dig_in_pin)
10826 spec->dig_in_nid = ALC262_DIGIN_NID;
10828 if (spec->kctls.list)
10829 add_mixer(spec, spec->kctls.list);
10831 add_verb(spec, alc262_volume_init_verbs);
10832 spec->num_mux_defs = 1;
10833 spec->input_mux = &spec->private_imux[0];
10835 err = alc_auto_add_mic_boost(codec);
10842 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10843 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10844 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10845 #define alc262_auto_init_input_src alc882_auto_init_input_src
10848 /* init callback for auto-configuration model -- overriding the default init */
10849 static void alc262_auto_init(struct hda_codec *codec)
10851 struct alc_spec *spec = codec->spec;
10852 alc262_auto_init_multi_out(codec);
10853 alc262_auto_init_hp_out(codec);
10854 alc262_auto_init_analog_input(codec);
10855 alc262_auto_init_input_src(codec);
10856 if (spec->unsol_event)
10857 alc_inithook(codec);
10861 * configuration and preset
10863 static const char *alc262_models[ALC262_MODEL_LAST] = {
10864 [ALC262_BASIC] = "basic",
10865 [ALC262_HIPPO] = "hippo",
10866 [ALC262_HIPPO_1] = "hippo_1",
10867 [ALC262_FUJITSU] = "fujitsu",
10868 [ALC262_HP_BPC] = "hp-bpc",
10869 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10870 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10871 [ALC262_HP_RP5700] = "hp-rp5700",
10872 [ALC262_BENQ_ED8] = "benq",
10873 [ALC262_BENQ_T31] = "benq-t31",
10874 [ALC262_SONY_ASSAMD] = "sony-assamd",
10875 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10876 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10877 [ALC262_ULTRA] = "ultra",
10878 [ALC262_LENOVO_3000] = "lenovo-3000",
10879 [ALC262_NEC] = "nec",
10880 [ALC262_TYAN] = "tyan",
10881 [ALC262_AUTO] = "auto",
10884 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10885 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10886 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10887 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10889 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10891 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10893 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10894 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10895 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10896 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10897 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10898 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10899 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10900 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10901 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10902 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10903 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10904 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10905 ALC262_HP_TC_T5735),
10906 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10907 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10908 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10909 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10910 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10911 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10912 ALC262_SONY_ASSAMD),
10913 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10914 ALC262_TOSHIBA_RX1),
10915 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10916 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10917 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10918 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10919 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10921 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10922 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10923 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10924 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10925 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10929 static struct alc_config_preset alc262_presets[] = {
10931 .mixers = { alc262_base_mixer },
10932 .init_verbs = { alc262_init_verbs },
10933 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10934 .dac_nids = alc262_dac_nids,
10936 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10937 .channel_mode = alc262_modes,
10938 .input_mux = &alc262_capture_source,
10941 .mixers = { alc262_base_mixer },
10942 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10943 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10944 .dac_nids = alc262_dac_nids,
10946 .dig_out_nid = ALC262_DIGOUT_NID,
10947 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10948 .channel_mode = alc262_modes,
10949 .input_mux = &alc262_capture_source,
10950 .unsol_event = alc262_hippo_unsol_event,
10951 .init_hook = alc262_hippo_automute,
10953 [ALC262_HIPPO_1] = {
10954 .mixers = { alc262_hippo1_mixer },
10955 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10956 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10957 .dac_nids = alc262_dac_nids,
10959 .dig_out_nid = ALC262_DIGOUT_NID,
10960 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10961 .channel_mode = alc262_modes,
10962 .input_mux = &alc262_capture_source,
10963 .unsol_event = alc262_hippo1_unsol_event,
10964 .init_hook = alc262_hippo1_automute,
10966 [ALC262_FUJITSU] = {
10967 .mixers = { alc262_fujitsu_mixer },
10968 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10969 alc262_fujitsu_unsol_verbs },
10970 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10971 .dac_nids = alc262_dac_nids,
10973 .dig_out_nid = ALC262_DIGOUT_NID,
10974 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10975 .channel_mode = alc262_modes,
10976 .input_mux = &alc262_fujitsu_capture_source,
10977 .unsol_event = alc262_fujitsu_unsol_event,
10978 .init_hook = alc262_fujitsu_init_hook,
10980 [ALC262_HP_BPC] = {
10981 .mixers = { alc262_HP_BPC_mixer },
10982 .init_verbs = { alc262_HP_BPC_init_verbs },
10983 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10984 .dac_nids = alc262_dac_nids,
10986 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10987 .channel_mode = alc262_modes,
10988 .input_mux = &alc262_HP_capture_source,
10989 .unsol_event = alc262_hp_bpc_unsol_event,
10990 .init_hook = alc262_hp_bpc_automute,
10992 [ALC262_HP_BPC_D7000_WF] = {
10993 .mixers = { alc262_HP_BPC_WildWest_mixer },
10994 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10995 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10996 .dac_nids = alc262_dac_nids,
10998 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10999 .channel_mode = alc262_modes,
11000 .input_mux = &alc262_HP_D7000_capture_source,
11001 .unsol_event = alc262_hp_wildwest_unsol_event,
11002 .init_hook = alc262_hp_wildwest_automute,
11004 [ALC262_HP_BPC_D7000_WL] = {
11005 .mixers = { alc262_HP_BPC_WildWest_mixer,
11006 alc262_HP_BPC_WildWest_option_mixer },
11007 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11008 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11009 .dac_nids = alc262_dac_nids,
11011 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11012 .channel_mode = alc262_modes,
11013 .input_mux = &alc262_HP_D7000_capture_source,
11014 .unsol_event = alc262_hp_wildwest_unsol_event,
11015 .init_hook = alc262_hp_wildwest_automute,
11017 [ALC262_HP_TC_T5735] = {
11018 .mixers = { alc262_hp_t5735_mixer },
11019 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11020 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11021 .dac_nids = alc262_dac_nids,
11023 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11024 .channel_mode = alc262_modes,
11025 .input_mux = &alc262_capture_source,
11026 .unsol_event = alc262_hp_t5735_unsol_event,
11027 .init_hook = alc262_hp_t5735_init_hook,
11029 [ALC262_HP_RP5700] = {
11030 .mixers = { alc262_hp_rp5700_mixer },
11031 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11032 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11033 .dac_nids = alc262_dac_nids,
11034 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11035 .channel_mode = alc262_modes,
11036 .input_mux = &alc262_hp_rp5700_capture_source,
11038 [ALC262_BENQ_ED8] = {
11039 .mixers = { alc262_base_mixer },
11040 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11041 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11042 .dac_nids = alc262_dac_nids,
11044 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11045 .channel_mode = alc262_modes,
11046 .input_mux = &alc262_capture_source,
11048 [ALC262_SONY_ASSAMD] = {
11049 .mixers = { alc262_sony_mixer },
11050 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11051 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11052 .dac_nids = alc262_dac_nids,
11054 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11055 .channel_mode = alc262_modes,
11056 .input_mux = &alc262_capture_source,
11057 .unsol_event = alc262_hippo_unsol_event,
11058 .init_hook = alc262_hippo_automute,
11060 [ALC262_BENQ_T31] = {
11061 .mixers = { alc262_benq_t31_mixer },
11062 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11063 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11064 .dac_nids = alc262_dac_nids,
11066 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11067 .channel_mode = alc262_modes,
11068 .input_mux = &alc262_capture_source,
11069 .unsol_event = alc262_hippo_unsol_event,
11070 .init_hook = alc262_hippo_automute,
11073 .mixers = { alc262_ultra_mixer },
11074 .cap_mixer = alc262_ultra_capture_mixer,
11075 .init_verbs = { alc262_ultra_verbs },
11076 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11077 .dac_nids = alc262_dac_nids,
11078 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11079 .channel_mode = alc262_modes,
11080 .input_mux = &alc262_ultra_capture_source,
11081 .adc_nids = alc262_adc_nids, /* ADC0 */
11082 .capsrc_nids = alc262_capsrc_nids,
11083 .num_adc_nids = 1, /* single ADC */
11084 .unsol_event = alc262_ultra_unsol_event,
11085 .init_hook = alc262_ultra_automute,
11087 [ALC262_LENOVO_3000] = {
11088 .mixers = { alc262_lenovo_3000_mixer },
11089 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11090 alc262_lenovo_3000_unsol_verbs },
11091 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11092 .dac_nids = alc262_dac_nids,
11094 .dig_out_nid = ALC262_DIGOUT_NID,
11095 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11096 .channel_mode = alc262_modes,
11097 .input_mux = &alc262_fujitsu_capture_source,
11098 .unsol_event = alc262_lenovo_3000_unsol_event,
11101 .mixers = { alc262_nec_mixer },
11102 .init_verbs = { alc262_nec_verbs },
11103 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11104 .dac_nids = alc262_dac_nids,
11106 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11107 .channel_mode = alc262_modes,
11108 .input_mux = &alc262_capture_source,
11110 [ALC262_TOSHIBA_S06] = {
11111 .mixers = { alc262_toshiba_s06_mixer },
11112 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11113 alc262_eapd_verbs },
11114 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11115 .capsrc_nids = alc262_dmic_capsrc_nids,
11116 .dac_nids = alc262_dac_nids,
11117 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11118 .dig_out_nid = ALC262_DIGOUT_NID,
11119 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11120 .channel_mode = alc262_modes,
11121 .input_mux = &alc262_dmic_capture_source,
11122 .unsol_event = alc262_toshiba_s06_unsol_event,
11123 .init_hook = alc262_toshiba_s06_init_hook,
11125 [ALC262_TOSHIBA_RX1] = {
11126 .mixers = { alc262_toshiba_rx1_mixer },
11127 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11128 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11129 .dac_nids = alc262_dac_nids,
11131 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11132 .channel_mode = alc262_modes,
11133 .input_mux = &alc262_capture_source,
11134 .unsol_event = alc262_hippo_unsol_event,
11135 .init_hook = alc262_hippo_automute,
11138 .mixers = { alc262_tyan_mixer },
11139 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11140 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11141 .dac_nids = alc262_dac_nids,
11143 .dig_out_nid = ALC262_DIGOUT_NID,
11144 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11145 .channel_mode = alc262_modes,
11146 .input_mux = &alc262_capture_source,
11147 .unsol_event = alc262_tyan_unsol_event,
11148 .init_hook = alc262_tyan_automute,
11152 static int patch_alc262(struct hda_codec *codec)
11154 struct alc_spec *spec;
11158 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11162 codec->spec = spec;
11164 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11169 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11170 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11171 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11172 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11176 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11178 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11182 if (board_config < 0) {
11183 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11184 "trying auto-probe from BIOS...\n");
11185 board_config = ALC262_AUTO;
11188 if (board_config == ALC262_AUTO) {
11189 /* automatic parse from the BIOS config */
11190 err = alc262_parse_auto_config(codec);
11196 "hda_codec: Cannot set up configuration "
11197 "from BIOS. Using base mode...\n");
11198 board_config = ALC262_BASIC;
11202 if (!spec->no_analog) {
11203 err = snd_hda_attach_beep_device(codec, 0x1);
11210 if (board_config != ALC262_AUTO)
11211 setup_preset(spec, &alc262_presets[board_config]);
11213 spec->stream_name_analog = "ALC262 Analog";
11214 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11215 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11217 spec->stream_name_digital = "ALC262 Digital";
11218 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11219 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11221 spec->capture_style = CAPT_MIX;
11222 if (!spec->adc_nids && spec->input_mux) {
11223 /* check whether NID 0x07 is valid */
11224 unsigned int wcap = get_wcaps(codec, 0x07);
11227 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11228 if (wcap != AC_WID_AUD_IN) {
11229 spec->adc_nids = alc262_adc_nids_alt;
11230 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11231 spec->capsrc_nids = alc262_capsrc_nids_alt;
11233 spec->adc_nids = alc262_adc_nids;
11234 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11235 spec->capsrc_nids = alc262_capsrc_nids;
11238 if (!spec->cap_mixer && !spec->no_analog)
11239 set_capture_mixer(spec);
11240 if (!spec->no_analog)
11241 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11243 spec->vmaster_nid = 0x0c;
11245 codec->patch_ops = alc_patch_ops;
11246 if (board_config == ALC262_AUTO)
11247 spec->init_hook = alc262_auto_init;
11248 #ifdef CONFIG_SND_HDA_POWER_SAVE
11249 if (!spec->loopback.amplist)
11250 spec->loopback.amplist = alc262_loopbacks;
11252 codec->proc_widget_hook = print_realtek_coef;
11258 * ALC268 channel source setting (2 channel)
11260 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11261 #define alc268_modes alc260_modes
11263 static hda_nid_t alc268_dac_nids[2] = {
11268 static hda_nid_t alc268_adc_nids[2] = {
11273 static hda_nid_t alc268_adc_nids_alt[1] = {
11278 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11280 static struct snd_kcontrol_new alc268_base_mixer[] = {
11281 /* output mixer control */
11282 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11283 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11284 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11286 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11287 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11288 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11292 /* bind Beep switches of both NID 0x0f and 0x10 */
11293 static struct hda_bind_ctls alc268_bind_beep_sw = {
11294 .ops = &snd_hda_bind_sw,
11296 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11297 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11302 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11303 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11304 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11308 static struct hda_verb alc268_eapd_verbs[] = {
11309 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11310 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11314 /* Toshiba specific */
11315 #define alc268_toshiba_automute alc262_hippo_automute
11317 static struct hda_verb alc268_toshiba_verbs[] = {
11318 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11322 static struct hda_input_mux alc268_acer_lc_capture_source = {
11330 /* Acer specific */
11331 /* bind volumes of both NID 0x02 and 0x03 */
11332 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11333 .ops = &snd_hda_bind_vol,
11335 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11336 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11341 /* mute/unmute internal speaker according to the hp jack and mute state */
11342 static void alc268_acer_automute(struct hda_codec *codec, int force)
11344 struct alc_spec *spec = codec->spec;
11347 if (force || !spec->sense_updated) {
11348 unsigned int present;
11349 present = snd_hda_codec_read(codec, 0x14, 0,
11350 AC_VERB_GET_PIN_SENSE, 0);
11351 spec->jack_present = (present & 0x80000000) != 0;
11352 spec->sense_updated = 1;
11354 if (spec->jack_present)
11355 mute = HDA_AMP_MUTE; /* mute internal speaker */
11356 else /* unmute internal speaker if necessary */
11357 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11358 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11359 HDA_AMP_MUTE, mute);
11363 /* bind hp and internal speaker mute (with plug check) */
11364 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11365 struct snd_ctl_elem_value *ucontrol)
11367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11368 long *valp = ucontrol->value.integer.value;
11371 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11373 valp[0] ? 0 : HDA_AMP_MUTE);
11374 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11376 valp[1] ? 0 : HDA_AMP_MUTE);
11378 alc268_acer_automute(codec, 0);
11382 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11383 /* output mixer control */
11384 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11387 .name = "Master Playback Switch",
11388 .info = snd_hda_mixer_amp_switch_info,
11389 .get = snd_hda_mixer_amp_switch_get,
11390 .put = alc268_acer_master_sw_put,
11391 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11393 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11397 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11398 /* output mixer control */
11399 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11401 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11402 .name = "Master Playback Switch",
11403 .info = snd_hda_mixer_amp_switch_info,
11404 .get = snd_hda_mixer_amp_switch_get,
11405 .put = alc268_acer_master_sw_put,
11406 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11408 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11409 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11410 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11414 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11415 /* output mixer control */
11416 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11418 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11419 .name = "Master Playback Switch",
11420 .info = snd_hda_mixer_amp_switch_info,
11421 .get = snd_hda_mixer_amp_switch_get,
11422 .put = alc268_acer_master_sw_put,
11423 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11425 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11426 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11430 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11431 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11433 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11434 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11435 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11436 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11440 static struct hda_verb alc268_acer_verbs[] = {
11441 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11442 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11444 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11445 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11446 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11447 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11451 /* unsolicited event for HP jack sensing */
11452 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11455 if ((res >> 26) != ALC880_HP_EVENT)
11457 alc268_toshiba_automute(codec);
11460 static void alc268_acer_unsol_event(struct hda_codec *codec,
11463 if ((res >> 26) != ALC880_HP_EVENT)
11465 alc268_acer_automute(codec, 1);
11468 static void alc268_acer_init_hook(struct hda_codec *codec)
11470 alc268_acer_automute(codec, 1);
11473 /* toggle speaker-output according to the hp-jack state */
11474 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11476 unsigned int present;
11477 unsigned char bits;
11479 present = snd_hda_codec_read(codec, 0x15, 0,
11480 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11481 bits = present ? AMP_IN_MUTE(0) : 0;
11482 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11483 AMP_IN_MUTE(0), bits);
11484 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11485 AMP_IN_MUTE(0), bits);
11489 static void alc268_acer_mic_automute(struct hda_codec *codec)
11491 unsigned int present;
11493 present = snd_hda_codec_read(codec, 0x18, 0,
11494 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11495 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11496 present ? 0x0 : 0x6);
11499 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11502 if ((res >> 26) == ALC880_HP_EVENT)
11503 alc268_aspire_one_speaker_automute(codec);
11504 if ((res >> 26) == ALC880_MIC_EVENT)
11505 alc268_acer_mic_automute(codec);
11508 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11510 alc268_aspire_one_speaker_automute(codec);
11511 alc268_acer_mic_automute(codec);
11514 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11515 /* output mixer control */
11516 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11517 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11518 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11519 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11520 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11521 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11525 static struct hda_verb alc268_dell_verbs[] = {
11526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11528 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11532 /* mute/unmute internal speaker according to the hp jack and mute state */
11533 static void alc268_dell_automute(struct hda_codec *codec)
11535 unsigned int present;
11538 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11539 if (present & 0x80000000)
11540 mute = HDA_AMP_MUTE;
11542 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11543 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11544 HDA_AMP_MUTE, mute);
11547 static void alc268_dell_unsol_event(struct hda_codec *codec,
11550 if ((res >> 26) != ALC880_HP_EVENT)
11552 alc268_dell_automute(codec);
11555 #define alc268_dell_init_hook alc268_dell_automute
11557 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11558 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11559 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11560 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11562 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11563 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11564 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11565 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11569 static struct hda_verb alc267_quanta_il1_verbs[] = {
11570 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11571 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11575 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11577 unsigned int present;
11579 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11580 & AC_PINSENSE_PRESENCE;
11581 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11582 present ? 0 : PIN_OUT);
11585 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11587 unsigned int present;
11589 present = snd_hda_codec_read(codec, 0x18, 0,
11590 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11591 snd_hda_codec_write(codec, 0x23, 0,
11592 AC_VERB_SET_CONNECT_SEL,
11593 present ? 0x00 : 0x01);
11596 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11598 alc267_quanta_il1_hp_automute(codec);
11599 alc267_quanta_il1_mic_automute(codec);
11602 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11605 switch (res >> 26) {
11606 case ALC880_HP_EVENT:
11607 alc267_quanta_il1_hp_automute(codec);
11609 case ALC880_MIC_EVENT:
11610 alc267_quanta_il1_mic_automute(codec);
11616 * generic initialization of ADC, input mixers and output mixers
11618 static struct hda_verb alc268_base_init_verbs[] = {
11619 /* Unmute DAC0-1 and set vol = 0 */
11620 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11621 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11624 * Set up output mixers (0x0c - 0x0e)
11626 /* set vol=0 to output mixers */
11627 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11628 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11631 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11635 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11636 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11637 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11638 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11639 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11640 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11642 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11644 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11646 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11648 /* set PCBEEP vol = 0, mute connections */
11649 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11650 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11651 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11653 /* Unmute Selector 23h,24h and set the default input to mic-in */
11655 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11657 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11664 * generic initialization of ADC, input mixers and output mixers
11666 static struct hda_verb alc268_volume_init_verbs[] = {
11667 /* set output DAC */
11668 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11669 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11671 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11672 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11673 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11674 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11675 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11677 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11678 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11679 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11681 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11682 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11684 /* set PCBEEP vol = 0, mute connections */
11685 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11686 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11687 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11692 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11693 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11694 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11696 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11697 /* The multiple "Capture Source" controls confuse alsamixer
11698 * So call somewhat different..
11700 /* .name = "Capture Source", */
11701 .name = "Input Source",
11703 .info = alc_mux_enum_info,
11704 .get = alc_mux_enum_get,
11705 .put = alc_mux_enum_put,
11710 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11711 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11712 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11713 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11714 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11717 /* The multiple "Capture Source" controls confuse alsamixer
11718 * So call somewhat different..
11720 /* .name = "Capture Source", */
11721 .name = "Input Source",
11723 .info = alc_mux_enum_info,
11724 .get = alc_mux_enum_get,
11725 .put = alc_mux_enum_put,
11730 static struct hda_input_mux alc268_capture_source = {
11734 { "Front Mic", 0x1 },
11740 static struct hda_input_mux alc268_acer_capture_source = {
11744 { "Internal Mic", 0x1 },
11749 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11753 { "Internal Mic", 0x6 },
11758 #ifdef CONFIG_SND_DEBUG
11759 static struct snd_kcontrol_new alc268_test_mixer[] = {
11760 /* Volume widgets */
11761 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11762 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11763 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11764 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11765 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11766 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11767 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11768 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11769 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11770 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11771 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11772 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11773 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11774 /* The below appears problematic on some hardwares */
11775 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11776 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11777 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11778 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11779 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11781 /* Modes for retasking pin widgets */
11782 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11783 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11784 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11785 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11787 /* Controls for GPIO pins, assuming they are configured as outputs */
11788 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11789 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11790 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11791 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11793 /* Switches to allow the digital SPDIF output pin to be enabled.
11794 * The ALC268 does not have an SPDIF input.
11796 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11798 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11799 * this output to turn on an external amplifier.
11801 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11802 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11808 /* create input playback/capture controls for the given pin */
11809 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11810 const char *ctlname, int idx)
11815 sprintf(name, "%s Playback Volume", ctlname);
11817 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11818 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11822 } else if (nid == 0x15) {
11823 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11824 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11830 sprintf(name, "%s Playback Switch", ctlname);
11831 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11832 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11838 /* add playback controls from the parsed DAC table */
11839 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11840 const struct auto_pin_cfg *cfg)
11845 spec->multiout.num_dacs = 2; /* only use one dac */
11846 spec->multiout.dac_nids = spec->private_dac_nids;
11847 spec->multiout.dac_nids[0] = 2;
11848 spec->multiout.dac_nids[1] = 3;
11850 nid = cfg->line_out_pins[0];
11852 alc268_new_analog_output(spec, nid, "Front", 0);
11854 nid = cfg->speaker_pins[0];
11856 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11857 "Speaker Playback Volume",
11858 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11862 nid = cfg->hp_pins[0];
11864 alc268_new_analog_output(spec, nid, "Headphone", 0);
11866 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11868 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11869 "Mono Playback Switch",
11870 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11877 /* create playback/capture controls for input pins */
11878 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11879 const struct auto_pin_cfg *cfg)
11881 struct hda_input_mux *imux = &spec->private_imux[0];
11884 for (i = 0; i < AUTO_PIN_LAST; i++) {
11885 switch(cfg->input_pins[i]) {
11887 idx1 = 0; /* Mic 1 */
11890 idx1 = 1; /* Mic 2 */
11893 idx1 = 2; /* Line In */
11900 idx1 = 6; /* digital mics */
11905 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11906 imux->items[imux->num_items].index = idx1;
11912 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11914 struct alc_spec *spec = codec->spec;
11915 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11916 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11917 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11918 unsigned int dac_vol1, dac_vol2;
11921 snd_hda_codec_write(codec, speaker_nid, 0,
11922 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11923 snd_hda_codec_write(codec, 0x0f, 0,
11924 AC_VERB_SET_AMP_GAIN_MUTE,
11926 snd_hda_codec_write(codec, 0x10, 0,
11927 AC_VERB_SET_AMP_GAIN_MUTE,
11930 snd_hda_codec_write(codec, 0x0f, 0,
11931 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11932 snd_hda_codec_write(codec, 0x10, 0,
11933 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11936 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11937 if (line_nid == 0x14)
11938 dac_vol2 = AMP_OUT_ZERO;
11939 else if (line_nid == 0x15)
11940 dac_vol1 = AMP_OUT_ZERO;
11941 if (hp_nid == 0x14)
11942 dac_vol2 = AMP_OUT_ZERO;
11943 else if (hp_nid == 0x15)
11944 dac_vol1 = AMP_OUT_ZERO;
11945 if (line_nid != 0x16 || hp_nid != 0x16 ||
11946 spec->autocfg.line_out_pins[1] != 0x16 ||
11947 spec->autocfg.line_out_pins[2] != 0x16)
11948 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11950 snd_hda_codec_write(codec, 0x02, 0,
11951 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11952 snd_hda_codec_write(codec, 0x03, 0,
11953 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11956 /* pcm configuration: identiacal with ALC880 */
11957 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11958 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11959 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11960 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11963 * BIOS auto configuration
11965 static int alc268_parse_auto_config(struct hda_codec *codec)
11967 struct alc_spec *spec = codec->spec;
11969 static hda_nid_t alc268_ignore[] = { 0 };
11971 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11975 if (!spec->autocfg.line_outs) {
11976 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11977 spec->multiout.max_channels = 2;
11978 spec->no_analog = 1;
11981 return 0; /* can't find valid BIOS pin config */
11983 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11986 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11990 spec->multiout.max_channels = 2;
11993 /* digital only support output */
11994 if (spec->autocfg.dig_outs) {
11995 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11996 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11998 if (spec->kctls.list)
11999 add_mixer(spec, spec->kctls.list);
12001 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12002 add_mixer(spec, alc268_beep_mixer);
12004 add_verb(spec, alc268_volume_init_verbs);
12005 spec->num_mux_defs = 1;
12006 spec->input_mux = &spec->private_imux[0];
12008 err = alc_auto_add_mic_boost(codec);
12015 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12016 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12017 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12019 /* init callback for auto-configuration model -- overriding the default init */
12020 static void alc268_auto_init(struct hda_codec *codec)
12022 struct alc_spec *spec = codec->spec;
12023 alc268_auto_init_multi_out(codec);
12024 alc268_auto_init_hp_out(codec);
12025 alc268_auto_init_mono_speaker_out(codec);
12026 alc268_auto_init_analog_input(codec);
12027 if (spec->unsol_event)
12028 alc_inithook(codec);
12032 * configuration and preset
12034 static const char *alc268_models[ALC268_MODEL_LAST] = {
12035 [ALC267_QUANTA_IL1] = "quanta-il1",
12036 [ALC268_3ST] = "3stack",
12037 [ALC268_TOSHIBA] = "toshiba",
12038 [ALC268_ACER] = "acer",
12039 [ALC268_ACER_DMIC] = "acer-dmic",
12040 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12041 [ALC268_DELL] = "dell",
12042 [ALC268_ZEPTO] = "zepto",
12043 #ifdef CONFIG_SND_DEBUG
12044 [ALC268_TEST] = "test",
12046 [ALC268_AUTO] = "auto",
12049 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12050 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12051 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12052 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12053 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12054 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12055 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12056 ALC268_ACER_ASPIRE_ONE),
12057 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12058 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12059 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
12060 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12061 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
12062 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
12063 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
12064 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12065 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12066 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12067 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12071 static struct alc_config_preset alc268_presets[] = {
12072 [ALC267_QUANTA_IL1] = {
12073 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12074 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12075 alc267_quanta_il1_verbs },
12076 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12077 .dac_nids = alc268_dac_nids,
12078 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12079 .adc_nids = alc268_adc_nids_alt,
12081 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12082 .channel_mode = alc268_modes,
12083 .input_mux = &alc268_capture_source,
12084 .unsol_event = alc267_quanta_il1_unsol_event,
12085 .init_hook = alc267_quanta_il1_automute,
12088 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12089 alc268_beep_mixer },
12090 .init_verbs = { alc268_base_init_verbs },
12091 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12092 .dac_nids = alc268_dac_nids,
12093 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12094 .adc_nids = alc268_adc_nids_alt,
12095 .capsrc_nids = alc268_capsrc_nids,
12097 .dig_out_nid = ALC268_DIGOUT_NID,
12098 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12099 .channel_mode = alc268_modes,
12100 .input_mux = &alc268_capture_source,
12102 [ALC268_TOSHIBA] = {
12103 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12104 alc268_beep_mixer },
12105 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12106 alc268_toshiba_verbs },
12107 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12108 .dac_nids = alc268_dac_nids,
12109 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12110 .adc_nids = alc268_adc_nids_alt,
12111 .capsrc_nids = alc268_capsrc_nids,
12113 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12114 .channel_mode = alc268_modes,
12115 .input_mux = &alc268_capture_source,
12116 .unsol_event = alc268_toshiba_unsol_event,
12117 .init_hook = alc268_toshiba_automute,
12120 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12121 alc268_beep_mixer },
12122 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12123 alc268_acer_verbs },
12124 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12125 .dac_nids = alc268_dac_nids,
12126 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12127 .adc_nids = alc268_adc_nids_alt,
12128 .capsrc_nids = alc268_capsrc_nids,
12130 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12131 .channel_mode = alc268_modes,
12132 .input_mux = &alc268_acer_capture_source,
12133 .unsol_event = alc268_acer_unsol_event,
12134 .init_hook = alc268_acer_init_hook,
12136 [ALC268_ACER_DMIC] = {
12137 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12138 alc268_beep_mixer },
12139 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12140 alc268_acer_verbs },
12141 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12142 .dac_nids = alc268_dac_nids,
12143 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12144 .adc_nids = alc268_adc_nids_alt,
12145 .capsrc_nids = alc268_capsrc_nids,
12147 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12148 .channel_mode = alc268_modes,
12149 .input_mux = &alc268_acer_dmic_capture_source,
12150 .unsol_event = alc268_acer_unsol_event,
12151 .init_hook = alc268_acer_init_hook,
12153 [ALC268_ACER_ASPIRE_ONE] = {
12154 .mixers = { alc268_acer_aspire_one_mixer,
12156 alc268_capture_alt_mixer },
12157 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12158 alc268_acer_aspire_one_verbs },
12159 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12160 .dac_nids = alc268_dac_nids,
12161 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12162 .adc_nids = alc268_adc_nids_alt,
12163 .capsrc_nids = alc268_capsrc_nids,
12165 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12166 .channel_mode = alc268_modes,
12167 .input_mux = &alc268_acer_lc_capture_source,
12168 .unsol_event = alc268_acer_lc_unsol_event,
12169 .init_hook = alc268_acer_lc_init_hook,
12172 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12173 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12174 alc268_dell_verbs },
12175 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12176 .dac_nids = alc268_dac_nids,
12178 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12179 .channel_mode = alc268_modes,
12180 .unsol_event = alc268_dell_unsol_event,
12181 .init_hook = alc268_dell_init_hook,
12182 .input_mux = &alc268_capture_source,
12185 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12186 alc268_beep_mixer },
12187 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12188 alc268_toshiba_verbs },
12189 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12190 .dac_nids = alc268_dac_nids,
12191 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12192 .adc_nids = alc268_adc_nids_alt,
12193 .capsrc_nids = alc268_capsrc_nids,
12195 .dig_out_nid = ALC268_DIGOUT_NID,
12196 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12197 .channel_mode = alc268_modes,
12198 .input_mux = &alc268_capture_source,
12199 .unsol_event = alc268_toshiba_unsol_event,
12200 .init_hook = alc268_toshiba_automute
12202 #ifdef CONFIG_SND_DEBUG
12204 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12205 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12206 alc268_volume_init_verbs },
12207 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12208 .dac_nids = alc268_dac_nids,
12209 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12210 .adc_nids = alc268_adc_nids_alt,
12211 .capsrc_nids = alc268_capsrc_nids,
12213 .dig_out_nid = ALC268_DIGOUT_NID,
12214 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12215 .channel_mode = alc268_modes,
12216 .input_mux = &alc268_capture_source,
12221 static int patch_alc268(struct hda_codec *codec)
12223 struct alc_spec *spec;
12225 int i, has_beep, err;
12227 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12231 codec->spec = spec;
12233 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12237 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12238 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12239 "trying auto-probe from BIOS...\n");
12240 board_config = ALC268_AUTO;
12243 if (board_config == ALC268_AUTO) {
12244 /* automatic parse from the BIOS config */
12245 err = alc268_parse_auto_config(codec);
12251 "hda_codec: Cannot set up configuration "
12252 "from BIOS. Using base mode...\n");
12253 board_config = ALC268_3ST;
12257 if (board_config != ALC268_AUTO)
12258 setup_preset(spec, &alc268_presets[board_config]);
12260 if (codec->vendor_id == 0x10ec0267) {
12261 spec->stream_name_analog = "ALC267 Analog";
12262 spec->stream_name_digital = "ALC267 Digital";
12264 spec->stream_name_analog = "ALC268 Analog";
12265 spec->stream_name_digital = "ALC268 Digital";
12268 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12269 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12270 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12272 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12275 for (i = 0; i < spec->num_mixers; i++) {
12276 if (spec->mixers[i] == alc268_beep_mixer) {
12283 err = snd_hda_attach_beep_device(codec, 0x1);
12288 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12289 /* override the amp caps for beep generator */
12290 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12291 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12292 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12293 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12294 (0 << AC_AMPCAP_MUTE_SHIFT));
12297 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12298 /* check whether NID 0x07 is valid */
12299 unsigned int wcap = get_wcaps(codec, 0x07);
12303 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12304 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12305 spec->adc_nids = alc268_adc_nids_alt;
12306 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12307 add_mixer(spec, alc268_capture_alt_mixer);
12309 spec->adc_nids = alc268_adc_nids;
12310 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12311 add_mixer(spec, alc268_capture_mixer);
12313 spec->capsrc_nids = alc268_capsrc_nids;
12314 /* set default input source */
12315 for (i = 0; i < spec->num_adc_nids; i++)
12316 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12317 0, AC_VERB_SET_CONNECT_SEL,
12318 spec->input_mux->items[0].index);
12321 spec->vmaster_nid = 0x02;
12323 codec->patch_ops = alc_patch_ops;
12324 if (board_config == ALC268_AUTO)
12325 spec->init_hook = alc268_auto_init;
12327 codec->proc_widget_hook = print_realtek_coef;
12333 * ALC269 channel source setting (2 channel)
12335 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12337 #define alc269_dac_nids alc260_dac_nids
12339 static hda_nid_t alc269_adc_nids[1] = {
12344 static hda_nid_t alc269_capsrc_nids[1] = {
12348 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12352 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12360 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12368 #define alc269_modes alc260_modes
12369 #define alc269_capture_source alc880_lg_lw_capture_source
12371 static struct snd_kcontrol_new alc269_base_mixer[] = {
12372 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12373 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12374 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12375 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12379 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12381 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12382 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12383 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12387 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12388 /* output mixer control */
12389 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12391 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12392 .name = "Master Playback Switch",
12393 .info = snd_hda_mixer_amp_switch_info,
12394 .get = snd_hda_mixer_amp_switch_get,
12395 .put = alc268_acer_master_sw_put,
12396 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12399 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12400 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12401 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12402 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12403 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12407 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12408 /* output mixer control */
12409 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12411 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12412 .name = "Master Playback Switch",
12413 .info = snd_hda_mixer_amp_switch_info,
12414 .get = snd_hda_mixer_amp_switch_get,
12415 .put = alc268_acer_master_sw_put,
12416 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12421 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12422 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12423 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12424 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12425 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12426 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12430 /* bind volumes of both NID 0x0c and 0x0d */
12431 static struct hda_bind_ctls alc269_epc_bind_vol = {
12432 .ops = &snd_hda_bind_vol,
12434 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12435 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12440 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12441 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12442 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12443 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12447 /* capture mixer elements */
12448 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12449 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12450 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12451 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12456 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12457 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12459 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12463 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12464 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12465 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12467 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12468 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12469 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12473 static struct hda_verb alc269_lifebook_verbs[] = {
12474 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12475 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12476 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12477 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12478 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12479 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12480 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12481 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12482 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12483 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12487 /* toggle speaker-output according to the hp-jack state */
12488 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12490 unsigned int present;
12491 unsigned char bits;
12493 present = snd_hda_codec_read(codec, 0x15, 0,
12494 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12495 bits = present ? AMP_IN_MUTE(0) : 0;
12496 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12497 AMP_IN_MUTE(0), bits);
12498 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12499 AMP_IN_MUTE(0), bits);
12501 snd_hda_codec_write(codec, 0x20, 0,
12502 AC_VERB_SET_COEF_INDEX, 0x0c);
12503 snd_hda_codec_write(codec, 0x20, 0,
12504 AC_VERB_SET_PROC_COEF, 0x680);
12506 snd_hda_codec_write(codec, 0x20, 0,
12507 AC_VERB_SET_COEF_INDEX, 0x0c);
12508 snd_hda_codec_write(codec, 0x20, 0,
12509 AC_VERB_SET_PROC_COEF, 0x480);
12512 /* toggle speaker-output according to the hp-jacks state */
12513 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12515 unsigned int present;
12516 unsigned char bits;
12518 /* Check laptop headphone socket */
12519 present = snd_hda_codec_read(codec, 0x15, 0,
12520 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12522 /* Check port replicator headphone socket */
12523 present |= snd_hda_codec_read(codec, 0x1a, 0,
12524 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12526 bits = present ? AMP_IN_MUTE(0) : 0;
12527 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12528 AMP_IN_MUTE(0), bits);
12529 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12530 AMP_IN_MUTE(0), bits);
12532 snd_hda_codec_write(codec, 0x20, 0,
12533 AC_VERB_SET_COEF_INDEX, 0x0c);
12534 snd_hda_codec_write(codec, 0x20, 0,
12535 AC_VERB_SET_PROC_COEF, 0x680);
12537 snd_hda_codec_write(codec, 0x20, 0,
12538 AC_VERB_SET_COEF_INDEX, 0x0c);
12539 snd_hda_codec_write(codec, 0x20, 0,
12540 AC_VERB_SET_PROC_COEF, 0x480);
12543 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12545 unsigned int present;
12547 present = snd_hda_codec_read(codec, 0x18, 0,
12548 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12549 snd_hda_codec_write(codec, 0x23, 0,
12550 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12553 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12555 unsigned int present_laptop;
12556 unsigned int present_dock;
12558 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12559 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12561 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12562 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12564 /* Laptop mic port overrides dock mic port, design decision */
12566 snd_hda_codec_write(codec, 0x23, 0,
12567 AC_VERB_SET_CONNECT_SEL, 0x3);
12568 if (present_laptop)
12569 snd_hda_codec_write(codec, 0x23, 0,
12570 AC_VERB_SET_CONNECT_SEL, 0x0);
12571 if (!present_dock && !present_laptop)
12572 snd_hda_codec_write(codec, 0x23, 0,
12573 AC_VERB_SET_CONNECT_SEL, 0x1);
12576 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12579 if ((res >> 26) == ALC880_HP_EVENT)
12580 alc269_quanta_fl1_speaker_automute(codec);
12581 if ((res >> 26) == ALC880_MIC_EVENT)
12582 alc269_quanta_fl1_mic_automute(codec);
12585 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12588 if ((res >> 26) == ALC880_HP_EVENT)
12589 alc269_lifebook_speaker_automute(codec);
12590 if ((res >> 26) == ALC880_MIC_EVENT)
12591 alc269_lifebook_mic_autoswitch(codec);
12594 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12596 alc269_quanta_fl1_speaker_automute(codec);
12597 alc269_quanta_fl1_mic_automute(codec);
12600 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12602 alc269_lifebook_speaker_automute(codec);
12603 alc269_lifebook_mic_autoswitch(codec);
12606 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12607 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12608 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12609 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12610 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12611 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12612 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12613 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12617 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12618 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12619 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12620 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12621 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12622 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12627 /* toggle speaker-output according to the hp-jack state */
12628 static void alc269_speaker_automute(struct hda_codec *codec)
12630 unsigned int present;
12631 unsigned char bits;
12633 present = snd_hda_codec_read(codec, 0x15, 0,
12634 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12635 bits = present ? AMP_IN_MUTE(0) : 0;
12636 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12637 AMP_IN_MUTE(0), bits);
12638 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12639 AMP_IN_MUTE(0), bits);
12642 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12644 unsigned int present;
12646 present = snd_hda_codec_read(codec, 0x18, 0,
12647 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12648 snd_hda_codec_write(codec, 0x23, 0,
12649 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12652 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12654 unsigned int present;
12656 present = snd_hda_codec_read(codec, 0x18, 0,
12657 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12658 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12659 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12660 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12661 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12664 /* unsolicited event for HP jack sensing */
12665 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12668 if ((res >> 26) == ALC880_HP_EVENT)
12669 alc269_speaker_automute(codec);
12671 if ((res >> 26) == ALC880_MIC_EVENT)
12672 alc269_eeepc_dmic_automute(codec);
12675 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12677 alc269_speaker_automute(codec);
12678 alc269_eeepc_dmic_automute(codec);
12681 /* unsolicited event for HP jack sensing */
12682 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12685 if ((res >> 26) == ALC880_HP_EVENT)
12686 alc269_speaker_automute(codec);
12688 if ((res >> 26) == ALC880_MIC_EVENT)
12689 alc269_eeepc_amic_automute(codec);
12692 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12694 alc269_speaker_automute(codec);
12695 alc269_eeepc_amic_automute(codec);
12699 * generic initialization of ADC, input mixers and output mixers
12701 static struct hda_verb alc269_init_verbs[] = {
12703 * Unmute ADC0 and set the default input to mic-in
12705 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12707 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12708 * analog-loopback mixer widget
12709 * Note: PASD motherboards uses the Line In 2 as the input for
12710 * front panel mic (mic 2)
12712 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12717 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12720 * Set up output mixers (0x0c - 0x0e)
12722 /* set vol=0 to output mixers */
12723 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12724 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12726 /* set up input amps for analog loopback */
12727 /* Amp Indices: DAC = 0, mixer = 1 */
12728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12730 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12731 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12732 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12738 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12739 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12740 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12741 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12743 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12745 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12748 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12749 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12751 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12752 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12754 /* FIXME: use matrix-type input source selection */
12755 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12756 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12757 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12763 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12764 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12768 /* add playback controls from the parsed DAC table */
12769 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12770 const struct auto_pin_cfg *cfg)
12775 spec->multiout.num_dacs = 1; /* only use one dac */
12776 spec->multiout.dac_nids = spec->private_dac_nids;
12777 spec->multiout.dac_nids[0] = 2;
12779 nid = cfg->line_out_pins[0];
12781 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12782 "Front Playback Volume",
12783 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12786 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12787 "Front Playback Switch",
12788 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12793 nid = cfg->speaker_pins[0];
12795 if (!cfg->line_out_pins[0]) {
12796 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12797 "Speaker Playback Volume",
12798 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12804 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12805 "Speaker Playback Switch",
12806 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12811 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12812 "Speaker Playback Switch",
12813 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12819 nid = cfg->hp_pins[0];
12821 /* spec->multiout.hp_nid = 2; */
12822 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12823 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12824 "Headphone Playback Volume",
12825 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12831 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12832 "Headphone Playback Switch",
12833 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12838 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12839 "Headphone Playback Switch",
12840 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12849 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12850 const struct auto_pin_cfg *cfg)
12854 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12857 /* digital-mic input pin is excluded in alc880_auto_create..()
12858 * because it's under 0x18
12860 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12861 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12862 struct hda_input_mux *imux = &spec->private_imux[0];
12863 imux->items[imux->num_items].label = "Int Mic";
12864 imux->items[imux->num_items].index = 0x05;
12870 #ifdef CONFIG_SND_HDA_POWER_SAVE
12871 #define alc269_loopbacks alc880_loopbacks
12874 /* pcm configuration: identiacal with ALC880 */
12875 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12876 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12877 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12878 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12880 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12884 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12885 /* NID is set in alc_build_pcms */
12887 .open = alc880_playback_pcm_open,
12888 .prepare = alc880_playback_pcm_prepare,
12889 .cleanup = alc880_playback_pcm_cleanup
12893 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12897 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12898 /* NID is set in alc_build_pcms */
12902 * BIOS auto configuration
12904 static int alc269_parse_auto_config(struct hda_codec *codec)
12906 struct alc_spec *spec = codec->spec;
12908 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12910 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12915 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12918 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12922 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12924 if (spec->autocfg.dig_outs)
12925 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12927 if (spec->kctls.list)
12928 add_mixer(spec, spec->kctls.list);
12930 add_verb(spec, alc269_init_verbs);
12931 spec->num_mux_defs = 1;
12932 spec->input_mux = &spec->private_imux[0];
12933 /* set default input source */
12934 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12935 0, AC_VERB_SET_CONNECT_SEL,
12936 spec->input_mux->items[0].index);
12938 err = alc_auto_add_mic_boost(codec);
12942 if (!spec->cap_mixer && !spec->no_analog)
12943 set_capture_mixer(spec);
12948 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12949 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12950 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12953 /* init callback for auto-configuration model -- overriding the default init */
12954 static void alc269_auto_init(struct hda_codec *codec)
12956 struct alc_spec *spec = codec->spec;
12957 alc269_auto_init_multi_out(codec);
12958 alc269_auto_init_hp_out(codec);
12959 alc269_auto_init_analog_input(codec);
12960 if (spec->unsol_event)
12961 alc_inithook(codec);
12965 * configuration and preset
12967 static const char *alc269_models[ALC269_MODEL_LAST] = {
12968 [ALC269_BASIC] = "basic",
12969 [ALC269_QUANTA_FL1] = "quanta",
12970 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12971 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12972 [ALC269_FUJITSU] = "fujitsu",
12973 [ALC269_LIFEBOOK] = "lifebook"
12976 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12977 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12978 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12979 ALC269_ASUS_EEEPC_P703),
12980 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12981 ALC269_ASUS_EEEPC_P901),
12982 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12983 ALC269_ASUS_EEEPC_P901),
12984 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12985 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12989 static struct alc_config_preset alc269_presets[] = {
12991 .mixers = { alc269_base_mixer },
12992 .init_verbs = { alc269_init_verbs },
12993 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12994 .dac_nids = alc269_dac_nids,
12996 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12997 .channel_mode = alc269_modes,
12998 .input_mux = &alc269_capture_source,
13000 [ALC269_QUANTA_FL1] = {
13001 .mixers = { alc269_quanta_fl1_mixer },
13002 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13003 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13004 .dac_nids = alc269_dac_nids,
13006 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13007 .channel_mode = alc269_modes,
13008 .input_mux = &alc269_capture_source,
13009 .unsol_event = alc269_quanta_fl1_unsol_event,
13010 .init_hook = alc269_quanta_fl1_init_hook,
13012 [ALC269_ASUS_EEEPC_P703] = {
13013 .mixers = { alc269_eeepc_mixer },
13014 .cap_mixer = alc269_epc_capture_mixer,
13015 .init_verbs = { alc269_init_verbs,
13016 alc269_eeepc_amic_init_verbs },
13017 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13018 .dac_nids = alc269_dac_nids,
13020 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13021 .channel_mode = alc269_modes,
13022 .input_mux = &alc269_eeepc_amic_capture_source,
13023 .unsol_event = alc269_eeepc_amic_unsol_event,
13024 .init_hook = alc269_eeepc_amic_inithook,
13026 [ALC269_ASUS_EEEPC_P901] = {
13027 .mixers = { alc269_eeepc_mixer },
13028 .cap_mixer = alc269_epc_capture_mixer,
13029 .init_verbs = { alc269_init_verbs,
13030 alc269_eeepc_dmic_init_verbs },
13031 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13032 .dac_nids = alc269_dac_nids,
13034 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13035 .channel_mode = alc269_modes,
13036 .input_mux = &alc269_eeepc_dmic_capture_source,
13037 .unsol_event = alc269_eeepc_dmic_unsol_event,
13038 .init_hook = alc269_eeepc_dmic_inithook,
13040 [ALC269_FUJITSU] = {
13041 .mixers = { alc269_fujitsu_mixer },
13042 .cap_mixer = alc269_epc_capture_mixer,
13043 .init_verbs = { alc269_init_verbs,
13044 alc269_eeepc_dmic_init_verbs },
13045 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13046 .dac_nids = alc269_dac_nids,
13048 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13049 .channel_mode = alc269_modes,
13050 .input_mux = &alc269_eeepc_dmic_capture_source,
13051 .unsol_event = alc269_eeepc_dmic_unsol_event,
13052 .init_hook = alc269_eeepc_dmic_inithook,
13054 [ALC269_LIFEBOOK] = {
13055 .mixers = { alc269_lifebook_mixer },
13056 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13057 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13058 .dac_nids = alc269_dac_nids,
13060 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13061 .channel_mode = alc269_modes,
13062 .input_mux = &alc269_capture_source,
13063 .unsol_event = alc269_lifebook_unsol_event,
13064 .init_hook = alc269_lifebook_init_hook,
13068 static int patch_alc269(struct hda_codec *codec)
13070 struct alc_spec *spec;
13074 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13078 codec->spec = spec;
13080 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13082 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13086 if (board_config < 0) {
13087 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
13088 "trying auto-probe from BIOS...\n");
13089 board_config = ALC269_AUTO;
13092 if (board_config == ALC269_AUTO) {
13093 /* automatic parse from the BIOS config */
13094 err = alc269_parse_auto_config(codec);
13100 "hda_codec: Cannot set up configuration "
13101 "from BIOS. Using base mode...\n");
13102 board_config = ALC269_BASIC;
13106 err = snd_hda_attach_beep_device(codec, 0x1);
13112 if (board_config != ALC269_AUTO)
13113 setup_preset(spec, &alc269_presets[board_config]);
13115 spec->stream_name_analog = "ALC269 Analog";
13116 if (codec->subsystem_id == 0x17aa3bf8) {
13117 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13118 * fix the sample rate of analog I/O to 44.1kHz
13120 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13121 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13123 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13124 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13126 spec->stream_name_digital = "ALC269 Digital";
13127 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13128 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13130 spec->adc_nids = alc269_adc_nids;
13131 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13132 spec->capsrc_nids = alc269_capsrc_nids;
13133 if (!spec->cap_mixer)
13134 set_capture_mixer(spec);
13135 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13137 codec->patch_ops = alc_patch_ops;
13138 if (board_config == ALC269_AUTO)
13139 spec->init_hook = alc269_auto_init;
13140 #ifdef CONFIG_SND_HDA_POWER_SAVE
13141 if (!spec->loopback.amplist)
13142 spec->loopback.amplist = alc269_loopbacks;
13144 codec->proc_widget_hook = print_realtek_coef;
13150 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13154 * set the path ways for 2 channel output
13155 * need to set the codec line out and mic 1 pin widgets to inputs
13157 static struct hda_verb alc861_threestack_ch2_init[] = {
13158 /* set pin widget 1Ah (line in) for input */
13159 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13160 /* set pin widget 18h (mic1/2) for input, for mic also enable
13163 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13165 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13167 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13168 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13174 * need to set the codec line out and mic 1 pin widgets to outputs
13176 static struct hda_verb alc861_threestack_ch6_init[] = {
13177 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13178 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13179 /* set pin widget 18h (mic1) for output (CLFE)*/
13180 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13182 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13183 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13185 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13187 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13188 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13193 static struct hda_channel_mode alc861_threestack_modes[2] = {
13194 { 2, alc861_threestack_ch2_init },
13195 { 6, alc861_threestack_ch6_init },
13197 /* Set mic1 as input and unmute the mixer */
13198 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13199 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13200 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13203 /* Set mic1 as output and mute mixer */
13204 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13205 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13206 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13210 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13211 { 2, alc861_uniwill_m31_ch2_init },
13212 { 4, alc861_uniwill_m31_ch4_init },
13215 /* Set mic1 and line-in as input and unmute the mixer */
13216 static struct hda_verb alc861_asus_ch2_init[] = {
13217 /* set pin widget 1Ah (line in) for input */
13218 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13219 /* set pin widget 18h (mic1/2) for input, for mic also enable
13222 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13224 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13226 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13227 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13231 /* Set mic1 nad line-in as output and mute mixer */
13232 static struct hda_verb alc861_asus_ch6_init[] = {
13233 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13234 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13235 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13236 /* set pin widget 18h (mic1) for output (CLFE)*/
13237 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13238 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13239 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13240 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13242 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13244 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13245 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13250 static struct hda_channel_mode alc861_asus_modes[2] = {
13251 { 2, alc861_asus_ch2_init },
13252 { 6, alc861_asus_ch6_init },
13257 static struct snd_kcontrol_new alc861_base_mixer[] = {
13258 /* output mixer control */
13259 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13260 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13261 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13262 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13263 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13265 /*Input mixer control */
13266 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13267 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13268 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13269 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13270 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13271 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13273 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13274 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13280 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13281 /* output mixer control */
13282 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13283 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13284 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13285 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13286 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13288 /* Input mixer control */
13289 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13290 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13291 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13292 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13293 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13294 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13296 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13297 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13301 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13302 .name = "Channel Mode",
13303 .info = alc_ch_mode_info,
13304 .get = alc_ch_mode_get,
13305 .put = alc_ch_mode_put,
13306 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13311 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13312 /* output mixer control */
13313 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13315 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13320 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13321 /* output mixer control */
13322 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13323 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13324 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13325 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13326 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13328 /* Input mixer control */
13329 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13330 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13331 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13332 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13333 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13334 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13336 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13337 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13338 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13341 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13342 .name = "Channel Mode",
13343 .info = alc_ch_mode_info,
13344 .get = alc_ch_mode_get,
13345 .put = alc_ch_mode_put,
13346 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13351 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13352 /* output mixer control */
13353 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13354 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13355 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13356 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13357 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13359 /* Input mixer control */
13360 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13361 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13362 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13363 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13364 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13365 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13367 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13368 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13369 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13373 .name = "Channel Mode",
13374 .info = alc_ch_mode_info,
13375 .get = alc_ch_mode_get,
13376 .put = alc_ch_mode_put,
13377 .private_value = ARRAY_SIZE(alc861_asus_modes),
13382 /* additional mixer */
13383 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13384 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13385 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13390 * generic initialization of ADC, input mixers and output mixers
13392 static struct hda_verb alc861_base_init_verbs[] = {
13394 * Unmute ADC0 and set the default input to mic-in
13396 /* port-A for surround (rear panel) */
13397 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13398 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13399 /* port-B for mic-in (rear panel) with vref */
13400 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13401 /* port-C for line-in (rear panel) */
13402 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13403 /* port-D for Front */
13404 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13405 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13406 /* port-E for HP out (front panel) */
13407 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13408 /* route front PCM to HP */
13409 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13410 /* port-F for mic-in (front panel) with vref */
13411 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13412 /* port-G for CLFE (rear panel) */
13413 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13414 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13415 /* port-H for side (rear panel) */
13416 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13417 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13419 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13420 /* route front mic to ADC1*/
13421 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13424 /* Unmute DAC0~3 & spdif out*/
13425 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13426 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13427 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13428 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13431 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13432 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13433 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13434 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13435 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13437 /* Unmute Stereo Mixer 15 */
13438 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13439 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13440 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13441 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13443 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13444 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13445 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13446 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13448 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13450 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13451 /* hp used DAC 3 (Front) */
13452 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13453 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13458 static struct hda_verb alc861_threestack_init_verbs[] = {
13460 * Unmute ADC0 and set the default input to mic-in
13462 /* port-A for surround (rear panel) */
13463 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13464 /* port-B for mic-in (rear panel) with vref */
13465 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13466 /* port-C for line-in (rear panel) */
13467 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13468 /* port-D for Front */
13469 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13470 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13471 /* port-E for HP out (front panel) */
13472 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13473 /* route front PCM to HP */
13474 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13475 /* port-F for mic-in (front panel) with vref */
13476 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13477 /* port-G for CLFE (rear panel) */
13478 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13479 /* port-H for side (rear panel) */
13480 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13482 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13483 /* route front mic to ADC1*/
13484 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13485 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13486 /* Unmute DAC0~3 & spdif out*/
13487 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13488 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13489 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13490 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13491 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13493 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13494 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13495 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13496 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13497 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13499 /* Unmute Stereo Mixer 15 */
13500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13501 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13502 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13503 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13505 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13506 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13507 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13508 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13509 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13510 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13511 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13512 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13513 /* hp used DAC 3 (Front) */
13514 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13515 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13519 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13521 * Unmute ADC0 and set the default input to mic-in
13523 /* port-A for surround (rear panel) */
13524 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13525 /* port-B for mic-in (rear panel) with vref */
13526 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13527 /* port-C for line-in (rear panel) */
13528 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13529 /* port-D for Front */
13530 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13531 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13532 /* port-E for HP out (front panel) */
13533 /* this has to be set to VREF80 */
13534 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13535 /* route front PCM to HP */
13536 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13537 /* port-F for mic-in (front panel) with vref */
13538 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13539 /* port-G for CLFE (rear panel) */
13540 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13541 /* port-H for side (rear panel) */
13542 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13544 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13545 /* route front mic to ADC1*/
13546 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13547 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13548 /* Unmute DAC0~3 & spdif out*/
13549 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13550 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13551 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13552 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13555 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13556 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13557 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13558 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13559 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13561 /* Unmute Stereo Mixer 15 */
13562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13567 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13568 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13569 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13570 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13571 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13572 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13573 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13574 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13575 /* hp used DAC 3 (Front) */
13576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13577 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13581 static struct hda_verb alc861_asus_init_verbs[] = {
13583 * Unmute ADC0 and set the default input to mic-in
13585 /* port-A for surround (rear panel)
13586 * according to codec#0 this is the HP jack
13588 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13589 /* route front PCM to HP */
13590 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13591 /* port-B for mic-in (rear panel) with vref */
13592 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13593 /* port-C for line-in (rear panel) */
13594 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13595 /* port-D for Front */
13596 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13597 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13598 /* port-E for HP out (front panel) */
13599 /* this has to be set to VREF80 */
13600 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13601 /* route front PCM to HP */
13602 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13603 /* port-F for mic-in (front panel) with vref */
13604 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13605 /* port-G for CLFE (rear panel) */
13606 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13607 /* port-H for side (rear panel) */
13608 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13610 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13611 /* route front mic to ADC1*/
13612 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13613 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13614 /* Unmute DAC0~3 & spdif out*/
13615 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13616 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13617 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13618 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13620 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13621 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13622 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13623 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13624 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13626 /* Unmute Stereo Mixer 15 */
13627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13632 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13633 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13634 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13635 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13636 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13637 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13639 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13640 /* hp used DAC 3 (Front) */
13641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13642 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13646 /* additional init verbs for ASUS laptops */
13647 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13648 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13649 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13654 * generic initialization of ADC, input mixers and output mixers
13656 static struct hda_verb alc861_auto_init_verbs[] = {
13658 * Unmute ADC0 and set the default input to mic-in
13660 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13663 /* Unmute DAC0~3 & spdif out*/
13664 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13665 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13666 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13667 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13668 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13670 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13671 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13672 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13673 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13674 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13676 /* Unmute Stereo Mixer 15 */
13677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13678 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13682 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13685 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13686 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13687 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13689 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13692 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13693 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13694 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13695 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13696 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13697 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13698 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13700 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13705 static struct hda_verb alc861_toshiba_init_verbs[] = {
13706 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13711 /* toggle speaker-output according to the hp-jack state */
13712 static void alc861_toshiba_automute(struct hda_codec *codec)
13714 unsigned int present;
13716 present = snd_hda_codec_read(codec, 0x0f, 0,
13717 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13718 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13719 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13720 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13721 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13724 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13727 if ((res >> 26) == ALC880_HP_EVENT)
13728 alc861_toshiba_automute(codec);
13731 /* pcm configuration: identiacal with ALC880 */
13732 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13733 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13734 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13735 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13738 #define ALC861_DIGOUT_NID 0x07
13740 static struct hda_channel_mode alc861_8ch_modes[1] = {
13744 static hda_nid_t alc861_dac_nids[4] = {
13745 /* front, surround, clfe, side */
13746 0x03, 0x06, 0x05, 0x04
13749 static hda_nid_t alc660_dac_nids[3] = {
13750 /* front, clfe, surround */
13754 static hda_nid_t alc861_adc_nids[1] = {
13759 static struct hda_input_mux alc861_capture_source = {
13763 { "Front Mic", 0x3 },
13770 /* fill in the dac_nids table from the parsed pin configuration */
13771 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13772 const struct auto_pin_cfg *cfg)
13777 spec->multiout.dac_nids = spec->private_dac_nids;
13778 for (i = 0; i < cfg->line_outs; i++) {
13779 nid = cfg->line_out_pins[i];
13781 if (i >= ARRAY_SIZE(alc861_dac_nids))
13783 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13786 spec->multiout.num_dacs = cfg->line_outs;
13790 /* add playback controls from the parsed DAC table */
13791 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13792 const struct auto_pin_cfg *cfg)
13795 static const char *chname[4] = {
13796 "Front", "Surround", NULL /*CLFE*/, "Side"
13801 for (i = 0; i < cfg->line_outs; i++) {
13802 nid = spec->multiout.dac_nids[i];
13807 err = add_control(spec, ALC_CTL_BIND_MUTE,
13808 "Center Playback Switch",
13809 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13813 err = add_control(spec, ALC_CTL_BIND_MUTE,
13814 "LFE Playback Switch",
13815 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13820 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13822 if (nid == alc861_dac_nids[idx])
13824 sprintf(name, "%s Playback Switch", chname[idx]);
13825 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13826 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13835 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13843 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13845 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13846 "Headphone Playback Switch",
13847 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13850 spec->multiout.hp_nid = nid;
13855 /* create playback/capture controls for input pins */
13856 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13857 const struct auto_pin_cfg *cfg)
13859 struct hda_input_mux *imux = &spec->private_imux[0];
13860 int i, err, idx, idx1;
13862 for (i = 0; i < AUTO_PIN_LAST; i++) {
13863 switch (cfg->input_pins[i]) {
13866 idx = 2; /* Line In */
13870 idx = 2; /* Line In */
13874 idx = 1; /* Mic In */
13878 idx = 1; /* Mic In */
13888 err = new_analog_input(spec, cfg->input_pins[i],
13889 auto_pin_cfg_labels[i], idx, 0x15);
13893 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13894 imux->items[imux->num_items].index = idx1;
13900 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13902 int pin_type, int dac_idx)
13904 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13906 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13910 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13912 struct alc_spec *spec = codec->spec;
13915 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13916 for (i = 0; i < spec->autocfg.line_outs; i++) {
13917 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13918 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13920 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13921 spec->multiout.dac_nids[i]);
13925 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13927 struct alc_spec *spec = codec->spec;
13930 pin = spec->autocfg.hp_pins[0];
13931 if (pin) /* connect to front */
13932 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13933 spec->multiout.dac_nids[0]);
13934 pin = spec->autocfg.speaker_pins[0];
13936 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13939 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13941 struct alc_spec *spec = codec->spec;
13944 for (i = 0; i < AUTO_PIN_LAST; i++) {
13945 hda_nid_t nid = spec->autocfg.input_pins[i];
13946 if (nid >= 0x0c && nid <= 0x11)
13947 alc_set_input_pin(codec, nid, i);
13951 /* parse the BIOS configuration and set up the alc_spec */
13952 /* return 1 if successful, 0 if the proper config is not found,
13953 * or a negative error code
13955 static int alc861_parse_auto_config(struct hda_codec *codec)
13957 struct alc_spec *spec = codec->spec;
13959 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13961 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13965 if (!spec->autocfg.line_outs)
13966 return 0; /* can't find valid BIOS pin config */
13968 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13971 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13974 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13977 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13981 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13983 if (spec->autocfg.dig_outs)
13984 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13986 if (spec->kctls.list)
13987 add_mixer(spec, spec->kctls.list);
13989 add_verb(spec, alc861_auto_init_verbs);
13991 spec->num_mux_defs = 1;
13992 spec->input_mux = &spec->private_imux[0];
13994 spec->adc_nids = alc861_adc_nids;
13995 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13996 set_capture_mixer(spec);
14001 /* additional initialization for auto-configuration model */
14002 static void alc861_auto_init(struct hda_codec *codec)
14004 struct alc_spec *spec = codec->spec;
14005 alc861_auto_init_multi_out(codec);
14006 alc861_auto_init_hp_out(codec);
14007 alc861_auto_init_analog_input(codec);
14008 if (spec->unsol_event)
14009 alc_inithook(codec);
14012 #ifdef CONFIG_SND_HDA_POWER_SAVE
14013 static struct hda_amp_list alc861_loopbacks[] = {
14014 { 0x15, HDA_INPUT, 0 },
14015 { 0x15, HDA_INPUT, 1 },
14016 { 0x15, HDA_INPUT, 2 },
14017 { 0x15, HDA_INPUT, 3 },
14024 * configuration and preset
14026 static const char *alc861_models[ALC861_MODEL_LAST] = {
14027 [ALC861_3ST] = "3stack",
14028 [ALC660_3ST] = "3stack-660",
14029 [ALC861_3ST_DIG] = "3stack-dig",
14030 [ALC861_6ST_DIG] = "6stack-dig",
14031 [ALC861_UNIWILL_M31] = "uniwill-m31",
14032 [ALC861_TOSHIBA] = "toshiba",
14033 [ALC861_ASUS] = "asus",
14034 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14035 [ALC861_AUTO] = "auto",
14038 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14039 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14040 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14041 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14042 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14043 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14044 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14045 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14046 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14047 * Any other models that need this preset?
14049 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14050 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14051 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14052 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14053 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14054 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14055 /* FIXME: the below seems conflict */
14056 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14057 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14058 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14062 static struct alc_config_preset alc861_presets[] = {
14064 .mixers = { alc861_3ST_mixer },
14065 .init_verbs = { alc861_threestack_init_verbs },
14066 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14067 .dac_nids = alc861_dac_nids,
14068 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14069 .channel_mode = alc861_threestack_modes,
14071 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14072 .adc_nids = alc861_adc_nids,
14073 .input_mux = &alc861_capture_source,
14075 [ALC861_3ST_DIG] = {
14076 .mixers = { alc861_base_mixer },
14077 .init_verbs = { alc861_threestack_init_verbs },
14078 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14079 .dac_nids = alc861_dac_nids,
14080 .dig_out_nid = ALC861_DIGOUT_NID,
14081 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14082 .channel_mode = alc861_threestack_modes,
14084 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14085 .adc_nids = alc861_adc_nids,
14086 .input_mux = &alc861_capture_source,
14088 [ALC861_6ST_DIG] = {
14089 .mixers = { alc861_base_mixer },
14090 .init_verbs = { alc861_base_init_verbs },
14091 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14092 .dac_nids = alc861_dac_nids,
14093 .dig_out_nid = ALC861_DIGOUT_NID,
14094 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14095 .channel_mode = alc861_8ch_modes,
14096 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14097 .adc_nids = alc861_adc_nids,
14098 .input_mux = &alc861_capture_source,
14101 .mixers = { alc861_3ST_mixer },
14102 .init_verbs = { alc861_threestack_init_verbs },
14103 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14104 .dac_nids = alc660_dac_nids,
14105 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14106 .channel_mode = alc861_threestack_modes,
14108 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14109 .adc_nids = alc861_adc_nids,
14110 .input_mux = &alc861_capture_source,
14112 [ALC861_UNIWILL_M31] = {
14113 .mixers = { alc861_uniwill_m31_mixer },
14114 .init_verbs = { alc861_uniwill_m31_init_verbs },
14115 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14116 .dac_nids = alc861_dac_nids,
14117 .dig_out_nid = ALC861_DIGOUT_NID,
14118 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14119 .channel_mode = alc861_uniwill_m31_modes,
14121 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14122 .adc_nids = alc861_adc_nids,
14123 .input_mux = &alc861_capture_source,
14125 [ALC861_TOSHIBA] = {
14126 .mixers = { alc861_toshiba_mixer },
14127 .init_verbs = { alc861_base_init_verbs,
14128 alc861_toshiba_init_verbs },
14129 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14130 .dac_nids = alc861_dac_nids,
14131 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14132 .channel_mode = alc883_3ST_2ch_modes,
14133 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14134 .adc_nids = alc861_adc_nids,
14135 .input_mux = &alc861_capture_source,
14136 .unsol_event = alc861_toshiba_unsol_event,
14137 .init_hook = alc861_toshiba_automute,
14140 .mixers = { alc861_asus_mixer },
14141 .init_verbs = { alc861_asus_init_verbs },
14142 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14143 .dac_nids = alc861_dac_nids,
14144 .dig_out_nid = ALC861_DIGOUT_NID,
14145 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14146 .channel_mode = alc861_asus_modes,
14149 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14150 .adc_nids = alc861_adc_nids,
14151 .input_mux = &alc861_capture_source,
14153 [ALC861_ASUS_LAPTOP] = {
14154 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14155 .init_verbs = { alc861_asus_init_verbs,
14156 alc861_asus_laptop_init_verbs },
14157 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14158 .dac_nids = alc861_dac_nids,
14159 .dig_out_nid = ALC861_DIGOUT_NID,
14160 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14161 .channel_mode = alc883_3ST_2ch_modes,
14163 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14164 .adc_nids = alc861_adc_nids,
14165 .input_mux = &alc861_capture_source,
14170 static int patch_alc861(struct hda_codec *codec)
14172 struct alc_spec *spec;
14176 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14180 codec->spec = spec;
14182 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14186 if (board_config < 0) {
14187 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14188 "trying auto-probe from BIOS...\n");
14189 board_config = ALC861_AUTO;
14192 if (board_config == ALC861_AUTO) {
14193 /* automatic parse from the BIOS config */
14194 err = alc861_parse_auto_config(codec);
14200 "hda_codec: Cannot set up configuration "
14201 "from BIOS. Using base mode...\n");
14202 board_config = ALC861_3ST_DIG;
14206 err = snd_hda_attach_beep_device(codec, 0x23);
14212 if (board_config != ALC861_AUTO)
14213 setup_preset(spec, &alc861_presets[board_config]);
14215 spec->stream_name_analog = "ALC861 Analog";
14216 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14217 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14219 spec->stream_name_digital = "ALC861 Digital";
14220 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14221 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14223 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14225 spec->vmaster_nid = 0x03;
14227 codec->patch_ops = alc_patch_ops;
14228 if (board_config == ALC861_AUTO)
14229 spec->init_hook = alc861_auto_init;
14230 #ifdef CONFIG_SND_HDA_POWER_SAVE
14231 if (!spec->loopback.amplist)
14232 spec->loopback.amplist = alc861_loopbacks;
14234 codec->proc_widget_hook = print_realtek_coef;
14240 * ALC861-VD support
14244 * In addition, an independent DAC
14246 #define ALC861VD_DIGOUT_NID 0x06
14248 static hda_nid_t alc861vd_dac_nids[4] = {
14249 /* front, surr, clfe, side surr */
14250 0x02, 0x03, 0x04, 0x05
14253 /* dac_nids for ALC660vd are in a different order - according to
14254 * Realtek's driver.
14255 * This should probably tesult in a different mixer for 6stack models
14256 * of ALC660vd codecs, but for now there is only 3stack mixer
14257 * - and it is the same as in 861vd.
14258 * adc_nids in ALC660vd are (is) the same as in 861vd
14260 static hda_nid_t alc660vd_dac_nids[3] = {
14261 /* front, rear, clfe, rear_surr */
14265 static hda_nid_t alc861vd_adc_nids[1] = {
14270 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14273 /* FIXME: should be a matrix-type input source selection */
14274 static struct hda_input_mux alc861vd_capture_source = {
14278 { "Front Mic", 0x1 },
14284 static struct hda_input_mux alc861vd_dallas_capture_source = {
14287 { "Ext Mic", 0x0 },
14288 { "Int Mic", 0x1 },
14292 static struct hda_input_mux alc861vd_hp_capture_source = {
14295 { "Front Mic", 0x0 },
14296 { "ATAPI Mic", 0x1 },
14303 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14310 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14311 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14312 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14313 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14314 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14321 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14322 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14323 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14324 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14325 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14329 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14330 { 6, alc861vd_6stack_ch6_init },
14331 { 8, alc861vd_6stack_ch8_init },
14334 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14337 .name = "Channel Mode",
14338 .info = alc_ch_mode_info,
14339 .get = alc_ch_mode_get,
14340 .put = alc_ch_mode_put,
14345 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14346 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14348 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14349 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14350 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14352 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14353 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14355 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14357 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14359 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14360 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14362 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14363 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14367 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14369 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14371 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14372 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14373 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14375 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14376 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14378 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14379 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14384 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14385 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14386 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14388 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14391 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14392 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14394 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14395 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14396 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14398 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14399 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14401 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14402 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14407 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14408 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14409 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14410 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14416 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14418 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14419 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14420 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14422 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14423 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14428 /* Pin assignment: Speaker=0x14, HP = 0x15,
14429 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14431 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14432 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14433 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14434 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14435 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14436 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14437 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14438 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14439 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14440 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14441 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14445 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14446 * Front Mic=0x18, ATAPI Mic = 0x19,
14448 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14449 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14450 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14451 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14452 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14453 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14454 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14455 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14456 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14462 * generic initialization of ADC, input mixers and output mixers
14464 static struct hda_verb alc861vd_volume_init_verbs[] = {
14466 * Unmute ADC0 and set the default input to mic-in
14468 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14469 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14471 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14472 * the analog-loopback mixer widget
14474 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14475 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14477 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14478 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14479 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14481 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14485 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14488 * Set up output mixers (0x02 - 0x05)
14490 /* set vol=0 to output mixers */
14491 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14492 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14493 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14494 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14496 /* set up input amps for analog loopback */
14497 /* Amp Indices: DAC = 0, mixer = 1 */
14498 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14500 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14502 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14504 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14505 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14511 * 3-stack pin configuration:
14512 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14514 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14516 * Set pin mode and muting
14518 /* set front pin widgets 0x14 for output */
14519 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14520 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14521 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14523 /* Mic (rear) pin: input vref at 80% */
14524 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14525 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14526 /* Front Mic pin: input vref at 80% */
14527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14528 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14529 /* Line In pin: input */
14530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14532 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14533 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14534 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14535 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14536 /* CD pin widget for input */
14537 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14543 * 6-stack pin configuration:
14545 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14547 * Set pin mode and muting
14549 /* set front pin widgets 0x14 for output */
14550 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14551 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14552 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14554 /* Rear Pin: output 1 (0x0d) */
14555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14556 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14557 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14558 /* CLFE Pin: output 2 (0x0e) */
14559 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14560 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14561 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14562 /* Side Pin: output 3 (0x0f) */
14563 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14564 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14565 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14567 /* Mic (rear) pin: input vref at 80% */
14568 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14569 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14570 /* Front Mic pin: input vref at 80% */
14571 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14572 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14573 /* Line In pin: input */
14574 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14575 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14576 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14577 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14578 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14579 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14580 /* CD pin widget for input */
14581 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14586 static struct hda_verb alc861vd_eapd_verbs[] = {
14587 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14591 static struct hda_verb alc660vd_eapd_verbs[] = {
14592 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14593 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14597 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14599 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14601 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14602 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14606 /* toggle speaker-output according to the hp-jack state */
14607 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14609 unsigned int present;
14610 unsigned char bits;
14612 present = snd_hda_codec_read(codec, 0x1b, 0,
14613 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14614 bits = present ? HDA_AMP_MUTE : 0;
14615 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14616 HDA_AMP_MUTE, bits);
14619 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14621 unsigned int present;
14622 unsigned char bits;
14624 present = snd_hda_codec_read(codec, 0x18, 0,
14625 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14626 bits = present ? HDA_AMP_MUTE : 0;
14627 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14628 HDA_AMP_MUTE, bits);
14631 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14633 alc861vd_lenovo_hp_automute(codec);
14634 alc861vd_lenovo_mic_automute(codec);
14637 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14640 switch (res >> 26) {
14641 case ALC880_HP_EVENT:
14642 alc861vd_lenovo_hp_automute(codec);
14644 case ALC880_MIC_EVENT:
14645 alc861vd_lenovo_mic_automute(codec);
14650 static struct hda_verb alc861vd_dallas_verbs[] = {
14651 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14652 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14653 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14654 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14659 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14661 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14662 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14663 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14665 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14666 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14669 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14670 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14671 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14672 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14674 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14675 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14676 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14677 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14678 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14679 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14680 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14681 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14686 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14688 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14689 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14690 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14695 /* toggle speaker-output according to the hp-jack state */
14696 static void alc861vd_dallas_automute(struct hda_codec *codec)
14698 unsigned int present;
14700 present = snd_hda_codec_read(codec, 0x15, 0,
14701 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14702 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14703 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14706 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14708 if ((res >> 26) == ALC880_HP_EVENT)
14709 alc861vd_dallas_automute(codec);
14712 #ifdef CONFIG_SND_HDA_POWER_SAVE
14713 #define alc861vd_loopbacks alc880_loopbacks
14716 /* pcm configuration: identiacal with ALC880 */
14717 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14718 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14719 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14720 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14723 * configuration and preset
14725 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14726 [ALC660VD_3ST] = "3stack-660",
14727 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14728 [ALC660VD_ASUS_V1S] = "asus-v1s",
14729 [ALC861VD_3ST] = "3stack",
14730 [ALC861VD_3ST_DIG] = "3stack-digout",
14731 [ALC861VD_6ST_DIG] = "6stack-digout",
14732 [ALC861VD_LENOVO] = "lenovo",
14733 [ALC861VD_DALLAS] = "dallas",
14734 [ALC861VD_HP] = "hp",
14735 [ALC861VD_AUTO] = "auto",
14738 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14739 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14740 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14741 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14742 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14743 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14744 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14745 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14746 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14747 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14748 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14749 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14750 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14751 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14752 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14753 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14757 static struct alc_config_preset alc861vd_presets[] = {
14759 .mixers = { alc861vd_3st_mixer },
14760 .init_verbs = { alc861vd_volume_init_verbs,
14761 alc861vd_3stack_init_verbs },
14762 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14763 .dac_nids = alc660vd_dac_nids,
14764 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14765 .channel_mode = alc861vd_3stack_2ch_modes,
14766 .input_mux = &alc861vd_capture_source,
14768 [ALC660VD_3ST_DIG] = {
14769 .mixers = { alc861vd_3st_mixer },
14770 .init_verbs = { alc861vd_volume_init_verbs,
14771 alc861vd_3stack_init_verbs },
14772 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14773 .dac_nids = alc660vd_dac_nids,
14774 .dig_out_nid = ALC861VD_DIGOUT_NID,
14775 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14776 .channel_mode = alc861vd_3stack_2ch_modes,
14777 .input_mux = &alc861vd_capture_source,
14780 .mixers = { alc861vd_3st_mixer },
14781 .init_verbs = { alc861vd_volume_init_verbs,
14782 alc861vd_3stack_init_verbs },
14783 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14784 .dac_nids = alc861vd_dac_nids,
14785 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14786 .channel_mode = alc861vd_3stack_2ch_modes,
14787 .input_mux = &alc861vd_capture_source,
14789 [ALC861VD_3ST_DIG] = {
14790 .mixers = { alc861vd_3st_mixer },
14791 .init_verbs = { alc861vd_volume_init_verbs,
14792 alc861vd_3stack_init_verbs },
14793 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14794 .dac_nids = alc861vd_dac_nids,
14795 .dig_out_nid = ALC861VD_DIGOUT_NID,
14796 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14797 .channel_mode = alc861vd_3stack_2ch_modes,
14798 .input_mux = &alc861vd_capture_source,
14800 [ALC861VD_6ST_DIG] = {
14801 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14802 .init_verbs = { alc861vd_volume_init_verbs,
14803 alc861vd_6stack_init_verbs },
14804 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14805 .dac_nids = alc861vd_dac_nids,
14806 .dig_out_nid = ALC861VD_DIGOUT_NID,
14807 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14808 .channel_mode = alc861vd_6stack_modes,
14809 .input_mux = &alc861vd_capture_source,
14811 [ALC861VD_LENOVO] = {
14812 .mixers = { alc861vd_lenovo_mixer },
14813 .init_verbs = { alc861vd_volume_init_verbs,
14814 alc861vd_3stack_init_verbs,
14815 alc861vd_eapd_verbs,
14816 alc861vd_lenovo_unsol_verbs },
14817 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14818 .dac_nids = alc660vd_dac_nids,
14819 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14820 .channel_mode = alc861vd_3stack_2ch_modes,
14821 .input_mux = &alc861vd_capture_source,
14822 .unsol_event = alc861vd_lenovo_unsol_event,
14823 .init_hook = alc861vd_lenovo_automute,
14825 [ALC861VD_DALLAS] = {
14826 .mixers = { alc861vd_dallas_mixer },
14827 .init_verbs = { alc861vd_dallas_verbs },
14828 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14829 .dac_nids = alc861vd_dac_nids,
14830 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14831 .channel_mode = alc861vd_3stack_2ch_modes,
14832 .input_mux = &alc861vd_dallas_capture_source,
14833 .unsol_event = alc861vd_dallas_unsol_event,
14834 .init_hook = alc861vd_dallas_automute,
14837 .mixers = { alc861vd_hp_mixer },
14838 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14839 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14840 .dac_nids = alc861vd_dac_nids,
14841 .dig_out_nid = ALC861VD_DIGOUT_NID,
14842 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14843 .channel_mode = alc861vd_3stack_2ch_modes,
14844 .input_mux = &alc861vd_hp_capture_source,
14845 .unsol_event = alc861vd_dallas_unsol_event,
14846 .init_hook = alc861vd_dallas_automute,
14848 [ALC660VD_ASUS_V1S] = {
14849 .mixers = { alc861vd_lenovo_mixer },
14850 .init_verbs = { alc861vd_volume_init_verbs,
14851 alc861vd_3stack_init_verbs,
14852 alc861vd_eapd_verbs,
14853 alc861vd_lenovo_unsol_verbs },
14854 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14855 .dac_nids = alc660vd_dac_nids,
14856 .dig_out_nid = ALC861VD_DIGOUT_NID,
14857 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14858 .channel_mode = alc861vd_3stack_2ch_modes,
14859 .input_mux = &alc861vd_capture_source,
14860 .unsol_event = alc861vd_lenovo_unsol_event,
14861 .init_hook = alc861vd_lenovo_automute,
14866 * BIOS auto configuration
14868 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14869 hda_nid_t nid, int pin_type, int dac_idx)
14871 alc_set_pin_output(codec, nid, pin_type);
14874 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14876 struct alc_spec *spec = codec->spec;
14879 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14880 for (i = 0; i <= HDA_SIDE; i++) {
14881 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14882 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14884 alc861vd_auto_set_output_and_unmute(codec, nid,
14890 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14892 struct alc_spec *spec = codec->spec;
14895 pin = spec->autocfg.hp_pins[0];
14896 if (pin) /* connect to front and use dac 0 */
14897 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14898 pin = spec->autocfg.speaker_pins[0];
14900 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14903 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14904 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14906 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14908 struct alc_spec *spec = codec->spec;
14911 for (i = 0; i < AUTO_PIN_LAST; i++) {
14912 hda_nid_t nid = spec->autocfg.input_pins[i];
14913 if (alc861vd_is_input_pin(nid)) {
14914 alc_set_input_pin(codec, nid, i);
14915 if (nid != ALC861VD_PIN_CD_NID &&
14916 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14917 snd_hda_codec_write(codec, nid, 0,
14918 AC_VERB_SET_AMP_GAIN_MUTE,
14924 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14926 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14927 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14929 /* add playback controls from the parsed DAC table */
14930 /* Based on ALC880 version. But ALC861VD has separate,
14931 * different NIDs for mute/unmute switch and volume control */
14932 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14933 const struct auto_pin_cfg *cfg)
14936 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14937 hda_nid_t nid_v, nid_s;
14940 for (i = 0; i < cfg->line_outs; i++) {
14941 if (!spec->multiout.dac_nids[i])
14943 nid_v = alc861vd_idx_to_mixer_vol(
14945 spec->multiout.dac_nids[i]));
14946 nid_s = alc861vd_idx_to_mixer_switch(
14948 spec->multiout.dac_nids[i]));
14952 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14953 "Center Playback Volume",
14954 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14958 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14959 "LFE Playback Volume",
14960 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14964 err = add_control(spec, ALC_CTL_BIND_MUTE,
14965 "Center Playback Switch",
14966 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14970 err = add_control(spec, ALC_CTL_BIND_MUTE,
14971 "LFE Playback Switch",
14972 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14977 sprintf(name, "%s Playback Volume", chname[i]);
14978 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14979 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14983 sprintf(name, "%s Playback Switch", chname[i]);
14984 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14985 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14994 /* add playback controls for speaker and HP outputs */
14995 /* Based on ALC880 version. But ALC861VD has separate,
14996 * different NIDs for mute/unmute switch and volume control */
14997 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14998 hda_nid_t pin, const char *pfx)
15000 hda_nid_t nid_v, nid_s;
15007 if (alc880_is_fixed_pin(pin)) {
15008 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15009 /* specify the DAC as the extra output */
15010 if (!spec->multiout.hp_nid)
15011 spec->multiout.hp_nid = nid_v;
15013 spec->multiout.extra_out_nid[0] = nid_v;
15014 /* control HP volume/switch on the output mixer amp */
15015 nid_v = alc861vd_idx_to_mixer_vol(
15016 alc880_fixed_pin_idx(pin));
15017 nid_s = alc861vd_idx_to_mixer_switch(
15018 alc880_fixed_pin_idx(pin));
15020 sprintf(name, "%s Playback Volume", pfx);
15021 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15022 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15025 sprintf(name, "%s Playback Switch", pfx);
15026 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15027 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15030 } else if (alc880_is_multi_pin(pin)) {
15031 /* set manual connection */
15032 /* we have only a switch on HP-out PIN */
15033 sprintf(name, "%s Playback Switch", pfx);
15034 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15035 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15042 /* parse the BIOS configuration and set up the alc_spec
15043 * return 1 if successful, 0 if the proper config is not found,
15044 * or a negative error code
15045 * Based on ALC880 version - had to change it to override
15046 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15047 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15049 struct alc_spec *spec = codec->spec;
15051 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15053 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15057 if (!spec->autocfg.line_outs)
15058 return 0; /* can't find valid BIOS pin config */
15060 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15063 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15066 err = alc861vd_auto_create_extra_out(spec,
15067 spec->autocfg.speaker_pins[0],
15071 err = alc861vd_auto_create_extra_out(spec,
15072 spec->autocfg.hp_pins[0],
15076 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15080 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15082 if (spec->autocfg.dig_outs)
15083 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15085 if (spec->kctls.list)
15086 add_mixer(spec, spec->kctls.list);
15088 add_verb(spec, alc861vd_volume_init_verbs);
15090 spec->num_mux_defs = 1;
15091 spec->input_mux = &spec->private_imux[0];
15093 err = alc_auto_add_mic_boost(codec);
15100 /* additional initialization for auto-configuration model */
15101 static void alc861vd_auto_init(struct hda_codec *codec)
15103 struct alc_spec *spec = codec->spec;
15104 alc861vd_auto_init_multi_out(codec);
15105 alc861vd_auto_init_hp_out(codec);
15106 alc861vd_auto_init_analog_input(codec);
15107 alc861vd_auto_init_input_src(codec);
15108 if (spec->unsol_event)
15109 alc_inithook(codec);
15112 static int patch_alc861vd(struct hda_codec *codec)
15114 struct alc_spec *spec;
15115 int err, board_config;
15117 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15121 codec->spec = spec;
15123 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15127 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15128 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
15129 "ALC861VD, trying auto-probe from BIOS...\n");
15130 board_config = ALC861VD_AUTO;
15133 if (board_config == ALC861VD_AUTO) {
15134 /* automatic parse from the BIOS config */
15135 err = alc861vd_parse_auto_config(codec);
15141 "hda_codec: Cannot set up configuration "
15142 "from BIOS. Using base mode...\n");
15143 board_config = ALC861VD_3ST;
15147 err = snd_hda_attach_beep_device(codec, 0x23);
15153 if (board_config != ALC861VD_AUTO)
15154 setup_preset(spec, &alc861vd_presets[board_config]);
15156 if (codec->vendor_id == 0x10ec0660) {
15157 spec->stream_name_analog = "ALC660-VD Analog";
15158 spec->stream_name_digital = "ALC660-VD Digital";
15159 /* always turn on EAPD */
15160 add_verb(spec, alc660vd_eapd_verbs);
15162 spec->stream_name_analog = "ALC861VD Analog";
15163 spec->stream_name_digital = "ALC861VD Digital";
15166 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15167 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15169 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15170 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15172 spec->adc_nids = alc861vd_adc_nids;
15173 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15174 spec->capsrc_nids = alc861vd_capsrc_nids;
15175 spec->capture_style = CAPT_MIX;
15177 set_capture_mixer(spec);
15178 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15180 spec->vmaster_nid = 0x02;
15182 codec->patch_ops = alc_patch_ops;
15184 if (board_config == ALC861VD_AUTO)
15185 spec->init_hook = alc861vd_auto_init;
15186 #ifdef CONFIG_SND_HDA_POWER_SAVE
15187 if (!spec->loopback.amplist)
15188 spec->loopback.amplist = alc861vd_loopbacks;
15190 codec->proc_widget_hook = print_realtek_coef;
15198 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15199 * configuration. Each pin widget can choose any input DACs and a mixer.
15200 * Each ADC is connected from a mixer of all inputs. This makes possible
15201 * 6-channel independent captures.
15203 * In addition, an independent DAC for the multi-playback (not used in this
15206 #define ALC662_DIGOUT_NID 0x06
15207 #define ALC662_DIGIN_NID 0x0a
15209 static hda_nid_t alc662_dac_nids[4] = {
15210 /* front, rear, clfe, rear_surr */
15214 static hda_nid_t alc662_adc_nids[1] = {
15219 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15222 /* FIXME: should be a matrix-type input source selection */
15223 static struct hda_input_mux alc662_capture_source = {
15227 { "Front Mic", 0x1 },
15233 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15241 static struct hda_input_mux alc662_eeepc_capture_source = {
15249 static struct hda_input_mux alc663_capture_source = {
15253 { "Front Mic", 0x1 },
15258 static struct hda_input_mux alc663_m51va_capture_source = {
15261 { "Ext-Mic", 0x0 },
15269 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15276 static struct hda_verb alc662_3ST_ch2_init[] = {
15277 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15278 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15279 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15280 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15287 static struct hda_verb alc662_3ST_ch6_init[] = {
15288 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15289 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15290 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15291 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15292 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15293 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15297 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15298 { 2, alc662_3ST_ch2_init },
15299 { 6, alc662_3ST_ch6_init },
15305 static struct hda_verb alc662_sixstack_ch6_init[] = {
15306 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15307 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15308 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15315 static struct hda_verb alc662_sixstack_ch8_init[] = {
15316 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15317 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15318 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15322 static struct hda_channel_mode alc662_5stack_modes[2] = {
15323 { 2, alc662_sixstack_ch6_init },
15324 { 6, alc662_sixstack_ch8_init },
15327 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15328 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15331 static struct snd_kcontrol_new alc662_base_mixer[] = {
15332 /* output mixer control */
15333 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15334 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15335 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15336 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15337 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15338 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15339 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15340 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15343 /*Input mixer control */
15344 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15345 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15346 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15347 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15348 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15349 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15350 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15351 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15355 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15356 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15357 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15358 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15359 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15360 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15361 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15362 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15365 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15366 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15370 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15371 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15372 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15373 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15374 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15375 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15376 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15377 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15378 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15379 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15380 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15381 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15385 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15386 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15387 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15391 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15392 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15393 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15394 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15395 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15396 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15397 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15398 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15404 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15405 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15407 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15408 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15410 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15411 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15412 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15414 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15415 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15416 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15420 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15421 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15422 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15423 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15424 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15425 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15426 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15427 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15428 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15429 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15430 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15438 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15439 .ops = &snd_hda_bind_vol,
15441 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15442 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15447 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15448 .ops = &snd_hda_bind_sw,
15450 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15451 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15456 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15457 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15458 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15464 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15465 .ops = &snd_hda_bind_sw,
15467 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15468 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15469 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15474 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15475 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15476 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15477 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15478 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15479 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15480 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15485 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15486 .ops = &snd_hda_bind_sw,
15488 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15489 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15490 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15495 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15496 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15497 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15499 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15500 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15501 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15505 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15506 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15507 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15511 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15512 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15516 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15517 .ops = &snd_hda_bind_vol,
15519 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15520 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15525 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15526 .ops = &snd_hda_bind_sw,
15528 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15529 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15534 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15535 HDA_BIND_VOL("Master Playback Volume",
15536 &alc663_asus_two_bind_master_vol),
15537 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15538 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15539 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15545 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15546 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15547 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15548 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15549 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15555 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15556 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15557 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15558 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15559 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15563 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15564 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15565 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15569 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15570 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15571 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15575 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15576 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15577 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15578 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15579 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15583 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15585 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15586 .name = "Channel Mode",
15587 .info = alc_ch_mode_info,
15588 .get = alc_ch_mode_get,
15589 .put = alc_ch_mode_put,
15594 static struct hda_verb alc662_init_verbs[] = {
15595 /* ADC: mute amp left and right */
15596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15597 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15598 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15601 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15608 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15610 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15611 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15613 /* Front Pin: output 0 (0x0c) */
15614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15615 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15617 /* Rear Pin: output 1 (0x0d) */
15618 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15619 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15621 /* CLFE Pin: output 2 (0x0e) */
15622 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15623 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15625 /* Mic (rear) pin: input vref at 80% */
15626 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15627 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15628 /* Front Mic pin: input vref at 80% */
15629 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15630 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15631 /* Line In pin: input */
15632 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15633 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15634 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15635 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15636 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15637 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15638 /* CD pin widget for input */
15639 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15641 /* FIXME: use matrix-type input source selection */
15642 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15645 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15654 /* always trun on EAPD */
15655 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15656 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15661 static struct hda_verb alc662_sue_init_verbs[] = {
15662 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15663 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15667 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15668 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15669 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15673 /* Set Unsolicited Event*/
15674 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15675 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15676 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15681 * generic initialization of ADC, input mixers and output mixers
15683 static struct hda_verb alc662_auto_init_verbs[] = {
15685 * Unmute ADC and set the default input to mic-in
15687 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15688 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15690 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15692 * Note: PASD motherboards uses the Line In 2 as the input for front
15693 * panel mic (mic 2)
15695 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15703 * Set up output mixers (0x0c - 0x0f)
15705 /* set vol=0 to output mixers */
15706 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15707 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15708 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15710 /* set up input amps for analog loopback */
15711 /* Amp Indices: DAC = 0, mixer = 1 */
15712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15713 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15714 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15715 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15717 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15720 /* FIXME: use matrix-type input source selection */
15721 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15723 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15724 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15728 /* additional verbs for ALC663 */
15729 static struct hda_verb alc663_auto_init_verbs[] = {
15730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15731 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15735 static struct hda_verb alc663_m51va_init_verbs[] = {
15736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15738 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15739 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15740 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15742 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15743 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15744 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15748 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15749 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15750 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15751 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15752 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15753 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15754 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15755 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15759 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15760 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15761 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15762 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15763 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15766 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15767 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15771 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15772 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15774 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15777 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15778 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15782 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15783 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15784 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15785 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15786 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15789 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15791 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15792 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15793 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15794 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15798 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15799 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15800 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15801 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15802 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15805 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15806 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15807 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15808 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15809 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15810 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15814 static struct hda_verb alc663_g71v_init_verbs[] = {
15815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15816 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15817 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15819 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15820 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15821 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15823 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15824 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15825 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15829 static struct hda_verb alc663_g50v_init_verbs[] = {
15830 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15831 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15832 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15834 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15835 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15839 static struct hda_verb alc662_ecs_init_verbs[] = {
15840 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15842 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15843 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15847 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15848 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15849 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15853 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15855 unsigned int present;
15856 unsigned char bits;
15858 present = snd_hda_codec_read(codec, 0x14, 0,
15859 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15860 bits = present ? HDA_AMP_MUTE : 0;
15861 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15862 HDA_AMP_MUTE, bits);
15865 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15867 unsigned int present;
15868 unsigned char bits;
15870 present = snd_hda_codec_read(codec, 0x1b, 0,
15871 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15872 bits = present ? HDA_AMP_MUTE : 0;
15873 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15874 HDA_AMP_MUTE, bits);
15875 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15876 HDA_AMP_MUTE, bits);
15879 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15882 if ((res >> 26) == ALC880_HP_EVENT)
15883 alc662_lenovo_101e_all_automute(codec);
15884 if ((res >> 26) == ALC880_FRONT_EVENT)
15885 alc662_lenovo_101e_ispeaker_automute(codec);
15888 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15890 unsigned int present;
15892 present = snd_hda_codec_read(codec, 0x18, 0,
15893 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15894 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15895 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15896 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15897 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15898 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15899 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15900 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15901 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15904 /* unsolicited event for HP jack sensing */
15905 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15908 if ((res >> 26) == ALC880_HP_EVENT)
15909 alc262_hippo1_automute( codec );
15911 if ((res >> 26) == ALC880_MIC_EVENT)
15912 alc662_eeepc_mic_automute(codec);
15915 static void alc662_eeepc_inithook(struct hda_codec *codec)
15917 alc262_hippo1_automute( codec );
15918 alc662_eeepc_mic_automute(codec);
15921 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15924 unsigned int present;
15926 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15927 present = snd_hda_codec_read(codec, 0x14, 0,
15928 AC_VERB_GET_PIN_SENSE, 0);
15929 present = (present & 0x80000000) != 0;
15931 /* mute internal speaker */
15932 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15933 HDA_AMP_MUTE, HDA_AMP_MUTE);
15935 /* unmute internal speaker if necessary */
15936 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15937 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15938 HDA_AMP_MUTE, mute);
15942 /* unsolicited event for HP jack sensing */
15943 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15946 if ((res >> 26) == ALC880_HP_EVENT)
15947 alc662_eeepc_ep20_automute(codec);
15950 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15952 alc662_eeepc_ep20_automute(codec);
15955 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15957 unsigned int present;
15958 unsigned char bits;
15960 present = snd_hda_codec_read(codec, 0x21, 0,
15961 AC_VERB_GET_PIN_SENSE, 0)
15962 & AC_PINSENSE_PRESENCE;
15963 bits = present ? HDA_AMP_MUTE : 0;
15964 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15965 AMP_IN_MUTE(0), bits);
15966 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15967 AMP_IN_MUTE(0), bits);
15970 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15972 unsigned int present;
15973 unsigned char bits;
15975 present = snd_hda_codec_read(codec, 0x21, 0,
15976 AC_VERB_GET_PIN_SENSE, 0)
15977 & AC_PINSENSE_PRESENCE;
15978 bits = present ? HDA_AMP_MUTE : 0;
15979 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15980 AMP_IN_MUTE(0), bits);
15981 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15982 AMP_IN_MUTE(0), bits);
15983 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15984 AMP_IN_MUTE(0), bits);
15985 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15986 AMP_IN_MUTE(0), bits);
15989 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15991 unsigned int present;
15992 unsigned char bits;
15994 present = snd_hda_codec_read(codec, 0x15, 0,
15995 AC_VERB_GET_PIN_SENSE, 0)
15996 & AC_PINSENSE_PRESENCE;
15997 bits = present ? HDA_AMP_MUTE : 0;
15998 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15999 AMP_IN_MUTE(0), bits);
16000 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16001 AMP_IN_MUTE(0), bits);
16002 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16003 AMP_IN_MUTE(0), bits);
16004 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16005 AMP_IN_MUTE(0), bits);
16008 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16010 unsigned int present;
16011 unsigned char bits;
16013 present = snd_hda_codec_read(codec, 0x1b, 0,
16014 AC_VERB_GET_PIN_SENSE, 0)
16015 & AC_PINSENSE_PRESENCE;
16016 bits = present ? 0 : PIN_OUT;
16017 snd_hda_codec_write(codec, 0x14, 0,
16018 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16021 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16023 unsigned int present1, present2;
16025 present1 = snd_hda_codec_read(codec, 0x21, 0,
16026 AC_VERB_GET_PIN_SENSE, 0)
16027 & AC_PINSENSE_PRESENCE;
16028 present2 = snd_hda_codec_read(codec, 0x15, 0,
16029 AC_VERB_GET_PIN_SENSE, 0)
16030 & AC_PINSENSE_PRESENCE;
16032 if (present1 || present2) {
16033 snd_hda_codec_write_cache(codec, 0x14, 0,
16034 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16036 snd_hda_codec_write_cache(codec, 0x14, 0,
16037 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16041 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16043 unsigned int present1, present2;
16045 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16046 AC_VERB_GET_PIN_SENSE, 0)
16047 & AC_PINSENSE_PRESENCE;
16048 present2 = snd_hda_codec_read(codec, 0x15, 0,
16049 AC_VERB_GET_PIN_SENSE, 0)
16050 & AC_PINSENSE_PRESENCE;
16052 if (present1 || present2) {
16053 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16054 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16055 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16056 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16058 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16059 AMP_IN_MUTE(0), 0);
16060 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16061 AMP_IN_MUTE(0), 0);
16065 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16067 unsigned int present;
16069 present = snd_hda_codec_read(codec, 0x18, 0,
16070 AC_VERB_GET_PIN_SENSE, 0)
16071 & AC_PINSENSE_PRESENCE;
16072 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16073 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16074 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16075 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16076 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16077 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16078 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16079 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16082 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16085 switch (res >> 26) {
16086 case ALC880_HP_EVENT:
16087 alc663_m51va_speaker_automute(codec);
16089 case ALC880_MIC_EVENT:
16090 alc663_m51va_mic_automute(codec);
16095 static void alc663_m51va_inithook(struct hda_codec *codec)
16097 alc663_m51va_speaker_automute(codec);
16098 alc663_m51va_mic_automute(codec);
16101 /* ***************** Mode1 ******************************/
16102 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16105 switch (res >> 26) {
16106 case ALC880_HP_EVENT:
16107 alc663_m51va_speaker_automute(codec);
16109 case ALC880_MIC_EVENT:
16110 alc662_eeepc_mic_automute(codec);
16115 static void alc663_mode1_inithook(struct hda_codec *codec)
16117 alc663_m51va_speaker_automute(codec);
16118 alc662_eeepc_mic_automute(codec);
16120 /* ***************** Mode2 ******************************/
16121 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16124 switch (res >> 26) {
16125 case ALC880_HP_EVENT:
16126 alc662_f5z_speaker_automute(codec);
16128 case ALC880_MIC_EVENT:
16129 alc662_eeepc_mic_automute(codec);
16134 static void alc662_mode2_inithook(struct hda_codec *codec)
16136 alc662_f5z_speaker_automute(codec);
16137 alc662_eeepc_mic_automute(codec);
16139 /* ***************** Mode3 ******************************/
16140 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16143 switch (res >> 26) {
16144 case ALC880_HP_EVENT:
16145 alc663_two_hp_m1_speaker_automute(codec);
16147 case ALC880_MIC_EVENT:
16148 alc662_eeepc_mic_automute(codec);
16153 static void alc663_mode3_inithook(struct hda_codec *codec)
16155 alc663_two_hp_m1_speaker_automute(codec);
16156 alc662_eeepc_mic_automute(codec);
16158 /* ***************** Mode4 ******************************/
16159 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16162 switch (res >> 26) {
16163 case ALC880_HP_EVENT:
16164 alc663_21jd_two_speaker_automute(codec);
16166 case ALC880_MIC_EVENT:
16167 alc662_eeepc_mic_automute(codec);
16172 static void alc663_mode4_inithook(struct hda_codec *codec)
16174 alc663_21jd_two_speaker_automute(codec);
16175 alc662_eeepc_mic_automute(codec);
16177 /* ***************** Mode5 ******************************/
16178 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16181 switch (res >> 26) {
16182 case ALC880_HP_EVENT:
16183 alc663_15jd_two_speaker_automute(codec);
16185 case ALC880_MIC_EVENT:
16186 alc662_eeepc_mic_automute(codec);
16191 static void alc663_mode5_inithook(struct hda_codec *codec)
16193 alc663_15jd_two_speaker_automute(codec);
16194 alc662_eeepc_mic_automute(codec);
16196 /* ***************** Mode6 ******************************/
16197 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16200 switch (res >> 26) {
16201 case ALC880_HP_EVENT:
16202 alc663_two_hp_m2_speaker_automute(codec);
16204 case ALC880_MIC_EVENT:
16205 alc662_eeepc_mic_automute(codec);
16210 static void alc663_mode6_inithook(struct hda_codec *codec)
16212 alc663_two_hp_m2_speaker_automute(codec);
16213 alc662_eeepc_mic_automute(codec);
16216 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16218 unsigned int present;
16219 unsigned char bits;
16221 present = snd_hda_codec_read(codec, 0x21, 0,
16222 AC_VERB_GET_PIN_SENSE, 0)
16223 & AC_PINSENSE_PRESENCE;
16224 bits = present ? HDA_AMP_MUTE : 0;
16225 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16226 HDA_AMP_MUTE, bits);
16227 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16228 HDA_AMP_MUTE, bits);
16231 static void alc663_g71v_front_automute(struct hda_codec *codec)
16233 unsigned int present;
16234 unsigned char bits;
16236 present = snd_hda_codec_read(codec, 0x15, 0,
16237 AC_VERB_GET_PIN_SENSE, 0)
16238 & AC_PINSENSE_PRESENCE;
16239 bits = present ? HDA_AMP_MUTE : 0;
16240 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16241 HDA_AMP_MUTE, bits);
16244 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16247 switch (res >> 26) {
16248 case ALC880_HP_EVENT:
16249 alc663_g71v_hp_automute(codec);
16251 case ALC880_FRONT_EVENT:
16252 alc663_g71v_front_automute(codec);
16254 case ALC880_MIC_EVENT:
16255 alc662_eeepc_mic_automute(codec);
16260 static void alc663_g71v_inithook(struct hda_codec *codec)
16262 alc663_g71v_front_automute(codec);
16263 alc663_g71v_hp_automute(codec);
16264 alc662_eeepc_mic_automute(codec);
16267 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16270 switch (res >> 26) {
16271 case ALC880_HP_EVENT:
16272 alc663_m51va_speaker_automute(codec);
16274 case ALC880_MIC_EVENT:
16275 alc662_eeepc_mic_automute(codec);
16280 static void alc663_g50v_inithook(struct hda_codec *codec)
16282 alc663_m51va_speaker_automute(codec);
16283 alc662_eeepc_mic_automute(codec);
16286 /* bind hp and internal speaker mute (with plug check) */
16287 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16288 struct snd_ctl_elem_value *ucontrol)
16290 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16291 long *valp = ucontrol->value.integer.value;
16294 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16296 valp[0] ? 0 : HDA_AMP_MUTE);
16297 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16299 valp[1] ? 0 : HDA_AMP_MUTE);
16301 alc262_hippo1_automute(codec);
16305 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16306 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16308 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16309 .name = "Master Playback Switch",
16310 .info = snd_hda_mixer_amp_switch_info,
16311 .get = snd_hda_mixer_amp_switch_get,
16312 .put = alc662_ecs_master_sw_put,
16313 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16316 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16317 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16318 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16320 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16321 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16322 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16326 #ifdef CONFIG_SND_HDA_POWER_SAVE
16327 #define alc662_loopbacks alc880_loopbacks
16331 /* pcm configuration: identiacal with ALC880 */
16332 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16333 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16334 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16335 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16338 * configuration and preset
16340 static const char *alc662_models[ALC662_MODEL_LAST] = {
16341 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16342 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16343 [ALC662_3ST_6ch] = "3stack-6ch",
16344 [ALC662_5ST_DIG] = "6stack-dig",
16345 [ALC662_LENOVO_101E] = "lenovo-101e",
16346 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16347 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16348 [ALC662_ECS] = "ecs",
16349 [ALC663_ASUS_M51VA] = "m51va",
16350 [ALC663_ASUS_G71V] = "g71v",
16351 [ALC663_ASUS_H13] = "h13",
16352 [ALC663_ASUS_G50V] = "g50v",
16353 [ALC663_ASUS_MODE1] = "asus-mode1",
16354 [ALC662_ASUS_MODE2] = "asus-mode2",
16355 [ALC663_ASUS_MODE3] = "asus-mode3",
16356 [ALC663_ASUS_MODE4] = "asus-mode4",
16357 [ALC663_ASUS_MODE5] = "asus-mode5",
16358 [ALC663_ASUS_MODE6] = "asus-mode6",
16359 [ALC662_AUTO] = "auto",
16362 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16363 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16364 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16365 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16366 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16367 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16368 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16369 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16370 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16371 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16372 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16373 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16374 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16375 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16376 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16377 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16378 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16379 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16380 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16381 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16382 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16383 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16384 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16385 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16386 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16387 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16388 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16389 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16390 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16391 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16392 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16393 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16394 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16395 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16396 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16397 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16398 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16399 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16400 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16401 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16402 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16403 ALC662_3ST_6ch_DIG),
16404 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16405 ALC662_3ST_6ch_DIG),
16406 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16407 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16408 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16409 ALC662_3ST_6ch_DIG),
16410 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16415 static struct alc_config_preset alc662_presets[] = {
16416 [ALC662_3ST_2ch_DIG] = {
16417 .mixers = { alc662_3ST_2ch_mixer },
16418 .init_verbs = { alc662_init_verbs },
16419 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16420 .dac_nids = alc662_dac_nids,
16421 .dig_out_nid = ALC662_DIGOUT_NID,
16422 .dig_in_nid = ALC662_DIGIN_NID,
16423 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16424 .channel_mode = alc662_3ST_2ch_modes,
16425 .input_mux = &alc662_capture_source,
16427 [ALC662_3ST_6ch_DIG] = {
16428 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16429 .init_verbs = { alc662_init_verbs },
16430 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16431 .dac_nids = alc662_dac_nids,
16432 .dig_out_nid = ALC662_DIGOUT_NID,
16433 .dig_in_nid = ALC662_DIGIN_NID,
16434 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16435 .channel_mode = alc662_3ST_6ch_modes,
16437 .input_mux = &alc662_capture_source,
16439 [ALC662_3ST_6ch] = {
16440 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16441 .init_verbs = { alc662_init_verbs },
16442 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16443 .dac_nids = alc662_dac_nids,
16444 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16445 .channel_mode = alc662_3ST_6ch_modes,
16447 .input_mux = &alc662_capture_source,
16449 [ALC662_5ST_DIG] = {
16450 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16451 .init_verbs = { alc662_init_verbs },
16452 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16453 .dac_nids = alc662_dac_nids,
16454 .dig_out_nid = ALC662_DIGOUT_NID,
16455 .dig_in_nid = ALC662_DIGIN_NID,
16456 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16457 .channel_mode = alc662_5stack_modes,
16458 .input_mux = &alc662_capture_source,
16460 [ALC662_LENOVO_101E] = {
16461 .mixers = { alc662_lenovo_101e_mixer },
16462 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16463 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16464 .dac_nids = alc662_dac_nids,
16465 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16466 .channel_mode = alc662_3ST_2ch_modes,
16467 .input_mux = &alc662_lenovo_101e_capture_source,
16468 .unsol_event = alc662_lenovo_101e_unsol_event,
16469 .init_hook = alc662_lenovo_101e_all_automute,
16471 [ALC662_ASUS_EEEPC_P701] = {
16472 .mixers = { alc662_eeepc_p701_mixer },
16473 .init_verbs = { alc662_init_verbs,
16474 alc662_eeepc_sue_init_verbs },
16475 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16476 .dac_nids = alc662_dac_nids,
16477 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16478 .channel_mode = alc662_3ST_2ch_modes,
16479 .input_mux = &alc662_eeepc_capture_source,
16480 .unsol_event = alc662_eeepc_unsol_event,
16481 .init_hook = alc662_eeepc_inithook,
16483 [ALC662_ASUS_EEEPC_EP20] = {
16484 .mixers = { alc662_eeepc_ep20_mixer,
16485 alc662_chmode_mixer },
16486 .init_verbs = { alc662_init_verbs,
16487 alc662_eeepc_ep20_sue_init_verbs },
16488 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16489 .dac_nids = alc662_dac_nids,
16490 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16491 .channel_mode = alc662_3ST_6ch_modes,
16492 .input_mux = &alc662_lenovo_101e_capture_source,
16493 .unsol_event = alc662_eeepc_ep20_unsol_event,
16494 .init_hook = alc662_eeepc_ep20_inithook,
16497 .mixers = { alc662_ecs_mixer },
16498 .init_verbs = { alc662_init_verbs,
16499 alc662_ecs_init_verbs },
16500 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16501 .dac_nids = alc662_dac_nids,
16502 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16503 .channel_mode = alc662_3ST_2ch_modes,
16504 .input_mux = &alc662_eeepc_capture_source,
16505 .unsol_event = alc662_eeepc_unsol_event,
16506 .init_hook = alc662_eeepc_inithook,
16508 [ALC663_ASUS_M51VA] = {
16509 .mixers = { alc663_m51va_mixer },
16510 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16511 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16512 .dac_nids = alc662_dac_nids,
16513 .dig_out_nid = ALC662_DIGOUT_NID,
16514 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16515 .channel_mode = alc662_3ST_2ch_modes,
16516 .input_mux = &alc663_m51va_capture_source,
16517 .unsol_event = alc663_m51va_unsol_event,
16518 .init_hook = alc663_m51va_inithook,
16520 [ALC663_ASUS_G71V] = {
16521 .mixers = { alc663_g71v_mixer },
16522 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16523 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16524 .dac_nids = alc662_dac_nids,
16525 .dig_out_nid = ALC662_DIGOUT_NID,
16526 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16527 .channel_mode = alc662_3ST_2ch_modes,
16528 .input_mux = &alc662_eeepc_capture_source,
16529 .unsol_event = alc663_g71v_unsol_event,
16530 .init_hook = alc663_g71v_inithook,
16532 [ALC663_ASUS_H13] = {
16533 .mixers = { alc663_m51va_mixer },
16534 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16535 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16536 .dac_nids = alc662_dac_nids,
16537 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16538 .channel_mode = alc662_3ST_2ch_modes,
16539 .input_mux = &alc663_m51va_capture_source,
16540 .unsol_event = alc663_m51va_unsol_event,
16541 .init_hook = alc663_m51va_inithook,
16543 [ALC663_ASUS_G50V] = {
16544 .mixers = { alc663_g50v_mixer },
16545 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16546 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16547 .dac_nids = alc662_dac_nids,
16548 .dig_out_nid = ALC662_DIGOUT_NID,
16549 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16550 .channel_mode = alc662_3ST_6ch_modes,
16551 .input_mux = &alc663_capture_source,
16552 .unsol_event = alc663_g50v_unsol_event,
16553 .init_hook = alc663_g50v_inithook,
16555 [ALC663_ASUS_MODE1] = {
16556 .mixers = { alc663_m51va_mixer },
16557 .cap_mixer = alc662_auto_capture_mixer,
16558 .init_verbs = { alc662_init_verbs,
16559 alc663_21jd_amic_init_verbs },
16560 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16562 .dac_nids = alc662_dac_nids,
16563 .dig_out_nid = ALC662_DIGOUT_NID,
16564 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16565 .channel_mode = alc662_3ST_2ch_modes,
16566 .input_mux = &alc662_eeepc_capture_source,
16567 .unsol_event = alc663_mode1_unsol_event,
16568 .init_hook = alc663_mode1_inithook,
16570 [ALC662_ASUS_MODE2] = {
16571 .mixers = { alc662_1bjd_mixer },
16572 .cap_mixer = alc662_auto_capture_mixer,
16573 .init_verbs = { alc662_init_verbs,
16574 alc662_1bjd_amic_init_verbs },
16575 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16576 .dac_nids = alc662_dac_nids,
16577 .dig_out_nid = ALC662_DIGOUT_NID,
16578 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16579 .channel_mode = alc662_3ST_2ch_modes,
16580 .input_mux = &alc662_eeepc_capture_source,
16581 .unsol_event = alc662_mode2_unsol_event,
16582 .init_hook = alc662_mode2_inithook,
16584 [ALC663_ASUS_MODE3] = {
16585 .mixers = { alc663_two_hp_m1_mixer },
16586 .cap_mixer = alc662_auto_capture_mixer,
16587 .init_verbs = { alc662_init_verbs,
16588 alc663_two_hp_amic_m1_init_verbs },
16589 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16591 .dac_nids = alc662_dac_nids,
16592 .dig_out_nid = ALC662_DIGOUT_NID,
16593 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16594 .channel_mode = alc662_3ST_2ch_modes,
16595 .input_mux = &alc662_eeepc_capture_source,
16596 .unsol_event = alc663_mode3_unsol_event,
16597 .init_hook = alc663_mode3_inithook,
16599 [ALC663_ASUS_MODE4] = {
16600 .mixers = { alc663_asus_21jd_clfe_mixer },
16601 .cap_mixer = alc662_auto_capture_mixer,
16602 .init_verbs = { alc662_init_verbs,
16603 alc663_21jd_amic_init_verbs},
16604 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16606 .dac_nids = alc662_dac_nids,
16607 .dig_out_nid = ALC662_DIGOUT_NID,
16608 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16609 .channel_mode = alc662_3ST_2ch_modes,
16610 .input_mux = &alc662_eeepc_capture_source,
16611 .unsol_event = alc663_mode4_unsol_event,
16612 .init_hook = alc663_mode4_inithook,
16614 [ALC663_ASUS_MODE5] = {
16615 .mixers = { alc663_asus_15jd_clfe_mixer },
16616 .cap_mixer = alc662_auto_capture_mixer,
16617 .init_verbs = { alc662_init_verbs,
16618 alc663_15jd_amic_init_verbs },
16619 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16621 .dac_nids = alc662_dac_nids,
16622 .dig_out_nid = ALC662_DIGOUT_NID,
16623 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16624 .channel_mode = alc662_3ST_2ch_modes,
16625 .input_mux = &alc662_eeepc_capture_source,
16626 .unsol_event = alc663_mode5_unsol_event,
16627 .init_hook = alc663_mode5_inithook,
16629 [ALC663_ASUS_MODE6] = {
16630 .mixers = { alc663_two_hp_m2_mixer },
16631 .cap_mixer = alc662_auto_capture_mixer,
16632 .init_verbs = { alc662_init_verbs,
16633 alc663_two_hp_amic_m2_init_verbs },
16634 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16636 .dac_nids = alc662_dac_nids,
16637 .dig_out_nid = ALC662_DIGOUT_NID,
16638 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16639 .channel_mode = alc662_3ST_2ch_modes,
16640 .input_mux = &alc662_eeepc_capture_source,
16641 .unsol_event = alc663_mode6_unsol_event,
16642 .init_hook = alc663_mode6_inithook,
16648 * BIOS auto configuration
16651 /* add playback controls from the parsed DAC table */
16652 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16653 const struct auto_pin_cfg *cfg)
16656 static const char *chname[4] = {
16657 "Front", "Surround", NULL /*CLFE*/, "Side"
16662 for (i = 0; i < cfg->line_outs; i++) {
16663 if (!spec->multiout.dac_nids[i])
16665 nid = alc880_idx_to_dac(i);
16668 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16669 "Center Playback Volume",
16670 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16674 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16675 "LFE Playback Volume",
16676 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16680 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16681 "Center Playback Switch",
16682 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16686 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16687 "LFE Playback Switch",
16688 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16693 sprintf(name, "%s Playback Volume", chname[i]);
16694 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16695 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16699 sprintf(name, "%s Playback Switch", chname[i]);
16700 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16701 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16710 /* add playback controls for speaker and HP outputs */
16711 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16722 /* ALC663 has a mono output pin on 0x17 */
16723 sprintf(name, "%s Playback Switch", pfx);
16724 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16725 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16729 if (alc880_is_fixed_pin(pin)) {
16730 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16731 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16732 /* specify the DAC as the extra output */
16733 if (!spec->multiout.hp_nid)
16734 spec->multiout.hp_nid = nid;
16736 spec->multiout.extra_out_nid[0] = nid;
16737 /* control HP volume/switch on the output mixer amp */
16738 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16739 sprintf(name, "%s Playback Volume", pfx);
16740 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16741 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16744 sprintf(name, "%s Playback Switch", pfx);
16745 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16746 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16749 } else if (alc880_is_multi_pin(pin)) {
16750 /* set manual connection */
16751 /* we have only a switch on HP-out PIN */
16752 sprintf(name, "%s Playback Switch", pfx);
16753 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16754 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16761 /* return the index of the src widget from the connection list of the nid.
16762 * return -1 if not found
16764 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16767 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16770 conns = snd_hda_get_connections(codec, nid, conn_list,
16771 ARRAY_SIZE(conn_list));
16774 for (i = 0; i < conns; i++)
16775 if (conn_list[i] == src)
16780 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16782 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16783 return (pincap & AC_PINCAP_IN) != 0;
16786 /* create playback/capture controls for input pins */
16787 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16788 const struct auto_pin_cfg *cfg)
16790 struct alc_spec *spec = codec->spec;
16791 struct hda_input_mux *imux = &spec->private_imux[0];
16794 for (i = 0; i < AUTO_PIN_LAST; i++) {
16795 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16796 idx = alc662_input_pin_idx(codec, 0x0b,
16797 cfg->input_pins[i]);
16799 err = new_analog_input(spec, cfg->input_pins[i],
16800 auto_pin_cfg_labels[i],
16805 idx = alc662_input_pin_idx(codec, 0x22,
16806 cfg->input_pins[i]);
16808 imux->items[imux->num_items].label =
16809 auto_pin_cfg_labels[i];
16810 imux->items[imux->num_items].index = idx;
16818 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16819 hda_nid_t nid, int pin_type,
16822 alc_set_pin_output(codec, nid, pin_type);
16823 /* need the manual connection? */
16824 if (alc880_is_multi_pin(nid)) {
16825 struct alc_spec *spec = codec->spec;
16826 int idx = alc880_multi_pin_idx(nid);
16827 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16828 AC_VERB_SET_CONNECT_SEL,
16829 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16833 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16835 struct alc_spec *spec = codec->spec;
16838 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16839 for (i = 0; i <= HDA_SIDE; i++) {
16840 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16841 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16843 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16848 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16850 struct alc_spec *spec = codec->spec;
16853 pin = spec->autocfg.hp_pins[0];
16854 if (pin) /* connect to front */
16856 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16857 pin = spec->autocfg.speaker_pins[0];
16859 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16862 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16864 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16866 struct alc_spec *spec = codec->spec;
16869 for (i = 0; i < AUTO_PIN_LAST; i++) {
16870 hda_nid_t nid = spec->autocfg.input_pins[i];
16871 if (alc662_is_input_pin(codec, nid)) {
16872 alc_set_input_pin(codec, nid, i);
16873 if (nid != ALC662_PIN_CD_NID &&
16874 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16875 snd_hda_codec_write(codec, nid, 0,
16876 AC_VERB_SET_AMP_GAIN_MUTE,
16882 #define alc662_auto_init_input_src alc882_auto_init_input_src
16884 static int alc662_parse_auto_config(struct hda_codec *codec)
16886 struct alc_spec *spec = codec->spec;
16888 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16890 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16894 if (!spec->autocfg.line_outs)
16895 return 0; /* can't find valid BIOS pin config */
16897 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16900 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16903 err = alc662_auto_create_extra_out(spec,
16904 spec->autocfg.speaker_pins[0],
16908 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16912 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
16916 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16918 if (spec->autocfg.dig_outs)
16919 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16921 if (spec->kctls.list)
16922 add_mixer(spec, spec->kctls.list);
16924 spec->num_mux_defs = 1;
16925 spec->input_mux = &spec->private_imux[0];
16927 add_verb(spec, alc662_auto_init_verbs);
16928 if (codec->vendor_id == 0x10ec0663)
16929 add_verb(spec, alc663_auto_init_verbs);
16931 err = alc_auto_add_mic_boost(codec);
16938 /* additional initialization for auto-configuration model */
16939 static void alc662_auto_init(struct hda_codec *codec)
16941 struct alc_spec *spec = codec->spec;
16942 alc662_auto_init_multi_out(codec);
16943 alc662_auto_init_hp_out(codec);
16944 alc662_auto_init_analog_input(codec);
16945 alc662_auto_init_input_src(codec);
16946 if (spec->unsol_event)
16947 alc_inithook(codec);
16950 static int patch_alc662(struct hda_codec *codec)
16952 struct alc_spec *spec;
16953 int err, board_config;
16955 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16959 codec->spec = spec;
16961 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16963 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16966 if (board_config < 0) {
16967 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16968 "trying auto-probe from BIOS...\n");
16969 board_config = ALC662_AUTO;
16972 if (board_config == ALC662_AUTO) {
16973 /* automatic parse from the BIOS config */
16974 err = alc662_parse_auto_config(codec);
16980 "hda_codec: Cannot set up configuration "
16981 "from BIOS. Using base mode...\n");
16982 board_config = ALC662_3ST_2ch_DIG;
16986 err = snd_hda_attach_beep_device(codec, 0x1);
16992 if (board_config != ALC662_AUTO)
16993 setup_preset(spec, &alc662_presets[board_config]);
16995 if (codec->vendor_id == 0x10ec0663) {
16996 spec->stream_name_analog = "ALC663 Analog";
16997 spec->stream_name_digital = "ALC663 Digital";
16998 } else if (codec->vendor_id == 0x10ec0272) {
16999 spec->stream_name_analog = "ALC272 Analog";
17000 spec->stream_name_digital = "ALC272 Digital";
17002 spec->stream_name_analog = "ALC662 Analog";
17003 spec->stream_name_digital = "ALC662 Digital";
17006 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17007 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17009 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17010 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17012 spec->adc_nids = alc662_adc_nids;
17013 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17014 spec->capsrc_nids = alc662_capsrc_nids;
17015 spec->capture_style = CAPT_MIX;
17017 if (!spec->cap_mixer)
17018 set_capture_mixer(spec);
17019 if (codec->vendor_id == 0x10ec0662)
17020 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17022 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17024 spec->vmaster_nid = 0x02;
17026 codec->patch_ops = alc_patch_ops;
17027 if (board_config == ALC662_AUTO)
17028 spec->init_hook = alc662_auto_init;
17029 #ifdef CONFIG_SND_HDA_POWER_SAVE
17030 if (!spec->loopback.amplist)
17031 spec->loopback.amplist = alc662_loopbacks;
17033 codec->proc_widget_hook = print_realtek_coef;
17041 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17042 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17043 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17044 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17045 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17046 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17047 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17048 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17049 .patch = patch_alc861 },
17050 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17051 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17052 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17053 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17054 .patch = patch_alc883 },
17055 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17056 .patch = patch_alc662 },
17057 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17058 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17059 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17060 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17061 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17062 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17063 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17064 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17065 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17066 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17067 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17068 .patch = patch_alc883 },
17069 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17070 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17071 {} /* terminator */
17074 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17076 MODULE_LICENSE("GPL");
17077 MODULE_DESCRIPTION("Realtek HD-audio codec");
17079 static struct hda_codec_preset_list realtek_list = {
17080 .preset = snd_hda_preset_realtek,
17081 .owner = THIS_MODULE,
17084 static int __init patch_realtek_init(void)
17086 return snd_hda_add_codec_preset(&realtek_list);
17089 static void __exit patch_realtek_exit(void)
17091 snd_hda_delete_codec_preset(&realtek_list);
17094 module_init(patch_realtek_init)
17095 module_exit(patch_realtek_exit)