2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
81 #ifdef CONFIG_SND_DEBUG
85 ALC260_MODEL_LAST /* last tag */
95 ALC262_HP_BPC_D7000_WL,
96 ALC262_HP_BPC_D7000_WF,
109 ALC262_MODEL_LAST /* last tag */
119 ALC268_ACER_ASPIRE_ONE,
122 #ifdef CONFIG_SND_DEBUG
126 ALC268_MODEL_LAST /* last tag */
133 ALC269_ASUS_EEEPC_P703,
134 ALC269_ASUS_EEEPC_P901,
138 ALC269_MODEL_LAST /* last tag */
155 /* ALC861-VD models */
177 ALC662_ASUS_EEEPC_P701,
178 ALC662_ASUS_EEEPC_EP20,
217 ALC883_TARGA_2ch_DIG,
220 ALC888_ACER_ASPIRE_4930G,
224 ALC883_LENOVO_101E_2ch,
225 ALC883_LENOVO_NB0763,
226 ALC888_LENOVO_MS7195_DIG,
233 ALC883_FUJITSU_PI2515,
234 ALC888_FUJITSU_XA3530,
235 ALC883_3ST_6ch_INTEL,
243 /* styles of capture selection */
245 CAPT_MUX = 0, /* only mux based */
246 CAPT_MIX, /* only mixer based */
247 CAPT_1MUX_MIX, /* first mux and other mixers */
251 #define GPIO_MASK 0x03
254 /* codec parameterization */
255 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
256 unsigned int num_mixers;
257 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
258 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
260 const struct hda_verb *init_verbs[5]; /* initialization verbs
264 unsigned int num_init_verbs;
266 char *stream_name_analog; /* analog PCM stream */
267 struct hda_pcm_stream *stream_analog_playback;
268 struct hda_pcm_stream *stream_analog_capture;
269 struct hda_pcm_stream *stream_analog_alt_playback;
270 struct hda_pcm_stream *stream_analog_alt_capture;
272 char *stream_name_digital; /* digital PCM stream */
273 struct hda_pcm_stream *stream_digital_playback;
274 struct hda_pcm_stream *stream_digital_capture;
277 struct hda_multi_out multiout; /* playback set-up
278 * max_channels, dacs must be set
279 * dig_out_nid and hp_nid are optional
281 hda_nid_t alt_dac_nid;
282 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
286 unsigned int num_adc_nids;
288 hda_nid_t *capsrc_nids;
289 hda_nid_t dig_in_nid; /* digital-in NID; optional */
290 int capture_style; /* capture style (CAPT_*) */
293 unsigned int num_mux_defs;
294 const struct hda_input_mux *input_mux;
295 unsigned int cur_mux[3];
298 const struct hda_channel_mode *channel_mode;
299 int num_channel_mode;
302 /* PCM information */
303 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
305 /* dynamic controls, init_verbs and input_mux */
306 struct auto_pin_cfg autocfg;
307 struct snd_array kctls;
308 struct hda_input_mux private_imux[3];
309 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
312 void (*init_hook)(struct hda_codec *codec);
313 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
315 /* for pin sensing */
316 unsigned int sense_updated: 1;
317 unsigned int jack_present: 1;
318 unsigned int master_sw: 1;
321 unsigned int no_analog :1; /* digital I/O only */
323 /* for virtual master */
324 hda_nid_t vmaster_nid;
325 #ifdef CONFIG_SND_HDA_POWER_SAVE
326 struct hda_loopback_check loopback;
331 unsigned int pll_coef_idx, pll_coef_bit;
333 #ifdef SND_HDA_NEEDS_RESUME
334 #define ALC_MAX_PINS 16
335 unsigned int num_pins;
336 hda_nid_t pin_nids[ALC_MAX_PINS];
337 unsigned int pin_cfgs[ALC_MAX_PINS];
342 * configuration template - to be copied to the spec instance
344 struct alc_config_preset {
345 struct snd_kcontrol_new *mixers[5]; /* should be identical size
348 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
349 const struct hda_verb *init_verbs[5];
350 unsigned int num_dacs;
352 hda_nid_t dig_out_nid; /* optional */
353 hda_nid_t hp_nid; /* optional */
354 hda_nid_t *slave_dig_outs;
355 unsigned int num_adc_nids;
357 hda_nid_t *capsrc_nids;
358 hda_nid_t dig_in_nid;
359 unsigned int num_channel_mode;
360 const struct hda_channel_mode *channel_mode;
362 unsigned int num_mux_defs;
363 const struct hda_input_mux *input_mux;
364 void (*unsol_event)(struct hda_codec *, unsigned int);
365 void (*init_hook)(struct hda_codec *);
366 #ifdef CONFIG_SND_HDA_POWER_SAVE
367 struct hda_amp_list *loopbacks;
375 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
376 struct snd_ctl_elem_info *uinfo)
378 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
379 struct alc_spec *spec = codec->spec;
380 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
381 if (mux_idx >= spec->num_mux_defs)
383 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
386 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
387 struct snd_ctl_elem_value *ucontrol)
389 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
390 struct alc_spec *spec = codec->spec;
391 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
393 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
397 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
398 struct snd_ctl_elem_value *ucontrol)
400 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
401 struct alc_spec *spec = codec->spec;
402 const struct hda_input_mux *imux;
403 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
404 unsigned int mux_idx;
405 hda_nid_t nid = spec->capsrc_nids ?
406 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
408 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
409 imux = &spec->input_mux[mux_idx];
411 if (spec->capture_style &&
412 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
413 /* Matrix-mixer style (e.g. ALC882) */
414 unsigned int *cur_val = &spec->cur_mux[adc_idx];
417 idx = ucontrol->value.enumerated.item[0];
418 if (idx >= imux->num_items)
419 idx = imux->num_items - 1;
422 for (i = 0; i < imux->num_items; i++) {
423 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
424 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
425 imux->items[i].index,
431 /* MUX style (e.g. ALC880) */
432 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
433 &spec->cur_mux[adc_idx]);
438 * channel mode setting
440 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
441 struct snd_ctl_elem_info *uinfo)
443 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
444 struct alc_spec *spec = codec->spec;
445 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
446 spec->num_channel_mode);
449 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
450 struct snd_ctl_elem_value *ucontrol)
452 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
453 struct alc_spec *spec = codec->spec;
454 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
455 spec->num_channel_mode,
456 spec->multiout.max_channels);
459 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_value *ucontrol)
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 struct alc_spec *spec = codec->spec;
464 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
465 spec->num_channel_mode,
466 &spec->multiout.max_channels);
467 if (err >= 0 && spec->need_dac_fix)
468 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
473 * Control the mode of pin widget settings via the mixer. "pc" is used
474 * instead of "%" to avoid consequences of accidently treating the % as
475 * being part of a format specifier. Maximum allowed length of a value is
476 * 63 characters plus NULL terminator.
478 * Note: some retasking pin complexes seem to ignore requests for input
479 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
480 * are requested. Therefore order this list so that this behaviour will not
481 * cause problems when mixer clients move through the enum sequentially.
482 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
485 static char *alc_pin_mode_names[] = {
486 "Mic 50pc bias", "Mic 80pc bias",
487 "Line in", "Line out", "Headphone out",
489 static unsigned char alc_pin_mode_values[] = {
490 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
492 /* The control can present all 5 options, or it can limit the options based
493 * in the pin being assumed to be exclusively an input or an output pin. In
494 * addition, "input" pins may or may not process the mic bias option
495 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
496 * accept requests for bias as of chip versions up to March 2006) and/or
497 * wiring in the computer.
499 #define ALC_PIN_DIR_IN 0x00
500 #define ALC_PIN_DIR_OUT 0x01
501 #define ALC_PIN_DIR_INOUT 0x02
502 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
503 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
505 /* Info about the pin modes supported by the different pin direction modes.
506 * For each direction the minimum and maximum values are given.
508 static signed char alc_pin_mode_dir_info[5][2] = {
509 { 0, 2 }, /* ALC_PIN_DIR_IN */
510 { 3, 4 }, /* ALC_PIN_DIR_OUT */
511 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
512 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
513 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
515 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
516 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
517 #define alc_pin_mode_n_items(_dir) \
518 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
520 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
521 struct snd_ctl_elem_info *uinfo)
523 unsigned int item_num = uinfo->value.enumerated.item;
524 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
526 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
528 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
530 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
531 item_num = alc_pin_mode_min(dir);
532 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
536 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
537 struct snd_ctl_elem_value *ucontrol)
540 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
541 hda_nid_t nid = kcontrol->private_value & 0xffff;
542 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
543 long *valp = ucontrol->value.integer.value;
544 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
545 AC_VERB_GET_PIN_WIDGET_CONTROL,
548 /* Find enumerated value for current pinctl setting */
549 i = alc_pin_mode_min(dir);
550 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
552 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
556 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
557 struct snd_ctl_elem_value *ucontrol)
560 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
561 hda_nid_t nid = kcontrol->private_value & 0xffff;
562 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
563 long val = *ucontrol->value.integer.value;
564 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
565 AC_VERB_GET_PIN_WIDGET_CONTROL,
568 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
569 val = alc_pin_mode_min(dir);
571 change = pinctl != alc_pin_mode_values[val];
573 /* Set pin mode to that requested */
574 snd_hda_codec_write_cache(codec, nid, 0,
575 AC_VERB_SET_PIN_WIDGET_CONTROL,
576 alc_pin_mode_values[val]);
578 /* Also enable the retasking pin's input/output as required
579 * for the requested pin mode. Enum values of 2 or less are
582 * Dynamically switching the input/output buffers probably
583 * reduces noise slightly (particularly on input) so we'll
584 * do it. However, having both input and output buffers
585 * enabled simultaneously doesn't seem to be problematic if
586 * this turns out to be necessary in the future.
589 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
590 HDA_AMP_MUTE, HDA_AMP_MUTE);
591 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
594 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
595 HDA_AMP_MUTE, HDA_AMP_MUTE);
596 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
603 #define ALC_PIN_MODE(xname, nid, dir) \
604 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
605 .info = alc_pin_mode_info, \
606 .get = alc_pin_mode_get, \
607 .put = alc_pin_mode_put, \
608 .private_value = nid | (dir<<16) }
610 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
611 * together using a mask with more than one bit set. This control is
612 * currently used only by the ALC260 test model. At this stage they are not
613 * needed for any "production" models.
615 #ifdef CONFIG_SND_DEBUG
616 #define alc_gpio_data_info snd_ctl_boolean_mono_info
618 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
619 struct snd_ctl_elem_value *ucontrol)
621 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
622 hda_nid_t nid = kcontrol->private_value & 0xffff;
623 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
624 long *valp = ucontrol->value.integer.value;
625 unsigned int val = snd_hda_codec_read(codec, nid, 0,
626 AC_VERB_GET_GPIO_DATA, 0x00);
628 *valp = (val & mask) != 0;
631 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
632 struct snd_ctl_elem_value *ucontrol)
635 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
636 hda_nid_t nid = kcontrol->private_value & 0xffff;
637 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
638 long val = *ucontrol->value.integer.value;
639 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
640 AC_VERB_GET_GPIO_DATA,
643 /* Set/unset the masked GPIO bit(s) as needed */
644 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
649 snd_hda_codec_write_cache(codec, nid, 0,
650 AC_VERB_SET_GPIO_DATA, gpio_data);
654 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
655 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
656 .info = alc_gpio_data_info, \
657 .get = alc_gpio_data_get, \
658 .put = alc_gpio_data_put, \
659 .private_value = nid | (mask<<16) }
660 #endif /* CONFIG_SND_DEBUG */
662 /* A switch control to allow the enabling of the digital IO pins on the
663 * ALC260. This is incredibly simplistic; the intention of this control is
664 * to provide something in the test model allowing digital outputs to be
665 * identified if present. If models are found which can utilise these
666 * outputs a more complete mixer control can be devised for those models if
669 #ifdef CONFIG_SND_DEBUG
670 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
672 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
673 struct snd_ctl_elem_value *ucontrol)
675 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
676 hda_nid_t nid = kcontrol->private_value & 0xffff;
677 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
678 long *valp = ucontrol->value.integer.value;
679 unsigned int val = snd_hda_codec_read(codec, nid, 0,
680 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
682 *valp = (val & mask) != 0;
685 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
686 struct snd_ctl_elem_value *ucontrol)
689 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
690 hda_nid_t nid = kcontrol->private_value & 0xffff;
691 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
692 long val = *ucontrol->value.integer.value;
693 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
694 AC_VERB_GET_DIGI_CONVERT_1,
697 /* Set/unset the masked control bit(s) as needed */
698 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
703 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
708 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
709 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
710 .info = alc_spdif_ctrl_info, \
711 .get = alc_spdif_ctrl_get, \
712 .put = alc_spdif_ctrl_put, \
713 .private_value = nid | (mask<<16) }
714 #endif /* CONFIG_SND_DEBUG */
716 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
717 * Again, this is only used in the ALC26x test models to help identify when
718 * the EAPD line must be asserted for features to work.
720 #ifdef CONFIG_SND_DEBUG
721 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
723 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
724 struct snd_ctl_elem_value *ucontrol)
726 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
727 hda_nid_t nid = kcontrol->private_value & 0xffff;
728 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
729 long *valp = ucontrol->value.integer.value;
730 unsigned int val = snd_hda_codec_read(codec, nid, 0,
731 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
733 *valp = (val & mask) != 0;
737 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
738 struct snd_ctl_elem_value *ucontrol)
741 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
742 hda_nid_t nid = kcontrol->private_value & 0xffff;
743 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
744 long val = *ucontrol->value.integer.value;
745 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
746 AC_VERB_GET_EAPD_BTLENABLE,
749 /* Set/unset the masked control bit(s) as needed */
750 change = (!val ? 0 : mask) != (ctrl_data & mask);
755 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
761 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
762 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
763 .info = alc_eapd_ctrl_info, \
764 .get = alc_eapd_ctrl_get, \
765 .put = alc_eapd_ctrl_put, \
766 .private_value = nid | (mask<<16) }
767 #endif /* CONFIG_SND_DEBUG */
771 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
773 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
775 spec->mixers[spec->num_mixers++] = mix;
778 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
780 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
782 spec->init_verbs[spec->num_init_verbs++] = verb;
785 #ifdef CONFIG_PROC_FS
789 static void print_realtek_coef(struct snd_info_buffer *buffer,
790 struct hda_codec *codec, hda_nid_t nid)
796 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
797 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
798 coeff = snd_hda_codec_read(codec, nid, 0,
799 AC_VERB_GET_COEF_INDEX, 0);
800 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
803 #define print_realtek_coef NULL
807 * set up from the preset table
809 static void setup_preset(struct alc_spec *spec,
810 const struct alc_config_preset *preset)
814 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
815 add_mixer(spec, preset->mixers[i]);
816 spec->cap_mixer = preset->cap_mixer;
817 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
819 add_verb(spec, preset->init_verbs[i]);
821 spec->channel_mode = preset->channel_mode;
822 spec->num_channel_mode = preset->num_channel_mode;
823 spec->need_dac_fix = preset->need_dac_fix;
825 spec->multiout.max_channels = spec->channel_mode[0].channels;
827 spec->multiout.num_dacs = preset->num_dacs;
828 spec->multiout.dac_nids = preset->dac_nids;
829 spec->multiout.dig_out_nid = preset->dig_out_nid;
830 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
831 spec->multiout.hp_nid = preset->hp_nid;
833 spec->num_mux_defs = preset->num_mux_defs;
834 if (!spec->num_mux_defs)
835 spec->num_mux_defs = 1;
836 spec->input_mux = preset->input_mux;
838 spec->num_adc_nids = preset->num_adc_nids;
839 spec->adc_nids = preset->adc_nids;
840 spec->capsrc_nids = preset->capsrc_nids;
841 spec->dig_in_nid = preset->dig_in_nid;
843 spec->unsol_event = preset->unsol_event;
844 spec->init_hook = preset->init_hook;
845 #ifdef CONFIG_SND_HDA_POWER_SAVE
846 spec->loopback.amplist = preset->loopbacks;
850 /* Enable GPIO mask and set output */
851 static struct hda_verb alc_gpio1_init_verbs[] = {
852 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
853 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
854 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
858 static struct hda_verb alc_gpio2_init_verbs[] = {
859 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
860 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
861 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
865 static struct hda_verb alc_gpio3_init_verbs[] = {
866 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
867 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
868 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
873 * Fix hardware PLL issue
874 * On some codecs, the analog PLL gating control must be off while
875 * the default value is 1.
877 static void alc_fix_pll(struct hda_codec *codec)
879 struct alc_spec *spec = codec->spec;
884 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
886 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
887 AC_VERB_GET_PROC_COEF, 0);
888 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
890 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
891 val & ~(1 << spec->pll_coef_bit));
894 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
895 unsigned int coef_idx, unsigned int coef_bit)
897 struct alc_spec *spec = codec->spec;
899 spec->pll_coef_idx = coef_idx;
900 spec->pll_coef_bit = coef_bit;
904 static void alc_sku_automute(struct hda_codec *codec)
906 struct alc_spec *spec = codec->spec;
907 unsigned int present;
908 unsigned int hp_nid = spec->autocfg.hp_pins[0];
909 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
911 /* need to execute and sync at first */
912 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
913 present = snd_hda_codec_read(codec, hp_nid, 0,
914 AC_VERB_GET_PIN_SENSE, 0);
915 spec->jack_present = (present & 0x80000000) != 0;
916 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
917 spec->jack_present ? 0 : PIN_OUT);
920 #if 0 /* it's broken in some acses -- temporarily disabled */
921 static void alc_mic_automute(struct hda_codec *codec)
923 struct alc_spec *spec = codec->spec;
924 unsigned int present;
925 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
926 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
927 unsigned int mix_nid = spec->capsrc_nids[0];
928 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
930 capsrc_idx_mic = mic_nid - 0x18;
931 capsrc_idx_fmic = fmic_nid - 0x18;
932 present = snd_hda_codec_read(codec, mic_nid, 0,
933 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
934 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
935 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
936 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
937 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
938 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
939 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
942 #define alc_mic_automute(codec) do {} while(0) /* NOP */
943 #endif /* disabled */
945 /* unsolicited event for HP jack sensing */
946 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
948 if (codec->vendor_id == 0x10ec0880)
952 if (res == ALC880_HP_EVENT)
953 alc_sku_automute(codec);
955 if (res == ALC880_MIC_EVENT)
956 alc_mic_automute(codec);
959 static void alc_inithook(struct hda_codec *codec)
961 alc_sku_automute(codec);
962 alc_mic_automute(codec);
965 /* additional initialization for ALC888 variants */
966 static void alc888_coef_init(struct hda_codec *codec)
970 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
971 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
972 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
973 if ((tmp & 0xf0) == 2)
975 snd_hda_codec_read(codec, 0x20, 0,
976 AC_VERB_SET_PROC_COEF, 0x830);
979 snd_hda_codec_read(codec, 0x20, 0,
980 AC_VERB_SET_PROC_COEF, 0x3030);
983 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
984 * 31 ~ 16 : Manufacture ID
986 * 7 ~ 0 : Assembly ID
987 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
989 static void alc_subsystem_id(struct hda_codec *codec,
990 unsigned int porta, unsigned int porte,
993 unsigned int ass, tmp, i;
995 struct alc_spec *spec = codec->spec;
997 ass = codec->subsystem_id & 0xffff;
998 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1002 * 31~30 : port conetcivity
1005 * 19~16 : Check sum (15:1)
1010 if (codec->vendor_id == 0x10ec0260)
1012 ass = snd_hda_codec_read(codec, nid, 0,
1013 AC_VERB_GET_CONFIG_DEFAULT, 0);
1014 if (!(ass & 1) && !(ass & 0x100000))
1016 if ((ass >> 30) != 1) /* no physical connection */
1021 for (i = 1; i < 16; i++) {
1025 if (((ass >> 16) & 0xf) != tmp)
1031 * 2 : 0 --> Desktop, 1 --> Laptop
1032 * 3~5 : External Amplifier control
1035 tmp = (ass & 0x38) >> 3; /* external Amp control */
1038 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1041 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1044 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1046 case 5: /* set EAPD output high */
1047 switch (codec->vendor_id) {
1049 snd_hda_codec_write(codec, 0x0f, 0,
1050 AC_VERB_SET_EAPD_BTLENABLE, 2);
1051 snd_hda_codec_write(codec, 0x10, 0,
1052 AC_VERB_SET_EAPD_BTLENABLE, 2);
1064 snd_hda_codec_write(codec, 0x14, 0,
1065 AC_VERB_SET_EAPD_BTLENABLE, 2);
1066 snd_hda_codec_write(codec, 0x15, 0,
1067 AC_VERB_SET_EAPD_BTLENABLE, 2);
1070 switch (codec->vendor_id) {
1072 snd_hda_codec_write(codec, 0x1a, 0,
1073 AC_VERB_SET_COEF_INDEX, 7);
1074 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1075 AC_VERB_GET_PROC_COEF, 0);
1076 snd_hda_codec_write(codec, 0x1a, 0,
1077 AC_VERB_SET_COEF_INDEX, 7);
1078 snd_hda_codec_write(codec, 0x1a, 0,
1079 AC_VERB_SET_PROC_COEF,
1089 snd_hda_codec_write(codec, 0x20, 0,
1090 AC_VERB_SET_COEF_INDEX, 7);
1091 tmp = snd_hda_codec_read(codec, 0x20, 0,
1092 AC_VERB_GET_PROC_COEF, 0);
1093 snd_hda_codec_write(codec, 0x20, 0,
1094 AC_VERB_SET_COEF_INDEX, 7);
1095 snd_hda_codec_write(codec, 0x20, 0,
1096 AC_VERB_SET_PROC_COEF,
1100 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1104 snd_hda_codec_write(codec, 0x20, 0,
1105 AC_VERB_SET_COEF_INDEX, 7);
1106 tmp = snd_hda_codec_read(codec, 0x20, 0,
1107 AC_VERB_GET_PROC_COEF, 0);
1108 snd_hda_codec_write(codec, 0x20, 0,
1109 AC_VERB_SET_COEF_INDEX, 7);
1110 snd_hda_codec_write(codec, 0x20, 0,
1111 AC_VERB_SET_PROC_COEF,
1119 /* is laptop or Desktop and enable the function "Mute internal speaker
1120 * when the external headphone out jack is plugged"
1122 if (!(ass & 0x8000))
1125 * 10~8 : Jack location
1126 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1128 * 15 : 1 --> enable the function "Mute internal speaker
1129 * when the external headphone out jack is plugged"
1131 if (!spec->autocfg.speaker_pins[0]) {
1132 if (spec->autocfg.line_out_pins[0])
1133 spec->autocfg.speaker_pins[0] =
1134 spec->autocfg.line_out_pins[0];
1139 if (!spec->autocfg.hp_pins[0]) {
1140 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1142 spec->autocfg.hp_pins[0] = porta;
1144 spec->autocfg.hp_pins[0] = porte;
1146 spec->autocfg.hp_pins[0] = portd;
1150 if (spec->autocfg.hp_pins[0])
1151 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1152 AC_VERB_SET_UNSOLICITED_ENABLE,
1153 AC_USRSP_EN | ALC880_HP_EVENT);
1155 #if 0 /* it's broken in some acses -- temporarily disabled */
1156 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1157 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1158 snd_hda_codec_write(codec,
1159 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1160 AC_VERB_SET_UNSOLICITED_ENABLE,
1161 AC_USRSP_EN | ALC880_MIC_EVENT);
1162 #endif /* disabled */
1164 spec->unsol_event = alc_sku_unsol_event;
1168 * Fix-up pin default configurations
1176 static void alc_fix_pincfg(struct hda_codec *codec,
1177 const struct snd_pci_quirk *quirk,
1178 const struct alc_pincfg **pinfix)
1180 const struct alc_pincfg *cfg;
1182 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1186 cfg = pinfix[quirk->value];
1187 for (; cfg->nid; cfg++) {
1190 for (i = 0; i < 4; i++) {
1191 snd_hda_codec_write(codec, cfg->nid, 0,
1192 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1206 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1207 /* Mic-in jack as mic in */
1208 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1209 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1210 /* Line-in jack as Line in */
1211 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1212 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1213 /* Line-Out as Front */
1214 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1221 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1222 /* Mic-in jack as mic in */
1223 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1224 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1225 /* Line-in jack as Surround */
1226 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1227 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1228 /* Line-Out as Front */
1229 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1236 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1237 /* Mic-in jack as CLFE */
1238 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1239 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1240 /* Line-in jack as Surround */
1241 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1242 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1243 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1244 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1251 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1252 /* Mic-in jack as CLFE */
1253 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1254 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1255 /* Line-in jack as Surround */
1256 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1257 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1258 /* Line-Out as Side */
1259 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1263 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1264 { 2, alc888_4ST_ch2_intel_init },
1265 { 4, alc888_4ST_ch4_intel_init },
1266 { 6, alc888_4ST_ch6_intel_init },
1267 { 8, alc888_4ST_ch8_intel_init },
1271 * ALC888 Fujitsu Siemens Amillo xa3530
1274 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1275 /* Front Mic: set to PIN_IN (empty by default) */
1276 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1277 /* Connect Internal HP to Front */
1278 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1279 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1280 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1281 /* Connect Bass HP to Front */
1282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1284 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1285 /* Connect Line-Out side jack (SPDIF) to Side */
1286 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1287 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1288 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1289 /* Connect Mic jack to CLFE */
1290 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1292 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1293 /* Connect Line-in jack to Surround */
1294 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1295 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1296 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1297 /* Connect HP out jack to Front */
1298 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1299 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1300 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1301 /* Enable unsolicited event for HP jack and Line-out jack */
1302 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1303 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1307 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1309 unsigned int present;
1311 /* Line out presence */
1312 present = snd_hda_codec_read(codec, 0x17, 0,
1313 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1314 /* HP out presence */
1315 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1316 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1317 bits = present ? HDA_AMP_MUTE : 0;
1318 /* Toggle internal speakers muting */
1319 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1320 HDA_AMP_MUTE, bits);
1321 /* Toggle internal bass muting */
1322 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1323 HDA_AMP_MUTE, bits);
1326 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1329 if (res >> 26 == ALC880_HP_EVENT)
1330 alc888_fujitsu_xa3530_automute(codec);
1335 * ALC888 Acer Aspire 4930G model
1338 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1339 /* Front Mic: set to PIN_IN (empty by default) */
1340 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1341 /* Unselect Front Mic by default in input mixer 3 */
1342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1343 /* Enable unsolicited event for HP jack */
1344 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1345 /* Connect Internal HP to front */
1346 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1347 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1348 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1349 /* Connect HP out to front */
1350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1352 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1356 static struct hda_input_mux alc888_2_capture_sources[2] = {
1357 /* Front mic only available on one ADC */
1364 { "Front Mic", 0xb },
1377 static struct snd_kcontrol_new alc888_base_mixer[] = {
1378 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1379 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1380 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1381 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1382 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1384 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1385 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1386 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1387 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1388 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1389 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1390 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1391 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1392 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1393 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1394 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1399 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1401 unsigned int present;
1403 present = snd_hda_codec_read(codec, 0x15, 0,
1404 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1405 bits = present ? HDA_AMP_MUTE : 0;
1406 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1407 HDA_AMP_MUTE, bits);
1410 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1413 if (res >> 26 == ALC880_HP_EVENT)
1414 alc888_acer_aspire_4930g_automute(codec);
1418 * ALC880 3-stack model
1420 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1421 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1422 * F-Mic = 0x1b, HP = 0x19
1425 static hda_nid_t alc880_dac_nids[4] = {
1426 /* front, rear, clfe, rear_surr */
1427 0x02, 0x05, 0x04, 0x03
1430 static hda_nid_t alc880_adc_nids[3] = {
1435 /* The datasheet says the node 0x07 is connected from inputs,
1436 * but it shows zero connection in the real implementation on some devices.
1437 * Note: this is a 915GAV bug, fixed on 915GLV
1439 static hda_nid_t alc880_adc_nids_alt[2] = {
1444 #define ALC880_DIGOUT_NID 0x06
1445 #define ALC880_DIGIN_NID 0x0a
1447 static struct hda_input_mux alc880_capture_source = {
1451 { "Front Mic", 0x3 },
1457 /* channel source setting (2/6 channel selection for 3-stack) */
1459 static struct hda_verb alc880_threestack_ch2_init[] = {
1460 /* set line-in to input, mute it */
1461 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1462 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1463 /* set mic-in to input vref 80%, mute it */
1464 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1465 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1470 static struct hda_verb alc880_threestack_ch6_init[] = {
1471 /* set line-in to output, unmute it */
1472 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1473 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1474 /* set mic-in to output, unmute it */
1475 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1476 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1480 static struct hda_channel_mode alc880_threestack_modes[2] = {
1481 { 2, alc880_threestack_ch2_init },
1482 { 6, alc880_threestack_ch6_init },
1485 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1486 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1487 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1488 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1489 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1490 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1491 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1492 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1493 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1496 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1497 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1499 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1500 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1501 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1504 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1505 .name = "Channel Mode",
1506 .info = alc_ch_mode_info,
1507 .get = alc_ch_mode_get,
1508 .put = alc_ch_mode_put,
1513 /* capture mixer elements */
1514 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1515 struct snd_ctl_elem_info *uinfo)
1517 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1518 struct alc_spec *spec = codec->spec;
1521 mutex_lock(&codec->control_mutex);
1522 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1524 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1525 mutex_unlock(&codec->control_mutex);
1529 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1530 unsigned int size, unsigned int __user *tlv)
1532 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1533 struct alc_spec *spec = codec->spec;
1536 mutex_lock(&codec->control_mutex);
1537 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1539 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1540 mutex_unlock(&codec->control_mutex);
1544 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1545 struct snd_ctl_elem_value *ucontrol);
1547 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1548 struct snd_ctl_elem_value *ucontrol,
1551 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1552 struct alc_spec *spec = codec->spec;
1553 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1556 mutex_lock(&codec->control_mutex);
1557 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1559 err = func(kcontrol, ucontrol);
1560 mutex_unlock(&codec->control_mutex);
1564 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1565 struct snd_ctl_elem_value *ucontrol)
1567 return alc_cap_getput_caller(kcontrol, ucontrol,
1568 snd_hda_mixer_amp_volume_get);
1571 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1572 struct snd_ctl_elem_value *ucontrol)
1574 return alc_cap_getput_caller(kcontrol, ucontrol,
1575 snd_hda_mixer_amp_volume_put);
1578 /* capture mixer elements */
1579 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1581 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1582 struct snd_ctl_elem_value *ucontrol)
1584 return alc_cap_getput_caller(kcontrol, ucontrol,
1585 snd_hda_mixer_amp_switch_get);
1588 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1589 struct snd_ctl_elem_value *ucontrol)
1591 return alc_cap_getput_caller(kcontrol, ucontrol,
1592 snd_hda_mixer_amp_switch_put);
1595 #define DEFINE_CAPMIX(num) \
1596 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1598 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1599 .name = "Capture Switch", \
1600 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1602 .info = alc_cap_sw_info, \
1603 .get = alc_cap_sw_get, \
1604 .put = alc_cap_sw_put, \
1607 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1608 .name = "Capture Volume", \
1609 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1610 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1611 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1613 .info = alc_cap_vol_info, \
1614 .get = alc_cap_vol_get, \
1615 .put = alc_cap_vol_put, \
1616 .tlv = { .c = alc_cap_vol_tlv }, \
1619 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1620 /* .name = "Capture Source", */ \
1621 .name = "Input Source", \
1623 .info = alc_mux_enum_info, \
1624 .get = alc_mux_enum_get, \
1625 .put = alc_mux_enum_put, \
1630 /* up to three ADCs */
1637 * ALC880 5-stack model
1639 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1641 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1642 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1645 /* additional mixers to alc880_three_stack_mixer */
1646 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1647 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1648 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1652 /* channel source setting (6/8 channel selection for 5-stack) */
1654 static struct hda_verb alc880_fivestack_ch6_init[] = {
1655 /* set line-in to input, mute it */
1656 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1657 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1662 static struct hda_verb alc880_fivestack_ch8_init[] = {
1663 /* set line-in to output, unmute it */
1664 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1665 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1669 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1670 { 6, alc880_fivestack_ch6_init },
1671 { 8, alc880_fivestack_ch8_init },
1676 * ALC880 6-stack model
1678 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1679 * Side = 0x05 (0x0f)
1680 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1681 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1684 static hda_nid_t alc880_6st_dac_nids[4] = {
1685 /* front, rear, clfe, rear_surr */
1686 0x02, 0x03, 0x04, 0x05
1689 static struct hda_input_mux alc880_6stack_capture_source = {
1693 { "Front Mic", 0x1 },
1699 /* fixed 8-channels */
1700 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1704 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1705 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1706 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1707 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1708 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1709 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1710 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1711 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1712 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1713 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1714 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1715 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1716 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1717 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1718 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1721 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1722 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1725 .name = "Channel Mode",
1726 .info = alc_ch_mode_info,
1727 .get = alc_ch_mode_get,
1728 .put = alc_ch_mode_put,
1737 * W810 has rear IO for:
1740 * Center/LFE (DAC 04)
1743 * The system also has a pair of internal speakers, and a headphone jack.
1744 * These are both connected to Line2 on the codec, hence to DAC 02.
1746 * There is a variable resistor to control the speaker or headphone
1747 * volume. This is a hardware-only device without a software API.
1749 * Plugging headphones in will disable the internal speakers. This is
1750 * implemented in hardware, not via the driver using jack sense. In
1751 * a similar fashion, plugging into the rear socket marked "front" will
1752 * disable both the speakers and headphones.
1754 * For input, there's a microphone jack, and an "audio in" jack.
1755 * These may not do anything useful with this driver yet, because I
1756 * haven't setup any initialization verbs for these yet...
1759 static hda_nid_t alc880_w810_dac_nids[3] = {
1760 /* front, rear/surround, clfe */
1764 /* fixed 6 channels */
1765 static struct hda_channel_mode alc880_w810_modes[1] = {
1769 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1770 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1771 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1772 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1774 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1775 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1776 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1777 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1778 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1779 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1787 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1788 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1792 static hda_nid_t alc880_z71v_dac_nids[1] = {
1795 #define ALC880_Z71V_HP_DAC 0x03
1797 /* fixed 2 channels */
1798 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1802 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1803 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1804 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1805 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1806 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1807 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1808 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1816 * ALC880 F1734 model
1818 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1819 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1822 static hda_nid_t alc880_f1734_dac_nids[1] = {
1825 #define ALC880_F1734_HP_DAC 0x02
1827 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1828 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1829 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1830 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1831 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1832 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1833 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1834 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1839 static struct hda_input_mux alc880_f1734_capture_source = {
1851 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1852 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1853 * Mic = 0x18, Line = 0x1a
1856 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1857 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1859 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1860 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1861 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1862 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1863 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1864 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1865 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1866 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1867 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1868 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1869 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1870 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1871 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1872 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1873 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1875 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1876 .name = "Channel Mode",
1877 .info = alc_ch_mode_info,
1878 .get = alc_ch_mode_get,
1879 .put = alc_ch_mode_put,
1885 * ALC880 ASUS W1V model
1887 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1888 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1889 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1892 /* additional mixers to alc880_asus_mixer */
1893 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1894 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1895 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1900 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1901 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1902 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1903 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1904 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1905 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1908 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1909 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1914 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1915 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1916 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1917 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1918 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1919 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1920 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1921 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1922 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1923 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1924 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1925 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1926 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1927 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1928 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1929 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1930 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1932 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1933 .name = "Channel Mode",
1934 .info = alc_ch_mode_info,
1935 .get = alc_ch_mode_get,
1936 .put = alc_ch_mode_put,
1941 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1942 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1943 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1944 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1945 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1946 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1947 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1948 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1949 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1950 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1951 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1955 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1956 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1957 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1958 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1959 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1966 * virtual master controls
1970 * slave controls for virtual master
1972 static const char *alc_slave_vols[] = {
1973 "Front Playback Volume",
1974 "Surround Playback Volume",
1975 "Center Playback Volume",
1976 "LFE Playback Volume",
1977 "Side Playback Volume",
1978 "Headphone Playback Volume",
1979 "Speaker Playback Volume",
1980 "Mono Playback Volume",
1981 "Line-Out Playback Volume",
1982 "PCM Playback Volume",
1986 static const char *alc_slave_sws[] = {
1987 "Front Playback Switch",
1988 "Surround Playback Switch",
1989 "Center Playback Switch",
1990 "LFE Playback Switch",
1991 "Side Playback Switch",
1992 "Headphone Playback Switch",
1993 "Speaker Playback Switch",
1994 "Mono Playback Switch",
1995 "IEC958 Playback Switch",
2000 * build control elements
2003 static void alc_free_kctls(struct hda_codec *codec);
2005 /* additional beep mixers; the actual parameters are overwritten at build */
2006 static struct snd_kcontrol_new alc_beep_mixer[] = {
2007 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2008 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2012 static int alc_build_controls(struct hda_codec *codec)
2014 struct alc_spec *spec = codec->spec;
2018 for (i = 0; i < spec->num_mixers; i++) {
2019 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2023 if (spec->cap_mixer) {
2024 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2028 if (spec->multiout.dig_out_nid) {
2029 err = snd_hda_create_spdif_out_ctls(codec,
2030 spec->multiout.dig_out_nid);
2033 if (!spec->no_analog) {
2034 err = snd_hda_create_spdif_share_sw(codec,
2038 spec->multiout.share_spdif = 1;
2041 if (spec->dig_in_nid) {
2042 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2047 /* create beep controls if needed */
2048 if (spec->beep_amp) {
2049 struct snd_kcontrol_new *knew;
2050 for (knew = alc_beep_mixer; knew->name; knew++) {
2051 struct snd_kcontrol *kctl;
2052 kctl = snd_ctl_new1(knew, codec);
2055 kctl->private_value = spec->beep_amp;
2056 err = snd_hda_ctl_add(codec, kctl);
2062 /* if we have no master control, let's create it */
2063 if (!spec->no_analog &&
2064 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2065 unsigned int vmaster_tlv[4];
2066 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2067 HDA_OUTPUT, vmaster_tlv);
2068 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2069 vmaster_tlv, alc_slave_vols);
2073 if (!spec->no_analog &&
2074 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2075 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2076 NULL, alc_slave_sws);
2081 alc_free_kctls(codec); /* no longer needed */
2087 * initialize the codec volumes, etc
2091 * generic initialization of ADC, input mixers and output mixers
2093 static struct hda_verb alc880_volume_init_verbs[] = {
2095 * Unmute ADC0-2 and set the default input to mic-in
2097 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2099 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2100 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2101 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2102 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2104 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2106 * Note: PASD motherboards uses the Line In 2 as the input for front
2109 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2119 * Set up output mixers (0x0c - 0x0f)
2121 /* set vol=0 to output mixers */
2122 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2123 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2124 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2125 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2126 /* set up input amps for analog loopback */
2127 /* Amp Indices: DAC = 0, mixer = 1 */
2128 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2129 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2130 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2131 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2132 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2133 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2134 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2135 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2141 * 3-stack pin configuration:
2142 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2144 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2146 * preset connection lists of input pins
2147 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2149 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2150 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2151 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2154 * Set pin mode and muting
2156 /* set front pin widgets 0x14 for output */
2157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2158 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2159 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2160 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2161 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2162 /* Mic2 (as headphone out) for HP output */
2163 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2164 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2165 /* Line In pin widget for input */
2166 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2167 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2168 /* Line2 (as front mic) pin widget for input and vref at 80% */
2169 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2170 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2171 /* CD pin widget for input */
2172 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2178 * 5-stack pin configuration:
2179 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2180 * line-in/side = 0x1a, f-mic = 0x1b
2182 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2184 * preset connection lists of input pins
2185 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2187 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2188 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2191 * Set pin mode and muting
2193 /* set pin widgets 0x14-0x17 for output */
2194 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2197 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2198 /* unmute pins for output (no gain on this amp) */
2199 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2201 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2202 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2204 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2205 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2207 /* Mic2 (as headphone out) for HP output */
2208 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2209 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2210 /* Line In pin widget for input */
2211 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2213 /* Line2 (as front mic) pin widget for input and vref at 80% */
2214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2215 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2216 /* CD pin widget for input */
2217 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2223 * W810 pin configuration:
2224 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2226 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2227 /* hphone/speaker input selector: front DAC */
2228 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2230 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2231 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2232 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2233 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2234 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2235 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2237 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2238 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2244 * Z71V pin configuration:
2245 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2247 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2248 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2249 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2250 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2251 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2253 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2254 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2255 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2256 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2262 * 6-stack pin configuration:
2263 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2264 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2266 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2267 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2269 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2270 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2272 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2273 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2274 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2275 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2276 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2278 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2279 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2280 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2281 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2282 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2283 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2284 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2285 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2286 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2292 * Uniwill pin configuration:
2293 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2296 static struct hda_verb alc880_uniwill_init_verbs[] = {
2297 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2300 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2303 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2304 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2305 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2306 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2316 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2317 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2318 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2320 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2321 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2322 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2324 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2325 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2332 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2334 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2335 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2338 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2339 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2341 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2342 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2345 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2352 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2353 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2354 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2355 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2357 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2358 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2363 static struct hda_verb alc880_beep_init_verbs[] = {
2364 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2368 /* toggle speaker-output according to the hp-jack state */
2369 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2371 unsigned int present;
2374 present = snd_hda_codec_read(codec, 0x14, 0,
2375 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2376 bits = present ? HDA_AMP_MUTE : 0;
2377 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2378 HDA_AMP_MUTE, bits);
2379 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2380 HDA_AMP_MUTE, bits);
2383 /* auto-toggle front mic */
2384 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2386 unsigned int present;
2389 present = snd_hda_codec_read(codec, 0x18, 0,
2390 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2391 bits = present ? HDA_AMP_MUTE : 0;
2392 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2395 static void alc880_uniwill_automute(struct hda_codec *codec)
2397 alc880_uniwill_hp_automute(codec);
2398 alc880_uniwill_mic_automute(codec);
2401 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2404 /* Looks like the unsol event is incompatible with the standard
2405 * definition. 4bit tag is placed at 28 bit!
2407 switch (res >> 28) {
2408 case ALC880_HP_EVENT:
2409 alc880_uniwill_hp_automute(codec);
2411 case ALC880_MIC_EVENT:
2412 alc880_uniwill_mic_automute(codec);
2417 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2419 unsigned int present;
2422 present = snd_hda_codec_read(codec, 0x14, 0,
2423 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2424 bits = present ? HDA_AMP_MUTE : 0;
2425 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2428 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2430 unsigned int present;
2432 present = snd_hda_codec_read(codec, 0x21, 0,
2433 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2434 present &= HDA_AMP_VOLMASK;
2435 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2436 HDA_AMP_VOLMASK, present);
2437 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2438 HDA_AMP_VOLMASK, present);
2441 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2444 /* Looks like the unsol event is incompatible with the standard
2445 * definition. 4bit tag is placed at 28 bit!
2447 if ((res >> 28) == ALC880_HP_EVENT)
2448 alc880_uniwill_p53_hp_automute(codec);
2449 if ((res >> 28) == ALC880_DCVOL_EVENT)
2450 alc880_uniwill_p53_dcvol_automute(codec);
2454 * F1734 pin configuration:
2455 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2457 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2458 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2459 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2460 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2461 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2462 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2469 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2470 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2471 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2472 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2473 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2474 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2476 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2477 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2479 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2480 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2486 * ASUS pin configuration:
2487 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2489 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2490 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2491 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2492 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2493 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2499 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2501 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2506 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2512 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2517 /* Enable GPIO mask and set output */
2518 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2519 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2521 /* Clevo m520g init */
2522 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2523 /* headphone output */
2524 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2529 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2530 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2532 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2533 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2534 /* Mic1 (rear panel) */
2535 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2536 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2537 /* Mic2 (front panel) */
2538 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2539 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2541 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2542 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2543 /* change to EAPD mode */
2544 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2545 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2550 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2551 /* change to EAPD mode */
2552 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2553 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2555 /* Headphone output */
2556 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2559 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2561 /* Line In pin widget for input */
2562 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2563 /* CD pin widget for input */
2564 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2565 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2566 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2568 /* change to EAPD mode */
2569 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2570 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2576 * LG m1 express dual
2579 * Rear Line-In/Out (blue): 0x14
2580 * Build-in Mic-In: 0x15
2582 * HP-Out (green): 0x1b
2583 * Mic-In/Out (red): 0x19
2587 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2588 static hda_nid_t alc880_lg_dac_nids[3] = {
2592 /* seems analog CD is not working */
2593 static struct hda_input_mux alc880_lg_capture_source = {
2598 { "Internal Mic", 0x6 },
2602 /* 2,4,6 channel modes */
2603 static struct hda_verb alc880_lg_ch2_init[] = {
2604 /* set line-in and mic-in to input */
2605 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2606 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2610 static struct hda_verb alc880_lg_ch4_init[] = {
2611 /* set line-in to out and mic-in to input */
2612 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2613 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2617 static struct hda_verb alc880_lg_ch6_init[] = {
2618 /* set line-in and mic-in to output */
2619 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2620 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2624 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2625 { 2, alc880_lg_ch2_init },
2626 { 4, alc880_lg_ch4_init },
2627 { 6, alc880_lg_ch6_init },
2630 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2631 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2632 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2633 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2634 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2635 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2636 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2637 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2638 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2641 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2642 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2643 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2644 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2646 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2647 .name = "Channel Mode",
2648 .info = alc_ch_mode_info,
2649 .get = alc_ch_mode_get,
2650 .put = alc_ch_mode_put,
2655 static struct hda_verb alc880_lg_init_verbs[] = {
2656 /* set capture source to mic-in */
2657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2658 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2659 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2660 /* mute all amp mixer inputs */
2661 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2662 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2663 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2664 /* line-in to input */
2665 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2666 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2669 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2671 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2672 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2673 /* mic-in to input */
2674 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2675 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2678 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2679 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2680 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2682 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2686 /* toggle speaker-output according to the hp-jack state */
2687 static void alc880_lg_automute(struct hda_codec *codec)
2689 unsigned int present;
2692 present = snd_hda_codec_read(codec, 0x1b, 0,
2693 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2694 bits = present ? HDA_AMP_MUTE : 0;
2695 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2696 HDA_AMP_MUTE, bits);
2699 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2701 /* Looks like the unsol event is incompatible with the standard
2702 * definition. 4bit tag is placed at 28 bit!
2704 if ((res >> 28) == 0x01)
2705 alc880_lg_automute(codec);
2714 * Built-in Mic-In: 0x19
2720 static struct hda_input_mux alc880_lg_lw_capture_source = {
2724 { "Internal Mic", 0x1 },
2729 #define alc880_lg_lw_modes alc880_threestack_modes
2731 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2732 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2733 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2734 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2735 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2736 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2737 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2738 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2739 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2740 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2741 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2744 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2745 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2747 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2748 .name = "Channel Mode",
2749 .info = alc_ch_mode_info,
2750 .get = alc_ch_mode_get,
2751 .put = alc_ch_mode_put,
2756 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2757 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2758 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2759 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2761 /* set capture source to mic-in */
2762 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2763 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2764 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2770 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2771 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2772 /* mic-in to input */
2773 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2774 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2776 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2779 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2783 /* toggle speaker-output according to the hp-jack state */
2784 static void alc880_lg_lw_automute(struct hda_codec *codec)
2786 unsigned int present;
2789 present = snd_hda_codec_read(codec, 0x1b, 0,
2790 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2791 bits = present ? HDA_AMP_MUTE : 0;
2792 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2793 HDA_AMP_MUTE, bits);
2796 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2798 /* Looks like the unsol event is incompatible with the standard
2799 * definition. 4bit tag is placed at 28 bit!
2801 if ((res >> 28) == 0x01)
2802 alc880_lg_lw_automute(codec);
2805 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2806 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2807 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2810 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2811 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2815 static struct hda_input_mux alc880_medion_rim_capture_source = {
2819 { "Internal Mic", 0x1 },
2823 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2824 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2827 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2829 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2830 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2831 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2832 /* Mic2 (as headphone out) for HP output */
2833 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2834 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2835 /* Internal Speaker */
2836 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2837 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2839 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2840 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2842 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2846 /* toggle speaker-output according to the hp-jack state */
2847 static void alc880_medion_rim_automute(struct hda_codec *codec)
2849 unsigned int present;
2852 present = snd_hda_codec_read(codec, 0x14, 0,
2853 AC_VERB_GET_PIN_SENSE, 0)
2854 & AC_PINSENSE_PRESENCE;
2855 bits = present ? HDA_AMP_MUTE : 0;
2856 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2857 HDA_AMP_MUTE, bits);
2859 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2861 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2864 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2867 /* Looks like the unsol event is incompatible with the standard
2868 * definition. 4bit tag is placed at 28 bit!
2870 if ((res >> 28) == ALC880_HP_EVENT)
2871 alc880_medion_rim_automute(codec);
2874 #ifdef CONFIG_SND_HDA_POWER_SAVE
2875 static struct hda_amp_list alc880_loopbacks[] = {
2876 { 0x0b, HDA_INPUT, 0 },
2877 { 0x0b, HDA_INPUT, 1 },
2878 { 0x0b, HDA_INPUT, 2 },
2879 { 0x0b, HDA_INPUT, 3 },
2880 { 0x0b, HDA_INPUT, 4 },
2884 static struct hda_amp_list alc880_lg_loopbacks[] = {
2885 { 0x0b, HDA_INPUT, 1 },
2886 { 0x0b, HDA_INPUT, 6 },
2887 { 0x0b, HDA_INPUT, 7 },
2896 static int alc_init(struct hda_codec *codec)
2898 struct alc_spec *spec = codec->spec;
2902 if (codec->vendor_id == 0x10ec0888)
2903 alc888_coef_init(codec);
2905 for (i = 0; i < spec->num_init_verbs; i++)
2906 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2908 if (spec->init_hook)
2909 spec->init_hook(codec);
2914 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2916 struct alc_spec *spec = codec->spec;
2918 if (spec->unsol_event)
2919 spec->unsol_event(codec, res);
2922 #ifdef CONFIG_SND_HDA_POWER_SAVE
2923 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2925 struct alc_spec *spec = codec->spec;
2926 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2931 * Analog playback callbacks
2933 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2934 struct hda_codec *codec,
2935 struct snd_pcm_substream *substream)
2937 struct alc_spec *spec = codec->spec;
2938 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2942 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2943 struct hda_codec *codec,
2944 unsigned int stream_tag,
2945 unsigned int format,
2946 struct snd_pcm_substream *substream)
2948 struct alc_spec *spec = codec->spec;
2949 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2950 stream_tag, format, substream);
2953 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2954 struct hda_codec *codec,
2955 struct snd_pcm_substream *substream)
2957 struct alc_spec *spec = codec->spec;
2958 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2964 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2965 struct hda_codec *codec,
2966 struct snd_pcm_substream *substream)
2968 struct alc_spec *spec = codec->spec;
2969 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2972 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2973 struct hda_codec *codec,
2974 unsigned int stream_tag,
2975 unsigned int format,
2976 struct snd_pcm_substream *substream)
2978 struct alc_spec *spec = codec->spec;
2979 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2980 stream_tag, format, substream);
2983 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2984 struct hda_codec *codec,
2985 struct snd_pcm_substream *substream)
2987 struct alc_spec *spec = codec->spec;
2988 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
2991 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2992 struct hda_codec *codec,
2993 struct snd_pcm_substream *substream)
2995 struct alc_spec *spec = codec->spec;
2996 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3002 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3003 struct hda_codec *codec,
3004 unsigned int stream_tag,
3005 unsigned int format,
3006 struct snd_pcm_substream *substream)
3008 struct alc_spec *spec = codec->spec;
3010 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3011 stream_tag, 0, format);
3015 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3016 struct hda_codec *codec,
3017 struct snd_pcm_substream *substream)
3019 struct alc_spec *spec = codec->spec;
3021 snd_hda_codec_cleanup_stream(codec,
3022 spec->adc_nids[substream->number + 1]);
3029 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3033 /* NID is set in alc_build_pcms */
3035 .open = alc880_playback_pcm_open,
3036 .prepare = alc880_playback_pcm_prepare,
3037 .cleanup = alc880_playback_pcm_cleanup
3041 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3045 /* NID is set in alc_build_pcms */
3048 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3052 /* NID is set in alc_build_pcms */
3055 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3056 .substreams = 2, /* can be overridden */
3059 /* NID is set in alc_build_pcms */
3061 .prepare = alc880_alt_capture_pcm_prepare,
3062 .cleanup = alc880_alt_capture_pcm_cleanup
3066 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3070 /* NID is set in alc_build_pcms */
3072 .open = alc880_dig_playback_pcm_open,
3073 .close = alc880_dig_playback_pcm_close,
3074 .prepare = alc880_dig_playback_pcm_prepare,
3075 .cleanup = alc880_dig_playback_pcm_cleanup
3079 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3083 /* NID is set in alc_build_pcms */
3086 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3087 static struct hda_pcm_stream alc_pcm_null_stream = {
3093 static int alc_build_pcms(struct hda_codec *codec)
3095 struct alc_spec *spec = codec->spec;
3096 struct hda_pcm *info = spec->pcm_rec;
3099 codec->num_pcms = 1;
3100 codec->pcm_info = info;
3102 if (spec->no_analog)
3105 info->name = spec->stream_name_analog;
3106 if (spec->stream_analog_playback) {
3107 if (snd_BUG_ON(!spec->multiout.dac_nids))
3109 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3110 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3112 if (spec->stream_analog_capture) {
3113 if (snd_BUG_ON(!spec->adc_nids))
3115 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3116 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3119 if (spec->channel_mode) {
3120 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3121 for (i = 0; i < spec->num_channel_mode; i++) {
3122 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3123 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3129 /* SPDIF for stream index #1 */
3130 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3131 codec->num_pcms = 2;
3132 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3133 info = spec->pcm_rec + 1;
3134 info->name = spec->stream_name_digital;
3135 if (spec->dig_out_type)
3136 info->pcm_type = spec->dig_out_type;
3138 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3139 if (spec->multiout.dig_out_nid &&
3140 spec->stream_digital_playback) {
3141 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3142 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3144 if (spec->dig_in_nid &&
3145 spec->stream_digital_capture) {
3146 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3147 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3149 /* FIXME: do we need this for all Realtek codec models? */
3150 codec->spdif_status_reset = 1;
3153 if (spec->no_analog)
3156 /* If the use of more than one ADC is requested for the current
3157 * model, configure a second analog capture-only PCM.
3159 /* Additional Analaog capture for index #2 */
3160 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3161 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3162 codec->num_pcms = 3;
3163 info = spec->pcm_rec + 2;
3164 info->name = spec->stream_name_analog;
3165 if (spec->alt_dac_nid) {
3166 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3167 *spec->stream_analog_alt_playback;
3168 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3171 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3172 alc_pcm_null_stream;
3173 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3175 if (spec->num_adc_nids > 1) {
3176 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3177 *spec->stream_analog_alt_capture;
3178 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3180 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3181 spec->num_adc_nids - 1;
3183 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3184 alc_pcm_null_stream;
3185 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3192 static void alc_free_kctls(struct hda_codec *codec)
3194 struct alc_spec *spec = codec->spec;
3196 if (spec->kctls.list) {
3197 struct snd_kcontrol_new *kctl = spec->kctls.list;
3199 for (i = 0; i < spec->kctls.used; i++)
3200 kfree(kctl[i].name);
3202 snd_array_free(&spec->kctls);
3205 static void alc_free(struct hda_codec *codec)
3207 struct alc_spec *spec = codec->spec;
3212 alc_free_kctls(codec);
3214 snd_hda_detach_beep_device(codec);
3217 #ifdef SND_HDA_NEEDS_RESUME
3218 static void store_pin_configs(struct hda_codec *codec)
3220 struct alc_spec *spec = codec->spec;
3221 hda_nid_t nid, end_nid;
3223 end_nid = codec->start_nid + codec->num_nodes;
3224 for (nid = codec->start_nid; nid < end_nid; nid++) {
3225 unsigned int wid_caps = get_wcaps(codec, nid);
3226 unsigned int wid_type =
3227 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3228 if (wid_type != AC_WID_PIN)
3230 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3232 spec->pin_nids[spec->num_pins] = nid;
3233 spec->pin_cfgs[spec->num_pins] =
3234 snd_hda_codec_read(codec, nid, 0,
3235 AC_VERB_GET_CONFIG_DEFAULT, 0);
3240 static void resume_pin_configs(struct hda_codec *codec)
3242 struct alc_spec *spec = codec->spec;
3245 for (i = 0; i < spec->num_pins; i++) {
3246 hda_nid_t pin_nid = spec->pin_nids[i];
3247 unsigned int pin_config = spec->pin_cfgs[i];
3248 snd_hda_codec_write(codec, pin_nid, 0,
3249 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3250 pin_config & 0x000000ff);
3251 snd_hda_codec_write(codec, pin_nid, 0,
3252 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3253 (pin_config & 0x0000ff00) >> 8);
3254 snd_hda_codec_write(codec, pin_nid, 0,
3255 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3256 (pin_config & 0x00ff0000) >> 16);
3257 snd_hda_codec_write(codec, pin_nid, 0,
3258 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3263 static int alc_resume(struct hda_codec *codec)
3265 resume_pin_configs(codec);
3266 codec->patch_ops.init(codec);
3267 snd_hda_codec_resume_amp(codec);
3268 snd_hda_codec_resume_cache(codec);
3272 #define store_pin_configs(codec)
3277 static struct hda_codec_ops alc_patch_ops = {
3278 .build_controls = alc_build_controls,
3279 .build_pcms = alc_build_pcms,
3282 .unsol_event = alc_unsol_event,
3283 #ifdef SND_HDA_NEEDS_RESUME
3284 .resume = alc_resume,
3286 #ifdef CONFIG_SND_HDA_POWER_SAVE
3287 .check_power_status = alc_check_power_status,
3293 * Test configuration for debugging
3295 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3298 #ifdef CONFIG_SND_DEBUG
3299 static hda_nid_t alc880_test_dac_nids[4] = {
3300 0x02, 0x03, 0x04, 0x05
3303 static struct hda_input_mux alc880_test_capture_source = {
3312 { "Surround", 0x6 },
3316 static struct hda_channel_mode alc880_test_modes[4] = {
3323 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3324 struct snd_ctl_elem_info *uinfo)
3326 static char *texts[] = {
3327 "N/A", "Line Out", "HP Out",
3328 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3330 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3332 uinfo->value.enumerated.items = 8;
3333 if (uinfo->value.enumerated.item >= 8)
3334 uinfo->value.enumerated.item = 7;
3335 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3339 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3340 struct snd_ctl_elem_value *ucontrol)
3342 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3343 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3344 unsigned int pin_ctl, item = 0;
3346 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3347 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3348 if (pin_ctl & AC_PINCTL_OUT_EN) {
3349 if (pin_ctl & AC_PINCTL_HP_EN)
3353 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3354 switch (pin_ctl & AC_PINCTL_VREFEN) {
3355 case AC_PINCTL_VREF_HIZ: item = 3; break;
3356 case AC_PINCTL_VREF_50: item = 4; break;
3357 case AC_PINCTL_VREF_GRD: item = 5; break;
3358 case AC_PINCTL_VREF_80: item = 6; break;
3359 case AC_PINCTL_VREF_100: item = 7; break;
3362 ucontrol->value.enumerated.item[0] = item;
3366 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3367 struct snd_ctl_elem_value *ucontrol)
3369 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3370 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3371 static unsigned int ctls[] = {
3372 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3373 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3374 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3375 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3376 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3377 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3379 unsigned int old_ctl, new_ctl;
3381 old_ctl = snd_hda_codec_read(codec, nid, 0,
3382 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3383 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3384 if (old_ctl != new_ctl) {
3386 snd_hda_codec_write_cache(codec, nid, 0,
3387 AC_VERB_SET_PIN_WIDGET_CONTROL,
3389 val = ucontrol->value.enumerated.item[0] >= 3 ?
3391 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3398 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3399 struct snd_ctl_elem_info *uinfo)
3401 static char *texts[] = {
3402 "Front", "Surround", "CLFE", "Side"
3404 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3406 uinfo->value.enumerated.items = 4;
3407 if (uinfo->value.enumerated.item >= 4)
3408 uinfo->value.enumerated.item = 3;
3409 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3413 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3414 struct snd_ctl_elem_value *ucontrol)
3416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3417 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3420 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3421 ucontrol->value.enumerated.item[0] = sel & 3;
3425 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3426 struct snd_ctl_elem_value *ucontrol)
3428 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3429 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3432 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3433 if (ucontrol->value.enumerated.item[0] != sel) {
3434 sel = ucontrol->value.enumerated.item[0] & 3;
3435 snd_hda_codec_write_cache(codec, nid, 0,
3436 AC_VERB_SET_CONNECT_SEL, sel);
3442 #define PIN_CTL_TEST(xname,nid) { \
3443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3445 .info = alc_test_pin_ctl_info, \
3446 .get = alc_test_pin_ctl_get, \
3447 .put = alc_test_pin_ctl_put, \
3448 .private_value = nid \
3451 #define PIN_SRC_TEST(xname,nid) { \
3452 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3454 .info = alc_test_pin_src_info, \
3455 .get = alc_test_pin_src_get, \
3456 .put = alc_test_pin_src_put, \
3457 .private_value = nid \
3460 static struct snd_kcontrol_new alc880_test_mixer[] = {
3461 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3462 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3463 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3464 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3465 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3466 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3467 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3468 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3469 PIN_CTL_TEST("Front Pin Mode", 0x14),
3470 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3471 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3472 PIN_CTL_TEST("Side Pin Mode", 0x17),
3473 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3474 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3475 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3476 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3477 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3478 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3479 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3480 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3481 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3482 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3483 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3484 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3485 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3486 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3487 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3488 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3489 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3490 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3493 .name = "Channel Mode",
3494 .info = alc_ch_mode_info,
3495 .get = alc_ch_mode_get,
3496 .put = alc_ch_mode_put,
3501 static struct hda_verb alc880_test_init_verbs[] = {
3502 /* Unmute inputs of 0x0c - 0x0f */
3503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3506 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3508 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3509 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3510 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3511 /* Vol output for 0x0c-0x0f */
3512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3515 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3516 /* Set output pins 0x14-0x17 */
3517 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3518 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3519 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3520 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3521 /* Unmute output pins 0x14-0x17 */
3522 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3524 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3525 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3526 /* Set input pins 0x18-0x1c */
3527 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3528 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3529 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3530 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3531 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3532 /* Mute input pins 0x18-0x1b */
3533 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3534 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3535 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3536 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3538 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3539 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3540 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3541 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3542 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3543 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3544 /* Analog input/passthru */
3545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3557 static const char *alc880_models[ALC880_MODEL_LAST] = {
3558 [ALC880_3ST] = "3stack",
3559 [ALC880_TCL_S700] = "tcl",
3560 [ALC880_3ST_DIG] = "3stack-digout",
3561 [ALC880_CLEVO] = "clevo",
3562 [ALC880_5ST] = "5stack",
3563 [ALC880_5ST_DIG] = "5stack-digout",
3564 [ALC880_W810] = "w810",
3565 [ALC880_Z71V] = "z71v",
3566 [ALC880_6ST] = "6stack",
3567 [ALC880_6ST_DIG] = "6stack-digout",
3568 [ALC880_ASUS] = "asus",
3569 [ALC880_ASUS_W1V] = "asus-w1v",
3570 [ALC880_ASUS_DIG] = "asus-dig",
3571 [ALC880_ASUS_DIG2] = "asus-dig2",
3572 [ALC880_UNIWILL_DIG] = "uniwill",
3573 [ALC880_UNIWILL_P53] = "uniwill-p53",
3574 [ALC880_FUJITSU] = "fujitsu",
3575 [ALC880_F1734] = "F1734",
3577 [ALC880_LG_LW] = "lg-lw",
3578 [ALC880_MEDION_RIM] = "medion",
3579 #ifdef CONFIG_SND_DEBUG
3580 [ALC880_TEST] = "test",
3582 [ALC880_AUTO] = "auto",
3585 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3586 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3587 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3588 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3589 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3590 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3591 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3592 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3593 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3594 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3595 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3596 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3597 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3598 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3599 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3600 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3601 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3602 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3603 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3604 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3605 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3606 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3607 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3608 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3609 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3610 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3611 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3612 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3613 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3614 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3615 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3616 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3617 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3618 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3619 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3620 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3621 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3622 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3623 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3624 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3625 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3626 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3627 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3628 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3629 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3630 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3631 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3632 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3633 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3634 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3635 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3636 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3637 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3638 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3639 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3640 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3641 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3642 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3643 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3644 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3645 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3646 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3647 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3648 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3649 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3650 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3651 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3652 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3653 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3655 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3656 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3657 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3662 * ALC880 codec presets
3664 static struct alc_config_preset alc880_presets[] = {
3666 .mixers = { alc880_three_stack_mixer },
3667 .init_verbs = { alc880_volume_init_verbs,
3668 alc880_pin_3stack_init_verbs },
3669 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3670 .dac_nids = alc880_dac_nids,
3671 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3672 .channel_mode = alc880_threestack_modes,
3674 .input_mux = &alc880_capture_source,
3676 [ALC880_3ST_DIG] = {
3677 .mixers = { alc880_three_stack_mixer },
3678 .init_verbs = { alc880_volume_init_verbs,
3679 alc880_pin_3stack_init_verbs },
3680 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3681 .dac_nids = alc880_dac_nids,
3682 .dig_out_nid = ALC880_DIGOUT_NID,
3683 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3684 .channel_mode = alc880_threestack_modes,
3686 .input_mux = &alc880_capture_source,
3688 [ALC880_TCL_S700] = {
3689 .mixers = { alc880_tcl_s700_mixer },
3690 .init_verbs = { alc880_volume_init_verbs,
3691 alc880_pin_tcl_S700_init_verbs,
3692 alc880_gpio2_init_verbs },
3693 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3694 .dac_nids = alc880_dac_nids,
3695 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3696 .num_adc_nids = 1, /* single ADC */
3698 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3699 .channel_mode = alc880_2_jack_modes,
3700 .input_mux = &alc880_capture_source,
3703 .mixers = { alc880_three_stack_mixer,
3704 alc880_five_stack_mixer},
3705 .init_verbs = { alc880_volume_init_verbs,
3706 alc880_pin_5stack_init_verbs },
3707 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3708 .dac_nids = alc880_dac_nids,
3709 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3710 .channel_mode = alc880_fivestack_modes,
3711 .input_mux = &alc880_capture_source,
3713 [ALC880_5ST_DIG] = {
3714 .mixers = { alc880_three_stack_mixer,
3715 alc880_five_stack_mixer },
3716 .init_verbs = { alc880_volume_init_verbs,
3717 alc880_pin_5stack_init_verbs },
3718 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3719 .dac_nids = alc880_dac_nids,
3720 .dig_out_nid = ALC880_DIGOUT_NID,
3721 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3722 .channel_mode = alc880_fivestack_modes,
3723 .input_mux = &alc880_capture_source,
3726 .mixers = { alc880_six_stack_mixer },
3727 .init_verbs = { alc880_volume_init_verbs,
3728 alc880_pin_6stack_init_verbs },
3729 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3730 .dac_nids = alc880_6st_dac_nids,
3731 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3732 .channel_mode = alc880_sixstack_modes,
3733 .input_mux = &alc880_6stack_capture_source,
3735 [ALC880_6ST_DIG] = {
3736 .mixers = { alc880_six_stack_mixer },
3737 .init_verbs = { alc880_volume_init_verbs,
3738 alc880_pin_6stack_init_verbs },
3739 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3740 .dac_nids = alc880_6st_dac_nids,
3741 .dig_out_nid = ALC880_DIGOUT_NID,
3742 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3743 .channel_mode = alc880_sixstack_modes,
3744 .input_mux = &alc880_6stack_capture_source,
3747 .mixers = { alc880_w810_base_mixer },
3748 .init_verbs = { alc880_volume_init_verbs,
3749 alc880_pin_w810_init_verbs,
3750 alc880_gpio2_init_verbs },
3751 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3752 .dac_nids = alc880_w810_dac_nids,
3753 .dig_out_nid = ALC880_DIGOUT_NID,
3754 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3755 .channel_mode = alc880_w810_modes,
3756 .input_mux = &alc880_capture_source,
3759 .mixers = { alc880_z71v_mixer },
3760 .init_verbs = { alc880_volume_init_verbs,
3761 alc880_pin_z71v_init_verbs },
3762 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3763 .dac_nids = alc880_z71v_dac_nids,
3764 .dig_out_nid = ALC880_DIGOUT_NID,
3766 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3767 .channel_mode = alc880_2_jack_modes,
3768 .input_mux = &alc880_capture_source,
3771 .mixers = { alc880_f1734_mixer },
3772 .init_verbs = { alc880_volume_init_verbs,
3773 alc880_pin_f1734_init_verbs },
3774 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3775 .dac_nids = alc880_f1734_dac_nids,
3777 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3778 .channel_mode = alc880_2_jack_modes,
3779 .input_mux = &alc880_f1734_capture_source,
3780 .unsol_event = alc880_uniwill_p53_unsol_event,
3781 .init_hook = alc880_uniwill_p53_hp_automute,
3784 .mixers = { alc880_asus_mixer },
3785 .init_verbs = { alc880_volume_init_verbs,
3786 alc880_pin_asus_init_verbs,
3787 alc880_gpio1_init_verbs },
3788 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3789 .dac_nids = alc880_asus_dac_nids,
3790 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3791 .channel_mode = alc880_asus_modes,
3793 .input_mux = &alc880_capture_source,
3795 [ALC880_ASUS_DIG] = {
3796 .mixers = { alc880_asus_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_ASUS_DIG2] = {
3809 .mixers = { alc880_asus_mixer },
3810 .init_verbs = { alc880_volume_init_verbs,
3811 alc880_pin_asus_init_verbs,
3812 alc880_gpio2_init_verbs }, /* use GPIO2 */
3813 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3814 .dac_nids = alc880_asus_dac_nids,
3815 .dig_out_nid = ALC880_DIGOUT_NID,
3816 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3817 .channel_mode = alc880_asus_modes,
3819 .input_mux = &alc880_capture_source,
3821 [ALC880_ASUS_W1V] = {
3822 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3823 .init_verbs = { alc880_volume_init_verbs,
3824 alc880_pin_asus_init_verbs,
3825 alc880_gpio1_init_verbs },
3826 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3827 .dac_nids = alc880_asus_dac_nids,
3828 .dig_out_nid = ALC880_DIGOUT_NID,
3829 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3830 .channel_mode = alc880_asus_modes,
3832 .input_mux = &alc880_capture_source,
3834 [ALC880_UNIWILL_DIG] = {
3835 .mixers = { alc880_asus_mixer },
3836 .init_verbs = { alc880_volume_init_verbs,
3837 alc880_pin_asus_init_verbs },
3838 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3839 .dac_nids = alc880_asus_dac_nids,
3840 .dig_out_nid = ALC880_DIGOUT_NID,
3841 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3842 .channel_mode = alc880_asus_modes,
3844 .input_mux = &alc880_capture_source,
3846 [ALC880_UNIWILL] = {
3847 .mixers = { alc880_uniwill_mixer },
3848 .init_verbs = { alc880_volume_init_verbs,
3849 alc880_uniwill_init_verbs },
3850 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3851 .dac_nids = alc880_asus_dac_nids,
3852 .dig_out_nid = ALC880_DIGOUT_NID,
3853 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3854 .channel_mode = alc880_threestack_modes,
3856 .input_mux = &alc880_capture_source,
3857 .unsol_event = alc880_uniwill_unsol_event,
3858 .init_hook = alc880_uniwill_automute,
3860 [ALC880_UNIWILL_P53] = {
3861 .mixers = { alc880_uniwill_p53_mixer },
3862 .init_verbs = { alc880_volume_init_verbs,
3863 alc880_uniwill_p53_init_verbs },
3864 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3865 .dac_nids = alc880_asus_dac_nids,
3866 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3867 .channel_mode = alc880_threestack_modes,
3868 .input_mux = &alc880_capture_source,
3869 .unsol_event = alc880_uniwill_p53_unsol_event,
3870 .init_hook = alc880_uniwill_p53_hp_automute,
3872 [ALC880_FUJITSU] = {
3873 .mixers = { alc880_fujitsu_mixer },
3874 .init_verbs = { alc880_volume_init_verbs,
3875 alc880_uniwill_p53_init_verbs,
3876 alc880_beep_init_verbs },
3877 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3878 .dac_nids = alc880_dac_nids,
3879 .dig_out_nid = ALC880_DIGOUT_NID,
3880 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3881 .channel_mode = alc880_2_jack_modes,
3882 .input_mux = &alc880_capture_source,
3883 .unsol_event = alc880_uniwill_p53_unsol_event,
3884 .init_hook = alc880_uniwill_p53_hp_automute,
3887 .mixers = { alc880_three_stack_mixer },
3888 .init_verbs = { alc880_volume_init_verbs,
3889 alc880_pin_clevo_init_verbs },
3890 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3891 .dac_nids = alc880_dac_nids,
3893 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3894 .channel_mode = alc880_threestack_modes,
3896 .input_mux = &alc880_capture_source,
3899 .mixers = { alc880_lg_mixer },
3900 .init_verbs = { alc880_volume_init_verbs,
3901 alc880_lg_init_verbs },
3902 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3903 .dac_nids = alc880_lg_dac_nids,
3904 .dig_out_nid = ALC880_DIGOUT_NID,
3905 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3906 .channel_mode = alc880_lg_ch_modes,
3908 .input_mux = &alc880_lg_capture_source,
3909 .unsol_event = alc880_lg_unsol_event,
3910 .init_hook = alc880_lg_automute,
3911 #ifdef CONFIG_SND_HDA_POWER_SAVE
3912 .loopbacks = alc880_lg_loopbacks,
3916 .mixers = { alc880_lg_lw_mixer },
3917 .init_verbs = { alc880_volume_init_verbs,
3918 alc880_lg_lw_init_verbs },
3919 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3920 .dac_nids = alc880_dac_nids,
3921 .dig_out_nid = ALC880_DIGOUT_NID,
3922 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3923 .channel_mode = alc880_lg_lw_modes,
3924 .input_mux = &alc880_lg_lw_capture_source,
3925 .unsol_event = alc880_lg_lw_unsol_event,
3926 .init_hook = alc880_lg_lw_automute,
3928 [ALC880_MEDION_RIM] = {
3929 .mixers = { alc880_medion_rim_mixer },
3930 .init_verbs = { alc880_volume_init_verbs,
3931 alc880_medion_rim_init_verbs,
3932 alc_gpio2_init_verbs },
3933 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3934 .dac_nids = alc880_dac_nids,
3935 .dig_out_nid = ALC880_DIGOUT_NID,
3936 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3937 .channel_mode = alc880_2_jack_modes,
3938 .input_mux = &alc880_medion_rim_capture_source,
3939 .unsol_event = alc880_medion_rim_unsol_event,
3940 .init_hook = alc880_medion_rim_automute,
3942 #ifdef CONFIG_SND_DEBUG
3944 .mixers = { alc880_test_mixer },
3945 .init_verbs = { alc880_test_init_verbs },
3946 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3947 .dac_nids = alc880_test_dac_nids,
3948 .dig_out_nid = ALC880_DIGOUT_NID,
3949 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3950 .channel_mode = alc880_test_modes,
3951 .input_mux = &alc880_test_capture_source,
3957 * Automatic parse of I/O pins from the BIOS configuration
3962 ALC_CTL_WIDGET_MUTE,
3965 static struct snd_kcontrol_new alc880_control_templates[] = {
3966 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3967 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3968 HDA_BIND_MUTE(NULL, 0, 0, 0),
3971 /* add dynamic controls */
3972 static int add_control(struct alc_spec *spec, int type, const char *name,
3975 struct snd_kcontrol_new *knew;
3977 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3978 knew = snd_array_new(&spec->kctls);
3981 *knew = alc880_control_templates[type];
3982 knew->name = kstrdup(name, GFP_KERNEL);
3985 knew->private_value = val;
3989 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3990 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3991 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3992 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3993 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3994 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3995 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3996 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3997 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3998 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3999 #define ALC880_PIN_CD_NID 0x1c
4001 /* fill in the dac_nids table from the parsed pin configuration */
4002 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4003 const struct auto_pin_cfg *cfg)
4009 memset(assigned, 0, sizeof(assigned));
4010 spec->multiout.dac_nids = spec->private_dac_nids;
4012 /* check the pins hardwired to audio widget */
4013 for (i = 0; i < cfg->line_outs; i++) {
4014 nid = cfg->line_out_pins[i];
4015 if (alc880_is_fixed_pin(nid)) {
4016 int idx = alc880_fixed_pin_idx(nid);
4017 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4021 /* left pins can be connect to any audio widget */
4022 for (i = 0; i < cfg->line_outs; i++) {
4023 nid = cfg->line_out_pins[i];
4024 if (alc880_is_fixed_pin(nid))
4026 /* search for an empty channel */
4027 for (j = 0; j < cfg->line_outs; j++) {
4029 spec->multiout.dac_nids[i] =
4030 alc880_idx_to_dac(j);
4036 spec->multiout.num_dacs = cfg->line_outs;
4040 /* add playback controls from the parsed DAC table */
4041 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4042 const struct auto_pin_cfg *cfg)
4045 static const char *chname[4] = {
4046 "Front", "Surround", NULL /*CLFE*/, "Side"
4051 for (i = 0; i < cfg->line_outs; i++) {
4052 if (!spec->multiout.dac_nids[i])
4054 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4057 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4058 "Center Playback Volume",
4059 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4063 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4064 "LFE Playback Volume",
4065 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4069 err = add_control(spec, ALC_CTL_BIND_MUTE,
4070 "Center Playback Switch",
4071 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4075 err = add_control(spec, ALC_CTL_BIND_MUTE,
4076 "LFE Playback Switch",
4077 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4082 sprintf(name, "%s Playback Volume", chname[i]);
4083 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4084 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4088 sprintf(name, "%s Playback Switch", chname[i]);
4089 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4090 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4099 /* add playback controls for speaker and HP outputs */
4100 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4110 if (alc880_is_fixed_pin(pin)) {
4111 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4112 /* specify the DAC as the extra output */
4113 if (!spec->multiout.hp_nid)
4114 spec->multiout.hp_nid = nid;
4116 spec->multiout.extra_out_nid[0] = nid;
4117 /* control HP volume/switch on the output mixer amp */
4118 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4119 sprintf(name, "%s Playback Volume", pfx);
4120 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4121 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4124 sprintf(name, "%s Playback Switch", pfx);
4125 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4126 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4129 } else if (alc880_is_multi_pin(pin)) {
4130 /* set manual connection */
4131 /* we have only a switch on HP-out PIN */
4132 sprintf(name, "%s Playback Switch", pfx);
4133 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4134 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4141 /* create input playback/capture controls for the given pin */
4142 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4143 const char *ctlname,
4144 int idx, hda_nid_t mix_nid)
4149 sprintf(name, "%s Playback Volume", ctlname);
4150 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4151 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4154 sprintf(name, "%s Playback Switch", ctlname);
4155 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4156 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4162 /* create playback/capture controls for input pins */
4163 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4164 const struct auto_pin_cfg *cfg)
4166 struct hda_input_mux *imux = &spec->private_imux[0];
4169 for (i = 0; i < AUTO_PIN_LAST; i++) {
4170 if (alc880_is_input_pin(cfg->input_pins[i])) {
4171 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4172 err = new_analog_input(spec, cfg->input_pins[i],
4173 auto_pin_cfg_labels[i],
4177 imux->items[imux->num_items].label =
4178 auto_pin_cfg_labels[i];
4179 imux->items[imux->num_items].index =
4180 alc880_input_pin_idx(cfg->input_pins[i]);
4187 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4188 unsigned int pin_type)
4190 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4193 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4197 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4198 hda_nid_t nid, int pin_type,
4201 alc_set_pin_output(codec, nid, pin_type);
4202 /* need the manual connection? */
4203 if (alc880_is_multi_pin(nid)) {
4204 struct alc_spec *spec = codec->spec;
4205 int idx = alc880_multi_pin_idx(nid);
4206 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4207 AC_VERB_SET_CONNECT_SEL,
4208 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4212 static int get_pin_type(int line_out_type)
4214 if (line_out_type == AUTO_PIN_HP_OUT)
4220 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4222 struct alc_spec *spec = codec->spec;
4225 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4226 for (i = 0; i < spec->autocfg.line_outs; i++) {
4227 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4228 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4229 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4233 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4235 struct alc_spec *spec = codec->spec;
4238 pin = spec->autocfg.speaker_pins[0];
4239 if (pin) /* connect to front */
4240 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4241 pin = spec->autocfg.hp_pins[0];
4242 if (pin) /* connect to front */
4243 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4246 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4248 struct alc_spec *spec = codec->spec;
4251 for (i = 0; i < AUTO_PIN_LAST; i++) {
4252 hda_nid_t nid = spec->autocfg.input_pins[i];
4253 if (alc880_is_input_pin(nid)) {
4254 snd_hda_codec_write(codec, nid, 0,
4255 AC_VERB_SET_PIN_WIDGET_CONTROL,
4256 i <= AUTO_PIN_FRONT_MIC ?
4257 PIN_VREF80 : PIN_IN);
4258 if (nid != ALC880_PIN_CD_NID)
4259 snd_hda_codec_write(codec, nid, 0,
4260 AC_VERB_SET_AMP_GAIN_MUTE,
4266 /* parse the BIOS configuration and set up the alc_spec */
4267 /* return 1 if successful, 0 if the proper config is not found,
4268 * or a negative error code
4270 static int alc880_parse_auto_config(struct hda_codec *codec)
4272 struct alc_spec *spec = codec->spec;
4274 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4276 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4280 if (!spec->autocfg.line_outs)
4281 return 0; /* can't find valid BIOS pin config */
4283 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4286 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4289 err = alc880_auto_create_extra_out(spec,
4290 spec->autocfg.speaker_pins[0],
4294 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4298 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4302 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4304 /* check multiple SPDIF-out (for recent codecs) */
4305 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4307 err = snd_hda_get_connections(codec,
4308 spec->autocfg.dig_out_pins[i],
4313 spec->multiout.dig_out_nid = dig_nid;
4315 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4316 spec->slave_dig_outs[i - 1] = dig_nid;
4317 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4321 if (spec->autocfg.dig_in_pin)
4322 spec->dig_in_nid = ALC880_DIGIN_NID;
4324 if (spec->kctls.list)
4325 add_mixer(spec, spec->kctls.list);
4327 add_verb(spec, alc880_volume_init_verbs);
4329 spec->num_mux_defs = 1;
4330 spec->input_mux = &spec->private_imux[0];
4332 store_pin_configs(codec);
4336 /* additional initialization for auto-configuration model */
4337 static void alc880_auto_init(struct hda_codec *codec)
4339 struct alc_spec *spec = codec->spec;
4340 alc880_auto_init_multi_out(codec);
4341 alc880_auto_init_extra_out(codec);
4342 alc880_auto_init_analog_input(codec);
4343 if (spec->unsol_event)
4344 alc_inithook(codec);
4347 static void set_capture_mixer(struct alc_spec *spec)
4349 static struct snd_kcontrol_new *caps[3] = {
4354 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4355 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4358 #define set_beep_amp(spec, nid, idx, dir) \
4359 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4362 * OK, here we have finally the patch for ALC880
4365 static int patch_alc880(struct hda_codec *codec)
4367 struct alc_spec *spec;
4371 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4377 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4380 if (board_config < 0) {
4381 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4382 "trying auto-probe from BIOS...\n");
4383 board_config = ALC880_AUTO;
4386 if (board_config == ALC880_AUTO) {
4387 /* automatic parse from the BIOS config */
4388 err = alc880_parse_auto_config(codec);
4394 "hda_codec: Cannot set up configuration "
4395 "from BIOS. Using 3-stack mode...\n");
4396 board_config = ALC880_3ST;
4400 err = snd_hda_attach_beep_device(codec, 0x1);
4406 if (board_config != ALC880_AUTO)
4407 setup_preset(spec, &alc880_presets[board_config]);
4409 spec->stream_name_analog = "ALC880 Analog";
4410 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4411 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4412 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4414 spec->stream_name_digital = "ALC880 Digital";
4415 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4416 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4418 if (!spec->adc_nids && spec->input_mux) {
4419 /* check whether NID 0x07 is valid */
4420 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4422 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4423 if (wcap != AC_WID_AUD_IN) {
4424 spec->adc_nids = alc880_adc_nids_alt;
4425 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4427 spec->adc_nids = alc880_adc_nids;
4428 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4431 set_capture_mixer(spec);
4432 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4434 spec->vmaster_nid = 0x0c;
4436 codec->patch_ops = alc_patch_ops;
4437 if (board_config == ALC880_AUTO)
4438 spec->init_hook = alc880_auto_init;
4439 #ifdef CONFIG_SND_HDA_POWER_SAVE
4440 if (!spec->loopback.amplist)
4441 spec->loopback.amplist = alc880_loopbacks;
4443 codec->proc_widget_hook = print_realtek_coef;
4453 static hda_nid_t alc260_dac_nids[1] = {
4458 static hda_nid_t alc260_adc_nids[1] = {
4463 static hda_nid_t alc260_adc_nids_alt[1] = {
4468 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4469 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4471 static hda_nid_t alc260_dual_adc_nids[2] = {
4476 #define ALC260_DIGOUT_NID 0x03
4477 #define ALC260_DIGIN_NID 0x06
4479 static struct hda_input_mux alc260_capture_source = {
4483 { "Front Mic", 0x1 },
4489 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4490 * headphone jack and the internal CD lines since these are the only pins at
4491 * which audio can appear. For flexibility, also allow the option of
4492 * recording the mixer output on the second ADC (ADC0 doesn't have a
4493 * connection to the mixer output).
4495 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4499 { "Mic/Line", 0x0 },
4501 { "Headphone", 0x2 },
4507 { "Mic/Line", 0x0 },
4509 { "Headphone", 0x2 },
4516 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4517 * the Fujitsu S702x, but jacks are marked differently.
4519 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4526 { "Headphone", 0x5 },
4535 { "Headphone", 0x6 },
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 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4821 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4823 static struct snd_kcontrol_new alc260_will_mixer[] = {
4824 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4825 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4827 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4828 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4829 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4830 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4831 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4832 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4833 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4837 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4838 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4840 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4841 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4842 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4844 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4845 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4846 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4847 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4848 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4849 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4850 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4855 * initialization verbs
4857 static struct hda_verb alc260_init_verbs[] = {
4858 /* Line In pin widget for input */
4859 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4860 /* CD pin widget for input */
4861 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4862 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4863 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4864 /* Mic2 (front panel) pin widget for input and vref at 80% */
4865 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4866 /* LINE-2 is used for line-out in rear */
4867 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4868 /* select line-out */
4869 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4871 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4873 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4875 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4876 /* mute capture amp left and right */
4877 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4878 /* set connection select to line in (default select for this ADC) */
4879 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4880 /* mute capture amp left and right */
4881 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4882 /* set connection select to line in (default select for this ADC) */
4883 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4884 /* set vol=0 Line-Out mixer amp left and right */
4885 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4886 /* unmute pin widget amp left and right (no gain on this amp) */
4887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4888 /* set vol=0 HP mixer amp left and right */
4889 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4890 /* unmute pin widget amp left and right (no gain on this amp) */
4891 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4892 /* set vol=0 Mono mixer amp left and right */
4893 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4894 /* unmute pin widget amp left and right (no gain on this amp) */
4895 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4896 /* unmute LINE-2 out pin */
4897 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4898 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4901 /* mute analog inputs */
4902 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4907 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4908 /* mute Front out path */
4909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4910 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4911 /* mute Headphone out path */
4912 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4914 /* mute Mono out path */
4915 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4916 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4920 #if 0 /* should be identical with alc260_init_verbs? */
4921 static struct hda_verb alc260_hp_init_verbs[] = {
4922 /* Headphone and output */
4923 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4925 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4926 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4927 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4928 /* Mic2 (front panel) pin widget for input and vref at 80% */
4929 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4930 /* Line In pin widget for input */
4931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4932 /* Line-2 pin widget for output */
4933 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4934 /* CD pin widget for input */
4935 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4936 /* unmute amp left and right */
4937 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4938 /* set connection select to line in (default select for this ADC) */
4939 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4940 /* unmute Line-Out mixer amp left and right (volume = 0) */
4941 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4942 /* mute pin widget amp left and right (no gain on this amp) */
4943 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4944 /* unmute HP mixer amp left and right (volume = 0) */
4945 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4946 /* mute pin widget amp left and right (no gain on this amp) */
4947 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4948 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4951 /* mute analog inputs */
4952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4957 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4958 /* Unmute Front out path */
4959 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4960 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4961 /* Unmute Headphone out path */
4962 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4963 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4964 /* Unmute Mono out path */
4965 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4966 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4971 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4972 /* Line out and output */
4973 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4975 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4976 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4977 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4978 /* Mic2 (front panel) pin widget for input and vref at 80% */
4979 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4980 /* Line In pin widget for input */
4981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4982 /* Headphone pin widget for output */
4983 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4984 /* CD pin widget for input */
4985 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4986 /* unmute amp left and right */
4987 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4988 /* set connection select to line in (default select for this ADC) */
4989 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4990 /* unmute Line-Out mixer amp left and right (volume = 0) */
4991 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4992 /* mute pin widget amp left and right (no gain on this amp) */
4993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4994 /* unmute HP mixer amp left and right (volume = 0) */
4995 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4996 /* mute pin widget amp left and right (no gain on this amp) */
4997 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4998 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5001 /* mute analog inputs */
5002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5007 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5008 /* Unmute Front out path */
5009 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5010 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5011 /* Unmute Headphone out path */
5012 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5013 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5014 /* Unmute Mono out path */
5015 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5016 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5020 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5021 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5022 * audio = 0x16, internal speaker = 0x10.
5024 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5025 /* Disable all GPIOs */
5026 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5027 /* Internal speaker is connected to headphone pin */
5028 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5029 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5030 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5031 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5032 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5033 /* Ensure all other unused pins are disabled and muted. */
5034 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5035 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5036 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5037 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5038 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5039 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5043 /* Disable digital (SPDIF) pins */
5044 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5045 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5047 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5048 * when acting as an output.
5050 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5052 /* Start with output sum widgets muted and their output gains at min */
5053 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5055 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5056 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5057 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5058 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5059 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5060 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5061 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5063 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5064 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5065 /* Unmute Line1 pin widget output buffer since it starts as an output.
5066 * If the pin mode is changed by the user the pin mode control will
5067 * take care of enabling the pin's input/output buffers as needed.
5068 * Therefore there's no need to enable the input buffer at this
5071 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5072 /* Unmute input buffer of pin widget used for Line-in (no equiv
5075 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5077 /* Mute capture amp left and right */
5078 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5079 /* Set ADC connection select to match default mixer setting - line
5082 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5084 /* Do the same for the second ADC: mute capture input amp and
5085 * set ADC connection to line in (on mic1 pin)
5087 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5088 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5090 /* Mute all inputs to mixer widget (even unconnected ones) */
5091 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5092 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5093 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5095 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5103 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5104 * similar laptops (adapted from Fujitsu init verbs).
5106 static struct hda_verb alc260_acer_init_verbs[] = {
5107 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5108 * the headphone jack. Turn this on and rely on the standard mute
5109 * methods whenever the user wants to turn these outputs off.
5111 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5112 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5113 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5114 /* Internal speaker/Headphone jack is connected to Line-out pin */
5115 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5116 /* Internal microphone/Mic jack is connected to Mic1 pin */
5117 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5118 /* Line In jack is connected to Line1 pin */
5119 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5120 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5121 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5122 /* Ensure all other unused pins are disabled and muted. */
5123 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5124 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5125 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5126 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5127 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5128 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5129 /* Disable digital (SPDIF) pins */
5130 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5131 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5133 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5134 * bus when acting as outputs.
5136 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5137 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5139 /* Start with output sum widgets muted and their output gains at min */
5140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5141 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5143 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5146 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5147 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5148 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5150 /* Unmute Line-out pin widget amp left and right
5151 * (no equiv mixer ctrl)
5153 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5154 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5155 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5156 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5157 * inputs. If the pin mode is changed by the user the pin mode control
5158 * will take care of enabling the pin's input/output buffers as needed.
5159 * Therefore there's no need to enable the input buffer at this
5162 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5163 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5165 /* Mute capture amp left and right */
5166 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5167 /* Set ADC connection select to match default mixer setting - mic
5170 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5172 /* Do similar with the second ADC: mute capture input amp and
5173 * set ADC connection to mic to match ALSA's default state.
5175 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5176 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5178 /* Mute all inputs to mixer widget (even unconnected ones) */
5179 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5181 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5191 static struct hda_verb alc260_will_verbs[] = {
5192 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5193 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5194 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5195 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5196 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5197 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5201 static struct hda_verb alc260_replacer_672v_verbs[] = {
5202 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5203 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5204 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5206 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5207 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5208 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5210 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5214 /* toggle speaker-output according to the hp-jack state */
5215 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5217 unsigned int present;
5219 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5220 present = snd_hda_codec_read(codec, 0x0f, 0,
5221 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5223 snd_hda_codec_write_cache(codec, 0x01, 0,
5224 AC_VERB_SET_GPIO_DATA, 1);
5225 snd_hda_codec_write_cache(codec, 0x0f, 0,
5226 AC_VERB_SET_PIN_WIDGET_CONTROL,
5229 snd_hda_codec_write_cache(codec, 0x01, 0,
5230 AC_VERB_SET_GPIO_DATA, 0);
5231 snd_hda_codec_write_cache(codec, 0x0f, 0,
5232 AC_VERB_SET_PIN_WIDGET_CONTROL,
5237 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5240 if ((res >> 26) == ALC880_HP_EVENT)
5241 alc260_replacer_672v_automute(codec);
5244 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5245 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5246 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5247 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5248 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5249 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5250 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5251 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5252 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5253 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5254 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5258 /* Test configuration for debugging, modelled after the ALC880 test
5261 #ifdef CONFIG_SND_DEBUG
5262 static hda_nid_t alc260_test_dac_nids[1] = {
5265 static hda_nid_t alc260_test_adc_nids[2] = {
5268 /* For testing the ALC260, each input MUX needs its own definition since
5269 * the signal assignments are different. This assumes that the first ADC
5272 static struct hda_input_mux alc260_test_capture_sources[2] = {
5276 { "MIC1 pin", 0x0 },
5277 { "MIC2 pin", 0x1 },
5278 { "LINE1 pin", 0x2 },
5279 { "LINE2 pin", 0x3 },
5281 { "LINE-OUT pin", 0x5 },
5282 { "HP-OUT pin", 0x6 },
5288 { "MIC1 pin", 0x0 },
5289 { "MIC2 pin", 0x1 },
5290 { "LINE1 pin", 0x2 },
5291 { "LINE2 pin", 0x3 },
5294 { "LINE-OUT pin", 0x6 },
5295 { "HP-OUT pin", 0x7 },
5299 static struct snd_kcontrol_new alc260_test_mixer[] = {
5300 /* Output driver widgets */
5301 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5302 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5303 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5304 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5305 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5306 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5308 /* Modes for retasking pin widgets
5309 * Note: the ALC260 doesn't seem to act on requests to enable mic
5310 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5311 * mention this restriction. At this stage it's not clear whether
5312 * this behaviour is intentional or is a hardware bug in chip
5313 * revisions available at least up until early 2006. Therefore for
5314 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5315 * choices, but if it turns out that the lack of mic bias for these
5316 * NIDs is intentional we could change their modes from
5317 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5319 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5320 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5321 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5322 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5323 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5324 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5326 /* Loopback mixer controls */
5327 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5328 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5329 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5330 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5331 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5332 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5333 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5334 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5335 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5336 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5337 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5338 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5339 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5340 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5342 /* Controls for GPIO pins, assuming they are configured as outputs */
5343 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5344 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5345 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5346 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5348 /* Switches to allow the digital IO pins to be enabled. The datasheet
5349 * is ambigious as to which NID is which; testing on laptops which
5350 * make this output available should provide clarification.
5352 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5353 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5355 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5356 * this output to turn on an external amplifier.
5358 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5359 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5363 static struct hda_verb alc260_test_init_verbs[] = {
5364 /* Enable all GPIOs as outputs with an initial value of 0 */
5365 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5366 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5367 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5369 /* Enable retasking pins as output, initially without power amp */
5370 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5371 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5373 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5374 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5375 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5377 /* Disable digital (SPDIF) pins initially, but users can enable
5378 * them via a mixer switch. In the case of SPDIF-out, this initverb
5379 * payload also sets the generation to 0, output to be in "consumer"
5380 * PCM format, copyright asserted, no pre-emphasis and no validity
5383 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5384 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5386 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5387 * OUT1 sum bus when acting as an output.
5389 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5390 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5391 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5392 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5394 /* Start with output sum widgets muted and their output gains at min */
5395 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5396 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5398 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5399 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5400 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5401 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5402 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5403 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5405 /* Unmute retasking pin widget output buffers since the default
5406 * state appears to be output. As the pin mode is changed by the
5407 * user the pin mode control will take care of enabling the pin's
5408 * input/output buffers as needed.
5410 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5412 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5413 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5414 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5415 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5416 /* Also unmute the mono-out pin widget */
5417 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5419 /* Mute capture amp left and right */
5420 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5421 /* Set ADC connection select to match default mixer setting (mic1
5424 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5426 /* Do the same for the second ADC: mute capture input amp and
5427 * set ADC connection to mic1 pin
5429 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5430 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5432 /* Mute all inputs to mixer widget (even unconnected ones) */
5433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5446 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5447 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5449 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5450 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5453 * for BIOS auto-configuration
5456 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5457 const char *pfx, int *vol_bits)
5460 unsigned long vol_val, sw_val;
5464 if (nid >= 0x0f && nid < 0x11) {
5465 nid_vol = nid - 0x7;
5466 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5467 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5468 } else if (nid == 0x11) {
5469 nid_vol = nid - 0x7;
5470 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5471 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5472 } else if (nid >= 0x12 && nid <= 0x15) {
5474 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5475 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5479 if (!(*vol_bits & (1 << nid_vol))) {
5480 /* first control for the volume widget */
5481 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5482 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5485 *vol_bits |= (1 << nid_vol);
5487 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5488 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5494 /* add playback controls from the parsed DAC table */
5495 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5496 const struct auto_pin_cfg *cfg)
5502 spec->multiout.num_dacs = 1;
5503 spec->multiout.dac_nids = spec->private_dac_nids;
5504 spec->multiout.dac_nids[0] = 0x02;
5506 nid = cfg->line_out_pins[0];
5508 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5513 nid = cfg->speaker_pins[0];
5515 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5520 nid = cfg->hp_pins[0];
5522 err = alc260_add_playback_controls(spec, nid, "Headphone",
5530 /* create playback/capture controls for input pins */
5531 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5532 const struct auto_pin_cfg *cfg)
5534 struct hda_input_mux *imux = &spec->private_imux[0];
5537 for (i = 0; i < AUTO_PIN_LAST; i++) {
5538 if (cfg->input_pins[i] >= 0x12) {
5539 idx = cfg->input_pins[i] - 0x12;
5540 err = new_analog_input(spec, cfg->input_pins[i],
5541 auto_pin_cfg_labels[i], idx,
5545 imux->items[imux->num_items].label =
5546 auto_pin_cfg_labels[i];
5547 imux->items[imux->num_items].index = idx;
5550 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5551 idx = cfg->input_pins[i] - 0x09;
5552 err = new_analog_input(spec, cfg->input_pins[i],
5553 auto_pin_cfg_labels[i], idx,
5557 imux->items[imux->num_items].label =
5558 auto_pin_cfg_labels[i];
5559 imux->items[imux->num_items].index = idx;
5566 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5567 hda_nid_t nid, int pin_type,
5570 alc_set_pin_output(codec, nid, pin_type);
5571 /* need the manual connection? */
5573 int idx = nid - 0x12;
5574 snd_hda_codec_write(codec, idx + 0x0b, 0,
5575 AC_VERB_SET_CONNECT_SEL, sel_idx);
5579 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5581 struct alc_spec *spec = codec->spec;
5584 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5585 nid = spec->autocfg.line_out_pins[0];
5587 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5588 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5591 nid = spec->autocfg.speaker_pins[0];
5593 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5595 nid = spec->autocfg.hp_pins[0];
5597 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5600 #define ALC260_PIN_CD_NID 0x16
5601 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5603 struct alc_spec *spec = codec->spec;
5606 for (i = 0; i < AUTO_PIN_LAST; i++) {
5607 hda_nid_t nid = spec->autocfg.input_pins[i];
5609 snd_hda_codec_write(codec, nid, 0,
5610 AC_VERB_SET_PIN_WIDGET_CONTROL,
5611 i <= AUTO_PIN_FRONT_MIC ?
5612 PIN_VREF80 : PIN_IN);
5613 if (nid != ALC260_PIN_CD_NID)
5614 snd_hda_codec_write(codec, nid, 0,
5615 AC_VERB_SET_AMP_GAIN_MUTE,
5622 * generic initialization of ADC, input mixers and output mixers
5624 static struct hda_verb alc260_volume_init_verbs[] = {
5626 * Unmute ADC0-1 and set the default input to mic-in
5628 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5629 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5630 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5631 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5633 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5635 * Note: PASD motherboards uses the Line In 2 as the input for
5636 * front panel mic (mic 2)
5638 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5639 /* mute analog inputs */
5640 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5641 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5642 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5643 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5644 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5647 * Set up output mixers (0x08 - 0x0a)
5649 /* set vol=0 to output mixers */
5650 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5651 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5652 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5653 /* set up input amps for analog loopback */
5654 /* Amp Indices: DAC = 0, mixer = 1 */
5655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5656 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5659 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5660 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5665 static int alc260_parse_auto_config(struct hda_codec *codec)
5667 struct alc_spec *spec = codec->spec;
5669 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5671 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5675 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5678 if (!spec->kctls.list)
5679 return 0; /* can't find valid BIOS pin config */
5680 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5684 spec->multiout.max_channels = 2;
5686 if (spec->autocfg.dig_outs)
5687 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5688 if (spec->kctls.list)
5689 add_mixer(spec, spec->kctls.list);
5691 add_verb(spec, alc260_volume_init_verbs);
5693 spec->num_mux_defs = 1;
5694 spec->input_mux = &spec->private_imux[0];
5696 store_pin_configs(codec);
5700 /* additional initialization for auto-configuration model */
5701 static void alc260_auto_init(struct hda_codec *codec)
5703 struct alc_spec *spec = codec->spec;
5704 alc260_auto_init_multi_out(codec);
5705 alc260_auto_init_analog_input(codec);
5706 if (spec->unsol_event)
5707 alc_inithook(codec);
5710 #ifdef CONFIG_SND_HDA_POWER_SAVE
5711 static struct hda_amp_list alc260_loopbacks[] = {
5712 { 0x07, HDA_INPUT, 0 },
5713 { 0x07, HDA_INPUT, 1 },
5714 { 0x07, HDA_INPUT, 2 },
5715 { 0x07, HDA_INPUT, 3 },
5716 { 0x07, HDA_INPUT, 4 },
5722 * ALC260 configurations
5724 static const char *alc260_models[ALC260_MODEL_LAST] = {
5725 [ALC260_BASIC] = "basic",
5727 [ALC260_HP_3013] = "hp-3013",
5728 [ALC260_HP_DC7600] = "hp-dc7600",
5729 [ALC260_FUJITSU_S702X] = "fujitsu",
5730 [ALC260_ACER] = "acer",
5731 [ALC260_WILL] = "will",
5732 [ALC260_REPLACER_672V] = "replacer",
5733 #ifdef CONFIG_SND_DEBUG
5734 [ALC260_TEST] = "test",
5736 [ALC260_AUTO] = "auto",
5739 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5740 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5741 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5742 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5743 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5744 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5745 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5746 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5747 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5748 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5749 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5750 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5751 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5752 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5753 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5754 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5755 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5756 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5757 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5761 static struct alc_config_preset alc260_presets[] = {
5763 .mixers = { alc260_base_output_mixer,
5764 alc260_input_mixer },
5765 .init_verbs = { alc260_init_verbs },
5766 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5767 .dac_nids = alc260_dac_nids,
5768 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5769 .adc_nids = alc260_adc_nids,
5770 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5771 .channel_mode = alc260_modes,
5772 .input_mux = &alc260_capture_source,
5775 .mixers = { alc260_hp_output_mixer,
5776 alc260_input_mixer },
5777 .init_verbs = { alc260_init_verbs,
5778 alc260_hp_unsol_verbs },
5779 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5780 .dac_nids = alc260_dac_nids,
5781 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5782 .adc_nids = alc260_adc_nids_alt,
5783 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5784 .channel_mode = alc260_modes,
5785 .input_mux = &alc260_capture_source,
5786 .unsol_event = alc260_hp_unsol_event,
5787 .init_hook = alc260_hp_automute,
5789 [ALC260_HP_DC7600] = {
5790 .mixers = { alc260_hp_dc7600_mixer,
5791 alc260_input_mixer },
5792 .init_verbs = { alc260_init_verbs,
5793 alc260_hp_dc7600_verbs },
5794 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5795 .dac_nids = alc260_dac_nids,
5796 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5797 .adc_nids = alc260_adc_nids_alt,
5798 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5799 .channel_mode = alc260_modes,
5800 .input_mux = &alc260_capture_source,
5801 .unsol_event = alc260_hp_3012_unsol_event,
5802 .init_hook = alc260_hp_3012_automute,
5804 [ALC260_HP_3013] = {
5805 .mixers = { alc260_hp_3013_mixer,
5806 alc260_input_mixer },
5807 .init_verbs = { alc260_hp_3013_init_verbs,
5808 alc260_hp_3013_unsol_verbs },
5809 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5810 .dac_nids = alc260_dac_nids,
5811 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5812 .adc_nids = alc260_adc_nids_alt,
5813 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5814 .channel_mode = alc260_modes,
5815 .input_mux = &alc260_capture_source,
5816 .unsol_event = alc260_hp_3013_unsol_event,
5817 .init_hook = alc260_hp_3013_automute,
5819 [ALC260_FUJITSU_S702X] = {
5820 .mixers = { alc260_fujitsu_mixer },
5821 .init_verbs = { alc260_fujitsu_init_verbs },
5822 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5823 .dac_nids = alc260_dac_nids,
5824 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5825 .adc_nids = alc260_dual_adc_nids,
5826 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5827 .channel_mode = alc260_modes,
5828 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5829 .input_mux = alc260_fujitsu_capture_sources,
5832 .mixers = { alc260_acer_mixer },
5833 .init_verbs = { alc260_acer_init_verbs },
5834 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5835 .dac_nids = alc260_dac_nids,
5836 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5837 .adc_nids = alc260_dual_adc_nids,
5838 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5839 .channel_mode = alc260_modes,
5840 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5841 .input_mux = alc260_acer_capture_sources,
5844 .mixers = { alc260_will_mixer },
5845 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5846 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5847 .dac_nids = alc260_dac_nids,
5848 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5849 .adc_nids = alc260_adc_nids,
5850 .dig_out_nid = ALC260_DIGOUT_NID,
5851 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5852 .channel_mode = alc260_modes,
5853 .input_mux = &alc260_capture_source,
5855 [ALC260_REPLACER_672V] = {
5856 .mixers = { alc260_replacer_672v_mixer },
5857 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5858 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5859 .dac_nids = alc260_dac_nids,
5860 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5861 .adc_nids = alc260_adc_nids,
5862 .dig_out_nid = ALC260_DIGOUT_NID,
5863 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5864 .channel_mode = alc260_modes,
5865 .input_mux = &alc260_capture_source,
5866 .unsol_event = alc260_replacer_672v_unsol_event,
5867 .init_hook = alc260_replacer_672v_automute,
5869 #ifdef CONFIG_SND_DEBUG
5871 .mixers = { alc260_test_mixer },
5872 .init_verbs = { alc260_test_init_verbs },
5873 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5874 .dac_nids = alc260_test_dac_nids,
5875 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5876 .adc_nids = alc260_test_adc_nids,
5877 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5878 .channel_mode = alc260_modes,
5879 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5880 .input_mux = alc260_test_capture_sources,
5885 static int patch_alc260(struct hda_codec *codec)
5887 struct alc_spec *spec;
5888 int err, board_config;
5890 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5896 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5899 if (board_config < 0) {
5900 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5901 "trying auto-probe from BIOS...\n");
5902 board_config = ALC260_AUTO;
5905 if (board_config == ALC260_AUTO) {
5906 /* automatic parse from the BIOS config */
5907 err = alc260_parse_auto_config(codec);
5913 "hda_codec: Cannot set up configuration "
5914 "from BIOS. Using base mode...\n");
5915 board_config = ALC260_BASIC;
5919 err = snd_hda_attach_beep_device(codec, 0x1);
5925 if (board_config != ALC260_AUTO)
5926 setup_preset(spec, &alc260_presets[board_config]);
5928 spec->stream_name_analog = "ALC260 Analog";
5929 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5930 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5932 spec->stream_name_digital = "ALC260 Digital";
5933 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5934 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5936 if (!spec->adc_nids && spec->input_mux) {
5937 /* check whether NID 0x04 is valid */
5938 unsigned int wcap = get_wcaps(codec, 0x04);
5939 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5941 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5942 spec->adc_nids = alc260_adc_nids_alt;
5943 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5945 spec->adc_nids = alc260_adc_nids;
5946 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5949 set_capture_mixer(spec);
5950 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
5952 spec->vmaster_nid = 0x08;
5954 codec->patch_ops = alc_patch_ops;
5955 if (board_config == ALC260_AUTO)
5956 spec->init_hook = alc260_auto_init;
5957 #ifdef CONFIG_SND_HDA_POWER_SAVE
5958 if (!spec->loopback.amplist)
5959 spec->loopback.amplist = alc260_loopbacks;
5961 codec->proc_widget_hook = print_realtek_coef;
5970 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5971 * configuration. Each pin widget can choose any input DACs and a mixer.
5972 * Each ADC is connected from a mixer of all inputs. This makes possible
5973 * 6-channel independent captures.
5975 * In addition, an independent DAC for the multi-playback (not used in this
5978 #define ALC882_DIGOUT_NID 0x06
5979 #define ALC882_DIGIN_NID 0x0a
5981 static struct hda_channel_mode alc882_ch_modes[1] = {
5985 static hda_nid_t alc882_dac_nids[4] = {
5986 /* front, rear, clfe, rear_surr */
5987 0x02, 0x03, 0x04, 0x05
5990 /* identical with ALC880 */
5991 #define alc882_adc_nids alc880_adc_nids
5992 #define alc882_adc_nids_alt alc880_adc_nids_alt
5994 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5995 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5998 /* FIXME: should be a matrix-type input source selection */
6000 static struct hda_input_mux alc882_capture_source = {
6004 { "Front Mic", 0x1 },
6012 static struct hda_verb alc882_3ST_ch2_init[] = {
6013 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6014 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6015 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6016 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6023 static struct hda_verb alc882_3ST_ch6_init[] = {
6024 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6025 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6026 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6027 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6028 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6029 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6033 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6034 { 2, alc882_3ST_ch2_init },
6035 { 6, alc882_3ST_ch6_init },
6041 static struct hda_verb alc882_sixstack_ch6_init[] = {
6042 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6043 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6044 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6045 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6052 static struct hda_verb alc882_sixstack_ch8_init[] = {
6053 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6054 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6055 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6056 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6060 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6061 { 6, alc882_sixstack_ch6_init },
6062 { 8, alc882_sixstack_ch8_init },
6066 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6072 static struct hda_verb alc885_mbp_ch2_init[] = {
6073 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6074 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6075 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6082 static struct hda_verb alc885_mbp_ch6_init[] = {
6083 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6084 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6085 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6086 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6087 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6091 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6092 { 2, alc885_mbp_ch2_init },
6093 { 6, alc885_mbp_ch6_init },
6097 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6098 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6100 static struct snd_kcontrol_new alc882_base_mixer[] = {
6101 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6102 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6103 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6104 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6105 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6106 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6107 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6108 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6109 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6110 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6111 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6112 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6113 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6115 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6119 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6120 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6121 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6125 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6127 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6128 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6129 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6131 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6133 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6134 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6138 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6139 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6140 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6151 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6152 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6153 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6155 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6156 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6157 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6158 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6159 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6160 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6161 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6162 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6163 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6164 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6168 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6169 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6171 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6173 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6175 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6180 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6181 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6184 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6188 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6189 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6190 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6192 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6193 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6194 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6195 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6197 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6202 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6204 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6205 .name = "Channel Mode",
6206 .info = alc_ch_mode_info,
6207 .get = alc_ch_mode_get,
6208 .put = alc_ch_mode_put,
6213 static struct hda_verb alc882_init_verbs[] = {
6214 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6216 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6219 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6220 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6221 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6223 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6224 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6225 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6227 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6228 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6229 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6231 /* Front Pin: output 0 (0x0c) */
6232 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6233 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6234 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6235 /* Rear Pin: output 1 (0x0d) */
6236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6237 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6238 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6239 /* CLFE Pin: output 2 (0x0e) */
6240 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6241 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6242 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6243 /* Side Pin: output 3 (0x0f) */
6244 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6245 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6246 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6247 /* Mic (rear) pin: input vref at 80% */
6248 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6249 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6250 /* Front Mic pin: input vref at 80% */
6251 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6252 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6253 /* Line In pin: input */
6254 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6255 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6256 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6257 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6258 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6259 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6260 /* CD pin widget for input */
6261 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6263 /* FIXME: use matrix-type input source selection */
6264 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6265 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6267 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6273 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6274 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6276 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6278 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6279 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6280 /* ADC1: mute amp left and right */
6281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6282 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6283 /* ADC2: mute amp left and right */
6284 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6285 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6286 /* ADC3: mute amp left and right */
6287 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6288 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6293 static struct hda_verb alc882_eapd_verbs[] = {
6294 /* change to EAPD mode */
6295 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6296 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6301 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6302 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6303 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6304 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6305 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6306 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6307 /* FIXME: this looks suspicious...
6308 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6309 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6314 static struct hda_verb alc882_macpro_init_verbs[] = {
6315 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6319 /* Front Pin: output 0 (0x0c) */
6320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6321 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6322 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6323 /* Front Mic pin: input vref at 80% */
6324 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6325 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6326 /* Speaker: output */
6327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6328 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6329 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6330 /* Headphone output (output 0 - 0x0c) */
6331 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6332 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6333 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6335 /* FIXME: use matrix-type input source selection */
6336 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6337 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6348 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6352 /* ADC1: mute amp left and right */
6353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6354 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6355 /* ADC2: mute amp left and right */
6356 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6357 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6358 /* ADC3: mute amp left and right */
6359 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6360 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6365 /* Macbook Pro rev3 */
6366 static struct hda_verb alc885_mbp3_init_verbs[] = {
6367 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6368 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6369 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6372 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6375 /* Front Pin: output 0 (0x0c) */
6376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6377 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6378 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6379 /* HP Pin: output 0 (0x0d) */
6380 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6381 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6382 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6383 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6384 /* Mic (rear) pin: input vref at 80% */
6385 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6386 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6387 /* Front Mic pin: input vref at 80% */
6388 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6389 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6390 /* Line In pin: use output 1 when in LineOut mode */
6391 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6392 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6393 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6395 /* FIXME: use matrix-type input source selection */
6396 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6397 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6408 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6412 /* ADC1: mute amp left and right */
6413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6414 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6415 /* ADC2: mute amp left and right */
6416 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6417 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6418 /* ADC3: mute amp left and right */
6419 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6420 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6425 /* iMac 24 mixer. */
6426 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6427 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6428 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6432 /* iMac 24 init verbs. */
6433 static struct hda_verb alc885_imac24_init_verbs[] = {
6434 /* Internal speakers: output 0 (0x0c) */
6435 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6436 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6437 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6438 /* Internal speakers: output 0 (0x0c) */
6439 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6440 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6441 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6442 /* Headphone: output 0 (0x0c) */
6443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6445 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6446 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6447 /* Front Mic: input vref at 80% */
6448 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6453 /* Toggle speaker-output according to the hp-jack state */
6454 static void alc885_imac24_automute(struct hda_codec *codec)
6456 unsigned int present;
6458 present = snd_hda_codec_read(codec, 0x14, 0,
6459 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6460 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6461 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6462 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6463 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6466 /* Processes unsolicited events. */
6467 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6470 /* Headphone insertion or removal. */
6471 if ((res >> 26) == ALC880_HP_EVENT)
6472 alc885_imac24_automute(codec);
6475 static void alc885_mbp3_automute(struct hda_codec *codec)
6477 unsigned int present;
6479 present = snd_hda_codec_read(codec, 0x15, 0,
6480 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6481 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6482 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6483 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6484 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6487 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6490 /* Headphone insertion or removal. */
6491 if ((res >> 26) == ALC880_HP_EVENT)
6492 alc885_mbp3_automute(codec);
6496 static struct hda_verb alc882_targa_verbs[] = {
6497 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6498 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6501 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6503 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6504 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6505 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6507 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6508 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6509 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6510 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6514 /* toggle speaker-output according to the hp-jack state */
6515 static void alc882_targa_automute(struct hda_codec *codec)
6517 unsigned int present;
6519 present = snd_hda_codec_read(codec, 0x14, 0,
6520 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6521 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6522 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6523 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6527 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6529 /* Looks like the unsol event is incompatible with the standard
6530 * definition. 4bit tag is placed at 26 bit!
6532 if (((res >> 26) == ALC880_HP_EVENT)) {
6533 alc882_targa_automute(codec);
6537 static struct hda_verb alc882_asus_a7j_verbs[] = {
6538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6541 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6542 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6543 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6545 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6546 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6547 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6549 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6550 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6551 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6555 static struct hda_verb alc882_asus_a7m_verbs[] = {
6556 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6557 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6559 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6560 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6561 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6563 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6564 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6565 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6567 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6568 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6569 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6573 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6575 unsigned int gpiostate, gpiomask, gpiodir;
6577 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6578 AC_VERB_GET_GPIO_DATA, 0);
6581 gpiostate |= (1 << pin);
6583 gpiostate &= ~(1 << pin);
6585 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6586 AC_VERB_GET_GPIO_MASK, 0);
6587 gpiomask |= (1 << pin);
6589 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6590 AC_VERB_GET_GPIO_DIRECTION, 0);
6591 gpiodir |= (1 << pin);
6594 snd_hda_codec_write(codec, codec->afg, 0,
6595 AC_VERB_SET_GPIO_MASK, gpiomask);
6596 snd_hda_codec_write(codec, codec->afg, 0,
6597 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6601 snd_hda_codec_write(codec, codec->afg, 0,
6602 AC_VERB_SET_GPIO_DATA, gpiostate);
6605 /* set up GPIO at initialization */
6606 static void alc885_macpro_init_hook(struct hda_codec *codec)
6608 alc882_gpio_mute(codec, 0, 0);
6609 alc882_gpio_mute(codec, 1, 0);
6612 /* set up GPIO and update auto-muting at initialization */
6613 static void alc885_imac24_init_hook(struct hda_codec *codec)
6615 alc885_macpro_init_hook(codec);
6616 alc885_imac24_automute(codec);
6620 * generic initialization of ADC, input mixers and output mixers
6622 static struct hda_verb alc882_auto_init_verbs[] = {
6624 * Unmute ADC0-2 and set the default input to mic-in
6626 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6627 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6628 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6629 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6630 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6633 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6635 * Note: PASD motherboards uses the Line In 2 as the input for
6636 * front panel mic (mic 2)
6638 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6646 * Set up output mixers (0x0c - 0x0f)
6648 /* set vol=0 to output mixers */
6649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6650 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6651 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6652 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6653 /* set up input amps for analog loopback */
6654 /* Amp Indices: DAC = 0, mixer = 1 */
6655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6659 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6661 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6662 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6663 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6664 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6666 /* FIXME: use matrix-type input source selection */
6667 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6668 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6669 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6670 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6671 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6674 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6675 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6676 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6687 #ifdef CONFIG_SND_HDA_POWER_SAVE
6688 #define alc882_loopbacks alc880_loopbacks
6691 /* pcm configuration: identiacal with ALC880 */
6692 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6693 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6694 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6695 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6698 * configuration and preset
6700 static const char *alc882_models[ALC882_MODEL_LAST] = {
6701 [ALC882_3ST_DIG] = "3stack-dig",
6702 [ALC882_6ST_DIG] = "6stack-dig",
6703 [ALC882_ARIMA] = "arima",
6704 [ALC882_W2JC] = "w2jc",
6705 [ALC882_TARGA] = "targa",
6706 [ALC882_ASUS_A7J] = "asus-a7j",
6707 [ALC882_ASUS_A7M] = "asus-a7m",
6708 [ALC885_MACPRO] = "macpro",
6709 [ALC885_MBP3] = "mbp3",
6710 [ALC885_IMAC24] = "imac24",
6711 [ALC882_AUTO] = "auto",
6714 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6715 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6716 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6717 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6718 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6719 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6720 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6721 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6722 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6723 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6724 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6725 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6726 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6730 static struct alc_config_preset alc882_presets[] = {
6731 [ALC882_3ST_DIG] = {
6732 .mixers = { alc882_base_mixer },
6733 .init_verbs = { alc882_init_verbs },
6734 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6735 .dac_nids = alc882_dac_nids,
6736 .dig_out_nid = ALC882_DIGOUT_NID,
6737 .dig_in_nid = ALC882_DIGIN_NID,
6738 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6739 .channel_mode = alc882_ch_modes,
6741 .input_mux = &alc882_capture_source,
6743 [ALC882_6ST_DIG] = {
6744 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6745 .init_verbs = { alc882_init_verbs },
6746 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6747 .dac_nids = alc882_dac_nids,
6748 .dig_out_nid = ALC882_DIGOUT_NID,
6749 .dig_in_nid = ALC882_DIGIN_NID,
6750 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6751 .channel_mode = alc882_sixstack_modes,
6752 .input_mux = &alc882_capture_source,
6755 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6756 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6757 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6758 .dac_nids = alc882_dac_nids,
6759 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6760 .channel_mode = alc882_sixstack_modes,
6761 .input_mux = &alc882_capture_source,
6764 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6765 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6766 alc880_gpio1_init_verbs },
6767 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6768 .dac_nids = alc882_dac_nids,
6769 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6770 .channel_mode = alc880_threestack_modes,
6772 .input_mux = &alc882_capture_source,
6773 .dig_out_nid = ALC882_DIGOUT_NID,
6776 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6777 .init_verbs = { alc885_mbp3_init_verbs,
6778 alc880_gpio1_init_verbs },
6779 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6780 .dac_nids = alc882_dac_nids,
6781 .channel_mode = alc885_mbp_6ch_modes,
6782 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6783 .input_mux = &alc882_capture_source,
6784 .dig_out_nid = ALC882_DIGOUT_NID,
6785 .dig_in_nid = ALC882_DIGIN_NID,
6786 .unsol_event = alc885_mbp3_unsol_event,
6787 .init_hook = alc885_mbp3_automute,
6790 .mixers = { alc882_macpro_mixer },
6791 .init_verbs = { alc882_macpro_init_verbs },
6792 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6793 .dac_nids = alc882_dac_nids,
6794 .dig_out_nid = ALC882_DIGOUT_NID,
6795 .dig_in_nid = ALC882_DIGIN_NID,
6796 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6797 .channel_mode = alc882_ch_modes,
6798 .input_mux = &alc882_capture_source,
6799 .init_hook = alc885_macpro_init_hook,
6802 .mixers = { alc885_imac24_mixer },
6803 .init_verbs = { alc885_imac24_init_verbs },
6804 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6805 .dac_nids = alc882_dac_nids,
6806 .dig_out_nid = ALC882_DIGOUT_NID,
6807 .dig_in_nid = ALC882_DIGIN_NID,
6808 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6809 .channel_mode = alc882_ch_modes,
6810 .input_mux = &alc882_capture_source,
6811 .unsol_event = alc885_imac24_unsol_event,
6812 .init_hook = alc885_imac24_init_hook,
6815 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6816 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6817 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6818 .dac_nids = alc882_dac_nids,
6819 .dig_out_nid = ALC882_DIGOUT_NID,
6820 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6821 .adc_nids = alc882_adc_nids,
6822 .capsrc_nids = alc882_capsrc_nids,
6823 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6824 .channel_mode = alc882_3ST_6ch_modes,
6826 .input_mux = &alc882_capture_source,
6827 .unsol_event = alc882_targa_unsol_event,
6828 .init_hook = alc882_targa_automute,
6830 [ALC882_ASUS_A7J] = {
6831 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6832 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6833 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6834 .dac_nids = alc882_dac_nids,
6835 .dig_out_nid = ALC882_DIGOUT_NID,
6836 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6837 .adc_nids = alc882_adc_nids,
6838 .capsrc_nids = alc882_capsrc_nids,
6839 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6840 .channel_mode = alc882_3ST_6ch_modes,
6842 .input_mux = &alc882_capture_source,
6844 [ALC882_ASUS_A7M] = {
6845 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6846 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6847 alc880_gpio1_init_verbs,
6848 alc882_asus_a7m_verbs },
6849 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6850 .dac_nids = alc882_dac_nids,
6851 .dig_out_nid = ALC882_DIGOUT_NID,
6852 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6853 .channel_mode = alc880_threestack_modes,
6855 .input_mux = &alc882_capture_source,
6864 PINFIX_ABIT_AW9D_MAX
6867 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6868 { 0x15, 0x01080104 }, /* side */
6869 { 0x16, 0x01011012 }, /* rear */
6870 { 0x17, 0x01016011 }, /* clfe */
6874 static const struct alc_pincfg *alc882_pin_fixes[] = {
6875 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6878 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6879 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6884 * BIOS auto configuration
6886 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6887 hda_nid_t nid, int pin_type,
6891 struct alc_spec *spec = codec->spec;
6894 alc_set_pin_output(codec, nid, pin_type);
6895 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6898 idx = spec->multiout.dac_nids[dac_idx] - 2;
6899 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6903 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6905 struct alc_spec *spec = codec->spec;
6908 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6909 for (i = 0; i <= HDA_SIDE; i++) {
6910 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6911 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6913 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6918 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6920 struct alc_spec *spec = codec->spec;
6923 pin = spec->autocfg.hp_pins[0];
6924 if (pin) /* connect to front */
6926 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6927 pin = spec->autocfg.speaker_pins[0];
6929 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6932 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6933 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6935 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6937 struct alc_spec *spec = codec->spec;
6940 for (i = 0; i < AUTO_PIN_LAST; i++) {
6941 hda_nid_t nid = spec->autocfg.input_pins[i];
6946 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6947 unsigned int pincap;
6948 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6949 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6953 snd_hda_codec_write(codec, nid, 0,
6954 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6955 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6956 snd_hda_codec_write(codec, nid, 0,
6957 AC_VERB_SET_AMP_GAIN_MUTE,
6962 static void alc882_auto_init_input_src(struct hda_codec *codec)
6964 struct alc_spec *spec = codec->spec;
6967 for (c = 0; c < spec->num_adc_nids; c++) {
6968 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6969 hda_nid_t nid = spec->capsrc_nids[c];
6970 unsigned int mux_idx;
6971 const struct hda_input_mux *imux;
6972 int conns, mute, idx, item;
6974 conns = snd_hda_get_connections(codec, nid, conn_list,
6975 ARRAY_SIZE(conn_list));
6978 mux_idx = c >= spec->num_mux_defs ? 0 : c;
6979 imux = &spec->input_mux[mux_idx];
6980 for (idx = 0; idx < conns; idx++) {
6981 /* if the current connection is the selected one,
6982 * unmute it as default - otherwise mute it
6984 mute = AMP_IN_MUTE(idx);
6985 for (item = 0; item < imux->num_items; item++) {
6986 if (imux->items[item].index == idx) {
6987 if (spec->cur_mux[c] == item)
6988 mute = AMP_IN_UNMUTE(idx);
6992 /* check if we have a selector or mixer
6993 * we could check for the widget type instead, but
6994 * just check for Amp-In presence (in case of mixer
6995 * without amp-in there is something wrong, this
6996 * function shouldn't be used or capsrc nid is wrong)
6998 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
6999 snd_hda_codec_write(codec, nid, 0,
7000 AC_VERB_SET_AMP_GAIN_MUTE,
7002 else if (mute != AMP_IN_MUTE(idx))
7003 snd_hda_codec_write(codec, nid, 0,
7004 AC_VERB_SET_CONNECT_SEL,
7010 /* add mic boosts if needed */
7011 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7013 struct alc_spec *spec = codec->spec;
7017 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7018 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7019 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7021 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7025 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7026 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7027 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7029 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7036 /* almost identical with ALC880 parser... */
7037 static int alc882_parse_auto_config(struct hda_codec *codec)
7039 struct alc_spec *spec = codec->spec;
7040 int err = alc880_parse_auto_config(codec);
7045 return 0; /* no config found */
7047 err = alc_auto_add_mic_boost(codec);
7051 /* hack - override the init verbs */
7052 spec->init_verbs[0] = alc882_auto_init_verbs;
7054 return 1; /* config found */
7057 /* additional initialization for auto-configuration model */
7058 static void alc882_auto_init(struct hda_codec *codec)
7060 struct alc_spec *spec = codec->spec;
7061 alc882_auto_init_multi_out(codec);
7062 alc882_auto_init_hp_out(codec);
7063 alc882_auto_init_analog_input(codec);
7064 alc882_auto_init_input_src(codec);
7065 if (spec->unsol_event)
7066 alc_inithook(codec);
7069 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7071 static int patch_alc882(struct hda_codec *codec)
7073 struct alc_spec *spec;
7074 int err, board_config;
7076 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7082 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7086 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7087 /* Pick up systems that don't supply PCI SSID */
7088 switch (codec->subsystem_id) {
7089 case 0x106b0c00: /* Mac Pro */
7090 board_config = ALC885_MACPRO;
7092 case 0x106b1000: /* iMac 24 */
7093 case 0x106b2800: /* AppleTV */
7094 case 0x106b3e00: /* iMac 24 Aluminium */
7095 board_config = ALC885_IMAC24;
7097 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7098 case 0x106b00a4: /* MacbookPro4,1 */
7099 case 0x106b2c00: /* Macbook Pro rev3 */
7100 case 0x106b3600: /* Macbook 3.1 */
7101 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7102 board_config = ALC885_MBP3;
7105 /* ALC889A is handled better as ALC888-compatible */
7106 if (codec->revision_id == 0x100101 ||
7107 codec->revision_id == 0x100103) {
7109 return patch_alc883(codec);
7111 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7112 "trying auto-probe from BIOS...\n");
7113 board_config = ALC882_AUTO;
7117 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7119 if (board_config == ALC882_AUTO) {
7120 /* automatic parse from the BIOS config */
7121 err = alc882_parse_auto_config(codec);
7127 "hda_codec: Cannot set up configuration "
7128 "from BIOS. Using base mode...\n");
7129 board_config = ALC882_3ST_DIG;
7133 err = snd_hda_attach_beep_device(codec, 0x1);
7139 if (board_config != ALC882_AUTO)
7140 setup_preset(spec, &alc882_presets[board_config]);
7142 if (codec->vendor_id == 0x10ec0885) {
7143 spec->stream_name_analog = "ALC885 Analog";
7144 spec->stream_name_digital = "ALC885 Digital";
7146 spec->stream_name_analog = "ALC882 Analog";
7147 spec->stream_name_digital = "ALC882 Digital";
7150 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7151 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7152 /* FIXME: setup DAC5 */
7153 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7154 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7156 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7157 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7159 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7160 if (!spec->adc_nids && spec->input_mux) {
7161 /* check whether NID 0x07 is valid */
7162 unsigned int wcap = get_wcaps(codec, 0x07);
7164 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7165 if (wcap != AC_WID_AUD_IN) {
7166 spec->adc_nids = alc882_adc_nids_alt;
7167 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7168 spec->capsrc_nids = alc882_capsrc_nids_alt;
7170 spec->adc_nids = alc882_adc_nids;
7171 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7172 spec->capsrc_nids = alc882_capsrc_nids;
7175 set_capture_mixer(spec);
7176 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7178 spec->vmaster_nid = 0x0c;
7180 codec->patch_ops = alc_patch_ops;
7181 if (board_config == ALC882_AUTO)
7182 spec->init_hook = alc882_auto_init;
7183 #ifdef CONFIG_SND_HDA_POWER_SAVE
7184 if (!spec->loopback.amplist)
7185 spec->loopback.amplist = alc882_loopbacks;
7187 codec->proc_widget_hook = print_realtek_coef;
7195 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7196 * configuration. Each pin widget can choose any input DACs and a mixer.
7197 * Each ADC is connected from a mixer of all inputs. This makes possible
7198 * 6-channel independent captures.
7200 * In addition, an independent DAC for the multi-playback (not used in this
7203 #define ALC883_DIGOUT_NID 0x06
7204 #define ALC883_DIGIN_NID 0x0a
7206 #define ALC1200_DIGOUT_NID 0x10
7208 static hda_nid_t alc883_dac_nids[4] = {
7209 /* front, rear, clfe, rear_surr */
7210 0x02, 0x03, 0x04, 0x05
7213 static hda_nid_t alc883_adc_nids[2] = {
7218 static hda_nid_t alc883_adc_nids_alt[1] = {
7223 static hda_nid_t alc883_adc_nids_rev[2] = {
7228 #define alc889_adc_nids alc880_adc_nids
7230 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7232 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7234 #define alc889_capsrc_nids alc882_capsrc_nids
7237 /* FIXME: should be a matrix-type input source selection */
7239 static struct hda_input_mux alc883_capture_source = {
7243 { "Front Mic", 0x1 },
7249 static struct hda_input_mux alc883_3stack_6ch_intel = {
7253 { "Front Mic", 0x0 },
7259 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7267 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7277 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7285 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7289 { "Front Mic", 0x1 },
7294 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7305 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7312 static struct hda_verb alc883_3ST_ch2_init[] = {
7313 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7314 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7315 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7316 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7323 static struct hda_verb alc883_3ST_ch4_init[] = {
7324 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7325 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7326 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7327 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7328 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7335 static struct hda_verb alc883_3ST_ch6_init[] = {
7336 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7337 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7338 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7339 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7340 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7341 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7345 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7346 { 2, alc883_3ST_ch2_init },
7347 { 4, alc883_3ST_ch4_init },
7348 { 6, alc883_3ST_ch6_init },
7354 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7355 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7356 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7357 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7358 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7365 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7366 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7367 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7368 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7369 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7370 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7377 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7378 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7379 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7380 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7381 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7382 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7383 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7387 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7388 { 2, alc883_3ST_ch2_intel_init },
7389 { 4, alc883_3ST_ch4_intel_init },
7390 { 6, alc883_3ST_ch6_intel_init },
7396 static struct hda_verb alc883_sixstack_ch6_init[] = {
7397 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7398 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7399 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7400 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7407 static struct hda_verb alc883_sixstack_ch8_init[] = {
7408 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7409 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7410 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7411 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7415 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7416 { 6, alc883_sixstack_ch6_init },
7417 { 8, alc883_sixstack_ch8_init },
7420 static struct hda_verb alc883_medion_eapd_verbs[] = {
7421 /* eanable EAPD on medion laptop */
7422 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7423 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7427 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7428 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7431 static struct snd_kcontrol_new alc883_base_mixer[] = {
7432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7433 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7435 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7436 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7437 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7438 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7439 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7440 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7441 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7442 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7443 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7444 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7450 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7452 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7456 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7457 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7458 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7459 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7460 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7461 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7462 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7463 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7464 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7465 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7467 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7468 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7469 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7473 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7474 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7475 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7477 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7479 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7480 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7481 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7482 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7483 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7487 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7488 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7489 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7490 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7491 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7492 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7493 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7494 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7496 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7497 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7501 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7502 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7503 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7504 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7505 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7506 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7507 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7508 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7510 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7511 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7512 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7513 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7514 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7518 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7519 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7520 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7521 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7522 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7523 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7524 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7525 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7526 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7527 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7528 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7529 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7530 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7531 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7533 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7535 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7537 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7541 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7542 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7543 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7545 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7546 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7548 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7549 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7550 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7551 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7552 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7553 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7554 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7555 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7556 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7557 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7558 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7559 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7560 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7561 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7565 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7566 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7567 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7568 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7569 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7570 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7571 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7572 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7573 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7575 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7576 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7577 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7578 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7580 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7581 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7582 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7583 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7584 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7588 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7589 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7591 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7592 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7593 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7594 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7595 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7596 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7597 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7598 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7599 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7600 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7601 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7603 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7608 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7609 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7610 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7611 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7612 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7613 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7615 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7617 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7618 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7619 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7623 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7625 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7626 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7627 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7628 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7631 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7635 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7636 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7637 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7639 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7640 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7643 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7644 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7648 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7649 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7650 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7651 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7652 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7653 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7654 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7655 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7656 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7657 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7661 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7662 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7663 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7666 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7669 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7673 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7674 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7675 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7676 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7677 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7678 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7679 0x0d, 1, 0x0, HDA_OUTPUT),
7680 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7681 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7682 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7683 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7684 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7685 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7686 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7687 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7688 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7690 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7692 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7694 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7695 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7696 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7700 static struct hda_bind_ctls alc883_bind_cap_vol = {
7701 .ops = &snd_hda_bind_vol,
7703 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7704 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7709 static struct hda_bind_ctls alc883_bind_cap_switch = {
7710 .ops = &snd_hda_bind_sw,
7712 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7713 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7718 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7719 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7720 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7722 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7723 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7725 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7726 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7730 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7731 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7732 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7734 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7735 /* .name = "Capture Source", */
7736 .name = "Input Source",
7738 .info = alc_mux_enum_info,
7739 .get = alc_mux_enum_get,
7740 .put = alc_mux_enum_put,
7745 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7747 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7748 .name = "Channel Mode",
7749 .info = alc_ch_mode_info,
7750 .get = alc_ch_mode_get,
7751 .put = alc_ch_mode_put,
7756 static struct hda_verb alc883_init_verbs[] = {
7757 /* ADC1: mute amp left and right */
7758 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7759 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7760 /* ADC2: mute amp left and right */
7761 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7762 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7763 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7764 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7768 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7769 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7770 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7772 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7773 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7774 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7776 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7777 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7778 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7780 /* mute analog input loopbacks */
7781 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7782 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7783 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7784 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7785 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7787 /* Front Pin: output 0 (0x0c) */
7788 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7789 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7790 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7791 /* Rear Pin: output 1 (0x0d) */
7792 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7794 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7795 /* CLFE Pin: output 2 (0x0e) */
7796 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7797 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7798 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7799 /* Side Pin: output 3 (0x0f) */
7800 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7801 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7802 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7803 /* Mic (rear) pin: input vref at 80% */
7804 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7805 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7806 /* Front Mic pin: input vref at 80% */
7807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7809 /* Line In pin: input */
7810 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7811 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7812 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7813 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7814 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7815 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7816 /* CD pin widget for input */
7817 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7819 /* FIXME: use matrix-type input source selection */
7820 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7822 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7824 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7834 /* toggle speaker-output according to the hp-jack state */
7835 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7837 unsigned int present;
7839 present = snd_hda_codec_read(codec, 0x15, 0,
7840 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7841 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7842 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7843 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7844 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7847 /* auto-toggle front mic */
7849 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7851 unsigned int present;
7854 present = snd_hda_codec_read(codec, 0x18, 0,
7855 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7856 bits = present ? HDA_AMP_MUTE : 0;
7857 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7861 static void alc883_mitac_automute(struct hda_codec *codec)
7863 alc883_mitac_hp_automute(codec);
7864 /* alc883_mitac_mic_automute(codec); */
7867 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7870 switch (res >> 26) {
7871 case ALC880_HP_EVENT:
7872 alc883_mitac_hp_automute(codec);
7874 case ALC880_MIC_EVENT:
7875 /* alc883_mitac_mic_automute(codec); */
7880 static struct hda_verb alc883_mitac_verbs[] = {
7882 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7885 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7886 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7888 /* enable unsolicited event */
7889 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7890 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7895 static struct hda_verb alc883_clevo_m720_verbs[] = {
7897 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7898 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7900 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7901 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7903 /* enable unsolicited event */
7904 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7905 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7910 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7912 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7913 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7915 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7916 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7918 /* enable unsolicited event */
7919 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7924 static struct hda_verb alc883_tagra_verbs[] = {
7925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7928 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7929 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7931 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7932 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7933 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7935 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7936 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7937 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7938 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7943 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7944 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7945 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7946 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7950 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7951 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7953 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7954 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7958 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7961 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7962 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7963 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7967 static struct hda_verb alc883_haier_w66_verbs[] = {
7968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7969 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7971 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7973 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7974 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7975 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7976 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7980 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7981 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7982 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7983 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7984 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7985 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7986 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7987 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7988 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7992 static struct hda_verb alc888_3st_hp_verbs[] = {
7993 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7994 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7995 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7999 static struct hda_verb alc888_6st_dell_verbs[] = {
8000 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8004 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8005 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8006 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8007 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8008 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8012 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8013 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8014 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8015 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8016 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8020 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
8021 { 2, alc888_3st_hp_2ch_init },
8022 { 6, alc888_3st_hp_6ch_init },
8025 /* toggle front-jack and RCA according to the hp-jack state */
8026 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8028 unsigned int present;
8030 present = snd_hda_codec_read(codec, 0x1b, 0,
8031 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8032 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8033 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8034 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8035 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8038 /* toggle RCA according to the front-jack state */
8039 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8041 unsigned int present;
8043 present = snd_hda_codec_read(codec, 0x14, 0,
8044 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8045 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8046 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8049 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8052 if ((res >> 26) == ALC880_HP_EVENT)
8053 alc888_lenovo_ms7195_front_automute(codec);
8054 if ((res >> 26) == ALC880_FRONT_EVENT)
8055 alc888_lenovo_ms7195_rca_automute(codec);
8058 static struct hda_verb alc883_medion_md2_verbs[] = {
8059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8064 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8068 /* toggle speaker-output according to the hp-jack state */
8069 static void alc883_medion_md2_automute(struct hda_codec *codec)
8071 unsigned int present;
8073 present = snd_hda_codec_read(codec, 0x14, 0,
8074 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8075 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8076 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8079 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8082 if ((res >> 26) == ALC880_HP_EVENT)
8083 alc883_medion_md2_automute(codec);
8086 /* toggle speaker-output according to the hp-jack state */
8087 static void alc883_tagra_automute(struct hda_codec *codec)
8089 unsigned int present;
8092 present = snd_hda_codec_read(codec, 0x14, 0,
8093 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8094 bits = present ? HDA_AMP_MUTE : 0;
8095 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8096 HDA_AMP_MUTE, bits);
8097 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8101 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8103 if ((res >> 26) == ALC880_HP_EVENT)
8104 alc883_tagra_automute(codec);
8107 /* toggle speaker-output according to the hp-jack state */
8108 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8110 unsigned int present;
8113 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8114 & AC_PINSENSE_PRESENCE;
8115 bits = present ? HDA_AMP_MUTE : 0;
8116 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8117 HDA_AMP_MUTE, bits);
8120 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8122 unsigned int present;
8124 present = snd_hda_codec_read(codec, 0x18, 0,
8125 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8126 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8127 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8130 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8132 alc883_clevo_m720_hp_automute(codec);
8133 alc883_clevo_m720_mic_automute(codec);
8136 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8139 switch (res >> 26) {
8140 case ALC880_HP_EVENT:
8141 alc883_clevo_m720_hp_automute(codec);
8143 case ALC880_MIC_EVENT:
8144 alc883_clevo_m720_mic_automute(codec);
8149 /* toggle speaker-output according to the hp-jack state */
8150 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8152 unsigned int present;
8155 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8156 & AC_PINSENSE_PRESENCE;
8157 bits = present ? HDA_AMP_MUTE : 0;
8158 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8159 HDA_AMP_MUTE, bits);
8162 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8165 if ((res >> 26) == ALC880_HP_EVENT)
8166 alc883_2ch_fujitsu_pi2515_automute(codec);
8169 static void alc883_haier_w66_automute(struct hda_codec *codec)
8171 unsigned int present;
8174 present = snd_hda_codec_read(codec, 0x1b, 0,
8175 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8176 bits = present ? 0x80 : 0;
8177 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8181 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8184 if ((res >> 26) == ALC880_HP_EVENT)
8185 alc883_haier_w66_automute(codec);
8188 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8190 unsigned int present;
8193 present = snd_hda_codec_read(codec, 0x14, 0,
8194 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8195 bits = present ? HDA_AMP_MUTE : 0;
8196 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8197 HDA_AMP_MUTE, bits);
8200 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8202 unsigned int present;
8205 present = snd_hda_codec_read(codec, 0x1b, 0,
8206 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8207 bits = present ? HDA_AMP_MUTE : 0;
8208 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8209 HDA_AMP_MUTE, bits);
8210 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8211 HDA_AMP_MUTE, bits);
8214 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8217 if ((res >> 26) == ALC880_HP_EVENT)
8218 alc883_lenovo_101e_all_automute(codec);
8219 if ((res >> 26) == ALC880_FRONT_EVENT)
8220 alc883_lenovo_101e_ispeaker_automute(codec);
8223 /* toggle speaker-output according to the hp-jack state */
8224 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8226 unsigned int present;
8228 present = snd_hda_codec_read(codec, 0x14, 0,
8229 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8230 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8231 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8232 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8233 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8236 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8239 if ((res >> 26) == ALC880_HP_EVENT)
8240 alc883_acer_aspire_automute(codec);
8243 static struct hda_verb alc883_acer_eapd_verbs[] = {
8244 /* HP Pin: output 0 (0x0c) */
8245 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8246 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8247 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8248 /* Front Pin: output 0 (0x0c) */
8249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8250 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8251 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8252 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8253 /* eanable EAPD on medion laptop */
8254 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8255 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8256 /* enable unsolicited event */
8257 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8261 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8263 unsigned int present;
8265 present = snd_hda_codec_read(codec, 0x1b, 0,
8266 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8267 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8268 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8269 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8270 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8271 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8272 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8273 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8274 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8277 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8280 switch (res >> 26) {
8281 case ALC880_HP_EVENT:
8282 /* printk(KERN_DEBUG "hp_event\n"); */
8283 alc888_6st_dell_front_automute(codec);
8288 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8291 unsigned int present;
8293 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8294 present = snd_hda_codec_read(codec, 0x1b, 0,
8295 AC_VERB_GET_PIN_SENSE, 0);
8296 present = (present & 0x80000000) != 0;
8298 /* mute internal speaker */
8299 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8300 HDA_AMP_MUTE, HDA_AMP_MUTE);
8301 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8302 HDA_AMP_MUTE, HDA_AMP_MUTE);
8303 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8304 HDA_AMP_MUTE, HDA_AMP_MUTE);
8305 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8306 HDA_AMP_MUTE, HDA_AMP_MUTE);
8307 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8308 HDA_AMP_MUTE, HDA_AMP_MUTE);
8310 /* unmute internal speaker if necessary */
8311 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8312 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8313 HDA_AMP_MUTE, mute);
8314 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8315 HDA_AMP_MUTE, mute);
8316 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8317 HDA_AMP_MUTE, mute);
8318 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8319 HDA_AMP_MUTE, mute);
8320 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8321 HDA_AMP_MUTE, mute);
8325 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8328 if ((res >> 26) == ALC880_HP_EVENT)
8329 alc888_lenovo_sky_front_automute(codec);
8333 * generic initialization of ADC, input mixers and output mixers
8335 static struct hda_verb alc883_auto_init_verbs[] = {
8337 * Unmute ADC0-2 and set the default input to mic-in
8339 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8340 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8341 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8344 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8346 * Note: PASD motherboards uses the Line In 2 as the input for
8347 * front panel mic (mic 2)
8349 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8351 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8352 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8357 * Set up output mixers (0x0c - 0x0f)
8359 /* set vol=0 to output mixers */
8360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8362 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8363 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8364 /* set up input amps for analog loopback */
8365 /* Amp Indices: DAC = 0, mixer = 1 */
8366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8369 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8371 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8373 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8374 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8375 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8377 /* FIXME: use matrix-type input source selection */
8378 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8383 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8389 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8390 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8395 static struct hda_verb alc888_asus_m90v_verbs[] = {
8396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8399 /* enable unsolicited event */
8400 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8405 static void alc883_nb_mic_automute(struct hda_codec *codec)
8407 unsigned int present;
8409 present = snd_hda_codec_read(codec, 0x18, 0,
8410 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8411 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8412 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8413 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8414 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8417 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8419 unsigned int present;
8422 present = snd_hda_codec_read(codec, 0x1b, 0,
8423 AC_VERB_GET_PIN_SENSE, 0)
8424 & AC_PINSENSE_PRESENCE;
8425 bits = present ? 0 : PIN_OUT;
8426 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8428 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8430 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8434 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8437 switch (res >> 26) {
8438 case ALC880_HP_EVENT:
8439 alc883_M90V_speaker_automute(codec);
8441 case ALC880_MIC_EVENT:
8442 alc883_nb_mic_automute(codec);
8447 static void alc883_mode2_inithook(struct hda_codec *codec)
8449 alc883_M90V_speaker_automute(codec);
8450 alc883_nb_mic_automute(codec);
8453 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8454 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8455 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8459 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8460 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8461 /* enable unsolicited event */
8462 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8466 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8468 unsigned int present;
8471 present = snd_hda_codec_read(codec, 0x14, 0,
8472 AC_VERB_GET_PIN_SENSE, 0)
8473 & AC_PINSENSE_PRESENCE;
8474 bits = present ? 0 : PIN_OUT;
8475 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8479 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8482 switch (res >> 26) {
8483 case ALC880_HP_EVENT:
8484 alc883_eee1601_speaker_automute(codec);
8489 static void alc883_eee1601_inithook(struct hda_codec *codec)
8491 alc883_eee1601_speaker_automute(codec);
8494 #ifdef CONFIG_SND_HDA_POWER_SAVE
8495 #define alc883_loopbacks alc880_loopbacks
8498 /* pcm configuration: identiacal with ALC880 */
8499 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8500 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8501 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8502 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8503 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8506 * configuration and preset
8508 static const char *alc883_models[ALC883_MODEL_LAST] = {
8509 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8510 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8511 [ALC883_3ST_6ch] = "3stack-6ch",
8512 [ALC883_6ST_DIG] = "6stack-dig",
8513 [ALC883_TARGA_DIG] = "targa-dig",
8514 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8515 [ALC883_ACER] = "acer",
8516 [ALC883_ACER_ASPIRE] = "acer-aspire",
8517 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8518 [ALC883_MEDION] = "medion",
8519 [ALC883_MEDION_MD2] = "medion-md2",
8520 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8521 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8522 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8523 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8524 [ALC888_LENOVO_SKY] = "lenovo-sky",
8525 [ALC883_HAIER_W66] = "haier-w66",
8526 [ALC888_3ST_HP] = "3stack-hp",
8527 [ALC888_6ST_DELL] = "6stack-dell",
8528 [ALC883_MITAC] = "mitac",
8529 [ALC883_CLEVO_M720] = "clevo-m720",
8530 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8531 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8532 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8533 [ALC1200_ASUS_P5Q] = "asus-p5q",
8534 [ALC883_AUTO] = "auto",
8537 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8538 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8539 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8540 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8541 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8542 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8543 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8544 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8545 ALC888_ACER_ASPIRE_4930G),
8546 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8547 ALC888_ACER_ASPIRE_4930G),
8548 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8549 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8550 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8551 ALC888_ACER_ASPIRE_4930G),
8553 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8554 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8555 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8556 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8557 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8558 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8559 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8560 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8561 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8562 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8563 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8564 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8565 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8566 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8567 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8568 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8569 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8570 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8571 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8572 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8573 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8574 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8575 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8576 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8577 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8578 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8579 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8580 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8581 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8582 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8583 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8584 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8585 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8586 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8587 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8588 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8589 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8590 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8591 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8592 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8593 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8594 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8595 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8596 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8597 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8598 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8599 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8600 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8601 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8602 SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
8603 ALC883_FUJITSU_PI2515),
8604 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8605 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8606 ALC888_FUJITSU_XA3530),
8607 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8608 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8609 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8610 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8611 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8612 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8613 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8614 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8615 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8616 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8617 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8618 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8619 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8620 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8624 static hda_nid_t alc1200_slave_dig_outs[] = {
8625 ALC883_DIGOUT_NID, 0,
8628 static struct alc_config_preset alc883_presets[] = {
8629 [ALC883_3ST_2ch_DIG] = {
8630 .mixers = { alc883_3ST_2ch_mixer },
8631 .init_verbs = { alc883_init_verbs },
8632 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8633 .dac_nids = alc883_dac_nids,
8634 .dig_out_nid = ALC883_DIGOUT_NID,
8635 .dig_in_nid = ALC883_DIGIN_NID,
8636 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8637 .channel_mode = alc883_3ST_2ch_modes,
8638 .input_mux = &alc883_capture_source,
8640 [ALC883_3ST_6ch_DIG] = {
8641 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8642 .init_verbs = { alc883_init_verbs },
8643 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8644 .dac_nids = alc883_dac_nids,
8645 .dig_out_nid = ALC883_DIGOUT_NID,
8646 .dig_in_nid = ALC883_DIGIN_NID,
8647 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8648 .channel_mode = alc883_3ST_6ch_modes,
8650 .input_mux = &alc883_capture_source,
8652 [ALC883_3ST_6ch] = {
8653 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8654 .init_verbs = { alc883_init_verbs },
8655 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8656 .dac_nids = alc883_dac_nids,
8657 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8658 .channel_mode = alc883_3ST_6ch_modes,
8660 .input_mux = &alc883_capture_source,
8662 [ALC883_3ST_6ch_INTEL] = {
8663 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8664 .init_verbs = { alc883_init_verbs },
8665 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8666 .dac_nids = alc883_dac_nids,
8667 .dig_out_nid = ALC883_DIGOUT_NID,
8668 .dig_in_nid = ALC883_DIGIN_NID,
8669 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8670 .channel_mode = alc883_3ST_6ch_intel_modes,
8672 .input_mux = &alc883_3stack_6ch_intel,
8674 [ALC883_6ST_DIG] = {
8675 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8676 .init_verbs = { alc883_init_verbs },
8677 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8678 .dac_nids = alc883_dac_nids,
8679 .dig_out_nid = ALC883_DIGOUT_NID,
8680 .dig_in_nid = ALC883_DIGIN_NID,
8681 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8682 .channel_mode = alc883_sixstack_modes,
8683 .input_mux = &alc883_capture_source,
8685 [ALC883_TARGA_DIG] = {
8686 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8687 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8688 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8689 .dac_nids = alc883_dac_nids,
8690 .dig_out_nid = ALC883_DIGOUT_NID,
8691 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8692 .channel_mode = alc883_3ST_6ch_modes,
8694 .input_mux = &alc883_capture_source,
8695 .unsol_event = alc883_tagra_unsol_event,
8696 .init_hook = alc883_tagra_automute,
8698 [ALC883_TARGA_2ch_DIG] = {
8699 .mixers = { alc883_tagra_2ch_mixer},
8700 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8701 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8702 .dac_nids = alc883_dac_nids,
8703 .adc_nids = alc883_adc_nids_alt,
8704 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8705 .dig_out_nid = ALC883_DIGOUT_NID,
8706 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8707 .channel_mode = alc883_3ST_2ch_modes,
8708 .input_mux = &alc883_capture_source,
8709 .unsol_event = alc883_tagra_unsol_event,
8710 .init_hook = alc883_tagra_automute,
8713 .mixers = { alc883_base_mixer },
8714 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8715 * and the headphone jack. Turn this on and rely on the
8716 * standard mute methods whenever the user wants to turn
8717 * these outputs off.
8719 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8720 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8721 .dac_nids = alc883_dac_nids,
8722 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8723 .channel_mode = alc883_3ST_2ch_modes,
8724 .input_mux = &alc883_capture_source,
8726 [ALC883_ACER_ASPIRE] = {
8727 .mixers = { alc883_acer_aspire_mixer },
8728 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8729 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8730 .dac_nids = alc883_dac_nids,
8731 .dig_out_nid = ALC883_DIGOUT_NID,
8732 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8733 .channel_mode = alc883_3ST_2ch_modes,
8734 .input_mux = &alc883_capture_source,
8735 .unsol_event = alc883_acer_aspire_unsol_event,
8736 .init_hook = alc883_acer_aspire_automute,
8738 [ALC888_ACER_ASPIRE_4930G] = {
8739 .mixers = { alc888_base_mixer,
8740 alc883_chmode_mixer },
8741 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8742 alc888_acer_aspire_4930g_verbs },
8743 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8744 .dac_nids = alc883_dac_nids,
8745 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8746 .adc_nids = alc883_adc_nids_rev,
8747 .capsrc_nids = alc883_capsrc_nids_rev,
8748 .dig_out_nid = ALC883_DIGOUT_NID,
8749 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8750 .channel_mode = alc883_3ST_6ch_modes,
8753 ARRAY_SIZE(alc888_2_capture_sources),
8754 .input_mux = alc888_2_capture_sources,
8755 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8756 .init_hook = alc888_acer_aspire_4930g_automute,
8759 .mixers = { alc883_fivestack_mixer,
8760 alc883_chmode_mixer },
8761 .init_verbs = { alc883_init_verbs,
8762 alc883_medion_eapd_verbs },
8763 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8764 .dac_nids = alc883_dac_nids,
8765 .adc_nids = alc883_adc_nids_alt,
8766 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8767 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8768 .channel_mode = alc883_sixstack_modes,
8769 .input_mux = &alc883_capture_source,
8771 [ALC883_MEDION_MD2] = {
8772 .mixers = { alc883_medion_md2_mixer},
8773 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8774 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8775 .dac_nids = alc883_dac_nids,
8776 .dig_out_nid = ALC883_DIGOUT_NID,
8777 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8778 .channel_mode = alc883_3ST_2ch_modes,
8779 .input_mux = &alc883_capture_source,
8780 .unsol_event = alc883_medion_md2_unsol_event,
8781 .init_hook = alc883_medion_md2_automute,
8783 [ALC883_LAPTOP_EAPD] = {
8784 .mixers = { alc883_base_mixer },
8785 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8786 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8787 .dac_nids = alc883_dac_nids,
8788 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8789 .channel_mode = alc883_3ST_2ch_modes,
8790 .input_mux = &alc883_capture_source,
8792 [ALC883_CLEVO_M720] = {
8793 .mixers = { alc883_clevo_m720_mixer },
8794 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8795 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8796 .dac_nids = alc883_dac_nids,
8797 .dig_out_nid = ALC883_DIGOUT_NID,
8798 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8799 .channel_mode = alc883_3ST_2ch_modes,
8800 .input_mux = &alc883_capture_source,
8801 .unsol_event = alc883_clevo_m720_unsol_event,
8802 .init_hook = alc883_clevo_m720_automute,
8804 [ALC883_LENOVO_101E_2ch] = {
8805 .mixers = { alc883_lenovo_101e_2ch_mixer},
8806 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8807 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8808 .dac_nids = alc883_dac_nids,
8809 .adc_nids = alc883_adc_nids_alt,
8810 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8811 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8812 .channel_mode = alc883_3ST_2ch_modes,
8813 .input_mux = &alc883_lenovo_101e_capture_source,
8814 .unsol_event = alc883_lenovo_101e_unsol_event,
8815 .init_hook = alc883_lenovo_101e_all_automute,
8817 [ALC883_LENOVO_NB0763] = {
8818 .mixers = { alc883_lenovo_nb0763_mixer },
8819 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8820 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8821 .dac_nids = alc883_dac_nids,
8822 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8823 .channel_mode = alc883_3ST_2ch_modes,
8825 .input_mux = &alc883_lenovo_nb0763_capture_source,
8826 .unsol_event = alc883_medion_md2_unsol_event,
8827 .init_hook = alc883_medion_md2_automute,
8829 [ALC888_LENOVO_MS7195_DIG] = {
8830 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8831 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8832 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8833 .dac_nids = alc883_dac_nids,
8834 .dig_out_nid = ALC883_DIGOUT_NID,
8835 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8836 .channel_mode = alc883_3ST_6ch_modes,
8838 .input_mux = &alc883_capture_source,
8839 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8840 .init_hook = alc888_lenovo_ms7195_front_automute,
8842 [ALC883_HAIER_W66] = {
8843 .mixers = { alc883_tagra_2ch_mixer},
8844 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8845 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8846 .dac_nids = alc883_dac_nids,
8847 .dig_out_nid = ALC883_DIGOUT_NID,
8848 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8849 .channel_mode = alc883_3ST_2ch_modes,
8850 .input_mux = &alc883_capture_source,
8851 .unsol_event = alc883_haier_w66_unsol_event,
8852 .init_hook = alc883_haier_w66_automute,
8855 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8856 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8857 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8858 .dac_nids = alc883_dac_nids,
8859 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8860 .channel_mode = alc888_3st_hp_modes,
8862 .input_mux = &alc883_capture_source,
8864 [ALC888_6ST_DELL] = {
8865 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8866 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8867 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8868 .dac_nids = alc883_dac_nids,
8869 .dig_out_nid = ALC883_DIGOUT_NID,
8870 .dig_in_nid = ALC883_DIGIN_NID,
8871 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8872 .channel_mode = alc883_sixstack_modes,
8873 .input_mux = &alc883_capture_source,
8874 .unsol_event = alc888_6st_dell_unsol_event,
8875 .init_hook = alc888_6st_dell_front_automute,
8878 .mixers = { alc883_mitac_mixer },
8879 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8880 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8881 .dac_nids = alc883_dac_nids,
8882 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8883 .channel_mode = alc883_3ST_2ch_modes,
8884 .input_mux = &alc883_capture_source,
8885 .unsol_event = alc883_mitac_unsol_event,
8886 .init_hook = alc883_mitac_automute,
8888 [ALC883_FUJITSU_PI2515] = {
8889 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8890 .init_verbs = { alc883_init_verbs,
8891 alc883_2ch_fujitsu_pi2515_verbs},
8892 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8893 .dac_nids = alc883_dac_nids,
8894 .dig_out_nid = ALC883_DIGOUT_NID,
8895 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8896 .channel_mode = alc883_3ST_2ch_modes,
8897 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8898 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8899 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8901 [ALC888_FUJITSU_XA3530] = {
8902 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8903 .init_verbs = { alc883_init_verbs,
8904 alc888_fujitsu_xa3530_verbs },
8905 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8906 .dac_nids = alc883_dac_nids,
8907 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8908 .adc_nids = alc883_adc_nids_rev,
8909 .capsrc_nids = alc883_capsrc_nids_rev,
8910 .dig_out_nid = ALC883_DIGOUT_NID,
8911 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8912 .channel_mode = alc888_4ST_8ch_intel_modes,
8914 ARRAY_SIZE(alc888_2_capture_sources),
8915 .input_mux = alc888_2_capture_sources,
8916 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8917 .init_hook = alc888_fujitsu_xa3530_automute,
8919 [ALC888_LENOVO_SKY] = {
8920 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8921 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_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_sixstack_modes),
8926 .channel_mode = alc883_sixstack_modes,
8928 .input_mux = &alc883_lenovo_sky_capture_source,
8929 .unsol_event = alc883_lenovo_sky_unsol_event,
8930 .init_hook = alc888_lenovo_sky_front_automute,
8932 [ALC888_ASUS_M90V] = {
8933 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8934 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8935 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8936 .dac_nids = alc883_dac_nids,
8937 .dig_out_nid = ALC883_DIGOUT_NID,
8938 .dig_in_nid = ALC883_DIGIN_NID,
8939 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8940 .channel_mode = alc883_3ST_6ch_modes,
8942 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8943 .unsol_event = alc883_mode2_unsol_event,
8944 .init_hook = alc883_mode2_inithook,
8946 [ALC888_ASUS_EEE1601] = {
8947 .mixers = { alc883_asus_eee1601_mixer },
8948 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8949 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8950 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8951 .dac_nids = alc883_dac_nids,
8952 .dig_out_nid = ALC883_DIGOUT_NID,
8953 .dig_in_nid = ALC883_DIGIN_NID,
8954 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8955 .channel_mode = alc883_3ST_2ch_modes,
8957 .input_mux = &alc883_asus_eee1601_capture_source,
8958 .unsol_event = alc883_eee1601_unsol_event,
8959 .init_hook = alc883_eee1601_inithook,
8961 [ALC1200_ASUS_P5Q] = {
8962 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8963 .init_verbs = { alc883_init_verbs },
8964 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8965 .dac_nids = alc883_dac_nids,
8966 .dig_out_nid = ALC1200_DIGOUT_NID,
8967 .dig_in_nid = ALC883_DIGIN_NID,
8968 .slave_dig_outs = alc1200_slave_dig_outs,
8969 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8970 .channel_mode = alc883_sixstack_modes,
8971 .input_mux = &alc883_capture_source,
8977 * BIOS auto configuration
8979 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8980 hda_nid_t nid, int pin_type,
8984 struct alc_spec *spec = codec->spec;
8987 alc_set_pin_output(codec, nid, pin_type);
8988 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8991 idx = spec->multiout.dac_nids[dac_idx] - 2;
8992 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8996 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8998 struct alc_spec *spec = codec->spec;
9001 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
9002 for (i = 0; i <= HDA_SIDE; i++) {
9003 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9004 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9006 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9011 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9013 struct alc_spec *spec = codec->spec;
9016 pin = spec->autocfg.hp_pins[0];
9017 if (pin) /* connect to front */
9019 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9020 pin = spec->autocfg.speaker_pins[0];
9022 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9025 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9026 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9028 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9030 struct alc_spec *spec = codec->spec;
9033 for (i = 0; i < AUTO_PIN_LAST; i++) {
9034 hda_nid_t nid = spec->autocfg.input_pins[i];
9035 if (alc883_is_input_pin(nid)) {
9036 snd_hda_codec_write(codec, nid, 0,
9037 AC_VERB_SET_PIN_WIDGET_CONTROL,
9038 (i <= AUTO_PIN_FRONT_MIC ?
9039 PIN_VREF80 : PIN_IN));
9040 if (nid != ALC883_PIN_CD_NID)
9041 snd_hda_codec_write(codec, nid, 0,
9042 AC_VERB_SET_AMP_GAIN_MUTE,
9048 #define alc883_auto_init_input_src alc882_auto_init_input_src
9050 /* almost identical with ALC880 parser... */
9051 static int alc883_parse_auto_config(struct hda_codec *codec)
9053 struct alc_spec *spec = codec->spec;
9054 int err = alc880_parse_auto_config(codec);
9055 struct auto_pin_cfg *cfg = &spec->autocfg;
9061 return 0; /* no config found */
9063 err = alc_auto_add_mic_boost(codec);
9067 /* hack - override the init verbs */
9068 spec->init_verbs[0] = alc883_auto_init_verbs;
9070 /* setup input_mux for ALC889 */
9071 if (codec->vendor_id == 0x10ec0889) {
9072 /* digital-mic input pin is excluded in alc880_auto_create..()
9073 * because it's under 0x18
9075 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9076 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9077 struct hda_input_mux *imux = &spec->private_imux[0];
9078 for (i = 1; i < 3; i++)
9079 memcpy(&spec->private_imux[i],
9080 &spec->private_imux[0],
9081 sizeof(spec->private_imux[0]));
9082 imux->items[imux->num_items].label = "Int DMic";
9083 imux->items[imux->num_items].index = 0x0b;
9085 spec->num_mux_defs = 3;
9086 spec->input_mux = spec->private_imux;
9090 return 1; /* config found */
9093 /* additional initialization for auto-configuration model */
9094 static void alc883_auto_init(struct hda_codec *codec)
9096 struct alc_spec *spec = codec->spec;
9097 alc883_auto_init_multi_out(codec);
9098 alc883_auto_init_hp_out(codec);
9099 alc883_auto_init_analog_input(codec);
9100 alc883_auto_init_input_src(codec);
9101 if (spec->unsol_event)
9102 alc_inithook(codec);
9105 static int patch_alc883(struct hda_codec *codec)
9107 struct alc_spec *spec;
9108 int err, board_config;
9110 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9116 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9118 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9121 if (board_config < 0) {
9122 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9123 "trying auto-probe from BIOS...\n");
9124 board_config = ALC883_AUTO;
9127 if (board_config == ALC883_AUTO) {
9128 /* automatic parse from the BIOS config */
9129 err = alc883_parse_auto_config(codec);
9135 "hda_codec: Cannot set up configuration "
9136 "from BIOS. Using base mode...\n");
9137 board_config = ALC883_3ST_2ch_DIG;
9141 err = snd_hda_attach_beep_device(codec, 0x1);
9147 if (board_config != ALC883_AUTO)
9148 setup_preset(spec, &alc883_presets[board_config]);
9150 switch (codec->vendor_id) {
9152 if (codec->revision_id == 0x100101) {
9153 spec->stream_name_analog = "ALC1200 Analog";
9154 spec->stream_name_digital = "ALC1200 Digital";
9156 spec->stream_name_analog = "ALC888 Analog";
9157 spec->stream_name_digital = "ALC888 Digital";
9159 if (!spec->num_adc_nids) {
9160 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9161 spec->adc_nids = alc883_adc_nids;
9163 if (!spec->capsrc_nids)
9164 spec->capsrc_nids = alc883_capsrc_nids;
9165 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9168 spec->stream_name_analog = "ALC889 Analog";
9169 spec->stream_name_digital = "ALC889 Digital";
9170 if (!spec->num_adc_nids) {
9171 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9172 spec->adc_nids = alc889_adc_nids;
9174 if (!spec->capsrc_nids)
9175 spec->capsrc_nids = alc889_capsrc_nids;
9176 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9180 spec->stream_name_analog = "ALC883 Analog";
9181 spec->stream_name_digital = "ALC883 Digital";
9182 if (!spec->num_adc_nids) {
9183 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9184 spec->adc_nids = alc883_adc_nids;
9186 if (!spec->capsrc_nids)
9187 spec->capsrc_nids = alc883_capsrc_nids;
9188 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9192 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9193 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9194 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9196 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9197 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9199 if (!spec->cap_mixer)
9200 set_capture_mixer(spec);
9201 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9203 spec->vmaster_nid = 0x0c;
9205 codec->patch_ops = alc_patch_ops;
9206 if (board_config == ALC883_AUTO)
9207 spec->init_hook = alc883_auto_init;
9209 #ifdef CONFIG_SND_HDA_POWER_SAVE
9210 if (!spec->loopback.amplist)
9211 spec->loopback.amplist = alc883_loopbacks;
9213 codec->proc_widget_hook = print_realtek_coef;
9222 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9223 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9225 #define alc262_dac_nids alc260_dac_nids
9226 #define alc262_adc_nids alc882_adc_nids
9227 #define alc262_adc_nids_alt alc882_adc_nids_alt
9228 #define alc262_capsrc_nids alc882_capsrc_nids
9229 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9231 #define alc262_modes alc260_modes
9232 #define alc262_capture_source alc882_capture_source
9234 static hda_nid_t alc262_dmic_adc_nids[1] = {
9239 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9241 static struct snd_kcontrol_new alc262_base_mixer[] = {
9242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9243 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9246 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9247 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9250 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9251 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9252 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9253 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9256 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9257 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9261 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9262 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9263 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9264 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9265 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9266 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9267 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9268 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9269 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9270 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9271 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9272 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9273 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9274 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9279 /* update HP, line and mono-out pins according to the master switch */
9280 static void alc262_hp_master_update(struct hda_codec *codec)
9282 struct alc_spec *spec = codec->spec;
9283 int val = spec->master_sw;
9286 snd_hda_codec_write_cache(codec, 0x1b, 0,
9287 AC_VERB_SET_PIN_WIDGET_CONTROL,
9289 snd_hda_codec_write_cache(codec, 0x15, 0,
9290 AC_VERB_SET_PIN_WIDGET_CONTROL,
9292 /* mono (speaker) depending on the HP jack sense */
9293 val = val && !spec->jack_present;
9294 snd_hda_codec_write_cache(codec, 0x16, 0,
9295 AC_VERB_SET_PIN_WIDGET_CONTROL,
9299 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9301 struct alc_spec *spec = codec->spec;
9302 unsigned int presence;
9303 presence = snd_hda_codec_read(codec, 0x1b, 0,
9304 AC_VERB_GET_PIN_SENSE, 0);
9305 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9306 alc262_hp_master_update(codec);
9309 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9311 if ((res >> 26) != ALC880_HP_EVENT)
9313 alc262_hp_bpc_automute(codec);
9316 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9318 struct alc_spec *spec = codec->spec;
9319 unsigned int presence;
9320 presence = snd_hda_codec_read(codec, 0x15, 0,
9321 AC_VERB_GET_PIN_SENSE, 0);
9322 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9323 alc262_hp_master_update(codec);
9326 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9329 if ((res >> 26) != ALC880_HP_EVENT)
9331 alc262_hp_wildwest_automute(codec);
9334 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9335 struct snd_ctl_elem_value *ucontrol)
9337 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9338 struct alc_spec *spec = codec->spec;
9339 *ucontrol->value.integer.value = spec->master_sw;
9343 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9344 struct snd_ctl_elem_value *ucontrol)
9346 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9347 struct alc_spec *spec = codec->spec;
9348 int val = !!*ucontrol->value.integer.value;
9350 if (val == spec->master_sw)
9352 spec->master_sw = val;
9353 alc262_hp_master_update(codec);
9357 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9359 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9360 .name = "Master Playback Switch",
9361 .info = snd_ctl_boolean_mono_info,
9362 .get = alc262_hp_master_sw_get,
9363 .put = alc262_hp_master_sw_put,
9365 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9366 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9367 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9368 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9370 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9374 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9375 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9376 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9377 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9378 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9379 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9380 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9381 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9382 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9383 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9387 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9389 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9390 .name = "Master Playback Switch",
9391 .info = snd_ctl_boolean_mono_info,
9392 .get = alc262_hp_master_sw_get,
9393 .put = alc262_hp_master_sw_put,
9395 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9396 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9397 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9399 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9401 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9403 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9404 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9405 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9406 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9407 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9408 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9409 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9413 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9414 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9415 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9416 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9420 /* mute/unmute internal speaker according to the hp jack and mute state */
9421 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9423 struct alc_spec *spec = codec->spec;
9425 if (force || !spec->sense_updated) {
9426 unsigned int present;
9427 present = snd_hda_codec_read(codec, 0x15, 0,
9428 AC_VERB_GET_PIN_SENSE, 0);
9429 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9430 spec->sense_updated = 1;
9432 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9433 spec->jack_present ? HDA_AMP_MUTE : 0);
9436 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9439 if ((res >> 26) != ALC880_HP_EVENT)
9441 alc262_hp_t5735_automute(codec, 1);
9444 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9446 alc262_hp_t5735_automute(codec, 1);
9449 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9450 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9451 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9452 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9453 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9456 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9460 static struct hda_verb alc262_hp_t5735_verbs[] = {
9461 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9464 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9468 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9469 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9470 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9471 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9472 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9473 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9474 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9478 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9479 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9480 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9481 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9482 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9484 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9492 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9499 /* bind hp and internal speaker mute (with plug check) */
9500 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9501 struct snd_ctl_elem_value *ucontrol)
9503 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9504 long *valp = ucontrol->value.integer.value;
9507 /* change hp mute */
9508 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9510 valp[0] ? 0 : HDA_AMP_MUTE);
9511 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9513 valp[1] ? 0 : HDA_AMP_MUTE);
9515 /* change speaker according to HP jack state */
9516 struct alc_spec *spec = codec->spec;
9518 if (spec->jack_present)
9519 mute = HDA_AMP_MUTE;
9521 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9523 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9524 HDA_AMP_MUTE, mute);
9529 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9530 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9532 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9533 .name = "Master Playback Switch",
9534 .info = snd_hda_mixer_amp_switch_info,
9535 .get = snd_hda_mixer_amp_switch_get,
9536 .put = alc262_sony_master_sw_put,
9537 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9541 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9542 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9546 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9547 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9548 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9549 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9552 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9553 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9557 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9558 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9559 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9560 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9561 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9562 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9563 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9566 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9567 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9568 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9569 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9573 static struct hda_verb alc262_tyan_verbs[] = {
9574 /* Headphone automute */
9575 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9576 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9577 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9579 /* P11 AUX_IN, white 4-pin connector */
9580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9581 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9582 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9583 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9588 /* unsolicited event for HP jack sensing */
9589 static void alc262_tyan_automute(struct hda_codec *codec)
9592 unsigned int present;
9594 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9595 present = snd_hda_codec_read(codec, 0x1b, 0,
9596 AC_VERB_GET_PIN_SENSE, 0);
9597 present = (present & 0x80000000) != 0;
9599 /* mute line output on ATX panel */
9600 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9601 HDA_AMP_MUTE, HDA_AMP_MUTE);
9603 /* unmute line output if necessary */
9604 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9605 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9606 HDA_AMP_MUTE, mute);
9610 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9613 if ((res >> 26) != ALC880_HP_EVENT)
9615 alc262_tyan_automute(codec);
9618 #define alc262_capture_mixer alc882_capture_mixer
9619 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9622 * generic initialization of ADC, input mixers and output mixers
9624 static struct hda_verb alc262_init_verbs[] = {
9626 * Unmute ADC0-2 and set the default input to mic-in
9628 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9629 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9630 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9632 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9635 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9637 * Note: PASD motherboards uses the Line In 2 as the input for
9638 * front panel mic (mic 2)
9640 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9648 * Set up output mixers (0x0c - 0x0e)
9650 /* set vol=0 to output mixers */
9651 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9653 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9654 /* set up input amps for analog loopback */
9655 /* Amp Indices: DAC = 0, mixer = 1 */
9656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9659 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9661 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9663 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9665 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9666 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9667 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9668 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9670 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9671 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9672 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9673 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9674 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9676 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9677 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9679 /* FIXME: use matrix-type input source selection */
9680 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9681 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9682 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9683 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9684 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9685 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9687 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9688 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9689 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9690 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9692 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9693 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9694 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9695 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9700 static struct hda_verb alc262_eapd_verbs[] = {
9701 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9702 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9706 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9707 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9708 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9712 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9713 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9714 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9715 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9717 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9718 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9722 static struct hda_verb alc262_sony_unsol_verbs[] = {
9723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9724 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9727 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9732 static struct hda_input_mux alc262_dmic_capture_source = {
9735 { "Int DMic", 0x9 },
9740 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9741 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9742 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9743 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9749 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9750 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9751 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9752 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9753 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9754 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9755 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9756 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9757 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9761 static void alc262_dmic_automute(struct hda_codec *codec)
9763 unsigned int present;
9765 present = snd_hda_codec_read(codec, 0x18, 0,
9766 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9767 snd_hda_codec_write(codec, 0x22, 0,
9768 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9771 /* toggle speaker-output according to the hp-jack state */
9772 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9774 unsigned int present;
9777 present = snd_hda_codec_read(codec, 0x15, 0,
9778 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9779 bits = present ? 0 : PIN_OUT;
9780 snd_hda_codec_write(codec, 0x14, 0,
9781 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9786 /* unsolicited event for HP jack sensing */
9787 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9790 if ((res >> 26) == ALC880_HP_EVENT)
9791 alc262_toshiba_s06_speaker_automute(codec);
9792 if ((res >> 26) == ALC880_MIC_EVENT)
9793 alc262_dmic_automute(codec);
9797 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9799 alc262_toshiba_s06_speaker_automute(codec);
9800 alc262_dmic_automute(codec);
9803 /* mute/unmute internal speaker according to the hp jack and mute state */
9804 static void alc262_hippo_automute(struct hda_codec *codec)
9806 struct alc_spec *spec = codec->spec;
9808 unsigned int present;
9810 /* need to execute and sync at first */
9811 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9812 present = snd_hda_codec_read(codec, 0x15, 0,
9813 AC_VERB_GET_PIN_SENSE, 0);
9814 spec->jack_present = (present & 0x80000000) != 0;
9815 if (spec->jack_present) {
9816 /* mute internal speaker */
9817 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9818 HDA_AMP_MUTE, HDA_AMP_MUTE);
9820 /* unmute internal speaker if necessary */
9821 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9822 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9823 HDA_AMP_MUTE, mute);
9827 /* unsolicited event for HP jack sensing */
9828 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9831 if ((res >> 26) != ALC880_HP_EVENT)
9833 alc262_hippo_automute(codec);
9836 static void alc262_hippo1_automute(struct hda_codec *codec)
9839 unsigned int present;
9841 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9842 present = snd_hda_codec_read(codec, 0x1b, 0,
9843 AC_VERB_GET_PIN_SENSE, 0);
9844 present = (present & 0x80000000) != 0;
9846 /* mute internal speaker */
9847 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9848 HDA_AMP_MUTE, HDA_AMP_MUTE);
9850 /* unmute internal speaker if necessary */
9851 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9852 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9853 HDA_AMP_MUTE, mute);
9857 /* unsolicited event for HP jack sensing */
9858 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9861 if ((res >> 26) != ALC880_HP_EVENT)
9863 alc262_hippo1_automute(codec);
9869 * 0x16 = internal speaker
9870 * 0x18 = external mic
9873 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9874 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9875 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9879 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9881 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9886 static struct hda_verb alc262_nec_verbs[] = {
9887 /* Unmute Speaker */
9888 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9891 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9894 /* External mic to headphone */
9895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9896 /* External mic to speaker */
9897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9903 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9904 * 0x1b = port replicator headphone out
9907 #define ALC_HP_EVENT 0x37
9909 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9910 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9912 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9913 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9917 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9918 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9919 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9923 static struct hda_input_mux alc262_fujitsu_capture_source = {
9932 static struct hda_input_mux alc262_HP_capture_source = {
9936 { "Front Mic", 0x1 },
9943 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9947 { "Front Mic", 0x2 },
9953 /* mute/unmute internal speaker according to the hp jacks and mute state */
9954 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9956 struct alc_spec *spec = codec->spec;
9959 if (force || !spec->sense_updated) {
9960 unsigned int present;
9961 /* need to execute and sync at first */
9962 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9963 /* check laptop HP jack */
9964 present = snd_hda_codec_read(codec, 0x14, 0,
9965 AC_VERB_GET_PIN_SENSE, 0);
9966 /* need to execute and sync at first */
9967 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9968 /* check docking HP jack */
9969 present |= snd_hda_codec_read(codec, 0x1b, 0,
9970 AC_VERB_GET_PIN_SENSE, 0);
9971 if (present & AC_PINSENSE_PRESENCE)
9972 spec->jack_present = 1;
9974 spec->jack_present = 0;
9975 spec->sense_updated = 1;
9977 /* unmute internal speaker only if both HPs are unplugged and
9978 * master switch is on
9980 if (spec->jack_present)
9981 mute = HDA_AMP_MUTE;
9983 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9984 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9985 HDA_AMP_MUTE, mute);
9988 /* unsolicited event for HP jack sensing */
9989 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9992 if ((res >> 26) != ALC_HP_EVENT)
9994 alc262_fujitsu_automute(codec, 1);
9997 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9999 alc262_fujitsu_automute(codec, 1);
10002 /* bind volumes of both NID 0x0c and 0x0d */
10003 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10004 .ops = &snd_hda_bind_vol,
10006 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10007 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10012 /* mute/unmute internal speaker according to the hp jack and mute state */
10013 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10015 struct alc_spec *spec = codec->spec;
10018 if (force || !spec->sense_updated) {
10019 unsigned int present_int_hp;
10020 /* need to execute and sync at first */
10021 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10022 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10023 AC_VERB_GET_PIN_SENSE, 0);
10024 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10025 spec->sense_updated = 1;
10027 if (spec->jack_present) {
10028 /* mute internal speaker */
10029 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10030 HDA_AMP_MUTE, HDA_AMP_MUTE);
10031 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10032 HDA_AMP_MUTE, HDA_AMP_MUTE);
10034 /* unmute internal speaker if necessary */
10035 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10036 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10037 HDA_AMP_MUTE, mute);
10038 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10039 HDA_AMP_MUTE, mute);
10043 /* unsolicited event for HP jack sensing */
10044 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10047 if ((res >> 26) != ALC_HP_EVENT)
10049 alc262_lenovo_3000_automute(codec, 1);
10052 /* bind hp and internal speaker mute (with plug check) */
10053 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10054 struct snd_ctl_elem_value *ucontrol)
10056 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10057 long *valp = ucontrol->value.integer.value;
10060 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10062 valp ? 0 : HDA_AMP_MUTE);
10063 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10065 valp ? 0 : HDA_AMP_MUTE);
10068 alc262_fujitsu_automute(codec, 0);
10072 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10073 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10075 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10076 .name = "Master Playback Switch",
10077 .info = snd_hda_mixer_amp_switch_info,
10078 .get = snd_hda_mixer_amp_switch_get,
10079 .put = alc262_fujitsu_master_sw_put,
10080 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10082 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10083 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10084 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10085 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10086 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10087 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10088 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10089 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10093 /* bind hp and internal speaker mute (with plug check) */
10094 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10095 struct snd_ctl_elem_value *ucontrol)
10097 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10098 long *valp = ucontrol->value.integer.value;
10101 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10103 valp ? 0 : HDA_AMP_MUTE);
10106 alc262_lenovo_3000_automute(codec, 0);
10110 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10111 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10114 .name = "Master Playback Switch",
10115 .info = snd_hda_mixer_amp_switch_info,
10116 .get = snd_hda_mixer_amp_switch_get,
10117 .put = alc262_lenovo_3000_master_sw_put,
10118 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10120 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10121 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10122 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10125 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10126 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10127 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10131 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10132 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10135 .name = "Master Playback Switch",
10136 .info = snd_hda_mixer_amp_switch_info,
10137 .get = snd_hda_mixer_amp_switch_get,
10138 .put = alc262_sony_master_sw_put,
10139 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10144 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10145 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10146 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10150 /* additional init verbs for Benq laptops */
10151 static struct hda_verb alc262_EAPD_verbs[] = {
10152 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10153 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10157 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10158 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10159 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10161 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10162 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10166 /* Samsung Q1 Ultra Vista model setup */
10167 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10168 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10169 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10172 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10173 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10177 static struct hda_verb alc262_ultra_verbs[] = {
10179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10184 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10185 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10186 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10189 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10190 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10191 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10192 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10194 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10195 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10196 /* ADC, choose mic */
10197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10201 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10202 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10203 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10204 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10210 /* mute/unmute internal speaker according to the hp jack and mute state */
10211 static void alc262_ultra_automute(struct hda_codec *codec)
10213 struct alc_spec *spec = codec->spec;
10217 /* auto-mute only when HP is used as HP */
10218 if (!spec->cur_mux[0]) {
10219 unsigned int present;
10220 /* need to execute and sync at first */
10221 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10222 present = snd_hda_codec_read(codec, 0x15, 0,
10223 AC_VERB_GET_PIN_SENSE, 0);
10224 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10225 if (spec->jack_present)
10226 mute = HDA_AMP_MUTE;
10228 /* mute/unmute internal speaker */
10229 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10230 HDA_AMP_MUTE, mute);
10231 /* mute/unmute HP */
10232 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10233 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10236 /* unsolicited event for HP jack sensing */
10237 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10240 if ((res >> 26) != ALC880_HP_EVENT)
10242 alc262_ultra_automute(codec);
10245 static struct hda_input_mux alc262_ultra_capture_source = {
10249 { "Headphone", 0x7 },
10253 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10254 struct snd_ctl_elem_value *ucontrol)
10256 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10257 struct alc_spec *spec = codec->spec;
10260 ret = alc_mux_enum_put(kcontrol, ucontrol);
10263 /* reprogram the HP pin as mic or HP according to the input source */
10264 snd_hda_codec_write_cache(codec, 0x15, 0,
10265 AC_VERB_SET_PIN_WIDGET_CONTROL,
10266 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10267 alc262_ultra_automute(codec); /* mute/unmute HP */
10271 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10272 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10273 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10275 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10276 .name = "Capture Source",
10277 .info = alc_mux_enum_info,
10278 .get = alc_mux_enum_get,
10279 .put = alc262_ultra_mux_enum_put,
10284 /* add playback controls from the parsed DAC table */
10285 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10286 const struct auto_pin_cfg *cfg)
10291 spec->multiout.num_dacs = 1; /* only use one dac */
10292 spec->multiout.dac_nids = spec->private_dac_nids;
10293 spec->multiout.dac_nids[0] = 2;
10295 nid = cfg->line_out_pins[0];
10297 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10298 "Front Playback Volume",
10299 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10302 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10303 "Front Playback Switch",
10304 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10309 nid = cfg->speaker_pins[0];
10312 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10313 "Speaker Playback Volume",
10314 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10318 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10319 "Speaker Playback Switch",
10320 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10325 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10326 "Speaker Playback Switch",
10327 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10333 nid = cfg->hp_pins[0];
10335 /* spec->multiout.hp_nid = 2; */
10337 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10338 "Headphone Playback Volume",
10339 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10343 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10344 "Headphone Playback Switch",
10345 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10350 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10351 "Headphone Playback Switch",
10352 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10361 /* identical with ALC880 */
10362 #define alc262_auto_create_analog_input_ctls \
10363 alc880_auto_create_analog_input_ctls
10366 * generic initialization of ADC, input mixers and output mixers
10368 static struct hda_verb alc262_volume_init_verbs[] = {
10370 * Unmute ADC0-2 and set the default input to mic-in
10372 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10374 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10375 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10376 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10377 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10379 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10381 * Note: PASD motherboards uses the Line In 2 as the input for
10382 * front panel mic (mic 2)
10384 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10392 * Set up output mixers (0x0c - 0x0f)
10394 /* set vol=0 to output mixers */
10395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10396 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10399 /* set up input amps for analog loopback */
10400 /* Amp Indices: DAC = 0, mixer = 1 */
10401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10403 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10408 /* FIXME: use matrix-type input source selection */
10409 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10410 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10411 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10412 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10416 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10429 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10431 * Unmute ADC0-2 and set the default input to mic-in
10433 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10435 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10436 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10437 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10438 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10440 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10442 * Note: PASD motherboards uses the Line In 2 as the input for
10443 * front panel mic (mic 2)
10445 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10455 * Set up output mixers (0x0c - 0x0e)
10457 /* set vol=0 to output mixers */
10458 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10459 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10460 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10462 /* set up input amps for analog loopback */
10463 /* Amp Indices: DAC = 0, mixer = 1 */
10464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10467 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10471 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10472 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10473 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10475 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10476 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10478 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10479 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10481 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10482 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10484 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10485 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10487 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10488 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10489 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10490 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10491 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10492 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10495 /* FIXME: use matrix-type input source selection */
10496 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10497 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10500 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10501 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10505 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10506 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10510 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10513 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10518 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10520 * Unmute ADC0-2 and set the default input to mic-in
10522 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10524 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10525 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10526 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10527 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10529 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10531 * Note: PASD motherboards uses the Line In 2 as the input for front
10532 * panel mic (mic 2)
10534 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10535 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10536 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10538 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10539 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10540 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10541 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10542 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10544 * Set up output mixers (0x0c - 0x0e)
10546 /* set vol=0 to output mixers */
10547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10549 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10551 /* set up input amps for analog loopback */
10552 /* Amp Indices: DAC = 0, mixer = 1 */
10553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10555 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10557 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10558 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10562 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10563 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10564 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10565 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10566 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10567 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10569 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10570 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10572 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10573 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10575 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10576 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10577 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10578 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10579 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10580 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10582 /* FIXME: use matrix-type input source selection */
10583 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10584 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10585 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10586 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10587 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10588 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10589 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10590 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10591 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10594 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10595 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10596 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10597 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10598 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10603 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10605 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10606 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10609 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10614 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10617 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10618 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10622 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10623 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10626 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10627 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10632 #ifdef CONFIG_SND_HDA_POWER_SAVE
10633 #define alc262_loopbacks alc880_loopbacks
10636 /* pcm configuration: identiacal with ALC880 */
10637 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10638 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10639 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10640 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10643 * BIOS auto configuration
10645 static int alc262_parse_auto_config(struct hda_codec *codec)
10647 struct alc_spec *spec = codec->spec;
10649 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10651 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10655 if (!spec->autocfg.line_outs) {
10656 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10657 spec->multiout.max_channels = 2;
10658 spec->no_analog = 1;
10661 return 0; /* can't find valid BIOS pin config */
10663 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10666 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10670 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10673 if (spec->autocfg.dig_outs) {
10674 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10675 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10677 if (spec->autocfg.dig_in_pin)
10678 spec->dig_in_nid = ALC262_DIGIN_NID;
10680 if (spec->kctls.list)
10681 add_mixer(spec, spec->kctls.list);
10683 add_verb(spec, alc262_volume_init_verbs);
10684 spec->num_mux_defs = 1;
10685 spec->input_mux = &spec->private_imux[0];
10687 err = alc_auto_add_mic_boost(codec);
10691 store_pin_configs(codec);
10695 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10696 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10697 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10698 #define alc262_auto_init_input_src alc882_auto_init_input_src
10701 /* init callback for auto-configuration model -- overriding the default init */
10702 static void alc262_auto_init(struct hda_codec *codec)
10704 struct alc_spec *spec = codec->spec;
10705 alc262_auto_init_multi_out(codec);
10706 alc262_auto_init_hp_out(codec);
10707 alc262_auto_init_analog_input(codec);
10708 alc262_auto_init_input_src(codec);
10709 if (spec->unsol_event)
10710 alc_inithook(codec);
10714 * configuration and preset
10716 static const char *alc262_models[ALC262_MODEL_LAST] = {
10717 [ALC262_BASIC] = "basic",
10718 [ALC262_HIPPO] = "hippo",
10719 [ALC262_HIPPO_1] = "hippo_1",
10720 [ALC262_FUJITSU] = "fujitsu",
10721 [ALC262_HP_BPC] = "hp-bpc",
10722 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10723 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10724 [ALC262_HP_RP5700] = "hp-rp5700",
10725 [ALC262_BENQ_ED8] = "benq",
10726 [ALC262_BENQ_T31] = "benq-t31",
10727 [ALC262_SONY_ASSAMD] = "sony-assamd",
10728 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10729 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10730 [ALC262_ULTRA] = "ultra",
10731 [ALC262_LENOVO_3000] = "lenovo-3000",
10732 [ALC262_NEC] = "nec",
10733 [ALC262_TYAN] = "tyan",
10734 [ALC262_AUTO] = "auto",
10737 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10738 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10739 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10740 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10742 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10744 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10745 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10746 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10747 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10748 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10749 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10750 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10751 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10752 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10753 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10754 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10755 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10756 ALC262_HP_TC_T5735),
10757 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10758 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10759 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10760 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10761 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10762 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10763 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10764 ALC262_SONY_ASSAMD),
10765 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10766 ALC262_TOSHIBA_RX1),
10767 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10768 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10769 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10770 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10771 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10773 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10774 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10775 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10776 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10777 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10781 static struct alc_config_preset alc262_presets[] = {
10783 .mixers = { alc262_base_mixer },
10784 .init_verbs = { alc262_init_verbs },
10785 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10786 .dac_nids = alc262_dac_nids,
10788 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10789 .channel_mode = alc262_modes,
10790 .input_mux = &alc262_capture_source,
10793 .mixers = { alc262_base_mixer },
10794 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10795 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10796 .dac_nids = alc262_dac_nids,
10798 .dig_out_nid = ALC262_DIGOUT_NID,
10799 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10800 .channel_mode = alc262_modes,
10801 .input_mux = &alc262_capture_source,
10802 .unsol_event = alc262_hippo_unsol_event,
10803 .init_hook = alc262_hippo_automute,
10805 [ALC262_HIPPO_1] = {
10806 .mixers = { alc262_hippo1_mixer },
10807 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10808 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10809 .dac_nids = alc262_dac_nids,
10811 .dig_out_nid = ALC262_DIGOUT_NID,
10812 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10813 .channel_mode = alc262_modes,
10814 .input_mux = &alc262_capture_source,
10815 .unsol_event = alc262_hippo1_unsol_event,
10816 .init_hook = alc262_hippo1_automute,
10818 [ALC262_FUJITSU] = {
10819 .mixers = { alc262_fujitsu_mixer },
10820 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10821 alc262_fujitsu_unsol_verbs },
10822 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10823 .dac_nids = alc262_dac_nids,
10825 .dig_out_nid = ALC262_DIGOUT_NID,
10826 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10827 .channel_mode = alc262_modes,
10828 .input_mux = &alc262_fujitsu_capture_source,
10829 .unsol_event = alc262_fujitsu_unsol_event,
10830 .init_hook = alc262_fujitsu_init_hook,
10832 [ALC262_HP_BPC] = {
10833 .mixers = { alc262_HP_BPC_mixer },
10834 .init_verbs = { alc262_HP_BPC_init_verbs },
10835 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10836 .dac_nids = alc262_dac_nids,
10838 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10839 .channel_mode = alc262_modes,
10840 .input_mux = &alc262_HP_capture_source,
10841 .unsol_event = alc262_hp_bpc_unsol_event,
10842 .init_hook = alc262_hp_bpc_automute,
10844 [ALC262_HP_BPC_D7000_WF] = {
10845 .mixers = { alc262_HP_BPC_WildWest_mixer },
10846 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10847 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10848 .dac_nids = alc262_dac_nids,
10850 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10851 .channel_mode = alc262_modes,
10852 .input_mux = &alc262_HP_D7000_capture_source,
10853 .unsol_event = alc262_hp_wildwest_unsol_event,
10854 .init_hook = alc262_hp_wildwest_automute,
10856 [ALC262_HP_BPC_D7000_WL] = {
10857 .mixers = { alc262_HP_BPC_WildWest_mixer,
10858 alc262_HP_BPC_WildWest_option_mixer },
10859 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10860 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10861 .dac_nids = alc262_dac_nids,
10863 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10864 .channel_mode = alc262_modes,
10865 .input_mux = &alc262_HP_D7000_capture_source,
10866 .unsol_event = alc262_hp_wildwest_unsol_event,
10867 .init_hook = alc262_hp_wildwest_automute,
10869 [ALC262_HP_TC_T5735] = {
10870 .mixers = { alc262_hp_t5735_mixer },
10871 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10872 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10873 .dac_nids = alc262_dac_nids,
10875 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10876 .channel_mode = alc262_modes,
10877 .input_mux = &alc262_capture_source,
10878 .unsol_event = alc262_hp_t5735_unsol_event,
10879 .init_hook = alc262_hp_t5735_init_hook,
10881 [ALC262_HP_RP5700] = {
10882 .mixers = { alc262_hp_rp5700_mixer },
10883 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10884 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10885 .dac_nids = alc262_dac_nids,
10886 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10887 .channel_mode = alc262_modes,
10888 .input_mux = &alc262_hp_rp5700_capture_source,
10890 [ALC262_BENQ_ED8] = {
10891 .mixers = { alc262_base_mixer },
10892 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10893 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10894 .dac_nids = alc262_dac_nids,
10896 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10897 .channel_mode = alc262_modes,
10898 .input_mux = &alc262_capture_source,
10900 [ALC262_SONY_ASSAMD] = {
10901 .mixers = { alc262_sony_mixer },
10902 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10903 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10904 .dac_nids = alc262_dac_nids,
10906 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10907 .channel_mode = alc262_modes,
10908 .input_mux = &alc262_capture_source,
10909 .unsol_event = alc262_hippo_unsol_event,
10910 .init_hook = alc262_hippo_automute,
10912 [ALC262_BENQ_T31] = {
10913 .mixers = { alc262_benq_t31_mixer },
10914 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10915 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10916 .dac_nids = alc262_dac_nids,
10918 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10919 .channel_mode = alc262_modes,
10920 .input_mux = &alc262_capture_source,
10921 .unsol_event = alc262_hippo_unsol_event,
10922 .init_hook = alc262_hippo_automute,
10925 .mixers = { alc262_ultra_mixer },
10926 .cap_mixer = alc262_ultra_capture_mixer,
10927 .init_verbs = { alc262_ultra_verbs },
10928 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10929 .dac_nids = alc262_dac_nids,
10930 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10931 .channel_mode = alc262_modes,
10932 .input_mux = &alc262_ultra_capture_source,
10933 .adc_nids = alc262_adc_nids, /* ADC0 */
10934 .capsrc_nids = alc262_capsrc_nids,
10935 .num_adc_nids = 1, /* single ADC */
10936 .unsol_event = alc262_ultra_unsol_event,
10937 .init_hook = alc262_ultra_automute,
10939 [ALC262_LENOVO_3000] = {
10940 .mixers = { alc262_lenovo_3000_mixer },
10941 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10942 alc262_lenovo_3000_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_fujitsu_capture_source,
10950 .unsol_event = alc262_lenovo_3000_unsol_event,
10953 .mixers = { alc262_nec_mixer },
10954 .init_verbs = { alc262_nec_verbs },
10955 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10956 .dac_nids = alc262_dac_nids,
10958 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10959 .channel_mode = alc262_modes,
10960 .input_mux = &alc262_capture_source,
10962 [ALC262_TOSHIBA_S06] = {
10963 .mixers = { alc262_toshiba_s06_mixer },
10964 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10965 alc262_eapd_verbs },
10966 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10967 .capsrc_nids = alc262_dmic_capsrc_nids,
10968 .dac_nids = alc262_dac_nids,
10969 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10970 .dig_out_nid = ALC262_DIGOUT_NID,
10971 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10972 .channel_mode = alc262_modes,
10973 .input_mux = &alc262_dmic_capture_source,
10974 .unsol_event = alc262_toshiba_s06_unsol_event,
10975 .init_hook = alc262_toshiba_s06_init_hook,
10977 [ALC262_TOSHIBA_RX1] = {
10978 .mixers = { alc262_toshiba_rx1_mixer },
10979 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10980 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10981 .dac_nids = alc262_dac_nids,
10983 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10984 .channel_mode = alc262_modes,
10985 .input_mux = &alc262_capture_source,
10986 .unsol_event = alc262_hippo_unsol_event,
10987 .init_hook = alc262_hippo_automute,
10990 .mixers = { alc262_tyan_mixer },
10991 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
10992 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10993 .dac_nids = alc262_dac_nids,
10995 .dig_out_nid = ALC262_DIGOUT_NID,
10996 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10997 .channel_mode = alc262_modes,
10998 .input_mux = &alc262_capture_source,
10999 .unsol_event = alc262_tyan_unsol_event,
11000 .init_hook = alc262_tyan_automute,
11004 static int patch_alc262(struct hda_codec *codec)
11006 struct alc_spec *spec;
11010 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11014 codec->spec = spec;
11016 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11021 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11022 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11023 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11024 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11028 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11030 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11034 if (board_config < 0) {
11035 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11036 "trying auto-probe from BIOS...\n");
11037 board_config = ALC262_AUTO;
11040 if (board_config == ALC262_AUTO) {
11041 /* automatic parse from the BIOS config */
11042 err = alc262_parse_auto_config(codec);
11048 "hda_codec: Cannot set up configuration "
11049 "from BIOS. Using base mode...\n");
11050 board_config = ALC262_BASIC;
11054 if (!spec->no_analog) {
11055 err = snd_hda_attach_beep_device(codec, 0x1);
11062 if (board_config != ALC262_AUTO)
11063 setup_preset(spec, &alc262_presets[board_config]);
11065 spec->stream_name_analog = "ALC262 Analog";
11066 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11067 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11069 spec->stream_name_digital = "ALC262 Digital";
11070 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11071 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11073 spec->capture_style = CAPT_MIX;
11074 if (!spec->adc_nids && spec->input_mux) {
11075 /* check whether NID 0x07 is valid */
11076 unsigned int wcap = get_wcaps(codec, 0x07);
11079 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11080 if (wcap != AC_WID_AUD_IN) {
11081 spec->adc_nids = alc262_adc_nids_alt;
11082 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11083 spec->capsrc_nids = alc262_capsrc_nids_alt;
11085 spec->adc_nids = alc262_adc_nids;
11086 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11087 spec->capsrc_nids = alc262_capsrc_nids;
11090 if (!spec->cap_mixer && !spec->no_analog)
11091 set_capture_mixer(spec);
11092 if (!spec->no_analog)
11093 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11095 spec->vmaster_nid = 0x0c;
11097 codec->patch_ops = alc_patch_ops;
11098 if (board_config == ALC262_AUTO)
11099 spec->init_hook = alc262_auto_init;
11100 #ifdef CONFIG_SND_HDA_POWER_SAVE
11101 if (!spec->loopback.amplist)
11102 spec->loopback.amplist = alc262_loopbacks;
11104 codec->proc_widget_hook = print_realtek_coef;
11110 * ALC268 channel source setting (2 channel)
11112 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11113 #define alc268_modes alc260_modes
11115 static hda_nid_t alc268_dac_nids[2] = {
11120 static hda_nid_t alc268_adc_nids[2] = {
11125 static hda_nid_t alc268_adc_nids_alt[1] = {
11130 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11132 static struct snd_kcontrol_new alc268_base_mixer[] = {
11133 /* output mixer control */
11134 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11135 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11136 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11138 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11139 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11140 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11144 /* bind Beep switches of both NID 0x0f and 0x10 */
11145 static struct hda_bind_ctls alc268_bind_beep_sw = {
11146 .ops = &snd_hda_bind_sw,
11148 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11149 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11154 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11155 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11156 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11160 static struct hda_verb alc268_eapd_verbs[] = {
11161 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11162 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11166 /* Toshiba specific */
11167 #define alc268_toshiba_automute alc262_hippo_automute
11169 static struct hda_verb alc268_toshiba_verbs[] = {
11170 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11174 static struct hda_input_mux alc268_acer_lc_capture_source = {
11182 /* Acer specific */
11183 /* bind volumes of both NID 0x02 and 0x03 */
11184 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11185 .ops = &snd_hda_bind_vol,
11187 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11188 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11193 /* mute/unmute internal speaker according to the hp jack and mute state */
11194 static void alc268_acer_automute(struct hda_codec *codec, int force)
11196 struct alc_spec *spec = codec->spec;
11199 if (force || !spec->sense_updated) {
11200 unsigned int present;
11201 present = snd_hda_codec_read(codec, 0x14, 0,
11202 AC_VERB_GET_PIN_SENSE, 0);
11203 spec->jack_present = (present & 0x80000000) != 0;
11204 spec->sense_updated = 1;
11206 if (spec->jack_present)
11207 mute = HDA_AMP_MUTE; /* mute internal speaker */
11208 else /* unmute internal speaker if necessary */
11209 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11210 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11211 HDA_AMP_MUTE, mute);
11215 /* bind hp and internal speaker mute (with plug check) */
11216 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11217 struct snd_ctl_elem_value *ucontrol)
11219 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11220 long *valp = ucontrol->value.integer.value;
11223 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11225 valp[0] ? 0 : HDA_AMP_MUTE);
11226 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11228 valp[1] ? 0 : HDA_AMP_MUTE);
11230 alc268_acer_automute(codec, 0);
11234 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11235 /* output mixer control */
11236 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11238 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11239 .name = "Master Playback Switch",
11240 .info = snd_hda_mixer_amp_switch_info,
11241 .get = snd_hda_mixer_amp_switch_get,
11242 .put = alc268_acer_master_sw_put,
11243 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11245 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11249 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11250 /* output mixer control */
11251 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11254 .name = "Master Playback Switch",
11255 .info = snd_hda_mixer_amp_switch_info,
11256 .get = snd_hda_mixer_amp_switch_get,
11257 .put = alc268_acer_master_sw_put,
11258 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11260 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11261 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11262 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11266 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11267 /* output mixer control */
11268 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11270 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11271 .name = "Master Playback Switch",
11272 .info = snd_hda_mixer_amp_switch_info,
11273 .get = snd_hda_mixer_amp_switch_get,
11274 .put = alc268_acer_master_sw_put,
11275 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11277 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11278 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11282 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11283 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11284 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11285 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11286 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11287 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11288 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11292 static struct hda_verb alc268_acer_verbs[] = {
11293 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11294 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11295 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11298 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11299 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11303 /* unsolicited event for HP jack sensing */
11304 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11307 if ((res >> 26) != ALC880_HP_EVENT)
11309 alc268_toshiba_automute(codec);
11312 static void alc268_acer_unsol_event(struct hda_codec *codec,
11315 if ((res >> 26) != ALC880_HP_EVENT)
11317 alc268_acer_automute(codec, 1);
11320 static void alc268_acer_init_hook(struct hda_codec *codec)
11322 alc268_acer_automute(codec, 1);
11325 /* toggle speaker-output according to the hp-jack state */
11326 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11328 unsigned int present;
11329 unsigned char bits;
11331 present = snd_hda_codec_read(codec, 0x15, 0,
11332 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11333 bits = present ? AMP_IN_MUTE(0) : 0;
11334 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11335 AMP_IN_MUTE(0), bits);
11336 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11337 AMP_IN_MUTE(0), bits);
11341 static void alc268_acer_mic_automute(struct hda_codec *codec)
11343 unsigned int present;
11345 present = snd_hda_codec_read(codec, 0x18, 0,
11346 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11347 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11348 present ? 0x0 : 0x6);
11351 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11354 if ((res >> 26) == ALC880_HP_EVENT)
11355 alc268_aspire_one_speaker_automute(codec);
11356 if ((res >> 26) == ALC880_MIC_EVENT)
11357 alc268_acer_mic_automute(codec);
11360 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11362 alc268_aspire_one_speaker_automute(codec);
11363 alc268_acer_mic_automute(codec);
11366 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11367 /* output mixer control */
11368 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11369 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11370 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11371 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11372 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11373 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11377 static struct hda_verb alc268_dell_verbs[] = {
11378 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11380 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11384 /* mute/unmute internal speaker according to the hp jack and mute state */
11385 static void alc268_dell_automute(struct hda_codec *codec)
11387 unsigned int present;
11390 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11391 if (present & 0x80000000)
11392 mute = HDA_AMP_MUTE;
11394 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11395 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11396 HDA_AMP_MUTE, mute);
11399 static void alc268_dell_unsol_event(struct hda_codec *codec,
11402 if ((res >> 26) != ALC880_HP_EVENT)
11404 alc268_dell_automute(codec);
11407 #define alc268_dell_init_hook alc268_dell_automute
11409 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11410 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11411 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11412 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11413 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11414 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11415 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11416 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11417 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11421 static struct hda_verb alc267_quanta_il1_verbs[] = {
11422 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11423 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11427 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11429 unsigned int present;
11431 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11432 & AC_PINSENSE_PRESENCE;
11433 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11434 present ? 0 : PIN_OUT);
11437 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11439 unsigned int present;
11441 present = snd_hda_codec_read(codec, 0x18, 0,
11442 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11443 snd_hda_codec_write(codec, 0x23, 0,
11444 AC_VERB_SET_CONNECT_SEL,
11445 present ? 0x00 : 0x01);
11448 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11450 alc267_quanta_il1_hp_automute(codec);
11451 alc267_quanta_il1_mic_automute(codec);
11454 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11457 switch (res >> 26) {
11458 case ALC880_HP_EVENT:
11459 alc267_quanta_il1_hp_automute(codec);
11461 case ALC880_MIC_EVENT:
11462 alc267_quanta_il1_mic_automute(codec);
11468 * generic initialization of ADC, input mixers and output mixers
11470 static struct hda_verb alc268_base_init_verbs[] = {
11471 /* Unmute DAC0-1 and set vol = 0 */
11472 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11473 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11476 * Set up output mixers (0x0c - 0x0e)
11478 /* set vol=0 to output mixers */
11479 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11480 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11482 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11483 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11487 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11489 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11490 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11491 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11492 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11494 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11495 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11496 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11497 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11498 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11500 /* set PCBEEP vol = 0, mute connections */
11501 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11502 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11503 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11505 /* Unmute Selector 23h,24h and set the default input to mic-in */
11507 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11509 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11510 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11516 * generic initialization of ADC, input mixers and output mixers
11518 static struct hda_verb alc268_volume_init_verbs[] = {
11519 /* set output DAC */
11520 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11521 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11523 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11524 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11525 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11526 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11527 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11529 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11530 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11531 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11533 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11536 /* set PCBEEP vol = 0, mute connections */
11537 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11538 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11539 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11544 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11545 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11546 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11548 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11549 /* The multiple "Capture Source" controls confuse alsamixer
11550 * So call somewhat different..
11552 /* .name = "Capture Source", */
11553 .name = "Input Source",
11555 .info = alc_mux_enum_info,
11556 .get = alc_mux_enum_get,
11557 .put = alc_mux_enum_put,
11562 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11563 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11564 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11565 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11566 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11568 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11569 /* The multiple "Capture Source" controls confuse alsamixer
11570 * So call somewhat different..
11572 /* .name = "Capture Source", */
11573 .name = "Input Source",
11575 .info = alc_mux_enum_info,
11576 .get = alc_mux_enum_get,
11577 .put = alc_mux_enum_put,
11582 static struct hda_input_mux alc268_capture_source = {
11586 { "Front Mic", 0x1 },
11592 static struct hda_input_mux alc268_acer_capture_source = {
11596 { "Internal Mic", 0x1 },
11601 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11605 { "Internal Mic", 0x6 },
11610 #ifdef CONFIG_SND_DEBUG
11611 static struct snd_kcontrol_new alc268_test_mixer[] = {
11612 /* Volume widgets */
11613 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11614 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11615 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11616 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11617 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11618 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11619 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11620 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11621 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11622 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11623 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11624 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11625 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11626 /* The below appears problematic on some hardwares */
11627 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11628 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11629 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11630 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11631 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11633 /* Modes for retasking pin widgets */
11634 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11635 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11636 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11637 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11639 /* Controls for GPIO pins, assuming they are configured as outputs */
11640 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11641 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11642 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11643 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11645 /* Switches to allow the digital SPDIF output pin to be enabled.
11646 * The ALC268 does not have an SPDIF input.
11648 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11650 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11651 * this output to turn on an external amplifier.
11653 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11654 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11660 /* create input playback/capture controls for the given pin */
11661 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11662 const char *ctlname, int idx)
11667 sprintf(name, "%s Playback Volume", ctlname);
11669 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11670 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11674 } else if (nid == 0x15) {
11675 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11676 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11682 sprintf(name, "%s Playback Switch", ctlname);
11683 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11684 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11690 /* add playback controls from the parsed DAC table */
11691 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11692 const struct auto_pin_cfg *cfg)
11697 spec->multiout.num_dacs = 2; /* only use one dac */
11698 spec->multiout.dac_nids = spec->private_dac_nids;
11699 spec->multiout.dac_nids[0] = 2;
11700 spec->multiout.dac_nids[1] = 3;
11702 nid = cfg->line_out_pins[0];
11704 alc268_new_analog_output(spec, nid, "Front", 0);
11706 nid = cfg->speaker_pins[0];
11708 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11709 "Speaker Playback Volume",
11710 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11714 nid = cfg->hp_pins[0];
11716 alc268_new_analog_output(spec, nid, "Headphone", 0);
11718 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11720 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11721 "Mono Playback Switch",
11722 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11729 /* create playback/capture controls for input pins */
11730 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11731 const struct auto_pin_cfg *cfg)
11733 struct hda_input_mux *imux = &spec->private_imux[0];
11736 for (i = 0; i < AUTO_PIN_LAST; i++) {
11737 switch(cfg->input_pins[i]) {
11739 idx1 = 0; /* Mic 1 */
11742 idx1 = 1; /* Mic 2 */
11745 idx1 = 2; /* Line In */
11752 idx1 = 6; /* digital mics */
11757 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11758 imux->items[imux->num_items].index = idx1;
11764 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11766 struct alc_spec *spec = codec->spec;
11767 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11768 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11769 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11770 unsigned int dac_vol1, dac_vol2;
11773 snd_hda_codec_write(codec, speaker_nid, 0,
11774 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11775 snd_hda_codec_write(codec, 0x0f, 0,
11776 AC_VERB_SET_AMP_GAIN_MUTE,
11778 snd_hda_codec_write(codec, 0x10, 0,
11779 AC_VERB_SET_AMP_GAIN_MUTE,
11782 snd_hda_codec_write(codec, 0x0f, 0,
11783 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11784 snd_hda_codec_write(codec, 0x10, 0,
11785 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11788 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11789 if (line_nid == 0x14)
11790 dac_vol2 = AMP_OUT_ZERO;
11791 else if (line_nid == 0x15)
11792 dac_vol1 = AMP_OUT_ZERO;
11793 if (hp_nid == 0x14)
11794 dac_vol2 = AMP_OUT_ZERO;
11795 else if (hp_nid == 0x15)
11796 dac_vol1 = AMP_OUT_ZERO;
11797 if (line_nid != 0x16 || hp_nid != 0x16 ||
11798 spec->autocfg.line_out_pins[1] != 0x16 ||
11799 spec->autocfg.line_out_pins[2] != 0x16)
11800 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11802 snd_hda_codec_write(codec, 0x02, 0,
11803 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11804 snd_hda_codec_write(codec, 0x03, 0,
11805 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11808 /* pcm configuration: identiacal with ALC880 */
11809 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11810 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11811 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11812 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11815 * BIOS auto configuration
11817 static int alc268_parse_auto_config(struct hda_codec *codec)
11819 struct alc_spec *spec = codec->spec;
11821 static hda_nid_t alc268_ignore[] = { 0 };
11823 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11827 if (!spec->autocfg.line_outs) {
11828 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11829 spec->multiout.max_channels = 2;
11830 spec->no_analog = 1;
11833 return 0; /* can't find valid BIOS pin config */
11835 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11838 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11842 spec->multiout.max_channels = 2;
11845 /* digital only support output */
11846 if (spec->autocfg.dig_outs) {
11847 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11848 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11850 if (spec->kctls.list)
11851 add_mixer(spec, spec->kctls.list);
11853 if (spec->autocfg.speaker_pins[0] != 0x1d)
11854 add_mixer(spec, alc268_beep_mixer);
11856 add_verb(spec, alc268_volume_init_verbs);
11857 spec->num_mux_defs = 1;
11858 spec->input_mux = &spec->private_imux[0];
11860 err = alc_auto_add_mic_boost(codec);
11864 store_pin_configs(codec);
11868 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11869 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11870 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11872 /* init callback for auto-configuration model -- overriding the default init */
11873 static void alc268_auto_init(struct hda_codec *codec)
11875 struct alc_spec *spec = codec->spec;
11876 alc268_auto_init_multi_out(codec);
11877 alc268_auto_init_hp_out(codec);
11878 alc268_auto_init_mono_speaker_out(codec);
11879 alc268_auto_init_analog_input(codec);
11880 if (spec->unsol_event)
11881 alc_inithook(codec);
11885 * configuration and preset
11887 static const char *alc268_models[ALC268_MODEL_LAST] = {
11888 [ALC267_QUANTA_IL1] = "quanta-il1",
11889 [ALC268_3ST] = "3stack",
11890 [ALC268_TOSHIBA] = "toshiba",
11891 [ALC268_ACER] = "acer",
11892 [ALC268_ACER_DMIC] = "acer-dmic",
11893 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11894 [ALC268_DELL] = "dell",
11895 [ALC268_ZEPTO] = "zepto",
11896 #ifdef CONFIG_SND_DEBUG
11897 [ALC268_TEST] = "test",
11899 [ALC268_AUTO] = "auto",
11902 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11903 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11904 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11905 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11906 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11907 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11908 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11909 ALC268_ACER_ASPIRE_ONE),
11910 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11911 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11912 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11913 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11914 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11915 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11916 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11917 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11918 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11919 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11920 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11924 static struct alc_config_preset alc268_presets[] = {
11925 [ALC267_QUANTA_IL1] = {
11926 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
11927 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11928 alc267_quanta_il1_verbs },
11929 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11930 .dac_nids = alc268_dac_nids,
11931 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11932 .adc_nids = alc268_adc_nids_alt,
11934 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11935 .channel_mode = alc268_modes,
11936 .input_mux = &alc268_capture_source,
11937 .unsol_event = alc267_quanta_il1_unsol_event,
11938 .init_hook = alc267_quanta_il1_automute,
11941 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11942 alc268_beep_mixer },
11943 .init_verbs = { alc268_base_init_verbs },
11944 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11945 .dac_nids = alc268_dac_nids,
11946 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11947 .adc_nids = alc268_adc_nids_alt,
11948 .capsrc_nids = alc268_capsrc_nids,
11950 .dig_out_nid = ALC268_DIGOUT_NID,
11951 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11952 .channel_mode = alc268_modes,
11953 .input_mux = &alc268_capture_source,
11955 [ALC268_TOSHIBA] = {
11956 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11957 alc268_beep_mixer },
11958 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11959 alc268_toshiba_verbs },
11960 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11961 .dac_nids = alc268_dac_nids,
11962 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11963 .adc_nids = alc268_adc_nids_alt,
11964 .capsrc_nids = alc268_capsrc_nids,
11966 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11967 .channel_mode = alc268_modes,
11968 .input_mux = &alc268_capture_source,
11969 .unsol_event = alc268_toshiba_unsol_event,
11970 .init_hook = alc268_toshiba_automute,
11973 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11974 alc268_beep_mixer },
11975 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11976 alc268_acer_verbs },
11977 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11978 .dac_nids = alc268_dac_nids,
11979 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11980 .adc_nids = alc268_adc_nids_alt,
11981 .capsrc_nids = alc268_capsrc_nids,
11983 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11984 .channel_mode = alc268_modes,
11985 .input_mux = &alc268_acer_capture_source,
11986 .unsol_event = alc268_acer_unsol_event,
11987 .init_hook = alc268_acer_init_hook,
11989 [ALC268_ACER_DMIC] = {
11990 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11991 alc268_beep_mixer },
11992 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11993 alc268_acer_verbs },
11994 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11995 .dac_nids = alc268_dac_nids,
11996 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11997 .adc_nids = alc268_adc_nids_alt,
11998 .capsrc_nids = alc268_capsrc_nids,
12000 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12001 .channel_mode = alc268_modes,
12002 .input_mux = &alc268_acer_dmic_capture_source,
12003 .unsol_event = alc268_acer_unsol_event,
12004 .init_hook = alc268_acer_init_hook,
12006 [ALC268_ACER_ASPIRE_ONE] = {
12007 .mixers = { alc268_acer_aspire_one_mixer,
12009 alc268_capture_alt_mixer },
12010 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12011 alc268_acer_aspire_one_verbs },
12012 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12013 .dac_nids = alc268_dac_nids,
12014 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12015 .adc_nids = alc268_adc_nids_alt,
12016 .capsrc_nids = alc268_capsrc_nids,
12018 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12019 .channel_mode = alc268_modes,
12020 .input_mux = &alc268_acer_lc_capture_source,
12021 .unsol_event = alc268_acer_lc_unsol_event,
12022 .init_hook = alc268_acer_lc_init_hook,
12025 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12026 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12027 alc268_dell_verbs },
12028 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12029 .dac_nids = alc268_dac_nids,
12031 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12032 .channel_mode = alc268_modes,
12033 .unsol_event = alc268_dell_unsol_event,
12034 .init_hook = alc268_dell_init_hook,
12035 .input_mux = &alc268_capture_source,
12038 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12039 alc268_beep_mixer },
12040 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12041 alc268_toshiba_verbs },
12042 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12043 .dac_nids = alc268_dac_nids,
12044 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12045 .adc_nids = alc268_adc_nids_alt,
12046 .capsrc_nids = alc268_capsrc_nids,
12048 .dig_out_nid = ALC268_DIGOUT_NID,
12049 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12050 .channel_mode = alc268_modes,
12051 .input_mux = &alc268_capture_source,
12052 .unsol_event = alc268_toshiba_unsol_event,
12053 .init_hook = alc268_toshiba_automute
12055 #ifdef CONFIG_SND_DEBUG
12057 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12058 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12059 alc268_volume_init_verbs },
12060 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12061 .dac_nids = alc268_dac_nids,
12062 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12063 .adc_nids = alc268_adc_nids_alt,
12064 .capsrc_nids = alc268_capsrc_nids,
12066 .dig_out_nid = ALC268_DIGOUT_NID,
12067 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12068 .channel_mode = alc268_modes,
12069 .input_mux = &alc268_capture_source,
12074 static int patch_alc268(struct hda_codec *codec)
12076 struct alc_spec *spec;
12078 int i, has_beep, err;
12080 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12084 codec->spec = spec;
12086 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12090 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12091 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12092 "trying auto-probe from BIOS...\n");
12093 board_config = ALC268_AUTO;
12096 if (board_config == ALC268_AUTO) {
12097 /* automatic parse from the BIOS config */
12098 err = alc268_parse_auto_config(codec);
12104 "hda_codec: Cannot set up configuration "
12105 "from BIOS. Using base mode...\n");
12106 board_config = ALC268_3ST;
12110 if (board_config != ALC268_AUTO)
12111 setup_preset(spec, &alc268_presets[board_config]);
12113 if (codec->vendor_id == 0x10ec0267) {
12114 spec->stream_name_analog = "ALC267 Analog";
12115 spec->stream_name_digital = "ALC267 Digital";
12117 spec->stream_name_analog = "ALC268 Analog";
12118 spec->stream_name_digital = "ALC268 Digital";
12121 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12122 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12123 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12125 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12128 for (i = 0; i < spec->num_mixers; i++) {
12129 if (spec->mixers[i] == alc268_beep_mixer) {
12136 err = snd_hda_attach_beep_device(codec, 0x1);
12141 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12142 /* override the amp caps for beep generator */
12143 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12144 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12145 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12146 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12147 (0 << AC_AMPCAP_MUTE_SHIFT));
12150 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12151 /* check whether NID 0x07 is valid */
12152 unsigned int wcap = get_wcaps(codec, 0x07);
12156 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12157 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12158 spec->adc_nids = alc268_adc_nids_alt;
12159 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12160 add_mixer(spec, alc268_capture_alt_mixer);
12162 spec->adc_nids = alc268_adc_nids;
12163 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12164 add_mixer(spec, alc268_capture_mixer);
12166 spec->capsrc_nids = alc268_capsrc_nids;
12167 /* set default input source */
12168 for (i = 0; i < spec->num_adc_nids; i++)
12169 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12170 0, AC_VERB_SET_CONNECT_SEL,
12171 spec->input_mux->items[0].index);
12174 spec->vmaster_nid = 0x02;
12176 codec->patch_ops = alc_patch_ops;
12177 if (board_config == ALC268_AUTO)
12178 spec->init_hook = alc268_auto_init;
12180 codec->proc_widget_hook = print_realtek_coef;
12186 * ALC269 channel source setting (2 channel)
12188 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12190 #define alc269_dac_nids alc260_dac_nids
12192 static hda_nid_t alc269_adc_nids[1] = {
12197 static hda_nid_t alc269_capsrc_nids[1] = {
12201 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12205 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12213 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12221 #define alc269_modes alc260_modes
12222 #define alc269_capture_source alc880_lg_lw_capture_source
12224 static struct snd_kcontrol_new alc269_base_mixer[] = {
12225 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12226 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12227 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12228 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12232 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12233 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12234 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12235 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12236 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12240 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12241 /* output mixer control */
12242 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12244 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12245 .name = "Master Playback Switch",
12246 .info = snd_hda_mixer_amp_switch_info,
12247 .get = snd_hda_mixer_amp_switch_get,
12248 .put = alc268_acer_master_sw_put,
12249 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12254 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12255 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12256 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12260 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12261 /* output mixer control */
12262 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12265 .name = "Master Playback Switch",
12266 .info = snd_hda_mixer_amp_switch_info,
12267 .get = snd_hda_mixer_amp_switch_get,
12268 .put = alc268_acer_master_sw_put,
12269 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12274 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12275 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12276 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12277 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12278 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12279 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12283 /* bind volumes of both NID 0x0c and 0x0d */
12284 static struct hda_bind_ctls alc269_epc_bind_vol = {
12285 .ops = &snd_hda_bind_vol,
12287 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12288 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12293 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12294 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12295 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12296 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12300 /* capture mixer elements */
12301 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12302 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12303 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12304 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12309 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12310 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12312 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12316 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12317 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12318 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12319 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12320 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12321 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12322 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12326 static struct hda_verb alc269_lifebook_verbs[] = {
12327 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12328 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12329 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12331 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12333 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12334 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12335 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12336 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12340 /* toggle speaker-output according to the hp-jack state */
12341 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12343 unsigned int present;
12344 unsigned char bits;
12346 present = snd_hda_codec_read(codec, 0x15, 0,
12347 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12348 bits = present ? AMP_IN_MUTE(0) : 0;
12349 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12350 AMP_IN_MUTE(0), bits);
12351 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12352 AMP_IN_MUTE(0), bits);
12354 snd_hda_codec_write(codec, 0x20, 0,
12355 AC_VERB_SET_COEF_INDEX, 0x0c);
12356 snd_hda_codec_write(codec, 0x20, 0,
12357 AC_VERB_SET_PROC_COEF, 0x680);
12359 snd_hda_codec_write(codec, 0x20, 0,
12360 AC_VERB_SET_COEF_INDEX, 0x0c);
12361 snd_hda_codec_write(codec, 0x20, 0,
12362 AC_VERB_SET_PROC_COEF, 0x480);
12365 /* toggle speaker-output according to the hp-jacks state */
12366 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12368 unsigned int present;
12369 unsigned char bits;
12371 /* Check laptop headphone socket */
12372 present = snd_hda_codec_read(codec, 0x15, 0,
12373 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12375 /* Check port replicator headphone socket */
12376 present |= snd_hda_codec_read(codec, 0x1a, 0,
12377 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12379 bits = present ? AMP_IN_MUTE(0) : 0;
12380 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12381 AMP_IN_MUTE(0), bits);
12382 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12383 AMP_IN_MUTE(0), bits);
12385 snd_hda_codec_write(codec, 0x20, 0,
12386 AC_VERB_SET_COEF_INDEX, 0x0c);
12387 snd_hda_codec_write(codec, 0x20, 0,
12388 AC_VERB_SET_PROC_COEF, 0x680);
12390 snd_hda_codec_write(codec, 0x20, 0,
12391 AC_VERB_SET_COEF_INDEX, 0x0c);
12392 snd_hda_codec_write(codec, 0x20, 0,
12393 AC_VERB_SET_PROC_COEF, 0x480);
12396 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12398 unsigned int present;
12400 present = snd_hda_codec_read(codec, 0x18, 0,
12401 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12402 snd_hda_codec_write(codec, 0x23, 0,
12403 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12406 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12408 unsigned int present_laptop;
12409 unsigned int present_dock;
12411 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12412 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12414 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12415 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12417 /* Laptop mic port overrides dock mic port, design decision */
12419 snd_hda_codec_write(codec, 0x23, 0,
12420 AC_VERB_SET_CONNECT_SEL, 0x3);
12421 if (present_laptop)
12422 snd_hda_codec_write(codec, 0x23, 0,
12423 AC_VERB_SET_CONNECT_SEL, 0x0);
12424 if (!present_dock && !present_laptop)
12425 snd_hda_codec_write(codec, 0x23, 0,
12426 AC_VERB_SET_CONNECT_SEL, 0x1);
12429 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12432 if ((res >> 26) == ALC880_HP_EVENT)
12433 alc269_quanta_fl1_speaker_automute(codec);
12434 if ((res >> 26) == ALC880_MIC_EVENT)
12435 alc269_quanta_fl1_mic_automute(codec);
12438 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12441 if ((res >> 26) == ALC880_HP_EVENT)
12442 alc269_lifebook_speaker_automute(codec);
12443 if ((res >> 26) == ALC880_MIC_EVENT)
12444 alc269_lifebook_mic_autoswitch(codec);
12447 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12449 alc269_quanta_fl1_speaker_automute(codec);
12450 alc269_quanta_fl1_mic_automute(codec);
12453 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12455 alc269_lifebook_speaker_automute(codec);
12456 alc269_lifebook_mic_autoswitch(codec);
12459 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12461 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12462 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12464 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12465 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12466 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12470 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12471 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12472 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12473 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12474 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12475 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12476 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12480 /* toggle speaker-output according to the hp-jack state */
12481 static void alc269_speaker_automute(struct hda_codec *codec)
12483 unsigned int present;
12484 unsigned char bits;
12486 present = snd_hda_codec_read(codec, 0x15, 0,
12487 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12488 bits = present ? AMP_IN_MUTE(0) : 0;
12489 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12490 AMP_IN_MUTE(0), bits);
12491 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12492 AMP_IN_MUTE(0), bits);
12495 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12497 unsigned int present;
12499 present = snd_hda_codec_read(codec, 0x18, 0,
12500 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12501 snd_hda_codec_write(codec, 0x23, 0,
12502 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12505 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12507 unsigned int present;
12509 present = snd_hda_codec_read(codec, 0x18, 0,
12510 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12511 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12512 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12513 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12514 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12517 /* unsolicited event for HP jack sensing */
12518 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12521 if ((res >> 26) == ALC880_HP_EVENT)
12522 alc269_speaker_automute(codec);
12524 if ((res >> 26) == ALC880_MIC_EVENT)
12525 alc269_eeepc_dmic_automute(codec);
12528 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12530 alc269_speaker_automute(codec);
12531 alc269_eeepc_dmic_automute(codec);
12534 /* unsolicited event for HP jack sensing */
12535 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12538 if ((res >> 26) == ALC880_HP_EVENT)
12539 alc269_speaker_automute(codec);
12541 if ((res >> 26) == ALC880_MIC_EVENT)
12542 alc269_eeepc_amic_automute(codec);
12545 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12547 alc269_speaker_automute(codec);
12548 alc269_eeepc_amic_automute(codec);
12552 * generic initialization of ADC, input mixers and output mixers
12554 static struct hda_verb alc269_init_verbs[] = {
12556 * Unmute ADC0 and set the default input to mic-in
12558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12560 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12561 * analog-loopback mixer widget
12562 * Note: PASD motherboards uses the Line In 2 as the input for
12563 * front panel mic (mic 2)
12565 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12573 * Set up output mixers (0x0c - 0x0e)
12575 /* set vol=0 to output mixers */
12576 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12577 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12579 /* set up input amps for analog loopback */
12580 /* Amp Indices: DAC = 0, mixer = 1 */
12581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12590 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12592 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12593 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12594 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12596 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12597 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12598 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12599 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12600 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12601 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12602 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12604 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12607 /* FIXME: use matrix-type input source selection */
12608 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12609 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12616 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12617 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12621 /* add playback controls from the parsed DAC table */
12622 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12623 const struct auto_pin_cfg *cfg)
12628 spec->multiout.num_dacs = 1; /* only use one dac */
12629 spec->multiout.dac_nids = spec->private_dac_nids;
12630 spec->multiout.dac_nids[0] = 2;
12632 nid = cfg->line_out_pins[0];
12634 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12635 "Front Playback Volume",
12636 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12639 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12640 "Front Playback Switch",
12641 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12646 nid = cfg->speaker_pins[0];
12648 if (!cfg->line_out_pins[0]) {
12649 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12650 "Speaker Playback Volume",
12651 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12657 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12658 "Speaker Playback Switch",
12659 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12664 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12665 "Speaker Playback Switch",
12666 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12672 nid = cfg->hp_pins[0];
12674 /* spec->multiout.hp_nid = 2; */
12675 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12676 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12677 "Headphone Playback Volume",
12678 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12684 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12685 "Headphone Playback Switch",
12686 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12691 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12692 "Headphone Playback Switch",
12693 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12702 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12703 const struct auto_pin_cfg *cfg)
12707 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12710 /* digital-mic input pin is excluded in alc880_auto_create..()
12711 * because it's under 0x18
12713 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12714 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12715 struct hda_input_mux *imux = &spec->private_imux[0];
12716 imux->items[imux->num_items].label = "Int Mic";
12717 imux->items[imux->num_items].index = 0x05;
12723 #ifdef CONFIG_SND_HDA_POWER_SAVE
12724 #define alc269_loopbacks alc880_loopbacks
12727 /* pcm configuration: identiacal with ALC880 */
12728 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12729 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12730 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12731 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12734 * BIOS auto configuration
12736 static int alc269_parse_auto_config(struct hda_codec *codec)
12738 struct alc_spec *spec = codec->spec;
12740 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12742 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12747 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12750 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12754 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12756 if (spec->autocfg.dig_outs)
12757 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12759 if (spec->kctls.list)
12760 add_mixer(spec, spec->kctls.list);
12762 add_verb(spec, alc269_init_verbs);
12763 spec->num_mux_defs = 1;
12764 spec->input_mux = &spec->private_imux[0];
12765 /* set default input source */
12766 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12767 0, AC_VERB_SET_CONNECT_SEL,
12768 spec->input_mux->items[0].index);
12770 err = alc_auto_add_mic_boost(codec);
12774 if (!spec->cap_mixer && !spec->no_analog)
12775 set_capture_mixer(spec);
12777 store_pin_configs(codec);
12781 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12782 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12783 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12786 /* init callback for auto-configuration model -- overriding the default init */
12787 static void alc269_auto_init(struct hda_codec *codec)
12789 struct alc_spec *spec = codec->spec;
12790 alc269_auto_init_multi_out(codec);
12791 alc269_auto_init_hp_out(codec);
12792 alc269_auto_init_analog_input(codec);
12793 if (spec->unsol_event)
12794 alc_inithook(codec);
12798 * configuration and preset
12800 static const char *alc269_models[ALC269_MODEL_LAST] = {
12801 [ALC269_BASIC] = "basic",
12802 [ALC269_QUANTA_FL1] = "quanta",
12803 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12804 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12805 [ALC269_FUJITSU] = "fujitsu",
12806 [ALC269_LIFEBOOK] = "lifebook"
12809 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12810 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12811 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12812 ALC269_ASUS_EEEPC_P703),
12813 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12814 ALC269_ASUS_EEEPC_P901),
12815 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12816 ALC269_ASUS_EEEPC_P901),
12817 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12818 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12822 static struct alc_config_preset alc269_presets[] = {
12824 .mixers = { alc269_base_mixer },
12825 .init_verbs = { alc269_init_verbs },
12826 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12827 .dac_nids = alc269_dac_nids,
12829 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12830 .channel_mode = alc269_modes,
12831 .input_mux = &alc269_capture_source,
12833 [ALC269_QUANTA_FL1] = {
12834 .mixers = { alc269_quanta_fl1_mixer },
12835 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12836 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12837 .dac_nids = alc269_dac_nids,
12839 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12840 .channel_mode = alc269_modes,
12841 .input_mux = &alc269_capture_source,
12842 .unsol_event = alc269_quanta_fl1_unsol_event,
12843 .init_hook = alc269_quanta_fl1_init_hook,
12845 [ALC269_ASUS_EEEPC_P703] = {
12846 .mixers = { alc269_eeepc_mixer },
12847 .cap_mixer = alc269_epc_capture_mixer,
12848 .init_verbs = { alc269_init_verbs,
12849 alc269_eeepc_amic_init_verbs },
12850 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12851 .dac_nids = alc269_dac_nids,
12853 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12854 .channel_mode = alc269_modes,
12855 .input_mux = &alc269_eeepc_amic_capture_source,
12856 .unsol_event = alc269_eeepc_amic_unsol_event,
12857 .init_hook = alc269_eeepc_amic_inithook,
12859 [ALC269_ASUS_EEEPC_P901] = {
12860 .mixers = { alc269_eeepc_mixer },
12861 .cap_mixer = alc269_epc_capture_mixer,
12862 .init_verbs = { alc269_init_verbs,
12863 alc269_eeepc_dmic_init_verbs },
12864 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12865 .dac_nids = alc269_dac_nids,
12867 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12868 .channel_mode = alc269_modes,
12869 .input_mux = &alc269_eeepc_dmic_capture_source,
12870 .unsol_event = alc269_eeepc_dmic_unsol_event,
12871 .init_hook = alc269_eeepc_dmic_inithook,
12873 [ALC269_FUJITSU] = {
12874 .mixers = { alc269_fujitsu_mixer },
12875 .cap_mixer = alc269_epc_capture_mixer,
12876 .init_verbs = { alc269_init_verbs,
12877 alc269_eeepc_dmic_init_verbs },
12878 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12879 .dac_nids = alc269_dac_nids,
12881 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12882 .channel_mode = alc269_modes,
12883 .input_mux = &alc269_eeepc_dmic_capture_source,
12884 .unsol_event = alc269_eeepc_dmic_unsol_event,
12885 .init_hook = alc269_eeepc_dmic_inithook,
12887 [ALC269_LIFEBOOK] = {
12888 .mixers = { alc269_lifebook_mixer },
12889 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12890 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12891 .dac_nids = alc269_dac_nids,
12893 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12894 .channel_mode = alc269_modes,
12895 .input_mux = &alc269_capture_source,
12896 .unsol_event = alc269_lifebook_unsol_event,
12897 .init_hook = alc269_lifebook_init_hook,
12901 static int patch_alc269(struct hda_codec *codec)
12903 struct alc_spec *spec;
12907 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12911 codec->spec = spec;
12913 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12915 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12919 if (board_config < 0) {
12920 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12921 "trying auto-probe from BIOS...\n");
12922 board_config = ALC269_AUTO;
12925 if (board_config == ALC269_AUTO) {
12926 /* automatic parse from the BIOS config */
12927 err = alc269_parse_auto_config(codec);
12933 "hda_codec: Cannot set up configuration "
12934 "from BIOS. Using base mode...\n");
12935 board_config = ALC269_BASIC;
12939 err = snd_hda_attach_beep_device(codec, 0x1);
12945 if (board_config != ALC269_AUTO)
12946 setup_preset(spec, &alc269_presets[board_config]);
12948 spec->stream_name_analog = "ALC269 Analog";
12949 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12950 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12952 spec->stream_name_digital = "ALC269 Digital";
12953 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12954 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12956 spec->adc_nids = alc269_adc_nids;
12957 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12958 spec->capsrc_nids = alc269_capsrc_nids;
12959 if (!spec->cap_mixer)
12960 set_capture_mixer(spec);
12961 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12963 codec->patch_ops = alc_patch_ops;
12964 if (board_config == ALC269_AUTO)
12965 spec->init_hook = alc269_auto_init;
12966 #ifdef CONFIG_SND_HDA_POWER_SAVE
12967 if (!spec->loopback.amplist)
12968 spec->loopback.amplist = alc269_loopbacks;
12970 codec->proc_widget_hook = print_realtek_coef;
12976 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12980 * set the path ways for 2 channel output
12981 * need to set the codec line out and mic 1 pin widgets to inputs
12983 static struct hda_verb alc861_threestack_ch2_init[] = {
12984 /* set pin widget 1Ah (line in) for input */
12985 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12986 /* set pin widget 18h (mic1/2) for input, for mic also enable
12989 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12991 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12993 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12994 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13000 * need to set the codec line out and mic 1 pin widgets to outputs
13002 static struct hda_verb alc861_threestack_ch6_init[] = {
13003 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13004 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13005 /* set pin widget 18h (mic1) for output (CLFE)*/
13006 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13008 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13009 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13011 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13013 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13014 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13019 static struct hda_channel_mode alc861_threestack_modes[2] = {
13020 { 2, alc861_threestack_ch2_init },
13021 { 6, alc861_threestack_ch6_init },
13023 /* Set mic1 as input and unmute the mixer */
13024 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13025 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13026 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13029 /* Set mic1 as output and mute mixer */
13030 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13031 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13032 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13036 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13037 { 2, alc861_uniwill_m31_ch2_init },
13038 { 4, alc861_uniwill_m31_ch4_init },
13041 /* Set mic1 and line-in as input and unmute the mixer */
13042 static struct hda_verb alc861_asus_ch2_init[] = {
13043 /* set pin widget 1Ah (line in) for input */
13044 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13045 /* set pin widget 18h (mic1/2) for input, for mic also enable
13048 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13050 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13052 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13053 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13057 /* Set mic1 nad line-in as output and mute mixer */
13058 static struct hda_verb alc861_asus_ch6_init[] = {
13059 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13060 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13061 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13062 /* set pin widget 18h (mic1) for output (CLFE)*/
13063 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13064 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13065 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13066 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13068 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13070 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13071 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13076 static struct hda_channel_mode alc861_asus_modes[2] = {
13077 { 2, alc861_asus_ch2_init },
13078 { 6, alc861_asus_ch6_init },
13083 static struct snd_kcontrol_new alc861_base_mixer[] = {
13084 /* output mixer control */
13085 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13086 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13087 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13088 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13089 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13091 /*Input mixer control */
13092 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13093 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13094 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13095 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13096 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13097 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13099 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13100 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13101 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13106 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13107 /* output mixer control */
13108 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13109 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13110 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13111 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13112 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13114 /* Input mixer control */
13115 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13116 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13117 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13118 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13119 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13120 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13122 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13123 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13124 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13127 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13128 .name = "Channel Mode",
13129 .info = alc_ch_mode_info,
13130 .get = alc_ch_mode_get,
13131 .put = alc_ch_mode_put,
13132 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13137 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13138 /* output mixer control */
13139 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13141 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13146 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13147 /* output mixer control */
13148 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13149 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13150 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13151 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13152 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13154 /* Input mixer control */
13155 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13156 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13157 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13158 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13159 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13160 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13162 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13163 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13164 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13167 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13168 .name = "Channel Mode",
13169 .info = alc_ch_mode_info,
13170 .get = alc_ch_mode_get,
13171 .put = alc_ch_mode_put,
13172 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13177 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13178 /* output mixer control */
13179 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13180 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13181 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13182 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13183 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13185 /* Input mixer control */
13186 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13187 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13188 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13189 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13190 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13191 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13193 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13194 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13198 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13199 .name = "Channel Mode",
13200 .info = alc_ch_mode_info,
13201 .get = alc_ch_mode_get,
13202 .put = alc_ch_mode_put,
13203 .private_value = ARRAY_SIZE(alc861_asus_modes),
13208 /* additional mixer */
13209 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13210 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13211 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13216 * generic initialization of ADC, input mixers and output mixers
13218 static struct hda_verb alc861_base_init_verbs[] = {
13220 * Unmute ADC0 and set the default input to mic-in
13222 /* port-A for surround (rear panel) */
13223 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13224 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13225 /* port-B for mic-in (rear panel) with vref */
13226 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13227 /* port-C for line-in (rear panel) */
13228 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13229 /* port-D for Front */
13230 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13231 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13232 /* port-E for HP out (front panel) */
13233 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13234 /* route front PCM to HP */
13235 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13236 /* port-F for mic-in (front panel) with vref */
13237 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13238 /* port-G for CLFE (rear panel) */
13239 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13240 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13241 /* port-H for side (rear panel) */
13242 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13243 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13245 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13246 /* route front mic to ADC1*/
13247 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13248 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13250 /* Unmute DAC0~3 & spdif out*/
13251 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13252 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13253 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13254 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13257 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13258 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13259 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13260 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13261 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13263 /* Unmute Stereo Mixer 15 */
13264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13266 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13269 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13270 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13271 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13272 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13273 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13274 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13275 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13276 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13277 /* hp used DAC 3 (Front) */
13278 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13279 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13284 static struct hda_verb alc861_threestack_init_verbs[] = {
13286 * Unmute ADC0 and set the default input to mic-in
13288 /* port-A for surround (rear panel) */
13289 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13290 /* port-B for mic-in (rear panel) with vref */
13291 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13292 /* port-C for line-in (rear panel) */
13293 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13294 /* port-D for Front */
13295 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13296 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13297 /* port-E for HP out (front panel) */
13298 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13299 /* route front PCM to HP */
13300 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13301 /* port-F for mic-in (front panel) with vref */
13302 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13303 /* port-G for CLFE (rear panel) */
13304 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13305 /* port-H for side (rear panel) */
13306 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13308 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13309 /* route front mic to ADC1*/
13310 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13311 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13312 /* Unmute DAC0~3 & spdif out*/
13313 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13314 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13315 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13316 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13319 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13320 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13321 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13322 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13323 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13325 /* Unmute Stereo Mixer 15 */
13326 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13328 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13329 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13331 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13332 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13333 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13334 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13335 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13336 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13337 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13338 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13339 /* hp used DAC 3 (Front) */
13340 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13345 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13347 * Unmute ADC0 and set the default input to mic-in
13349 /* port-A for surround (rear panel) */
13350 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13351 /* port-B for mic-in (rear panel) with vref */
13352 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13353 /* port-C for line-in (rear panel) */
13354 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13355 /* port-D for Front */
13356 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13357 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13358 /* port-E for HP out (front panel) */
13359 /* this has to be set to VREF80 */
13360 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13361 /* route front PCM to HP */
13362 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13363 /* port-F for mic-in (front panel) with vref */
13364 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13365 /* port-G for CLFE (rear panel) */
13366 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13367 /* port-H for side (rear panel) */
13368 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13370 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13371 /* route front mic to ADC1*/
13372 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13373 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13374 /* Unmute DAC0~3 & spdif out*/
13375 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13376 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13377 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13378 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13381 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13382 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13383 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13384 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13385 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13387 /* Unmute Stereo Mixer 15 */
13388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13389 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13390 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13391 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13393 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13394 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13395 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13396 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13397 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13398 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13399 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13400 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13401 /* hp used DAC 3 (Front) */
13402 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13403 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13407 static struct hda_verb alc861_asus_init_verbs[] = {
13409 * Unmute ADC0 and set the default input to mic-in
13411 /* port-A for surround (rear panel)
13412 * according to codec#0 this is the HP jack
13414 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13415 /* route front PCM to HP */
13416 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13417 /* port-B for mic-in (rear panel) with vref */
13418 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13419 /* port-C for line-in (rear panel) */
13420 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13421 /* port-D for Front */
13422 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13423 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13424 /* port-E for HP out (front panel) */
13425 /* this has to be set to VREF80 */
13426 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13427 /* route front PCM to HP */
13428 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13429 /* port-F for mic-in (front panel) with vref */
13430 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13431 /* port-G for CLFE (rear panel) */
13432 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13433 /* port-H for side (rear panel) */
13434 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13436 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13437 /* route front mic to ADC1*/
13438 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13440 /* Unmute DAC0~3 & spdif out*/
13441 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13442 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13443 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13444 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13446 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13447 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13448 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13449 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13450 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13452 /* Unmute Stereo Mixer 15 */
13453 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13454 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13456 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13458 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13459 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13460 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13461 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13462 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13463 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13464 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13465 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13466 /* hp used DAC 3 (Front) */
13467 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13468 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13472 /* additional init verbs for ASUS laptops */
13473 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13474 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13475 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13480 * generic initialization of ADC, input mixers and output mixers
13482 static struct hda_verb alc861_auto_init_verbs[] = {
13484 * Unmute ADC0 and set the default input to mic-in
13486 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13487 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13489 /* Unmute DAC0~3 & spdif out*/
13490 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13491 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13492 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13493 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13496 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13497 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13498 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13499 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13500 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13502 /* Unmute Stereo Mixer 15 */
13503 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13506 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13508 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13509 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13510 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13511 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13513 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13514 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13515 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13517 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13518 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13519 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13520 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13521 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13522 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13523 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13524 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13526 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13531 static struct hda_verb alc861_toshiba_init_verbs[] = {
13532 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13537 /* toggle speaker-output according to the hp-jack state */
13538 static void alc861_toshiba_automute(struct hda_codec *codec)
13540 unsigned int present;
13542 present = snd_hda_codec_read(codec, 0x0f, 0,
13543 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13544 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13545 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13546 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13547 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13550 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13553 if ((res >> 26) == ALC880_HP_EVENT)
13554 alc861_toshiba_automute(codec);
13557 /* pcm configuration: identiacal with ALC880 */
13558 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13559 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13560 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13561 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13564 #define ALC861_DIGOUT_NID 0x07
13566 static struct hda_channel_mode alc861_8ch_modes[1] = {
13570 static hda_nid_t alc861_dac_nids[4] = {
13571 /* front, surround, clfe, side */
13572 0x03, 0x06, 0x05, 0x04
13575 static hda_nid_t alc660_dac_nids[3] = {
13576 /* front, clfe, surround */
13580 static hda_nid_t alc861_adc_nids[1] = {
13585 static struct hda_input_mux alc861_capture_source = {
13589 { "Front Mic", 0x3 },
13596 /* fill in the dac_nids table from the parsed pin configuration */
13597 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13598 const struct auto_pin_cfg *cfg)
13603 spec->multiout.dac_nids = spec->private_dac_nids;
13604 for (i = 0; i < cfg->line_outs; i++) {
13605 nid = cfg->line_out_pins[i];
13607 if (i >= ARRAY_SIZE(alc861_dac_nids))
13609 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13612 spec->multiout.num_dacs = cfg->line_outs;
13616 /* add playback controls from the parsed DAC table */
13617 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13618 const struct auto_pin_cfg *cfg)
13621 static const char *chname[4] = {
13622 "Front", "Surround", NULL /*CLFE*/, "Side"
13627 for (i = 0; i < cfg->line_outs; i++) {
13628 nid = spec->multiout.dac_nids[i];
13633 err = add_control(spec, ALC_CTL_BIND_MUTE,
13634 "Center Playback Switch",
13635 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13639 err = add_control(spec, ALC_CTL_BIND_MUTE,
13640 "LFE Playback Switch",
13641 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13646 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13648 if (nid == alc861_dac_nids[idx])
13650 sprintf(name, "%s Playback Switch", chname[idx]);
13651 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13652 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13661 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13669 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13671 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13672 "Headphone Playback Switch",
13673 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13676 spec->multiout.hp_nid = nid;
13681 /* create playback/capture controls for input pins */
13682 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13683 const struct auto_pin_cfg *cfg)
13685 struct hda_input_mux *imux = &spec->private_imux[0];
13686 int i, err, idx, idx1;
13688 for (i = 0; i < AUTO_PIN_LAST; i++) {
13689 switch (cfg->input_pins[i]) {
13692 idx = 2; /* Line In */
13696 idx = 2; /* Line In */
13700 idx = 1; /* Mic In */
13704 idx = 1; /* Mic In */
13714 err = new_analog_input(spec, cfg->input_pins[i],
13715 auto_pin_cfg_labels[i], idx, 0x15);
13719 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13720 imux->items[imux->num_items].index = idx1;
13726 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13728 int pin_type, int dac_idx)
13730 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13732 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13736 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13738 struct alc_spec *spec = codec->spec;
13741 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13742 for (i = 0; i < spec->autocfg.line_outs; i++) {
13743 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13744 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13746 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13747 spec->multiout.dac_nids[i]);
13751 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13753 struct alc_spec *spec = codec->spec;
13756 pin = spec->autocfg.hp_pins[0];
13757 if (pin) /* connect to front */
13758 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13759 spec->multiout.dac_nids[0]);
13760 pin = spec->autocfg.speaker_pins[0];
13762 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13765 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13767 struct alc_spec *spec = codec->spec;
13770 for (i = 0; i < AUTO_PIN_LAST; i++) {
13771 hda_nid_t nid = spec->autocfg.input_pins[i];
13772 if (nid >= 0x0c && nid <= 0x11) {
13773 snd_hda_codec_write(codec, nid, 0,
13774 AC_VERB_SET_PIN_WIDGET_CONTROL,
13775 i <= AUTO_PIN_FRONT_MIC ?
13776 PIN_VREF80 : PIN_IN);
13781 /* parse the BIOS configuration and set up the alc_spec */
13782 /* return 1 if successful, 0 if the proper config is not found,
13783 * or a negative error code
13785 static int alc861_parse_auto_config(struct hda_codec *codec)
13787 struct alc_spec *spec = codec->spec;
13789 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13791 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13795 if (!spec->autocfg.line_outs)
13796 return 0; /* can't find valid BIOS pin config */
13798 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13801 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13804 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13807 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13811 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13813 if (spec->autocfg.dig_outs)
13814 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13816 if (spec->kctls.list)
13817 add_mixer(spec, spec->kctls.list);
13819 add_verb(spec, alc861_auto_init_verbs);
13821 spec->num_mux_defs = 1;
13822 spec->input_mux = &spec->private_imux[0];
13824 spec->adc_nids = alc861_adc_nids;
13825 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13826 set_capture_mixer(spec);
13828 store_pin_configs(codec);
13832 /* additional initialization for auto-configuration model */
13833 static void alc861_auto_init(struct hda_codec *codec)
13835 struct alc_spec *spec = codec->spec;
13836 alc861_auto_init_multi_out(codec);
13837 alc861_auto_init_hp_out(codec);
13838 alc861_auto_init_analog_input(codec);
13839 if (spec->unsol_event)
13840 alc_inithook(codec);
13843 #ifdef CONFIG_SND_HDA_POWER_SAVE
13844 static struct hda_amp_list alc861_loopbacks[] = {
13845 { 0x15, HDA_INPUT, 0 },
13846 { 0x15, HDA_INPUT, 1 },
13847 { 0x15, HDA_INPUT, 2 },
13848 { 0x15, HDA_INPUT, 3 },
13855 * configuration and preset
13857 static const char *alc861_models[ALC861_MODEL_LAST] = {
13858 [ALC861_3ST] = "3stack",
13859 [ALC660_3ST] = "3stack-660",
13860 [ALC861_3ST_DIG] = "3stack-dig",
13861 [ALC861_6ST_DIG] = "6stack-dig",
13862 [ALC861_UNIWILL_M31] = "uniwill-m31",
13863 [ALC861_TOSHIBA] = "toshiba",
13864 [ALC861_ASUS] = "asus",
13865 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13866 [ALC861_AUTO] = "auto",
13869 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13870 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13871 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13872 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13873 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13874 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13875 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13876 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13877 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13878 * Any other models that need this preset?
13880 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13881 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13882 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13883 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13884 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13885 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13886 /* FIXME: the below seems conflict */
13887 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13888 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13889 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13893 static struct alc_config_preset alc861_presets[] = {
13895 .mixers = { alc861_3ST_mixer },
13896 .init_verbs = { alc861_threestack_init_verbs },
13897 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13898 .dac_nids = alc861_dac_nids,
13899 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13900 .channel_mode = alc861_threestack_modes,
13902 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13903 .adc_nids = alc861_adc_nids,
13904 .input_mux = &alc861_capture_source,
13906 [ALC861_3ST_DIG] = {
13907 .mixers = { alc861_base_mixer },
13908 .init_verbs = { alc861_threestack_init_verbs },
13909 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13910 .dac_nids = alc861_dac_nids,
13911 .dig_out_nid = ALC861_DIGOUT_NID,
13912 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13913 .channel_mode = alc861_threestack_modes,
13915 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13916 .adc_nids = alc861_adc_nids,
13917 .input_mux = &alc861_capture_source,
13919 [ALC861_6ST_DIG] = {
13920 .mixers = { alc861_base_mixer },
13921 .init_verbs = { alc861_base_init_verbs },
13922 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13923 .dac_nids = alc861_dac_nids,
13924 .dig_out_nid = ALC861_DIGOUT_NID,
13925 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13926 .channel_mode = alc861_8ch_modes,
13927 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13928 .adc_nids = alc861_adc_nids,
13929 .input_mux = &alc861_capture_source,
13932 .mixers = { alc861_3ST_mixer },
13933 .init_verbs = { alc861_threestack_init_verbs },
13934 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13935 .dac_nids = alc660_dac_nids,
13936 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13937 .channel_mode = alc861_threestack_modes,
13939 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13940 .adc_nids = alc861_adc_nids,
13941 .input_mux = &alc861_capture_source,
13943 [ALC861_UNIWILL_M31] = {
13944 .mixers = { alc861_uniwill_m31_mixer },
13945 .init_verbs = { alc861_uniwill_m31_init_verbs },
13946 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13947 .dac_nids = alc861_dac_nids,
13948 .dig_out_nid = ALC861_DIGOUT_NID,
13949 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13950 .channel_mode = alc861_uniwill_m31_modes,
13952 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13953 .adc_nids = alc861_adc_nids,
13954 .input_mux = &alc861_capture_source,
13956 [ALC861_TOSHIBA] = {
13957 .mixers = { alc861_toshiba_mixer },
13958 .init_verbs = { alc861_base_init_verbs,
13959 alc861_toshiba_init_verbs },
13960 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13961 .dac_nids = alc861_dac_nids,
13962 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13963 .channel_mode = alc883_3ST_2ch_modes,
13964 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13965 .adc_nids = alc861_adc_nids,
13966 .input_mux = &alc861_capture_source,
13967 .unsol_event = alc861_toshiba_unsol_event,
13968 .init_hook = alc861_toshiba_automute,
13971 .mixers = { alc861_asus_mixer },
13972 .init_verbs = { alc861_asus_init_verbs },
13973 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13974 .dac_nids = alc861_dac_nids,
13975 .dig_out_nid = ALC861_DIGOUT_NID,
13976 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13977 .channel_mode = alc861_asus_modes,
13980 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13981 .adc_nids = alc861_adc_nids,
13982 .input_mux = &alc861_capture_source,
13984 [ALC861_ASUS_LAPTOP] = {
13985 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13986 .init_verbs = { alc861_asus_init_verbs,
13987 alc861_asus_laptop_init_verbs },
13988 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13989 .dac_nids = alc861_dac_nids,
13990 .dig_out_nid = ALC861_DIGOUT_NID,
13991 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13992 .channel_mode = alc883_3ST_2ch_modes,
13994 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13995 .adc_nids = alc861_adc_nids,
13996 .input_mux = &alc861_capture_source,
14001 static int patch_alc861(struct hda_codec *codec)
14003 struct alc_spec *spec;
14007 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14011 codec->spec = spec;
14013 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14017 if (board_config < 0) {
14018 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14019 "trying auto-probe from BIOS...\n");
14020 board_config = ALC861_AUTO;
14023 if (board_config == ALC861_AUTO) {
14024 /* automatic parse from the BIOS config */
14025 err = alc861_parse_auto_config(codec);
14031 "hda_codec: Cannot set up configuration "
14032 "from BIOS. Using base mode...\n");
14033 board_config = ALC861_3ST_DIG;
14037 err = snd_hda_attach_beep_device(codec, 0x23);
14043 if (board_config != ALC861_AUTO)
14044 setup_preset(spec, &alc861_presets[board_config]);
14046 spec->stream_name_analog = "ALC861 Analog";
14047 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14048 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14050 spec->stream_name_digital = "ALC861 Digital";
14051 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14052 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14054 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14056 spec->vmaster_nid = 0x03;
14058 codec->patch_ops = alc_patch_ops;
14059 if (board_config == ALC861_AUTO)
14060 spec->init_hook = alc861_auto_init;
14061 #ifdef CONFIG_SND_HDA_POWER_SAVE
14062 if (!spec->loopback.amplist)
14063 spec->loopback.amplist = alc861_loopbacks;
14065 codec->proc_widget_hook = print_realtek_coef;
14071 * ALC861-VD support
14075 * In addition, an independent DAC
14077 #define ALC861VD_DIGOUT_NID 0x06
14079 static hda_nid_t alc861vd_dac_nids[4] = {
14080 /* front, surr, clfe, side surr */
14081 0x02, 0x03, 0x04, 0x05
14084 /* dac_nids for ALC660vd are in a different order - according to
14085 * Realtek's driver.
14086 * This should probably tesult in a different mixer for 6stack models
14087 * of ALC660vd codecs, but for now there is only 3stack mixer
14088 * - and it is the same as in 861vd.
14089 * adc_nids in ALC660vd are (is) the same as in 861vd
14091 static hda_nid_t alc660vd_dac_nids[3] = {
14092 /* front, rear, clfe, rear_surr */
14096 static hda_nid_t alc861vd_adc_nids[1] = {
14101 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14104 /* FIXME: should be a matrix-type input source selection */
14105 static struct hda_input_mux alc861vd_capture_source = {
14109 { "Front Mic", 0x1 },
14115 static struct hda_input_mux alc861vd_dallas_capture_source = {
14118 { "Ext Mic", 0x0 },
14119 { "Int Mic", 0x1 },
14123 static struct hda_input_mux alc861vd_hp_capture_source = {
14126 { "Front Mic", 0x0 },
14127 { "ATAPI Mic", 0x1 },
14134 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14141 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14142 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14143 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14144 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14145 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14152 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14153 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14154 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14155 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14156 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14160 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14161 { 6, alc861vd_6stack_ch6_init },
14162 { 8, alc861vd_6stack_ch8_init },
14165 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14167 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14168 .name = "Channel Mode",
14169 .info = alc_ch_mode_info,
14170 .get = alc_ch_mode_get,
14171 .put = alc_ch_mode_put,
14176 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14177 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14179 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14180 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14181 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14183 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14184 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14186 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14188 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14190 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14191 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14193 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14194 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14196 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14198 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14202 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14207 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14209 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14210 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14215 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14216 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14217 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14219 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14221 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14223 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14225 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14226 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14227 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14229 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14230 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14238 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14239 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14240 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14241 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14243 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14245 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14249 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14250 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14251 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14253 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14254 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14259 /* Pin assignment: Speaker=0x14, HP = 0x15,
14260 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14262 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14263 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14264 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14265 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14266 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14267 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14268 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14269 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14270 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14271 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14272 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14276 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14277 * Front Mic=0x18, ATAPI Mic = 0x19,
14279 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14280 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14281 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14282 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14283 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14284 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14285 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14286 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14287 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14293 * generic initialization of ADC, input mixers and output mixers
14295 static struct hda_verb alc861vd_volume_init_verbs[] = {
14297 * Unmute ADC0 and set the default input to mic-in
14299 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14300 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14302 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14303 * the analog-loopback mixer widget
14305 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14312 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14319 * Set up output mixers (0x02 - 0x05)
14321 /* set vol=0 to output mixers */
14322 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14323 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14324 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14325 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14327 /* set up input amps for analog loopback */
14328 /* Amp Indices: DAC = 0, mixer = 1 */
14329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14335 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14342 * 3-stack pin configuration:
14343 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14345 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14347 * Set pin mode and muting
14349 /* set front pin widgets 0x14 for output */
14350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14351 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14352 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14354 /* Mic (rear) pin: input vref at 80% */
14355 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14356 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14357 /* Front Mic pin: input vref at 80% */
14358 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14359 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14360 /* Line In pin: input */
14361 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14362 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14363 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14364 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14365 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14366 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14367 /* CD pin widget for input */
14368 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14374 * 6-stack pin configuration:
14376 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14378 * Set pin mode and muting
14380 /* set front pin widgets 0x14 for output */
14381 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14382 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14383 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14385 /* Rear Pin: output 1 (0x0d) */
14386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14388 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14389 /* CLFE Pin: output 2 (0x0e) */
14390 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14391 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14392 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14393 /* Side Pin: output 3 (0x0f) */
14394 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14395 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14396 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14398 /* Mic (rear) pin: input vref at 80% */
14399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14400 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14401 /* Front Mic pin: input vref at 80% */
14402 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14404 /* Line In pin: input */
14405 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14407 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14408 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14409 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14410 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14411 /* CD pin widget for input */
14412 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14417 static struct hda_verb alc861vd_eapd_verbs[] = {
14418 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14422 static struct hda_verb alc660vd_eapd_verbs[] = {
14423 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14424 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14428 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14431 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14432 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14433 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14437 /* toggle speaker-output according to the hp-jack state */
14438 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14440 unsigned int present;
14441 unsigned char bits;
14443 present = snd_hda_codec_read(codec, 0x1b, 0,
14444 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14445 bits = present ? HDA_AMP_MUTE : 0;
14446 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14447 HDA_AMP_MUTE, bits);
14450 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14452 unsigned int present;
14453 unsigned char bits;
14455 present = snd_hda_codec_read(codec, 0x18, 0,
14456 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14457 bits = present ? HDA_AMP_MUTE : 0;
14458 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14459 HDA_AMP_MUTE, bits);
14462 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14464 alc861vd_lenovo_hp_automute(codec);
14465 alc861vd_lenovo_mic_automute(codec);
14468 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14471 switch (res >> 26) {
14472 case ALC880_HP_EVENT:
14473 alc861vd_lenovo_hp_automute(codec);
14475 case ALC880_MIC_EVENT:
14476 alc861vd_lenovo_mic_automute(codec);
14481 static struct hda_verb alc861vd_dallas_verbs[] = {
14482 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14483 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14484 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14485 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14487 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14489 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14490 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14491 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14492 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14493 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14494 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14498 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14499 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14500 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14501 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14502 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14503 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14505 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14506 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14507 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14508 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14509 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14511 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14512 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14517 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14519 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14520 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14521 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14526 /* toggle speaker-output according to the hp-jack state */
14527 static void alc861vd_dallas_automute(struct hda_codec *codec)
14529 unsigned int present;
14531 present = snd_hda_codec_read(codec, 0x15, 0,
14532 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14533 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14534 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14537 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14539 if ((res >> 26) == ALC880_HP_EVENT)
14540 alc861vd_dallas_automute(codec);
14543 #ifdef CONFIG_SND_HDA_POWER_SAVE
14544 #define alc861vd_loopbacks alc880_loopbacks
14547 /* pcm configuration: identiacal with ALC880 */
14548 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14549 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14550 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14551 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14554 * configuration and preset
14556 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14557 [ALC660VD_3ST] = "3stack-660",
14558 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14559 [ALC660VD_ASUS_V1S] = "asus-v1s",
14560 [ALC861VD_3ST] = "3stack",
14561 [ALC861VD_3ST_DIG] = "3stack-digout",
14562 [ALC861VD_6ST_DIG] = "6stack-digout",
14563 [ALC861VD_LENOVO] = "lenovo",
14564 [ALC861VD_DALLAS] = "dallas",
14565 [ALC861VD_HP] = "hp",
14566 [ALC861VD_AUTO] = "auto",
14569 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14570 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14571 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14572 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14573 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14574 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14575 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14576 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14577 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14578 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14579 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14580 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14581 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14582 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14583 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14584 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14588 static struct alc_config_preset alc861vd_presets[] = {
14590 .mixers = { alc861vd_3st_mixer },
14591 .init_verbs = { alc861vd_volume_init_verbs,
14592 alc861vd_3stack_init_verbs },
14593 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14594 .dac_nids = alc660vd_dac_nids,
14595 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14596 .channel_mode = alc861vd_3stack_2ch_modes,
14597 .input_mux = &alc861vd_capture_source,
14599 [ALC660VD_3ST_DIG] = {
14600 .mixers = { alc861vd_3st_mixer },
14601 .init_verbs = { alc861vd_volume_init_verbs,
14602 alc861vd_3stack_init_verbs },
14603 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14604 .dac_nids = alc660vd_dac_nids,
14605 .dig_out_nid = ALC861VD_DIGOUT_NID,
14606 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14607 .channel_mode = alc861vd_3stack_2ch_modes,
14608 .input_mux = &alc861vd_capture_source,
14611 .mixers = { alc861vd_3st_mixer },
14612 .init_verbs = { alc861vd_volume_init_verbs,
14613 alc861vd_3stack_init_verbs },
14614 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14615 .dac_nids = alc861vd_dac_nids,
14616 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14617 .channel_mode = alc861vd_3stack_2ch_modes,
14618 .input_mux = &alc861vd_capture_source,
14620 [ALC861VD_3ST_DIG] = {
14621 .mixers = { alc861vd_3st_mixer },
14622 .init_verbs = { alc861vd_volume_init_verbs,
14623 alc861vd_3stack_init_verbs },
14624 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14625 .dac_nids = alc861vd_dac_nids,
14626 .dig_out_nid = ALC861VD_DIGOUT_NID,
14627 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14628 .channel_mode = alc861vd_3stack_2ch_modes,
14629 .input_mux = &alc861vd_capture_source,
14631 [ALC861VD_6ST_DIG] = {
14632 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14633 .init_verbs = { alc861vd_volume_init_verbs,
14634 alc861vd_6stack_init_verbs },
14635 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14636 .dac_nids = alc861vd_dac_nids,
14637 .dig_out_nid = ALC861VD_DIGOUT_NID,
14638 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14639 .channel_mode = alc861vd_6stack_modes,
14640 .input_mux = &alc861vd_capture_source,
14642 [ALC861VD_LENOVO] = {
14643 .mixers = { alc861vd_lenovo_mixer },
14644 .init_verbs = { alc861vd_volume_init_verbs,
14645 alc861vd_3stack_init_verbs,
14646 alc861vd_eapd_verbs,
14647 alc861vd_lenovo_unsol_verbs },
14648 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14649 .dac_nids = alc660vd_dac_nids,
14650 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14651 .channel_mode = alc861vd_3stack_2ch_modes,
14652 .input_mux = &alc861vd_capture_source,
14653 .unsol_event = alc861vd_lenovo_unsol_event,
14654 .init_hook = alc861vd_lenovo_automute,
14656 [ALC861VD_DALLAS] = {
14657 .mixers = { alc861vd_dallas_mixer },
14658 .init_verbs = { alc861vd_dallas_verbs },
14659 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14660 .dac_nids = alc861vd_dac_nids,
14661 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14662 .channel_mode = alc861vd_3stack_2ch_modes,
14663 .input_mux = &alc861vd_dallas_capture_source,
14664 .unsol_event = alc861vd_dallas_unsol_event,
14665 .init_hook = alc861vd_dallas_automute,
14668 .mixers = { alc861vd_hp_mixer },
14669 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14670 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14671 .dac_nids = alc861vd_dac_nids,
14672 .dig_out_nid = ALC861VD_DIGOUT_NID,
14673 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14674 .channel_mode = alc861vd_3stack_2ch_modes,
14675 .input_mux = &alc861vd_hp_capture_source,
14676 .unsol_event = alc861vd_dallas_unsol_event,
14677 .init_hook = alc861vd_dallas_automute,
14679 [ALC660VD_ASUS_V1S] = {
14680 .mixers = { alc861vd_lenovo_mixer },
14681 .init_verbs = { alc861vd_volume_init_verbs,
14682 alc861vd_3stack_init_verbs,
14683 alc861vd_eapd_verbs,
14684 alc861vd_lenovo_unsol_verbs },
14685 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14686 .dac_nids = alc660vd_dac_nids,
14687 .dig_out_nid = ALC861VD_DIGOUT_NID,
14688 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14689 .channel_mode = alc861vd_3stack_2ch_modes,
14690 .input_mux = &alc861vd_capture_source,
14691 .unsol_event = alc861vd_lenovo_unsol_event,
14692 .init_hook = alc861vd_lenovo_automute,
14697 * BIOS auto configuration
14699 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14700 hda_nid_t nid, int pin_type, int dac_idx)
14702 alc_set_pin_output(codec, nid, pin_type);
14705 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14707 struct alc_spec *spec = codec->spec;
14710 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14711 for (i = 0; i <= HDA_SIDE; i++) {
14712 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14713 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14715 alc861vd_auto_set_output_and_unmute(codec, nid,
14721 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14723 struct alc_spec *spec = codec->spec;
14726 pin = spec->autocfg.hp_pins[0];
14727 if (pin) /* connect to front and use dac 0 */
14728 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14729 pin = spec->autocfg.speaker_pins[0];
14731 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14734 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14735 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14737 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14739 struct alc_spec *spec = codec->spec;
14742 for (i = 0; i < AUTO_PIN_LAST; i++) {
14743 hda_nid_t nid = spec->autocfg.input_pins[i];
14744 if (alc861vd_is_input_pin(nid)) {
14745 snd_hda_codec_write(codec, nid, 0,
14746 AC_VERB_SET_PIN_WIDGET_CONTROL,
14747 i <= AUTO_PIN_FRONT_MIC ?
14748 PIN_VREF80 : PIN_IN);
14749 if (nid != ALC861VD_PIN_CD_NID)
14750 snd_hda_codec_write(codec, nid, 0,
14751 AC_VERB_SET_AMP_GAIN_MUTE,
14757 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14759 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14760 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14762 /* add playback controls from the parsed DAC table */
14763 /* Based on ALC880 version. But ALC861VD has separate,
14764 * different NIDs for mute/unmute switch and volume control */
14765 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14766 const struct auto_pin_cfg *cfg)
14769 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14770 hda_nid_t nid_v, nid_s;
14773 for (i = 0; i < cfg->line_outs; i++) {
14774 if (!spec->multiout.dac_nids[i])
14776 nid_v = alc861vd_idx_to_mixer_vol(
14778 spec->multiout.dac_nids[i]));
14779 nid_s = alc861vd_idx_to_mixer_switch(
14781 spec->multiout.dac_nids[i]));
14785 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14786 "Center Playback Volume",
14787 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14791 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14792 "LFE Playback Volume",
14793 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14797 err = add_control(spec, ALC_CTL_BIND_MUTE,
14798 "Center Playback Switch",
14799 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14803 err = add_control(spec, ALC_CTL_BIND_MUTE,
14804 "LFE Playback Switch",
14805 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14810 sprintf(name, "%s Playback Volume", chname[i]);
14811 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14812 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14816 sprintf(name, "%s Playback Switch", chname[i]);
14817 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14818 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14827 /* add playback controls for speaker and HP outputs */
14828 /* Based on ALC880 version. But ALC861VD has separate,
14829 * different NIDs for mute/unmute switch and volume control */
14830 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14831 hda_nid_t pin, const char *pfx)
14833 hda_nid_t nid_v, nid_s;
14840 if (alc880_is_fixed_pin(pin)) {
14841 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14842 /* specify the DAC as the extra output */
14843 if (!spec->multiout.hp_nid)
14844 spec->multiout.hp_nid = nid_v;
14846 spec->multiout.extra_out_nid[0] = nid_v;
14847 /* control HP volume/switch on the output mixer amp */
14848 nid_v = alc861vd_idx_to_mixer_vol(
14849 alc880_fixed_pin_idx(pin));
14850 nid_s = alc861vd_idx_to_mixer_switch(
14851 alc880_fixed_pin_idx(pin));
14853 sprintf(name, "%s Playback Volume", pfx);
14854 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14855 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14858 sprintf(name, "%s Playback Switch", pfx);
14859 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14860 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14863 } else if (alc880_is_multi_pin(pin)) {
14864 /* set manual connection */
14865 /* we have only a switch on HP-out PIN */
14866 sprintf(name, "%s Playback Switch", pfx);
14867 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14868 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14875 /* parse the BIOS configuration and set up the alc_spec
14876 * return 1 if successful, 0 if the proper config is not found,
14877 * or a negative error code
14878 * Based on ALC880 version - had to change it to override
14879 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14880 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14882 struct alc_spec *spec = codec->spec;
14884 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14886 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14890 if (!spec->autocfg.line_outs)
14891 return 0; /* can't find valid BIOS pin config */
14893 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14896 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14899 err = alc861vd_auto_create_extra_out(spec,
14900 spec->autocfg.speaker_pins[0],
14904 err = alc861vd_auto_create_extra_out(spec,
14905 spec->autocfg.hp_pins[0],
14909 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14913 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14915 if (spec->autocfg.dig_outs)
14916 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14918 if (spec->kctls.list)
14919 add_mixer(spec, spec->kctls.list);
14921 add_verb(spec, alc861vd_volume_init_verbs);
14923 spec->num_mux_defs = 1;
14924 spec->input_mux = &spec->private_imux[0];
14926 err = alc_auto_add_mic_boost(codec);
14930 store_pin_configs(codec);
14934 /* additional initialization for auto-configuration model */
14935 static void alc861vd_auto_init(struct hda_codec *codec)
14937 struct alc_spec *spec = codec->spec;
14938 alc861vd_auto_init_multi_out(codec);
14939 alc861vd_auto_init_hp_out(codec);
14940 alc861vd_auto_init_analog_input(codec);
14941 alc861vd_auto_init_input_src(codec);
14942 if (spec->unsol_event)
14943 alc_inithook(codec);
14946 static int patch_alc861vd(struct hda_codec *codec)
14948 struct alc_spec *spec;
14949 int err, board_config;
14951 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14955 codec->spec = spec;
14957 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14961 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14962 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14963 "ALC861VD, trying auto-probe from BIOS...\n");
14964 board_config = ALC861VD_AUTO;
14967 if (board_config == ALC861VD_AUTO) {
14968 /* automatic parse from the BIOS config */
14969 err = alc861vd_parse_auto_config(codec);
14975 "hda_codec: Cannot set up configuration "
14976 "from BIOS. Using base mode...\n");
14977 board_config = ALC861VD_3ST;
14981 err = snd_hda_attach_beep_device(codec, 0x23);
14987 if (board_config != ALC861VD_AUTO)
14988 setup_preset(spec, &alc861vd_presets[board_config]);
14990 if (codec->vendor_id == 0x10ec0660) {
14991 spec->stream_name_analog = "ALC660-VD Analog";
14992 spec->stream_name_digital = "ALC660-VD Digital";
14993 /* always turn on EAPD */
14994 add_verb(spec, alc660vd_eapd_verbs);
14996 spec->stream_name_analog = "ALC861VD Analog";
14997 spec->stream_name_digital = "ALC861VD Digital";
15000 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15001 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15003 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15004 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15006 spec->adc_nids = alc861vd_adc_nids;
15007 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15008 spec->capsrc_nids = alc861vd_capsrc_nids;
15009 spec->capture_style = CAPT_MIX;
15011 set_capture_mixer(spec);
15012 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15014 spec->vmaster_nid = 0x02;
15016 codec->patch_ops = alc_patch_ops;
15018 if (board_config == ALC861VD_AUTO)
15019 spec->init_hook = alc861vd_auto_init;
15020 #ifdef CONFIG_SND_HDA_POWER_SAVE
15021 if (!spec->loopback.amplist)
15022 spec->loopback.amplist = alc861vd_loopbacks;
15024 codec->proc_widget_hook = print_realtek_coef;
15032 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15033 * configuration. Each pin widget can choose any input DACs and a mixer.
15034 * Each ADC is connected from a mixer of all inputs. This makes possible
15035 * 6-channel independent captures.
15037 * In addition, an independent DAC for the multi-playback (not used in this
15040 #define ALC662_DIGOUT_NID 0x06
15041 #define ALC662_DIGIN_NID 0x0a
15043 static hda_nid_t alc662_dac_nids[4] = {
15044 /* front, rear, clfe, rear_surr */
15048 static hda_nid_t alc662_adc_nids[1] = {
15053 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15056 /* FIXME: should be a matrix-type input source selection */
15057 static struct hda_input_mux alc662_capture_source = {
15061 { "Front Mic", 0x1 },
15067 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15075 static struct hda_input_mux alc662_eeepc_capture_source = {
15083 static struct hda_input_mux alc663_capture_source = {
15087 { "Front Mic", 0x1 },
15092 static struct hda_input_mux alc663_m51va_capture_source = {
15095 { "Ext-Mic", 0x0 },
15103 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15110 static struct hda_verb alc662_3ST_ch2_init[] = {
15111 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15112 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15113 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15114 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15121 static struct hda_verb alc662_3ST_ch6_init[] = {
15122 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15123 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15124 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15125 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15126 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15127 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15131 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15132 { 2, alc662_3ST_ch2_init },
15133 { 6, alc662_3ST_ch6_init },
15139 static struct hda_verb alc662_sixstack_ch6_init[] = {
15140 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15141 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15142 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15149 static struct hda_verb alc662_sixstack_ch8_init[] = {
15150 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15151 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15152 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15156 static struct hda_channel_mode alc662_5stack_modes[2] = {
15157 { 2, alc662_sixstack_ch6_init },
15158 { 6, alc662_sixstack_ch8_init },
15161 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15162 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15165 static struct snd_kcontrol_new alc662_base_mixer[] = {
15166 /* output mixer control */
15167 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15168 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15169 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15170 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15171 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15172 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15173 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15174 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15177 /*Input mixer control */
15178 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15179 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15180 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15181 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15182 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15183 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15184 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15185 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15189 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15190 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15191 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15193 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15194 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15199 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15204 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15205 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15206 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15208 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15209 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15210 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15211 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15212 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15213 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15214 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15215 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15220 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15221 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15225 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15226 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15227 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15228 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15229 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15238 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15239 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15241 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15242 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15244 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15245 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15246 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15248 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15249 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15250 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15254 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15255 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15256 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15257 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15258 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15259 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15260 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15261 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15262 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15263 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15264 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15265 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15266 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15272 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15273 .ops = &snd_hda_bind_vol,
15275 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15276 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15281 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15282 .ops = &snd_hda_bind_sw,
15284 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15285 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15290 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15291 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15292 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15294 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15298 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15299 .ops = &snd_hda_bind_sw,
15301 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15302 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15303 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15308 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15309 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15310 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15312 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15313 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15314 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15319 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15320 .ops = &snd_hda_bind_sw,
15322 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15323 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15324 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15329 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15330 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15331 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15334 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15335 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15339 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15340 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15341 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15343 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15344 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15345 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15346 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15350 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15351 .ops = &snd_hda_bind_vol,
15353 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15354 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15359 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15360 .ops = &snd_hda_bind_sw,
15362 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15363 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15368 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15369 HDA_BIND_VOL("Master Playback Volume",
15370 &alc663_asus_two_bind_master_vol),
15371 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15372 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15379 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15380 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15381 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15382 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15383 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15385 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15389 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15390 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15391 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15392 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15393 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15397 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15398 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15399 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15403 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15404 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15405 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15406 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15408 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15409 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15410 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15411 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15412 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15413 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15417 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15420 .name = "Channel Mode",
15421 .info = alc_ch_mode_info,
15422 .get = alc_ch_mode_get,
15423 .put = alc_ch_mode_put,
15428 static struct hda_verb alc662_init_verbs[] = {
15429 /* ADC: mute amp left and right */
15430 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15431 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15432 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15434 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15438 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15442 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15444 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15445 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15447 /* Front Pin: output 0 (0x0c) */
15448 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15449 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15451 /* Rear Pin: output 1 (0x0d) */
15452 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15453 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15455 /* CLFE Pin: output 2 (0x0e) */
15456 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15457 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15459 /* Mic (rear) pin: input vref at 80% */
15460 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15461 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15462 /* Front Mic pin: input vref at 80% */
15463 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15464 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15465 /* Line In pin: input */
15466 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15467 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15468 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15469 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15470 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15471 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15472 /* CD pin widget for input */
15473 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15475 /* FIXME: use matrix-type input source selection */
15476 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15483 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15488 /* always trun on EAPD */
15489 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15490 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15495 static struct hda_verb alc662_sue_init_verbs[] = {
15496 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15497 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15501 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15502 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15503 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15507 /* Set Unsolicited Event*/
15508 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15510 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15515 * generic initialization of ADC, input mixers and output mixers
15517 static struct hda_verb alc662_auto_init_verbs[] = {
15519 * Unmute ADC and set the default input to mic-in
15521 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15522 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15524 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15526 * Note: PASD motherboards uses the Line In 2 as the input for front
15527 * panel mic (mic 2)
15529 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15531 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15532 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15533 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15537 * Set up output mixers (0x0c - 0x0f)
15539 /* set vol=0 to output mixers */
15540 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15541 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15542 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15544 /* set up input amps for analog loopback */
15545 /* Amp Indices: DAC = 0, mixer = 1 */
15546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15550 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15551 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15554 /* FIXME: use matrix-type input source selection */
15555 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15562 /* additional verbs for ALC663 */
15563 static struct hda_verb alc663_auto_init_verbs[] = {
15564 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15565 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15569 static struct hda_verb alc663_m51va_init_verbs[] = {
15570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15571 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15572 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15573 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15574 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15575 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15577 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15578 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15582 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15583 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15584 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15585 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15588 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15589 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15593 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15594 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15596 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15597 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15598 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15600 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15601 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15605 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15606 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15607 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15608 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15611 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15612 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15616 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15617 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15618 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15619 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15620 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15626 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15627 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15628 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15632 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15633 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15635 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15636 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15642 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15643 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15648 static struct hda_verb alc663_g71v_init_verbs[] = {
15649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15650 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15651 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15653 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15654 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15655 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15657 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15658 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15659 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15663 static struct hda_verb alc663_g50v_init_verbs[] = {
15664 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15665 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15666 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15668 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15669 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15673 static struct hda_verb alc662_ecs_init_verbs[] = {
15674 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15676 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15677 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15681 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15682 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15683 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15687 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15689 unsigned int present;
15690 unsigned char bits;
15692 present = snd_hda_codec_read(codec, 0x14, 0,
15693 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15694 bits = present ? HDA_AMP_MUTE : 0;
15695 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15696 HDA_AMP_MUTE, bits);
15699 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15701 unsigned int present;
15702 unsigned char bits;
15704 present = snd_hda_codec_read(codec, 0x1b, 0,
15705 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15706 bits = present ? HDA_AMP_MUTE : 0;
15707 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15708 HDA_AMP_MUTE, bits);
15709 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15710 HDA_AMP_MUTE, bits);
15713 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15716 if ((res >> 26) == ALC880_HP_EVENT)
15717 alc662_lenovo_101e_all_automute(codec);
15718 if ((res >> 26) == ALC880_FRONT_EVENT)
15719 alc662_lenovo_101e_ispeaker_automute(codec);
15722 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15724 unsigned int present;
15726 present = snd_hda_codec_read(codec, 0x18, 0,
15727 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15728 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15729 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15730 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15731 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15732 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15733 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15734 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15735 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15738 /* unsolicited event for HP jack sensing */
15739 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15742 if ((res >> 26) == ALC880_HP_EVENT)
15743 alc262_hippo1_automute( codec );
15745 if ((res >> 26) == ALC880_MIC_EVENT)
15746 alc662_eeepc_mic_automute(codec);
15749 static void alc662_eeepc_inithook(struct hda_codec *codec)
15751 alc262_hippo1_automute( codec );
15752 alc662_eeepc_mic_automute(codec);
15755 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15758 unsigned int present;
15760 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15761 present = snd_hda_codec_read(codec, 0x14, 0,
15762 AC_VERB_GET_PIN_SENSE, 0);
15763 present = (present & 0x80000000) != 0;
15765 /* mute internal speaker */
15766 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15767 HDA_AMP_MUTE, HDA_AMP_MUTE);
15769 /* unmute internal speaker if necessary */
15770 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15771 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15772 HDA_AMP_MUTE, mute);
15776 /* unsolicited event for HP jack sensing */
15777 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15780 if ((res >> 26) == ALC880_HP_EVENT)
15781 alc662_eeepc_ep20_automute(codec);
15784 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15786 alc662_eeepc_ep20_automute(codec);
15789 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15791 unsigned int present;
15792 unsigned char bits;
15794 present = snd_hda_codec_read(codec, 0x21, 0,
15795 AC_VERB_GET_PIN_SENSE, 0)
15796 & AC_PINSENSE_PRESENCE;
15797 bits = present ? HDA_AMP_MUTE : 0;
15798 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15799 AMP_IN_MUTE(0), bits);
15800 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15801 AMP_IN_MUTE(0), bits);
15804 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15806 unsigned int present;
15807 unsigned char bits;
15809 present = snd_hda_codec_read(codec, 0x21, 0,
15810 AC_VERB_GET_PIN_SENSE, 0)
15811 & AC_PINSENSE_PRESENCE;
15812 bits = present ? HDA_AMP_MUTE : 0;
15813 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15814 AMP_IN_MUTE(0), bits);
15815 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15816 AMP_IN_MUTE(0), bits);
15817 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15818 AMP_IN_MUTE(0), bits);
15819 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15820 AMP_IN_MUTE(0), bits);
15823 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15825 unsigned int present;
15826 unsigned char bits;
15828 present = snd_hda_codec_read(codec, 0x15, 0,
15829 AC_VERB_GET_PIN_SENSE, 0)
15830 & AC_PINSENSE_PRESENCE;
15831 bits = present ? HDA_AMP_MUTE : 0;
15832 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15833 AMP_IN_MUTE(0), bits);
15834 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15835 AMP_IN_MUTE(0), bits);
15836 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15837 AMP_IN_MUTE(0), bits);
15838 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15839 AMP_IN_MUTE(0), bits);
15842 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15844 unsigned int present;
15845 unsigned char bits;
15847 present = snd_hda_codec_read(codec, 0x1b, 0,
15848 AC_VERB_GET_PIN_SENSE, 0)
15849 & AC_PINSENSE_PRESENCE;
15850 bits = present ? 0 : PIN_OUT;
15851 snd_hda_codec_write(codec, 0x14, 0,
15852 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15855 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15857 unsigned int present1, present2;
15859 present1 = snd_hda_codec_read(codec, 0x21, 0,
15860 AC_VERB_GET_PIN_SENSE, 0)
15861 & AC_PINSENSE_PRESENCE;
15862 present2 = snd_hda_codec_read(codec, 0x15, 0,
15863 AC_VERB_GET_PIN_SENSE, 0)
15864 & AC_PINSENSE_PRESENCE;
15866 if (present1 || present2) {
15867 snd_hda_codec_write_cache(codec, 0x14, 0,
15868 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15870 snd_hda_codec_write_cache(codec, 0x14, 0,
15871 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15875 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15877 unsigned int present1, present2;
15879 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15880 AC_VERB_GET_PIN_SENSE, 0)
15881 & AC_PINSENSE_PRESENCE;
15882 present2 = snd_hda_codec_read(codec, 0x15, 0,
15883 AC_VERB_GET_PIN_SENSE, 0)
15884 & AC_PINSENSE_PRESENCE;
15886 if (present1 || present2) {
15887 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15888 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15889 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15890 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15892 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15893 AMP_IN_MUTE(0), 0);
15894 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15895 AMP_IN_MUTE(0), 0);
15899 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15901 unsigned int present;
15903 present = snd_hda_codec_read(codec, 0x18, 0,
15904 AC_VERB_GET_PIN_SENSE, 0)
15905 & AC_PINSENSE_PRESENCE;
15906 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15907 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15908 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15909 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15910 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15911 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15912 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15913 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15916 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15919 switch (res >> 26) {
15920 case ALC880_HP_EVENT:
15921 alc663_m51va_speaker_automute(codec);
15923 case ALC880_MIC_EVENT:
15924 alc663_m51va_mic_automute(codec);
15929 static void alc663_m51va_inithook(struct hda_codec *codec)
15931 alc663_m51va_speaker_automute(codec);
15932 alc663_m51va_mic_automute(codec);
15935 /* ***************** Mode1 ******************************/
15936 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15939 switch (res >> 26) {
15940 case ALC880_HP_EVENT:
15941 alc663_m51va_speaker_automute(codec);
15943 case ALC880_MIC_EVENT:
15944 alc662_eeepc_mic_automute(codec);
15949 static void alc663_mode1_inithook(struct hda_codec *codec)
15951 alc663_m51va_speaker_automute(codec);
15952 alc662_eeepc_mic_automute(codec);
15954 /* ***************** Mode2 ******************************/
15955 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15958 switch (res >> 26) {
15959 case ALC880_HP_EVENT:
15960 alc662_f5z_speaker_automute(codec);
15962 case ALC880_MIC_EVENT:
15963 alc662_eeepc_mic_automute(codec);
15968 static void alc662_mode2_inithook(struct hda_codec *codec)
15970 alc662_f5z_speaker_automute(codec);
15971 alc662_eeepc_mic_automute(codec);
15973 /* ***************** Mode3 ******************************/
15974 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15977 switch (res >> 26) {
15978 case ALC880_HP_EVENT:
15979 alc663_two_hp_m1_speaker_automute(codec);
15981 case ALC880_MIC_EVENT:
15982 alc662_eeepc_mic_automute(codec);
15987 static void alc663_mode3_inithook(struct hda_codec *codec)
15989 alc663_two_hp_m1_speaker_automute(codec);
15990 alc662_eeepc_mic_automute(codec);
15992 /* ***************** Mode4 ******************************/
15993 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15996 switch (res >> 26) {
15997 case ALC880_HP_EVENT:
15998 alc663_21jd_two_speaker_automute(codec);
16000 case ALC880_MIC_EVENT:
16001 alc662_eeepc_mic_automute(codec);
16006 static void alc663_mode4_inithook(struct hda_codec *codec)
16008 alc663_21jd_two_speaker_automute(codec);
16009 alc662_eeepc_mic_automute(codec);
16011 /* ***************** Mode5 ******************************/
16012 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16015 switch (res >> 26) {
16016 case ALC880_HP_EVENT:
16017 alc663_15jd_two_speaker_automute(codec);
16019 case ALC880_MIC_EVENT:
16020 alc662_eeepc_mic_automute(codec);
16025 static void alc663_mode5_inithook(struct hda_codec *codec)
16027 alc663_15jd_two_speaker_automute(codec);
16028 alc662_eeepc_mic_automute(codec);
16030 /* ***************** Mode6 ******************************/
16031 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16034 switch (res >> 26) {
16035 case ALC880_HP_EVENT:
16036 alc663_two_hp_m2_speaker_automute(codec);
16038 case ALC880_MIC_EVENT:
16039 alc662_eeepc_mic_automute(codec);
16044 static void alc663_mode6_inithook(struct hda_codec *codec)
16046 alc663_two_hp_m2_speaker_automute(codec);
16047 alc662_eeepc_mic_automute(codec);
16050 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16052 unsigned int present;
16053 unsigned char bits;
16055 present = snd_hda_codec_read(codec, 0x21, 0,
16056 AC_VERB_GET_PIN_SENSE, 0)
16057 & AC_PINSENSE_PRESENCE;
16058 bits = present ? HDA_AMP_MUTE : 0;
16059 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16060 HDA_AMP_MUTE, bits);
16061 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16062 HDA_AMP_MUTE, bits);
16065 static void alc663_g71v_front_automute(struct hda_codec *codec)
16067 unsigned int present;
16068 unsigned char bits;
16070 present = snd_hda_codec_read(codec, 0x15, 0,
16071 AC_VERB_GET_PIN_SENSE, 0)
16072 & AC_PINSENSE_PRESENCE;
16073 bits = present ? HDA_AMP_MUTE : 0;
16074 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16075 HDA_AMP_MUTE, bits);
16078 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16081 switch (res >> 26) {
16082 case ALC880_HP_EVENT:
16083 alc663_g71v_hp_automute(codec);
16085 case ALC880_FRONT_EVENT:
16086 alc663_g71v_front_automute(codec);
16088 case ALC880_MIC_EVENT:
16089 alc662_eeepc_mic_automute(codec);
16094 static void alc663_g71v_inithook(struct hda_codec *codec)
16096 alc663_g71v_front_automute(codec);
16097 alc663_g71v_hp_automute(codec);
16098 alc662_eeepc_mic_automute(codec);
16101 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16104 switch (res >> 26) {
16105 case ALC880_HP_EVENT:
16106 alc663_m51va_speaker_automute(codec);
16108 case ALC880_MIC_EVENT:
16109 alc662_eeepc_mic_automute(codec);
16114 static void alc663_g50v_inithook(struct hda_codec *codec)
16116 alc663_m51va_speaker_automute(codec);
16117 alc662_eeepc_mic_automute(codec);
16120 /* bind hp and internal speaker mute (with plug check) */
16121 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16122 struct snd_ctl_elem_value *ucontrol)
16124 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16125 long *valp = ucontrol->value.integer.value;
16128 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16130 valp[0] ? 0 : HDA_AMP_MUTE);
16131 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16133 valp[1] ? 0 : HDA_AMP_MUTE);
16135 alc262_hippo1_automute(codec);
16139 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16140 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16142 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16143 .name = "Master Playback Switch",
16144 .info = snd_hda_mixer_amp_switch_info,
16145 .get = snd_hda_mixer_amp_switch_get,
16146 .put = alc662_ecs_master_sw_put,
16147 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16150 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16151 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16152 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16154 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16155 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16156 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16160 #ifdef CONFIG_SND_HDA_POWER_SAVE
16161 #define alc662_loopbacks alc880_loopbacks
16165 /* pcm configuration: identiacal with ALC880 */
16166 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16167 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16168 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16169 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16172 * configuration and preset
16174 static const char *alc662_models[ALC662_MODEL_LAST] = {
16175 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16176 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16177 [ALC662_3ST_6ch] = "3stack-6ch",
16178 [ALC662_5ST_DIG] = "6stack-dig",
16179 [ALC662_LENOVO_101E] = "lenovo-101e",
16180 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16181 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16182 [ALC662_ECS] = "ecs",
16183 [ALC663_ASUS_M51VA] = "m51va",
16184 [ALC663_ASUS_G71V] = "g71v",
16185 [ALC663_ASUS_H13] = "h13",
16186 [ALC663_ASUS_G50V] = "g50v",
16187 [ALC663_ASUS_MODE1] = "asus-mode1",
16188 [ALC662_ASUS_MODE2] = "asus-mode2",
16189 [ALC663_ASUS_MODE3] = "asus-mode3",
16190 [ALC663_ASUS_MODE4] = "asus-mode4",
16191 [ALC663_ASUS_MODE5] = "asus-mode5",
16192 [ALC663_ASUS_MODE6] = "asus-mode6",
16193 [ALC662_AUTO] = "auto",
16196 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16197 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16198 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16199 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16200 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16201 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16202 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16203 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16204 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16205 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16206 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16207 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16208 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16209 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16210 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16211 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16212 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16213 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16214 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16215 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16216 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16217 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16218 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16219 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16220 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16221 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16222 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16223 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16224 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16225 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16226 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16227 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16228 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16229 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16230 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16231 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16232 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16233 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16234 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16235 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16236 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16237 ALC662_3ST_6ch_DIG),
16238 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16239 ALC662_3ST_6ch_DIG),
16240 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16241 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16242 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16243 ALC662_3ST_6ch_DIG),
16244 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16249 static struct alc_config_preset alc662_presets[] = {
16250 [ALC662_3ST_2ch_DIG] = {
16251 .mixers = { alc662_3ST_2ch_mixer },
16252 .init_verbs = { alc662_init_verbs },
16253 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16254 .dac_nids = alc662_dac_nids,
16255 .dig_out_nid = ALC662_DIGOUT_NID,
16256 .dig_in_nid = ALC662_DIGIN_NID,
16257 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16258 .channel_mode = alc662_3ST_2ch_modes,
16259 .input_mux = &alc662_capture_source,
16261 [ALC662_3ST_6ch_DIG] = {
16262 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16263 .init_verbs = { alc662_init_verbs },
16264 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16265 .dac_nids = alc662_dac_nids,
16266 .dig_out_nid = ALC662_DIGOUT_NID,
16267 .dig_in_nid = ALC662_DIGIN_NID,
16268 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16269 .channel_mode = alc662_3ST_6ch_modes,
16271 .input_mux = &alc662_capture_source,
16273 [ALC662_3ST_6ch] = {
16274 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16275 .init_verbs = { alc662_init_verbs },
16276 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16277 .dac_nids = alc662_dac_nids,
16278 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16279 .channel_mode = alc662_3ST_6ch_modes,
16281 .input_mux = &alc662_capture_source,
16283 [ALC662_5ST_DIG] = {
16284 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16285 .init_verbs = { alc662_init_verbs },
16286 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16287 .dac_nids = alc662_dac_nids,
16288 .dig_out_nid = ALC662_DIGOUT_NID,
16289 .dig_in_nid = ALC662_DIGIN_NID,
16290 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16291 .channel_mode = alc662_5stack_modes,
16292 .input_mux = &alc662_capture_source,
16294 [ALC662_LENOVO_101E] = {
16295 .mixers = { alc662_lenovo_101e_mixer },
16296 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16297 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16298 .dac_nids = alc662_dac_nids,
16299 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16300 .channel_mode = alc662_3ST_2ch_modes,
16301 .input_mux = &alc662_lenovo_101e_capture_source,
16302 .unsol_event = alc662_lenovo_101e_unsol_event,
16303 .init_hook = alc662_lenovo_101e_all_automute,
16305 [ALC662_ASUS_EEEPC_P701] = {
16306 .mixers = { alc662_eeepc_p701_mixer },
16307 .init_verbs = { alc662_init_verbs,
16308 alc662_eeepc_sue_init_verbs },
16309 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16310 .dac_nids = alc662_dac_nids,
16311 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16312 .channel_mode = alc662_3ST_2ch_modes,
16313 .input_mux = &alc662_eeepc_capture_source,
16314 .unsol_event = alc662_eeepc_unsol_event,
16315 .init_hook = alc662_eeepc_inithook,
16317 [ALC662_ASUS_EEEPC_EP20] = {
16318 .mixers = { alc662_eeepc_ep20_mixer,
16319 alc662_chmode_mixer },
16320 .init_verbs = { alc662_init_verbs,
16321 alc662_eeepc_ep20_sue_init_verbs },
16322 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16323 .dac_nids = alc662_dac_nids,
16324 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16325 .channel_mode = alc662_3ST_6ch_modes,
16326 .input_mux = &alc662_lenovo_101e_capture_source,
16327 .unsol_event = alc662_eeepc_ep20_unsol_event,
16328 .init_hook = alc662_eeepc_ep20_inithook,
16331 .mixers = { alc662_ecs_mixer },
16332 .init_verbs = { alc662_init_verbs,
16333 alc662_ecs_init_verbs },
16334 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16335 .dac_nids = alc662_dac_nids,
16336 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16337 .channel_mode = alc662_3ST_2ch_modes,
16338 .input_mux = &alc662_eeepc_capture_source,
16339 .unsol_event = alc662_eeepc_unsol_event,
16340 .init_hook = alc662_eeepc_inithook,
16342 [ALC663_ASUS_M51VA] = {
16343 .mixers = { alc663_m51va_mixer },
16344 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16345 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16346 .dac_nids = alc662_dac_nids,
16347 .dig_out_nid = ALC662_DIGOUT_NID,
16348 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16349 .channel_mode = alc662_3ST_2ch_modes,
16350 .input_mux = &alc663_m51va_capture_source,
16351 .unsol_event = alc663_m51va_unsol_event,
16352 .init_hook = alc663_m51va_inithook,
16354 [ALC663_ASUS_G71V] = {
16355 .mixers = { alc663_g71v_mixer },
16356 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16357 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16358 .dac_nids = alc662_dac_nids,
16359 .dig_out_nid = ALC662_DIGOUT_NID,
16360 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16361 .channel_mode = alc662_3ST_2ch_modes,
16362 .input_mux = &alc662_eeepc_capture_source,
16363 .unsol_event = alc663_g71v_unsol_event,
16364 .init_hook = alc663_g71v_inithook,
16366 [ALC663_ASUS_H13] = {
16367 .mixers = { alc663_m51va_mixer },
16368 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16369 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16370 .dac_nids = alc662_dac_nids,
16371 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16372 .channel_mode = alc662_3ST_2ch_modes,
16373 .input_mux = &alc663_m51va_capture_source,
16374 .unsol_event = alc663_m51va_unsol_event,
16375 .init_hook = alc663_m51va_inithook,
16377 [ALC663_ASUS_G50V] = {
16378 .mixers = { alc663_g50v_mixer },
16379 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16380 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16381 .dac_nids = alc662_dac_nids,
16382 .dig_out_nid = ALC662_DIGOUT_NID,
16383 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16384 .channel_mode = alc662_3ST_6ch_modes,
16385 .input_mux = &alc663_capture_source,
16386 .unsol_event = alc663_g50v_unsol_event,
16387 .init_hook = alc663_g50v_inithook,
16389 [ALC663_ASUS_MODE1] = {
16390 .mixers = { alc663_m51va_mixer },
16391 .cap_mixer = alc662_auto_capture_mixer,
16392 .init_verbs = { alc662_init_verbs,
16393 alc663_21jd_amic_init_verbs },
16394 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16396 .dac_nids = alc662_dac_nids,
16397 .dig_out_nid = ALC662_DIGOUT_NID,
16398 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16399 .channel_mode = alc662_3ST_2ch_modes,
16400 .input_mux = &alc662_eeepc_capture_source,
16401 .unsol_event = alc663_mode1_unsol_event,
16402 .init_hook = alc663_mode1_inithook,
16404 [ALC662_ASUS_MODE2] = {
16405 .mixers = { alc662_1bjd_mixer },
16406 .cap_mixer = alc662_auto_capture_mixer,
16407 .init_verbs = { alc662_init_verbs,
16408 alc662_1bjd_amic_init_verbs },
16409 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16410 .dac_nids = alc662_dac_nids,
16411 .dig_out_nid = ALC662_DIGOUT_NID,
16412 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16413 .channel_mode = alc662_3ST_2ch_modes,
16414 .input_mux = &alc662_eeepc_capture_source,
16415 .unsol_event = alc662_mode2_unsol_event,
16416 .init_hook = alc662_mode2_inithook,
16418 [ALC663_ASUS_MODE3] = {
16419 .mixers = { alc663_two_hp_m1_mixer },
16420 .cap_mixer = alc662_auto_capture_mixer,
16421 .init_verbs = { alc662_init_verbs,
16422 alc663_two_hp_amic_m1_init_verbs },
16423 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16425 .dac_nids = alc662_dac_nids,
16426 .dig_out_nid = ALC662_DIGOUT_NID,
16427 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16428 .channel_mode = alc662_3ST_2ch_modes,
16429 .input_mux = &alc662_eeepc_capture_source,
16430 .unsol_event = alc663_mode3_unsol_event,
16431 .init_hook = alc663_mode3_inithook,
16433 [ALC663_ASUS_MODE4] = {
16434 .mixers = { alc663_asus_21jd_clfe_mixer },
16435 .cap_mixer = alc662_auto_capture_mixer,
16436 .init_verbs = { alc662_init_verbs,
16437 alc663_21jd_amic_init_verbs},
16438 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16440 .dac_nids = alc662_dac_nids,
16441 .dig_out_nid = ALC662_DIGOUT_NID,
16442 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16443 .channel_mode = alc662_3ST_2ch_modes,
16444 .input_mux = &alc662_eeepc_capture_source,
16445 .unsol_event = alc663_mode4_unsol_event,
16446 .init_hook = alc663_mode4_inithook,
16448 [ALC663_ASUS_MODE5] = {
16449 .mixers = { alc663_asus_15jd_clfe_mixer },
16450 .cap_mixer = alc662_auto_capture_mixer,
16451 .init_verbs = { alc662_init_verbs,
16452 alc663_15jd_amic_init_verbs },
16453 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16455 .dac_nids = alc662_dac_nids,
16456 .dig_out_nid = ALC662_DIGOUT_NID,
16457 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16458 .channel_mode = alc662_3ST_2ch_modes,
16459 .input_mux = &alc662_eeepc_capture_source,
16460 .unsol_event = alc663_mode5_unsol_event,
16461 .init_hook = alc663_mode5_inithook,
16463 [ALC663_ASUS_MODE6] = {
16464 .mixers = { alc663_two_hp_m2_mixer },
16465 .cap_mixer = alc662_auto_capture_mixer,
16466 .init_verbs = { alc662_init_verbs,
16467 alc663_two_hp_amic_m2_init_verbs },
16468 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16470 .dac_nids = alc662_dac_nids,
16471 .dig_out_nid = ALC662_DIGOUT_NID,
16472 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16473 .channel_mode = alc662_3ST_2ch_modes,
16474 .input_mux = &alc662_eeepc_capture_source,
16475 .unsol_event = alc663_mode6_unsol_event,
16476 .init_hook = alc663_mode6_inithook,
16482 * BIOS auto configuration
16485 /* add playback controls from the parsed DAC table */
16486 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16487 const struct auto_pin_cfg *cfg)
16490 static const char *chname[4] = {
16491 "Front", "Surround", NULL /*CLFE*/, "Side"
16496 for (i = 0; i < cfg->line_outs; i++) {
16497 if (!spec->multiout.dac_nids[i])
16499 nid = alc880_idx_to_dac(i);
16502 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16503 "Center Playback Volume",
16504 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16508 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16509 "LFE Playback Volume",
16510 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16514 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16515 "Center Playback Switch",
16516 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16520 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16521 "LFE Playback Switch",
16522 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16527 sprintf(name, "%s Playback Volume", chname[i]);
16528 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16529 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16533 sprintf(name, "%s Playback Switch", chname[i]);
16534 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16535 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16544 /* add playback controls for speaker and HP outputs */
16545 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16556 /* ALC663 has a mono output pin on 0x17 */
16557 sprintf(name, "%s Playback Switch", pfx);
16558 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16559 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16563 if (alc880_is_fixed_pin(pin)) {
16564 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16565 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16566 /* specify the DAC as the extra output */
16567 if (!spec->multiout.hp_nid)
16568 spec->multiout.hp_nid = nid;
16570 spec->multiout.extra_out_nid[0] = nid;
16571 /* control HP volume/switch on the output mixer amp */
16572 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16573 sprintf(name, "%s Playback Volume", pfx);
16574 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16575 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16578 sprintf(name, "%s Playback Switch", pfx);
16579 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16580 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16583 } else if (alc880_is_multi_pin(pin)) {
16584 /* set manual connection */
16585 /* we have only a switch on HP-out PIN */
16586 sprintf(name, "%s Playback Switch", pfx);
16587 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16588 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16595 /* create playback/capture controls for input pins */
16596 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16597 const struct auto_pin_cfg *cfg)
16599 struct hda_input_mux *imux = &spec->private_imux[0];
16602 for (i = 0; i < AUTO_PIN_LAST; i++) {
16603 if (alc880_is_input_pin(cfg->input_pins[i])) {
16604 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16605 err = new_analog_input(spec, cfg->input_pins[i],
16606 auto_pin_cfg_labels[i],
16610 imux->items[imux->num_items].label =
16611 auto_pin_cfg_labels[i];
16612 imux->items[imux->num_items].index =
16613 alc880_input_pin_idx(cfg->input_pins[i]);
16620 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16621 hda_nid_t nid, int pin_type,
16624 alc_set_pin_output(codec, nid, pin_type);
16625 /* need the manual connection? */
16626 if (alc880_is_multi_pin(nid)) {
16627 struct alc_spec *spec = codec->spec;
16628 int idx = alc880_multi_pin_idx(nid);
16629 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16630 AC_VERB_SET_CONNECT_SEL,
16631 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16635 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16637 struct alc_spec *spec = codec->spec;
16640 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16641 for (i = 0; i <= HDA_SIDE; i++) {
16642 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16643 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16645 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16650 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16652 struct alc_spec *spec = codec->spec;
16655 pin = spec->autocfg.hp_pins[0];
16656 if (pin) /* connect to front */
16658 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16659 pin = spec->autocfg.speaker_pins[0];
16661 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16664 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16665 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16667 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16669 struct alc_spec *spec = codec->spec;
16672 for (i = 0; i < AUTO_PIN_LAST; i++) {
16673 hda_nid_t nid = spec->autocfg.input_pins[i];
16674 if (alc662_is_input_pin(nid)) {
16675 snd_hda_codec_write(codec, nid, 0,
16676 AC_VERB_SET_PIN_WIDGET_CONTROL,
16677 (i <= AUTO_PIN_FRONT_MIC ?
16678 PIN_VREF80 : PIN_IN));
16679 if (nid != ALC662_PIN_CD_NID)
16680 snd_hda_codec_write(codec, nid, 0,
16681 AC_VERB_SET_AMP_GAIN_MUTE,
16687 #define alc662_auto_init_input_src alc882_auto_init_input_src
16689 static int alc662_parse_auto_config(struct hda_codec *codec)
16691 struct alc_spec *spec = codec->spec;
16693 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16695 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16699 if (!spec->autocfg.line_outs)
16700 return 0; /* can't find valid BIOS pin config */
16702 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16705 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16708 err = alc662_auto_create_extra_out(spec,
16709 spec->autocfg.speaker_pins[0],
16713 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16717 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16721 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16723 if (spec->autocfg.dig_outs)
16724 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16726 if (spec->kctls.list)
16727 add_mixer(spec, spec->kctls.list);
16729 spec->num_mux_defs = 1;
16730 spec->input_mux = &spec->private_imux[0];
16732 add_verb(spec, alc662_auto_init_verbs);
16733 if (codec->vendor_id == 0x10ec0663)
16734 add_verb(spec, alc663_auto_init_verbs);
16736 err = alc_auto_add_mic_boost(codec);
16740 store_pin_configs(codec);
16744 /* additional initialization for auto-configuration model */
16745 static void alc662_auto_init(struct hda_codec *codec)
16747 struct alc_spec *spec = codec->spec;
16748 alc662_auto_init_multi_out(codec);
16749 alc662_auto_init_hp_out(codec);
16750 alc662_auto_init_analog_input(codec);
16751 alc662_auto_init_input_src(codec);
16752 if (spec->unsol_event)
16753 alc_inithook(codec);
16756 static int patch_alc662(struct hda_codec *codec)
16758 struct alc_spec *spec;
16759 int err, board_config;
16761 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16765 codec->spec = spec;
16767 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16769 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16772 if (board_config < 0) {
16773 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16774 "trying auto-probe from BIOS...\n");
16775 board_config = ALC662_AUTO;
16778 if (board_config == ALC662_AUTO) {
16779 /* automatic parse from the BIOS config */
16780 err = alc662_parse_auto_config(codec);
16786 "hda_codec: Cannot set up configuration "
16787 "from BIOS. Using base mode...\n");
16788 board_config = ALC662_3ST_2ch_DIG;
16792 err = snd_hda_attach_beep_device(codec, 0x1);
16798 if (board_config != ALC662_AUTO)
16799 setup_preset(spec, &alc662_presets[board_config]);
16801 if (codec->vendor_id == 0x10ec0663) {
16802 spec->stream_name_analog = "ALC663 Analog";
16803 spec->stream_name_digital = "ALC663 Digital";
16804 } else if (codec->vendor_id == 0x10ec0272) {
16805 spec->stream_name_analog = "ALC272 Analog";
16806 spec->stream_name_digital = "ALC272 Digital";
16808 spec->stream_name_analog = "ALC662 Analog";
16809 spec->stream_name_digital = "ALC662 Digital";
16812 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16813 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16815 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16816 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16818 spec->adc_nids = alc662_adc_nids;
16819 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16820 spec->capsrc_nids = alc662_capsrc_nids;
16821 spec->capture_style = CAPT_MIX;
16823 if (!spec->cap_mixer)
16824 set_capture_mixer(spec);
16825 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16827 spec->vmaster_nid = 0x02;
16829 codec->patch_ops = alc_patch_ops;
16830 if (board_config == ALC662_AUTO)
16831 spec->init_hook = alc662_auto_init;
16832 #ifdef CONFIG_SND_HDA_POWER_SAVE
16833 if (!spec->loopback.amplist)
16834 spec->loopback.amplist = alc662_loopbacks;
16836 codec->proc_widget_hook = print_realtek_coef;
16844 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16845 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16846 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16847 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16848 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16849 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16850 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16851 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16852 .patch = patch_alc861 },
16853 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16854 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16855 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16856 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16857 .patch = patch_alc883 },
16858 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16859 .patch = patch_alc662 },
16860 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16861 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16862 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16863 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16864 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16865 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16866 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16867 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16868 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16869 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16870 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16871 .patch = patch_alc883 },
16872 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16873 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16874 {} /* terminator */
16877 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16879 MODULE_LICENSE("GPL");
16880 MODULE_DESCRIPTION("Realtek HD-audio codec");
16882 static struct hda_codec_preset_list realtek_list = {
16883 .preset = snd_hda_preset_realtek,
16884 .owner = THIS_MODULE,
16887 static int __init patch_realtek_init(void)
16889 return snd_hda_add_codec_preset(&realtek_list);
16892 static void __exit patch_realtek_exit(void)
16894 snd_hda_delete_codec_preset(&realtek_list);
16897 module_init(patch_realtek_init)
16898 module_exit(patch_realtek_exit)