2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
220 ALC883_TARGA_2ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
227 ALC883_LENOVO_101E_2ch,
228 ALC883_LENOVO_NB0763,
229 ALC888_LENOVO_MS7195_DIG,
236 ALC883_FUJITSU_PI2515,
237 ALC888_FUJITSU_XA3530,
238 ALC883_3ST_6ch_INTEL,
246 /* styles of capture selection */
248 CAPT_MUX = 0, /* only mux based */
249 CAPT_MIX, /* only mixer based */
250 CAPT_1MUX_MIX, /* first mux and other mixers */
254 #define GPIO_MASK 0x03
257 /* codec parameterization */
258 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
259 unsigned int num_mixers;
260 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
261 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
263 const struct hda_verb *init_verbs[5]; /* initialization verbs
267 unsigned int num_init_verbs;
269 char *stream_name_analog; /* analog PCM stream */
270 struct hda_pcm_stream *stream_analog_playback;
271 struct hda_pcm_stream *stream_analog_capture;
272 struct hda_pcm_stream *stream_analog_alt_playback;
273 struct hda_pcm_stream *stream_analog_alt_capture;
275 char *stream_name_digital; /* digital PCM stream */
276 struct hda_pcm_stream *stream_digital_playback;
277 struct hda_pcm_stream *stream_digital_capture;
280 struct hda_multi_out multiout; /* playback set-up
281 * max_channels, dacs must be set
282 * dig_out_nid and hp_nid are optional
284 hda_nid_t alt_dac_nid;
285 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
289 unsigned int num_adc_nids;
291 hda_nid_t *capsrc_nids;
292 hda_nid_t dig_in_nid; /* digital-in NID; optional */
293 int capture_style; /* capture style (CAPT_*) */
296 unsigned int num_mux_defs;
297 const struct hda_input_mux *input_mux;
298 unsigned int cur_mux[3];
301 const struct hda_channel_mode *channel_mode;
302 int num_channel_mode;
305 /* PCM information */
306 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
308 /* dynamic controls, init_verbs and input_mux */
309 struct auto_pin_cfg autocfg;
310 struct snd_array kctls;
311 struct hda_input_mux private_imux[3];
312 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
315 void (*init_hook)(struct hda_codec *codec);
316 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
318 /* for pin sensing */
319 unsigned int sense_updated: 1;
320 unsigned int jack_present: 1;
321 unsigned int master_sw: 1;
324 unsigned int no_analog :1; /* digital I/O only */
326 /* for virtual master */
327 hda_nid_t vmaster_nid;
328 #ifdef CONFIG_SND_HDA_POWER_SAVE
329 struct hda_loopback_check loopback;
334 unsigned int pll_coef_idx, pll_coef_bit;
338 * configuration template - to be copied to the spec instance
340 struct alc_config_preset {
341 struct snd_kcontrol_new *mixers[5]; /* should be identical size
344 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
345 const struct hda_verb *init_verbs[5];
346 unsigned int num_dacs;
348 hda_nid_t dig_out_nid; /* optional */
349 hda_nid_t hp_nid; /* optional */
350 hda_nid_t *slave_dig_outs;
351 unsigned int num_adc_nids;
353 hda_nid_t *capsrc_nids;
354 hda_nid_t dig_in_nid;
355 unsigned int num_channel_mode;
356 const struct hda_channel_mode *channel_mode;
358 unsigned int num_mux_defs;
359 const struct hda_input_mux *input_mux;
360 void (*unsol_event)(struct hda_codec *, unsigned int);
361 void (*init_hook)(struct hda_codec *);
362 #ifdef CONFIG_SND_HDA_POWER_SAVE
363 struct hda_amp_list *loopbacks;
371 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
372 struct snd_ctl_elem_info *uinfo)
374 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
375 struct alc_spec *spec = codec->spec;
376 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
377 if (mux_idx >= spec->num_mux_defs)
379 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
382 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
383 struct snd_ctl_elem_value *ucontrol)
385 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
386 struct alc_spec *spec = codec->spec;
387 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
389 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
393 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
394 struct snd_ctl_elem_value *ucontrol)
396 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
397 struct alc_spec *spec = codec->spec;
398 const struct hda_input_mux *imux;
399 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
400 unsigned int mux_idx;
401 hda_nid_t nid = spec->capsrc_nids ?
402 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
404 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
405 imux = &spec->input_mux[mux_idx];
407 if (spec->capture_style &&
408 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
409 /* Matrix-mixer style (e.g. ALC882) */
410 unsigned int *cur_val = &spec->cur_mux[adc_idx];
413 idx = ucontrol->value.enumerated.item[0];
414 if (idx >= imux->num_items)
415 idx = imux->num_items - 1;
418 for (i = 0; i < imux->num_items; i++) {
419 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
420 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
421 imux->items[i].index,
427 /* MUX style (e.g. ALC880) */
428 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
429 &spec->cur_mux[adc_idx]);
434 * channel mode setting
436 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
437 struct snd_ctl_elem_info *uinfo)
439 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
440 struct alc_spec *spec = codec->spec;
441 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
442 spec->num_channel_mode);
445 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
446 struct snd_ctl_elem_value *ucontrol)
448 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
449 struct alc_spec *spec = codec->spec;
450 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
451 spec->num_channel_mode,
452 spec->multiout.max_channels);
455 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
456 struct snd_ctl_elem_value *ucontrol)
458 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
459 struct alc_spec *spec = codec->spec;
460 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
461 spec->num_channel_mode,
462 &spec->multiout.max_channels);
463 if (err >= 0 && spec->need_dac_fix)
464 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
469 * Control the mode of pin widget settings via the mixer. "pc" is used
470 * instead of "%" to avoid consequences of accidently treating the % as
471 * being part of a format specifier. Maximum allowed length of a value is
472 * 63 characters plus NULL terminator.
474 * Note: some retasking pin complexes seem to ignore requests for input
475 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
476 * are requested. Therefore order this list so that this behaviour will not
477 * cause problems when mixer clients move through the enum sequentially.
478 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
481 static char *alc_pin_mode_names[] = {
482 "Mic 50pc bias", "Mic 80pc bias",
483 "Line in", "Line out", "Headphone out",
485 static unsigned char alc_pin_mode_values[] = {
486 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
488 /* The control can present all 5 options, or it can limit the options based
489 * in the pin being assumed to be exclusively an input or an output pin. In
490 * addition, "input" pins may or may not process the mic bias option
491 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
492 * accept requests for bias as of chip versions up to March 2006) and/or
493 * wiring in the computer.
495 #define ALC_PIN_DIR_IN 0x00
496 #define ALC_PIN_DIR_OUT 0x01
497 #define ALC_PIN_DIR_INOUT 0x02
498 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
499 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
501 /* Info about the pin modes supported by the different pin direction modes.
502 * For each direction the minimum and maximum values are given.
504 static signed char alc_pin_mode_dir_info[5][2] = {
505 { 0, 2 }, /* ALC_PIN_DIR_IN */
506 { 3, 4 }, /* ALC_PIN_DIR_OUT */
507 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
508 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
509 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
511 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
512 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
513 #define alc_pin_mode_n_items(_dir) \
514 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
516 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
517 struct snd_ctl_elem_info *uinfo)
519 unsigned int item_num = uinfo->value.enumerated.item;
520 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
522 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
524 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
526 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
527 item_num = alc_pin_mode_min(dir);
528 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
532 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
533 struct snd_ctl_elem_value *ucontrol)
536 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
537 hda_nid_t nid = kcontrol->private_value & 0xffff;
538 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
539 long *valp = ucontrol->value.integer.value;
540 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
541 AC_VERB_GET_PIN_WIDGET_CONTROL,
544 /* Find enumerated value for current pinctl setting */
545 i = alc_pin_mode_min(dir);
546 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
548 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
552 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
553 struct snd_ctl_elem_value *ucontrol)
556 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
557 hda_nid_t nid = kcontrol->private_value & 0xffff;
558 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
559 long val = *ucontrol->value.integer.value;
560 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
561 AC_VERB_GET_PIN_WIDGET_CONTROL,
564 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
565 val = alc_pin_mode_min(dir);
567 change = pinctl != alc_pin_mode_values[val];
569 /* Set pin mode to that requested */
570 snd_hda_codec_write_cache(codec, nid, 0,
571 AC_VERB_SET_PIN_WIDGET_CONTROL,
572 alc_pin_mode_values[val]);
574 /* Also enable the retasking pin's input/output as required
575 * for the requested pin mode. Enum values of 2 or less are
578 * Dynamically switching the input/output buffers probably
579 * reduces noise slightly (particularly on input) so we'll
580 * do it. However, having both input and output buffers
581 * enabled simultaneously doesn't seem to be problematic if
582 * this turns out to be necessary in the future.
585 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
586 HDA_AMP_MUTE, HDA_AMP_MUTE);
587 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
590 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
591 HDA_AMP_MUTE, HDA_AMP_MUTE);
592 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
599 #define ALC_PIN_MODE(xname, nid, dir) \
600 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
601 .info = alc_pin_mode_info, \
602 .get = alc_pin_mode_get, \
603 .put = alc_pin_mode_put, \
604 .private_value = nid | (dir<<16) }
606 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
607 * together using a mask with more than one bit set. This control is
608 * currently used only by the ALC260 test model. At this stage they are not
609 * needed for any "production" models.
611 #ifdef CONFIG_SND_DEBUG
612 #define alc_gpio_data_info snd_ctl_boolean_mono_info
614 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
615 struct snd_ctl_elem_value *ucontrol)
617 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
618 hda_nid_t nid = kcontrol->private_value & 0xffff;
619 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
620 long *valp = ucontrol->value.integer.value;
621 unsigned int val = snd_hda_codec_read(codec, nid, 0,
622 AC_VERB_GET_GPIO_DATA, 0x00);
624 *valp = (val & mask) != 0;
627 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
628 struct snd_ctl_elem_value *ucontrol)
631 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
632 hda_nid_t nid = kcontrol->private_value & 0xffff;
633 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
634 long val = *ucontrol->value.integer.value;
635 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
636 AC_VERB_GET_GPIO_DATA,
639 /* Set/unset the masked GPIO bit(s) as needed */
640 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
645 snd_hda_codec_write_cache(codec, nid, 0,
646 AC_VERB_SET_GPIO_DATA, gpio_data);
650 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
651 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
652 .info = alc_gpio_data_info, \
653 .get = alc_gpio_data_get, \
654 .put = alc_gpio_data_put, \
655 .private_value = nid | (mask<<16) }
656 #endif /* CONFIG_SND_DEBUG */
658 /* A switch control to allow the enabling of the digital IO pins on the
659 * ALC260. This is incredibly simplistic; the intention of this control is
660 * to provide something in the test model allowing digital outputs to be
661 * identified if present. If models are found which can utilise these
662 * outputs a more complete mixer control can be devised for those models if
665 #ifdef CONFIG_SND_DEBUG
666 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
668 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
669 struct snd_ctl_elem_value *ucontrol)
671 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
672 hda_nid_t nid = kcontrol->private_value & 0xffff;
673 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
674 long *valp = ucontrol->value.integer.value;
675 unsigned int val = snd_hda_codec_read(codec, nid, 0,
676 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
678 *valp = (val & mask) != 0;
681 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
682 struct snd_ctl_elem_value *ucontrol)
685 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
686 hda_nid_t nid = kcontrol->private_value & 0xffff;
687 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
688 long val = *ucontrol->value.integer.value;
689 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
690 AC_VERB_GET_DIGI_CONVERT_1,
693 /* Set/unset the masked control bit(s) as needed */
694 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
699 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
704 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
705 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
706 .info = alc_spdif_ctrl_info, \
707 .get = alc_spdif_ctrl_get, \
708 .put = alc_spdif_ctrl_put, \
709 .private_value = nid | (mask<<16) }
710 #endif /* CONFIG_SND_DEBUG */
712 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
713 * Again, this is only used in the ALC26x test models to help identify when
714 * the EAPD line must be asserted for features to work.
716 #ifdef CONFIG_SND_DEBUG
717 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
719 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
720 struct snd_ctl_elem_value *ucontrol)
722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
723 hda_nid_t nid = kcontrol->private_value & 0xffff;
724 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
725 long *valp = ucontrol->value.integer.value;
726 unsigned int val = snd_hda_codec_read(codec, nid, 0,
727 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
729 *valp = (val & mask) != 0;
733 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
734 struct snd_ctl_elem_value *ucontrol)
737 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
738 hda_nid_t nid = kcontrol->private_value & 0xffff;
739 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
740 long val = *ucontrol->value.integer.value;
741 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
742 AC_VERB_GET_EAPD_BTLENABLE,
745 /* Set/unset the masked control bit(s) as needed */
746 change = (!val ? 0 : mask) != (ctrl_data & mask);
751 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
757 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
758 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
759 .info = alc_eapd_ctrl_info, \
760 .get = alc_eapd_ctrl_get, \
761 .put = alc_eapd_ctrl_put, \
762 .private_value = nid | (mask<<16) }
763 #endif /* CONFIG_SND_DEBUG */
766 * set up the input pin config (depending on the given auto-pin type)
768 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
771 unsigned int val = PIN_IN;
773 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
775 pincap = snd_hda_query_pin_caps(codec, nid);
776 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
777 if (pincap & AC_PINCAP_VREF_80)
780 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
785 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
787 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
789 spec->mixers[spec->num_mixers++] = mix;
792 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
794 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
796 spec->init_verbs[spec->num_init_verbs++] = verb;
799 #ifdef CONFIG_PROC_FS
803 static void print_realtek_coef(struct snd_info_buffer *buffer,
804 struct hda_codec *codec, hda_nid_t nid)
810 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
811 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
812 coeff = snd_hda_codec_read(codec, nid, 0,
813 AC_VERB_GET_COEF_INDEX, 0);
814 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
817 #define print_realtek_coef NULL
821 * set up from the preset table
823 static void setup_preset(struct alc_spec *spec,
824 const struct alc_config_preset *preset)
828 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
829 add_mixer(spec, preset->mixers[i]);
830 spec->cap_mixer = preset->cap_mixer;
831 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
833 add_verb(spec, preset->init_verbs[i]);
835 spec->channel_mode = preset->channel_mode;
836 spec->num_channel_mode = preset->num_channel_mode;
837 spec->need_dac_fix = preset->need_dac_fix;
839 spec->multiout.max_channels = spec->channel_mode[0].channels;
841 spec->multiout.num_dacs = preset->num_dacs;
842 spec->multiout.dac_nids = preset->dac_nids;
843 spec->multiout.dig_out_nid = preset->dig_out_nid;
844 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
845 spec->multiout.hp_nid = preset->hp_nid;
847 spec->num_mux_defs = preset->num_mux_defs;
848 if (!spec->num_mux_defs)
849 spec->num_mux_defs = 1;
850 spec->input_mux = preset->input_mux;
852 spec->num_adc_nids = preset->num_adc_nids;
853 spec->adc_nids = preset->adc_nids;
854 spec->capsrc_nids = preset->capsrc_nids;
855 spec->dig_in_nid = preset->dig_in_nid;
857 spec->unsol_event = preset->unsol_event;
858 spec->init_hook = preset->init_hook;
859 #ifdef CONFIG_SND_HDA_POWER_SAVE
860 spec->loopback.amplist = preset->loopbacks;
864 /* Enable GPIO mask and set output */
865 static struct hda_verb alc_gpio1_init_verbs[] = {
866 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
867 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
868 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
872 static struct hda_verb alc_gpio2_init_verbs[] = {
873 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
874 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
875 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
879 static struct hda_verb alc_gpio3_init_verbs[] = {
880 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
881 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
882 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
887 * Fix hardware PLL issue
888 * On some codecs, the analog PLL gating control must be off while
889 * the default value is 1.
891 static void alc_fix_pll(struct hda_codec *codec)
893 struct alc_spec *spec = codec->spec;
898 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
900 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
901 AC_VERB_GET_PROC_COEF, 0);
902 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
904 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
905 val & ~(1 << spec->pll_coef_bit));
908 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
909 unsigned int coef_idx, unsigned int coef_bit)
911 struct alc_spec *spec = codec->spec;
913 spec->pll_coef_idx = coef_idx;
914 spec->pll_coef_bit = coef_bit;
918 static void alc_sku_automute(struct hda_codec *codec)
920 struct alc_spec *spec = codec->spec;
921 unsigned int present;
922 unsigned int hp_nid = spec->autocfg.hp_pins[0];
923 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
925 /* need to execute and sync at first */
926 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
927 present = snd_hda_codec_read(codec, hp_nid, 0,
928 AC_VERB_GET_PIN_SENSE, 0);
929 spec->jack_present = (present & 0x80000000) != 0;
930 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
931 spec->jack_present ? 0 : PIN_OUT);
934 #if 0 /* it's broken in some acses -- temporarily disabled */
935 static void alc_mic_automute(struct hda_codec *codec)
937 struct alc_spec *spec = codec->spec;
938 unsigned int present;
939 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
940 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
941 unsigned int mix_nid = spec->capsrc_nids[0];
942 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
944 capsrc_idx_mic = mic_nid - 0x18;
945 capsrc_idx_fmic = fmic_nid - 0x18;
946 present = snd_hda_codec_read(codec, mic_nid, 0,
947 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
948 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
949 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
950 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
951 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
952 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
953 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
956 #define alc_mic_automute(codec) do {} while(0) /* NOP */
957 #endif /* disabled */
959 /* unsolicited event for HP jack sensing */
960 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
962 if (codec->vendor_id == 0x10ec0880)
966 if (res == ALC880_HP_EVENT)
967 alc_sku_automute(codec);
969 if (res == ALC880_MIC_EVENT)
970 alc_mic_automute(codec);
973 static void alc_inithook(struct hda_codec *codec)
975 alc_sku_automute(codec);
976 alc_mic_automute(codec);
979 /* additional initialization for ALC888 variants */
980 static void alc888_coef_init(struct hda_codec *codec)
984 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
985 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
986 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
987 if ((tmp & 0xf0) == 0x20)
989 snd_hda_codec_read(codec, 0x20, 0,
990 AC_VERB_SET_PROC_COEF, 0x830);
993 snd_hda_codec_read(codec, 0x20, 0,
994 AC_VERB_SET_PROC_COEF, 0x3030);
997 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
998 * 31 ~ 16 : Manufacture ID
1000 * 7 ~ 0 : Assembly ID
1001 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1003 static void alc_subsystem_id(struct hda_codec *codec,
1004 unsigned int porta, unsigned int porte,
1007 unsigned int ass, tmp, i;
1009 struct alc_spec *spec = codec->spec;
1011 ass = codec->subsystem_id & 0xffff;
1012 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1016 * 31~30 : port conetcivity
1019 * 19~16 : Check sum (15:1)
1024 if (codec->vendor_id == 0x10ec0260)
1026 ass = snd_hda_codec_get_pincfg(codec, nid);
1027 if (!(ass & 1) && !(ass & 0x100000))
1029 if ((ass >> 30) != 1) /* no physical connection */
1034 for (i = 1; i < 16; i++) {
1038 if (((ass >> 16) & 0xf) != tmp)
1044 * 2 : 0 --> Desktop, 1 --> Laptop
1045 * 3~5 : External Amplifier control
1048 tmp = (ass & 0x38) >> 3; /* external Amp control */
1051 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1054 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1057 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1059 case 5: /* set EAPD output high */
1060 switch (codec->vendor_id) {
1062 snd_hda_codec_write(codec, 0x0f, 0,
1063 AC_VERB_SET_EAPD_BTLENABLE, 2);
1064 snd_hda_codec_write(codec, 0x10, 0,
1065 AC_VERB_SET_EAPD_BTLENABLE, 2);
1077 snd_hda_codec_write(codec, 0x14, 0,
1078 AC_VERB_SET_EAPD_BTLENABLE, 2);
1079 snd_hda_codec_write(codec, 0x15, 0,
1080 AC_VERB_SET_EAPD_BTLENABLE, 2);
1083 switch (codec->vendor_id) {
1085 snd_hda_codec_write(codec, 0x1a, 0,
1086 AC_VERB_SET_COEF_INDEX, 7);
1087 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1088 AC_VERB_GET_PROC_COEF, 0);
1089 snd_hda_codec_write(codec, 0x1a, 0,
1090 AC_VERB_SET_COEF_INDEX, 7);
1091 snd_hda_codec_write(codec, 0x1a, 0,
1092 AC_VERB_SET_PROC_COEF,
1102 snd_hda_codec_write(codec, 0x20, 0,
1103 AC_VERB_SET_COEF_INDEX, 7);
1104 tmp = snd_hda_codec_read(codec, 0x20, 0,
1105 AC_VERB_GET_PROC_COEF, 0);
1106 snd_hda_codec_write(codec, 0x20, 0,
1107 AC_VERB_SET_COEF_INDEX, 7);
1108 snd_hda_codec_write(codec, 0x20, 0,
1109 AC_VERB_SET_PROC_COEF,
1113 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1117 snd_hda_codec_write(codec, 0x20, 0,
1118 AC_VERB_SET_COEF_INDEX, 7);
1119 tmp = snd_hda_codec_read(codec, 0x20, 0,
1120 AC_VERB_GET_PROC_COEF, 0);
1121 snd_hda_codec_write(codec, 0x20, 0,
1122 AC_VERB_SET_COEF_INDEX, 7);
1123 snd_hda_codec_write(codec, 0x20, 0,
1124 AC_VERB_SET_PROC_COEF,
1132 /* is laptop or Desktop and enable the function "Mute internal speaker
1133 * when the external headphone out jack is plugged"
1135 if (!(ass & 0x8000))
1138 * 10~8 : Jack location
1139 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1141 * 15 : 1 --> enable the function "Mute internal speaker
1142 * when the external headphone out jack is plugged"
1144 if (!spec->autocfg.speaker_pins[0]) {
1145 if (spec->autocfg.line_out_pins[0])
1146 spec->autocfg.speaker_pins[0] =
1147 spec->autocfg.line_out_pins[0];
1152 if (!spec->autocfg.hp_pins[0]) {
1153 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1155 spec->autocfg.hp_pins[0] = porta;
1157 spec->autocfg.hp_pins[0] = porte;
1159 spec->autocfg.hp_pins[0] = portd;
1163 if (spec->autocfg.hp_pins[0])
1164 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1165 AC_VERB_SET_UNSOLICITED_ENABLE,
1166 AC_USRSP_EN | ALC880_HP_EVENT);
1168 #if 0 /* it's broken in some acses -- temporarily disabled */
1169 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1170 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1171 snd_hda_codec_write(codec,
1172 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1173 AC_VERB_SET_UNSOLICITED_ENABLE,
1174 AC_USRSP_EN | ALC880_MIC_EVENT);
1175 #endif /* disabled */
1177 spec->unsol_event = alc_sku_unsol_event;
1181 * Fix-up pin default configurations
1189 static void alc_fix_pincfg(struct hda_codec *codec,
1190 const struct snd_pci_quirk *quirk,
1191 const struct alc_pincfg **pinfix)
1193 const struct alc_pincfg *cfg;
1195 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1199 cfg = pinfix[quirk->value];
1200 for (; cfg->nid; cfg++)
1201 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1211 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1212 /* Mic-in jack as mic in */
1213 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1214 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1215 /* Line-in jack as Line in */
1216 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1217 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1218 /* Line-Out as Front */
1219 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1226 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1227 /* Mic-in jack as mic in */
1228 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1229 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1230 /* Line-in jack as Surround */
1231 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1232 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1233 /* Line-Out as Front */
1234 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1241 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1242 /* Mic-in jack as CLFE */
1243 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1244 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1245 /* Line-in jack as Surround */
1246 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1247 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1248 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1249 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1256 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1257 /* Mic-in jack as CLFE */
1258 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1259 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1260 /* Line-in jack as Surround */
1261 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1262 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1263 /* Line-Out as Side */
1264 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1268 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1269 { 2, alc888_4ST_ch2_intel_init },
1270 { 4, alc888_4ST_ch4_intel_init },
1271 { 6, alc888_4ST_ch6_intel_init },
1272 { 8, alc888_4ST_ch8_intel_init },
1276 * ALC888 Fujitsu Siemens Amillo xa3530
1279 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1280 /* Front Mic: set to PIN_IN (empty by default) */
1281 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1282 /* Connect Internal HP to Front */
1283 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1284 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1285 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1286 /* Connect Bass HP to Front */
1287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1289 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1290 /* Connect Line-Out side jack (SPDIF) to Side */
1291 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1292 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1293 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1294 /* Connect Mic jack to CLFE */
1295 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1296 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1297 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1298 /* Connect Line-in jack to Surround */
1299 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1300 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1301 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1302 /* Connect HP out jack to Front */
1303 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1304 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1305 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1306 /* Enable unsolicited event for HP jack and Line-out jack */
1307 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1308 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1312 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1314 unsigned int present;
1316 /* Line out presence */
1317 present = snd_hda_codec_read(codec, 0x17, 0,
1318 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1319 /* HP out presence */
1320 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1321 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1322 bits = present ? HDA_AMP_MUTE : 0;
1323 /* Toggle internal speakers muting */
1324 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1325 HDA_AMP_MUTE, bits);
1326 /* Toggle internal bass muting */
1327 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1328 HDA_AMP_MUTE, bits);
1331 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1334 if (res >> 26 == ALC880_HP_EVENT)
1335 alc888_fujitsu_xa3530_automute(codec);
1340 * ALC888 Acer Aspire 4930G model
1343 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1344 /* Front Mic: set to PIN_IN (empty by default) */
1345 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1346 /* Unselect Front Mic by default in input mixer 3 */
1347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1348 /* Enable unsolicited event for HP jack */
1349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1350 /* Connect Internal HP to front */
1351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1353 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1354 /* Connect HP out to front */
1355 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1361 static struct hda_input_mux alc888_2_capture_sources[2] = {
1362 /* Front mic only available on one ADC */
1369 { "Front Mic", 0xb },
1382 static struct snd_kcontrol_new alc888_base_mixer[] = {
1383 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1384 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1385 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1386 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1387 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1389 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1390 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1391 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1392 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1393 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1394 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1395 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1404 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1406 unsigned int present;
1408 present = snd_hda_codec_read(codec, 0x15, 0,
1409 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1410 bits = present ? HDA_AMP_MUTE : 0;
1411 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1412 HDA_AMP_MUTE, bits);
1415 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1418 if (res >> 26 == ALC880_HP_EVENT)
1419 alc888_acer_aspire_4930g_automute(codec);
1423 * ALC880 3-stack model
1425 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1426 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1427 * F-Mic = 0x1b, HP = 0x19
1430 static hda_nid_t alc880_dac_nids[4] = {
1431 /* front, rear, clfe, rear_surr */
1432 0x02, 0x05, 0x04, 0x03
1435 static hda_nid_t alc880_adc_nids[3] = {
1440 /* The datasheet says the node 0x07 is connected from inputs,
1441 * but it shows zero connection in the real implementation on some devices.
1442 * Note: this is a 915GAV bug, fixed on 915GLV
1444 static hda_nid_t alc880_adc_nids_alt[2] = {
1449 #define ALC880_DIGOUT_NID 0x06
1450 #define ALC880_DIGIN_NID 0x0a
1452 static struct hda_input_mux alc880_capture_source = {
1456 { "Front Mic", 0x3 },
1462 /* channel source setting (2/6 channel selection for 3-stack) */
1464 static struct hda_verb alc880_threestack_ch2_init[] = {
1465 /* set line-in to input, mute it */
1466 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1467 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1468 /* set mic-in to input vref 80%, mute it */
1469 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1470 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1475 static struct hda_verb alc880_threestack_ch6_init[] = {
1476 /* set line-in to output, unmute it */
1477 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1478 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1479 /* set mic-in to output, unmute it */
1480 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1481 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1485 static struct hda_channel_mode alc880_threestack_modes[2] = {
1486 { 2, alc880_threestack_ch2_init },
1487 { 6, alc880_threestack_ch6_init },
1490 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1491 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1492 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1493 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1494 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1495 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1496 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1497 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1498 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1499 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1500 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1501 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1502 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1504 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1505 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1506 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1507 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1509 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1510 .name = "Channel Mode",
1511 .info = alc_ch_mode_info,
1512 .get = alc_ch_mode_get,
1513 .put = alc_ch_mode_put,
1518 /* capture mixer elements */
1519 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1520 struct snd_ctl_elem_info *uinfo)
1522 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1523 struct alc_spec *spec = codec->spec;
1526 mutex_lock(&codec->control_mutex);
1527 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1529 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1530 mutex_unlock(&codec->control_mutex);
1534 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1535 unsigned int size, unsigned int __user *tlv)
1537 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1538 struct alc_spec *spec = codec->spec;
1541 mutex_lock(&codec->control_mutex);
1542 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1544 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1545 mutex_unlock(&codec->control_mutex);
1549 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1550 struct snd_ctl_elem_value *ucontrol);
1552 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1553 struct snd_ctl_elem_value *ucontrol,
1556 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1557 struct alc_spec *spec = codec->spec;
1558 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1561 mutex_lock(&codec->control_mutex);
1562 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1564 err = func(kcontrol, ucontrol);
1565 mutex_unlock(&codec->control_mutex);
1569 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1570 struct snd_ctl_elem_value *ucontrol)
1572 return alc_cap_getput_caller(kcontrol, ucontrol,
1573 snd_hda_mixer_amp_volume_get);
1576 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1577 struct snd_ctl_elem_value *ucontrol)
1579 return alc_cap_getput_caller(kcontrol, ucontrol,
1580 snd_hda_mixer_amp_volume_put);
1583 /* capture mixer elements */
1584 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1586 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1587 struct snd_ctl_elem_value *ucontrol)
1589 return alc_cap_getput_caller(kcontrol, ucontrol,
1590 snd_hda_mixer_amp_switch_get);
1593 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1594 struct snd_ctl_elem_value *ucontrol)
1596 return alc_cap_getput_caller(kcontrol, ucontrol,
1597 snd_hda_mixer_amp_switch_put);
1600 #define _DEFINE_CAPMIX(num) \
1602 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1603 .name = "Capture Switch", \
1604 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1606 .info = alc_cap_sw_info, \
1607 .get = alc_cap_sw_get, \
1608 .put = alc_cap_sw_put, \
1611 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1612 .name = "Capture Volume", \
1613 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1614 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1615 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1617 .info = alc_cap_vol_info, \
1618 .get = alc_cap_vol_get, \
1619 .put = alc_cap_vol_put, \
1620 .tlv = { .c = alc_cap_vol_tlv }, \
1623 #define _DEFINE_CAPSRC(num) \
1625 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1626 /* .name = "Capture Source", */ \
1627 .name = "Input Source", \
1629 .info = alc_mux_enum_info, \
1630 .get = alc_mux_enum_get, \
1631 .put = alc_mux_enum_put, \
1634 #define DEFINE_CAPMIX(num) \
1635 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1636 _DEFINE_CAPMIX(num), \
1637 _DEFINE_CAPSRC(num), \
1641 #define DEFINE_CAPMIX_NOSRC(num) \
1642 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1643 _DEFINE_CAPMIX(num), \
1647 /* up to three ADCs */
1651 DEFINE_CAPMIX_NOSRC(1);
1652 DEFINE_CAPMIX_NOSRC(2);
1653 DEFINE_CAPMIX_NOSRC(3);
1656 * ALC880 5-stack model
1658 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1660 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1661 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1664 /* additional mixers to alc880_three_stack_mixer */
1665 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1666 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1667 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1671 /* channel source setting (6/8 channel selection for 5-stack) */
1673 static struct hda_verb alc880_fivestack_ch6_init[] = {
1674 /* set line-in to input, mute it */
1675 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1676 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1681 static struct hda_verb alc880_fivestack_ch8_init[] = {
1682 /* set line-in to output, unmute it */
1683 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1684 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1688 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1689 { 6, alc880_fivestack_ch6_init },
1690 { 8, alc880_fivestack_ch8_init },
1695 * ALC880 6-stack model
1697 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1698 * Side = 0x05 (0x0f)
1699 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1700 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1703 static hda_nid_t alc880_6st_dac_nids[4] = {
1704 /* front, rear, clfe, rear_surr */
1705 0x02, 0x03, 0x04, 0x05
1708 static struct hda_input_mux alc880_6stack_capture_source = {
1712 { "Front Mic", 0x1 },
1718 /* fixed 8-channels */
1719 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1723 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1724 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1725 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1726 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1727 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1728 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1729 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1730 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1731 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1732 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1733 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1734 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1735 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1736 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1737 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1740 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1741 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1743 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1744 .name = "Channel Mode",
1745 .info = alc_ch_mode_info,
1746 .get = alc_ch_mode_get,
1747 .put = alc_ch_mode_put,
1756 * W810 has rear IO for:
1759 * Center/LFE (DAC 04)
1762 * The system also has a pair of internal speakers, and a headphone jack.
1763 * These are both connected to Line2 on the codec, hence to DAC 02.
1765 * There is a variable resistor to control the speaker or headphone
1766 * volume. This is a hardware-only device without a software API.
1768 * Plugging headphones in will disable the internal speakers. This is
1769 * implemented in hardware, not via the driver using jack sense. In
1770 * a similar fashion, plugging into the rear socket marked "front" will
1771 * disable both the speakers and headphones.
1773 * For input, there's a microphone jack, and an "audio in" jack.
1774 * These may not do anything useful with this driver yet, because I
1775 * haven't setup any initialization verbs for these yet...
1778 static hda_nid_t alc880_w810_dac_nids[3] = {
1779 /* front, rear/surround, clfe */
1783 /* fixed 6 channels */
1784 static struct hda_channel_mode alc880_w810_modes[1] = {
1788 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1789 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1791 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1794 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1795 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1796 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1797 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1798 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1806 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1807 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1811 static hda_nid_t alc880_z71v_dac_nids[1] = {
1814 #define ALC880_Z71V_HP_DAC 0x03
1816 /* fixed 2 channels */
1817 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1821 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1822 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1823 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1824 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1825 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1826 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1827 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1828 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1829 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1835 * ALC880 F1734 model
1837 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1838 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1841 static hda_nid_t alc880_f1734_dac_nids[1] = {
1844 #define ALC880_F1734_HP_DAC 0x02
1846 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1847 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1848 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1849 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1850 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1851 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1852 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1853 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1858 static struct hda_input_mux alc880_f1734_capture_source = {
1870 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1871 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1872 * Mic = 0x18, Line = 0x1a
1875 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1876 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1878 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1879 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1880 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1881 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1882 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1883 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1884 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1885 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1886 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1887 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1888 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1889 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1890 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1894 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1895 .name = "Channel Mode",
1896 .info = alc_ch_mode_info,
1897 .get = alc_ch_mode_get,
1898 .put = alc_ch_mode_put,
1904 * ALC880 ASUS W1V model
1906 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1907 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1908 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1911 /* additional mixers to alc880_asus_mixer */
1912 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1913 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1914 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1919 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1920 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1921 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1922 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
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("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1927 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1928 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1933 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1934 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1935 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1936 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1937 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1938 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1939 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1940 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1941 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1942 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1943 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1944 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1945 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1948 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1949 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1951 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1952 .name = "Channel Mode",
1953 .info = alc_ch_mode_info,
1954 .get = alc_ch_mode_get,
1955 .put = alc_ch_mode_put,
1960 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1961 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1962 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1963 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1964 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1967 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1968 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1969 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1970 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1974 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1975 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1976 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1977 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1978 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1985 * virtual master controls
1989 * slave controls for virtual master
1991 static const char *alc_slave_vols[] = {
1992 "Front Playback Volume",
1993 "Surround Playback Volume",
1994 "Center Playback Volume",
1995 "LFE Playback Volume",
1996 "Side Playback Volume",
1997 "Headphone Playback Volume",
1998 "Speaker Playback Volume",
1999 "Mono Playback Volume",
2000 "Line-Out Playback Volume",
2001 "PCM Playback Volume",
2005 static const char *alc_slave_sws[] = {
2006 "Front Playback Switch",
2007 "Surround Playback Switch",
2008 "Center Playback Switch",
2009 "LFE Playback Switch",
2010 "Side Playback Switch",
2011 "Headphone Playback Switch",
2012 "Speaker Playback Switch",
2013 "Mono Playback Switch",
2014 "IEC958 Playback Switch",
2019 * build control elements
2022 static void alc_free_kctls(struct hda_codec *codec);
2024 /* additional beep mixers; the actual parameters are overwritten at build */
2025 static struct snd_kcontrol_new alc_beep_mixer[] = {
2026 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2027 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2031 static int alc_build_controls(struct hda_codec *codec)
2033 struct alc_spec *spec = codec->spec;
2037 for (i = 0; i < spec->num_mixers; i++) {
2038 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2042 if (spec->cap_mixer) {
2043 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2047 if (spec->multiout.dig_out_nid) {
2048 err = snd_hda_create_spdif_out_ctls(codec,
2049 spec->multiout.dig_out_nid);
2052 if (!spec->no_analog) {
2053 err = snd_hda_create_spdif_share_sw(codec,
2057 spec->multiout.share_spdif = 1;
2060 if (spec->dig_in_nid) {
2061 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2066 /* create beep controls if needed */
2067 if (spec->beep_amp) {
2068 struct snd_kcontrol_new *knew;
2069 for (knew = alc_beep_mixer; knew->name; knew++) {
2070 struct snd_kcontrol *kctl;
2071 kctl = snd_ctl_new1(knew, codec);
2074 kctl->private_value = spec->beep_amp;
2075 err = snd_hda_ctl_add(codec, kctl);
2081 /* if we have no master control, let's create it */
2082 if (!spec->no_analog &&
2083 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2084 unsigned int vmaster_tlv[4];
2085 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2086 HDA_OUTPUT, vmaster_tlv);
2087 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2088 vmaster_tlv, alc_slave_vols);
2092 if (!spec->no_analog &&
2093 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2094 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2095 NULL, alc_slave_sws);
2100 alc_free_kctls(codec); /* no longer needed */
2106 * initialize the codec volumes, etc
2110 * generic initialization of ADC, input mixers and output mixers
2112 static struct hda_verb alc880_volume_init_verbs[] = {
2114 * Unmute ADC0-2 and set the default input to mic-in
2116 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2118 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2119 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2120 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2121 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2123 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2125 * Note: PASD motherboards uses the Line In 2 as the input for front
2128 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2138 * Set up output mixers (0x0c - 0x0f)
2140 /* set vol=0 to output mixers */
2141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2143 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2144 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2145 /* set up input amps for analog loopback */
2146 /* Amp Indices: DAC = 0, mixer = 1 */
2147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2149 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2150 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2151 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2152 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2153 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2154 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2160 * 3-stack pin configuration:
2161 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2163 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2165 * preset connection lists of input pins
2166 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2168 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2169 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2170 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2173 * Set pin mode and muting
2175 /* set front pin widgets 0x14 for output */
2176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2178 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2179 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2180 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2181 /* Mic2 (as headphone out) for HP output */
2182 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2183 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2184 /* Line In pin widget for input */
2185 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2186 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2187 /* Line2 (as front mic) pin widget for input and vref at 80% */
2188 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2189 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2190 /* CD pin widget for input */
2191 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2197 * 5-stack pin configuration:
2198 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2199 * line-in/side = 0x1a, f-mic = 0x1b
2201 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2203 * preset connection lists of input pins
2204 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2206 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2207 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2210 * Set pin mode and muting
2212 /* set pin widgets 0x14-0x17 for output */
2213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2215 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2216 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2217 /* unmute pins for output (no gain on this amp) */
2218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2219 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2220 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2221 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2223 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2224 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2225 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2226 /* Mic2 (as headphone out) for HP output */
2227 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2228 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2229 /* Line In pin widget for input */
2230 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2231 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2232 /* Line2 (as front mic) pin widget for input and vref at 80% */
2233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2234 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2235 /* CD pin widget for input */
2236 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2242 * W810 pin configuration:
2243 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2245 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2246 /* hphone/speaker input selector: front DAC */
2247 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2250 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2253 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2254 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2256 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2257 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2263 * Z71V pin configuration:
2264 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2266 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2267 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2268 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2270 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2272 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2273 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2274 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2275 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2281 * 6-stack pin configuration:
2282 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2283 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2285 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2286 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2289 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2291 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2292 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2293 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2294 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2295 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2298 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2299 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2300 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2301 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2302 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2303 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2304 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2305 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2311 * Uniwill pin configuration:
2312 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2315 static struct hda_verb alc880_uniwill_init_verbs[] = {
2316 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2318 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2319 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2321 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2322 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2323 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2324 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2325 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2330 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2331 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2333 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2334 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2335 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2336 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2337 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2338 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2339 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2340 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2341 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2343 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2344 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2351 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2353 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2354 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2357 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2359 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2360 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2361 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2366 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2369 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2370 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2373 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2374 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2376 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2377 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2382 static struct hda_verb alc880_beep_init_verbs[] = {
2383 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2387 /* toggle speaker-output according to the hp-jack state */
2388 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2390 unsigned int present;
2393 present = snd_hda_codec_read(codec, 0x14, 0,
2394 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2395 bits = present ? HDA_AMP_MUTE : 0;
2396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2397 HDA_AMP_MUTE, bits);
2398 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2399 HDA_AMP_MUTE, bits);
2402 /* auto-toggle front mic */
2403 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2405 unsigned int present;
2408 present = snd_hda_codec_read(codec, 0x18, 0,
2409 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2410 bits = present ? HDA_AMP_MUTE : 0;
2411 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2414 static void alc880_uniwill_automute(struct hda_codec *codec)
2416 alc880_uniwill_hp_automute(codec);
2417 alc880_uniwill_mic_automute(codec);
2420 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2423 /* Looks like the unsol event is incompatible with the standard
2424 * definition. 4bit tag is placed at 28 bit!
2426 switch (res >> 28) {
2427 case ALC880_HP_EVENT:
2428 alc880_uniwill_hp_automute(codec);
2430 case ALC880_MIC_EVENT:
2431 alc880_uniwill_mic_automute(codec);
2436 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2438 unsigned int present;
2441 present = snd_hda_codec_read(codec, 0x14, 0,
2442 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2443 bits = present ? HDA_AMP_MUTE : 0;
2444 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2447 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2449 unsigned int present;
2451 present = snd_hda_codec_read(codec, 0x21, 0,
2452 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2453 present &= HDA_AMP_VOLMASK;
2454 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2455 HDA_AMP_VOLMASK, present);
2456 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2457 HDA_AMP_VOLMASK, present);
2460 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2463 /* Looks like the unsol event is incompatible with the standard
2464 * definition. 4bit tag is placed at 28 bit!
2466 if ((res >> 28) == ALC880_HP_EVENT)
2467 alc880_uniwill_p53_hp_automute(codec);
2468 if ((res >> 28) == ALC880_DCVOL_EVENT)
2469 alc880_uniwill_p53_dcvol_automute(codec);
2473 * F1734 pin configuration:
2474 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2476 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2477 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2478 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2479 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2480 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2481 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2483 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2486 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2489 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2490 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2491 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2493 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2494 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2495 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2496 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2498 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2499 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2505 * ASUS pin configuration:
2506 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2508 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2509 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2510 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2511 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2512 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2515 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2517 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2518 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2519 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2520 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2521 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2523 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2524 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2525 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2527 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2528 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2530 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2531 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2536 /* Enable GPIO mask and set output */
2537 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2538 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2540 /* Clevo m520g init */
2541 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2542 /* headphone output */
2543 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2545 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2546 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2548 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2549 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2551 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2552 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2553 /* Mic1 (rear panel) */
2554 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2555 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2556 /* Mic2 (front panel) */
2557 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2558 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2560 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2561 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2562 /* change to EAPD mode */
2563 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2564 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2569 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2570 /* change to EAPD mode */
2571 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2572 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2574 /* Headphone output */
2575 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2577 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2578 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2580 /* Line In pin widget for input */
2581 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2582 /* CD pin widget for input */
2583 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2584 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2585 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2587 /* change to EAPD mode */
2588 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2589 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2595 * LG m1 express dual
2598 * Rear Line-In/Out (blue): 0x14
2599 * Build-in Mic-In: 0x15
2601 * HP-Out (green): 0x1b
2602 * Mic-In/Out (red): 0x19
2606 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2607 static hda_nid_t alc880_lg_dac_nids[3] = {
2611 /* seems analog CD is not working */
2612 static struct hda_input_mux alc880_lg_capture_source = {
2617 { "Internal Mic", 0x6 },
2621 /* 2,4,6 channel modes */
2622 static struct hda_verb alc880_lg_ch2_init[] = {
2623 /* set line-in and mic-in to input */
2624 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2625 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2629 static struct hda_verb alc880_lg_ch4_init[] = {
2630 /* set line-in to out and mic-in to input */
2631 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2632 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2636 static struct hda_verb alc880_lg_ch6_init[] = {
2637 /* set line-in and mic-in to output */
2638 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2639 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2643 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2644 { 2, alc880_lg_ch2_init },
2645 { 4, alc880_lg_ch4_init },
2646 { 6, alc880_lg_ch6_init },
2649 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2650 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2651 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2652 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2653 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2654 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2655 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2656 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2657 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2659 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2660 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2661 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2662 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2663 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2665 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2666 .name = "Channel Mode",
2667 .info = alc_ch_mode_info,
2668 .get = alc_ch_mode_get,
2669 .put = alc_ch_mode_put,
2674 static struct hda_verb alc880_lg_init_verbs[] = {
2675 /* set capture source to mic-in */
2676 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2677 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2678 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2679 /* mute all amp mixer inputs */
2680 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2681 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2682 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2683 /* line-in to input */
2684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2685 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2690 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2691 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 /* mic-in to input */
2693 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2697 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2701 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2705 /* toggle speaker-output according to the hp-jack state */
2706 static void alc880_lg_automute(struct hda_codec *codec)
2708 unsigned int present;
2711 present = snd_hda_codec_read(codec, 0x1b, 0,
2712 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2713 bits = present ? HDA_AMP_MUTE : 0;
2714 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2715 HDA_AMP_MUTE, bits);
2718 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2720 /* Looks like the unsol event is incompatible with the standard
2721 * definition. 4bit tag is placed at 28 bit!
2723 if ((res >> 28) == 0x01)
2724 alc880_lg_automute(codec);
2733 * Built-in Mic-In: 0x19
2739 static struct hda_input_mux alc880_lg_lw_capture_source = {
2743 { "Internal Mic", 0x1 },
2748 #define alc880_lg_lw_modes alc880_threestack_modes
2750 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2751 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2752 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2753 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2754 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2755 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2756 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2757 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2758 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2759 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2760 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2763 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2764 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2766 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2767 .name = "Channel Mode",
2768 .info = alc_ch_mode_info,
2769 .get = alc_ch_mode_get,
2770 .put = alc_ch_mode_put,
2775 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2776 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2777 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2778 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2780 /* set capture source to mic-in */
2781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2783 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2784 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2786 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2787 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2789 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2790 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2791 /* mic-in to input */
2792 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2793 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2795 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2796 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2798 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2802 /* toggle speaker-output according to the hp-jack state */
2803 static void alc880_lg_lw_automute(struct hda_codec *codec)
2805 unsigned int present;
2808 present = snd_hda_codec_read(codec, 0x1b, 0,
2809 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2810 bits = present ? HDA_AMP_MUTE : 0;
2811 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2812 HDA_AMP_MUTE, bits);
2815 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2817 /* Looks like the unsol event is incompatible with the standard
2818 * definition. 4bit tag is placed at 28 bit!
2820 if ((res >> 28) == 0x01)
2821 alc880_lg_lw_automute(codec);
2824 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2825 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2826 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2829 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2830 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2834 static struct hda_input_mux alc880_medion_rim_capture_source = {
2838 { "Internal Mic", 0x1 },
2842 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2843 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2848 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2849 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2850 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2851 /* Mic2 (as headphone out) for HP output */
2852 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2853 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2854 /* Internal Speaker */
2855 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2856 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2858 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2859 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2861 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2865 /* toggle speaker-output according to the hp-jack state */
2866 static void alc880_medion_rim_automute(struct hda_codec *codec)
2868 unsigned int present;
2871 present = snd_hda_codec_read(codec, 0x14, 0,
2872 AC_VERB_GET_PIN_SENSE, 0)
2873 & AC_PINSENSE_PRESENCE;
2874 bits = present ? HDA_AMP_MUTE : 0;
2875 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2876 HDA_AMP_MUTE, bits);
2878 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2880 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2883 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2886 /* Looks like the unsol event is incompatible with the standard
2887 * definition. 4bit tag is placed at 28 bit!
2889 if ((res >> 28) == ALC880_HP_EVENT)
2890 alc880_medion_rim_automute(codec);
2893 #ifdef CONFIG_SND_HDA_POWER_SAVE
2894 static struct hda_amp_list alc880_loopbacks[] = {
2895 { 0x0b, HDA_INPUT, 0 },
2896 { 0x0b, HDA_INPUT, 1 },
2897 { 0x0b, HDA_INPUT, 2 },
2898 { 0x0b, HDA_INPUT, 3 },
2899 { 0x0b, HDA_INPUT, 4 },
2903 static struct hda_amp_list alc880_lg_loopbacks[] = {
2904 { 0x0b, HDA_INPUT, 1 },
2905 { 0x0b, HDA_INPUT, 6 },
2906 { 0x0b, HDA_INPUT, 7 },
2915 static int alc_init(struct hda_codec *codec)
2917 struct alc_spec *spec = codec->spec;
2921 if (codec->vendor_id == 0x10ec0888)
2922 alc888_coef_init(codec);
2924 for (i = 0; i < spec->num_init_verbs; i++)
2925 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2927 if (spec->init_hook)
2928 spec->init_hook(codec);
2933 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2935 struct alc_spec *spec = codec->spec;
2937 if (spec->unsol_event)
2938 spec->unsol_event(codec, res);
2941 #ifdef CONFIG_SND_HDA_POWER_SAVE
2942 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2944 struct alc_spec *spec = codec->spec;
2945 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2950 * Analog playback callbacks
2952 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2953 struct hda_codec *codec,
2954 struct snd_pcm_substream *substream)
2956 struct alc_spec *spec = codec->spec;
2957 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2961 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2962 struct hda_codec *codec,
2963 unsigned int stream_tag,
2964 unsigned int format,
2965 struct snd_pcm_substream *substream)
2967 struct alc_spec *spec = codec->spec;
2968 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2969 stream_tag, format, substream);
2972 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2973 struct hda_codec *codec,
2974 struct snd_pcm_substream *substream)
2976 struct alc_spec *spec = codec->spec;
2977 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2983 static int alc880_dig_playback_pcm_open(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_open(codec, &spec->multiout);
2991 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2992 struct hda_codec *codec,
2993 unsigned int stream_tag,
2994 unsigned int format,
2995 struct snd_pcm_substream *substream)
2997 struct alc_spec *spec = codec->spec;
2998 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2999 stream_tag, format, substream);
3002 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3003 struct hda_codec *codec,
3004 struct snd_pcm_substream *substream)
3006 struct alc_spec *spec = codec->spec;
3007 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3010 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3011 struct hda_codec *codec,
3012 struct snd_pcm_substream *substream)
3014 struct alc_spec *spec = codec->spec;
3015 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3021 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3022 struct hda_codec *codec,
3023 unsigned int stream_tag,
3024 unsigned int format,
3025 struct snd_pcm_substream *substream)
3027 struct alc_spec *spec = codec->spec;
3029 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3030 stream_tag, 0, format);
3034 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3035 struct hda_codec *codec,
3036 struct snd_pcm_substream *substream)
3038 struct alc_spec *spec = codec->spec;
3040 snd_hda_codec_cleanup_stream(codec,
3041 spec->adc_nids[substream->number + 1]);
3048 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3052 /* NID is set in alc_build_pcms */
3054 .open = alc880_playback_pcm_open,
3055 .prepare = alc880_playback_pcm_prepare,
3056 .cleanup = alc880_playback_pcm_cleanup
3060 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3064 /* NID is set in alc_build_pcms */
3067 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3071 /* NID is set in alc_build_pcms */
3074 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3075 .substreams = 2, /* can be overridden */
3078 /* NID is set in alc_build_pcms */
3080 .prepare = alc880_alt_capture_pcm_prepare,
3081 .cleanup = alc880_alt_capture_pcm_cleanup
3085 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3089 /* NID is set in alc_build_pcms */
3091 .open = alc880_dig_playback_pcm_open,
3092 .close = alc880_dig_playback_pcm_close,
3093 .prepare = alc880_dig_playback_pcm_prepare,
3094 .cleanup = alc880_dig_playback_pcm_cleanup
3098 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3102 /* NID is set in alc_build_pcms */
3105 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3106 static struct hda_pcm_stream alc_pcm_null_stream = {
3112 static int alc_build_pcms(struct hda_codec *codec)
3114 struct alc_spec *spec = codec->spec;
3115 struct hda_pcm *info = spec->pcm_rec;
3118 codec->num_pcms = 1;
3119 codec->pcm_info = info;
3121 if (spec->no_analog)
3124 info->name = spec->stream_name_analog;
3125 if (spec->stream_analog_playback) {
3126 if (snd_BUG_ON(!spec->multiout.dac_nids))
3128 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3129 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3131 if (spec->stream_analog_capture) {
3132 if (snd_BUG_ON(!spec->adc_nids))
3134 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3135 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3138 if (spec->channel_mode) {
3139 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3140 for (i = 0; i < spec->num_channel_mode; i++) {
3141 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3142 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3148 /* SPDIF for stream index #1 */
3149 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3150 codec->num_pcms = 2;
3151 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3152 info = spec->pcm_rec + 1;
3153 info->name = spec->stream_name_digital;
3154 if (spec->dig_out_type)
3155 info->pcm_type = spec->dig_out_type;
3157 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3158 if (spec->multiout.dig_out_nid &&
3159 spec->stream_digital_playback) {
3160 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3161 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3163 if (spec->dig_in_nid &&
3164 spec->stream_digital_capture) {
3165 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3166 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3168 /* FIXME: do we need this for all Realtek codec models? */
3169 codec->spdif_status_reset = 1;
3172 if (spec->no_analog)
3175 /* If the use of more than one ADC is requested for the current
3176 * model, configure a second analog capture-only PCM.
3178 /* Additional Analaog capture for index #2 */
3179 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3180 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3181 codec->num_pcms = 3;
3182 info = spec->pcm_rec + 2;
3183 info->name = spec->stream_name_analog;
3184 if (spec->alt_dac_nid) {
3185 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3186 *spec->stream_analog_alt_playback;
3187 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3190 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3191 alc_pcm_null_stream;
3192 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3194 if (spec->num_adc_nids > 1) {
3195 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3196 *spec->stream_analog_alt_capture;
3197 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3199 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3200 spec->num_adc_nids - 1;
3202 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3203 alc_pcm_null_stream;
3204 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3211 static void alc_free_kctls(struct hda_codec *codec)
3213 struct alc_spec *spec = codec->spec;
3215 if (spec->kctls.list) {
3216 struct snd_kcontrol_new *kctl = spec->kctls.list;
3218 for (i = 0; i < spec->kctls.used; i++)
3219 kfree(kctl[i].name);
3221 snd_array_free(&spec->kctls);
3224 static void alc_free(struct hda_codec *codec)
3226 struct alc_spec *spec = codec->spec;
3231 alc_free_kctls(codec);
3233 snd_hda_detach_beep_device(codec);
3236 #ifdef SND_HDA_NEEDS_RESUME
3237 static int alc_resume(struct hda_codec *codec)
3239 codec->patch_ops.init(codec);
3240 snd_hda_codec_resume_amp(codec);
3241 snd_hda_codec_resume_cache(codec);
3248 static struct hda_codec_ops alc_patch_ops = {
3249 .build_controls = alc_build_controls,
3250 .build_pcms = alc_build_pcms,
3253 .unsol_event = alc_unsol_event,
3254 #ifdef SND_HDA_NEEDS_RESUME
3255 .resume = alc_resume,
3257 #ifdef CONFIG_SND_HDA_POWER_SAVE
3258 .check_power_status = alc_check_power_status,
3264 * Test configuration for debugging
3266 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3269 #ifdef CONFIG_SND_DEBUG
3270 static hda_nid_t alc880_test_dac_nids[4] = {
3271 0x02, 0x03, 0x04, 0x05
3274 static struct hda_input_mux alc880_test_capture_source = {
3283 { "Surround", 0x6 },
3287 static struct hda_channel_mode alc880_test_modes[4] = {
3294 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3295 struct snd_ctl_elem_info *uinfo)
3297 static char *texts[] = {
3298 "N/A", "Line Out", "HP Out",
3299 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3301 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3303 uinfo->value.enumerated.items = 8;
3304 if (uinfo->value.enumerated.item >= 8)
3305 uinfo->value.enumerated.item = 7;
3306 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3310 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3311 struct snd_ctl_elem_value *ucontrol)
3313 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3314 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3315 unsigned int pin_ctl, item = 0;
3317 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3318 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3319 if (pin_ctl & AC_PINCTL_OUT_EN) {
3320 if (pin_ctl & AC_PINCTL_HP_EN)
3324 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3325 switch (pin_ctl & AC_PINCTL_VREFEN) {
3326 case AC_PINCTL_VREF_HIZ: item = 3; break;
3327 case AC_PINCTL_VREF_50: item = 4; break;
3328 case AC_PINCTL_VREF_GRD: item = 5; break;
3329 case AC_PINCTL_VREF_80: item = 6; break;
3330 case AC_PINCTL_VREF_100: item = 7; break;
3333 ucontrol->value.enumerated.item[0] = item;
3337 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3338 struct snd_ctl_elem_value *ucontrol)
3340 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3341 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3342 static unsigned int ctls[] = {
3343 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3344 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3345 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3346 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3347 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3348 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3350 unsigned int old_ctl, new_ctl;
3352 old_ctl = snd_hda_codec_read(codec, nid, 0,
3353 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3354 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3355 if (old_ctl != new_ctl) {
3357 snd_hda_codec_write_cache(codec, nid, 0,
3358 AC_VERB_SET_PIN_WIDGET_CONTROL,
3360 val = ucontrol->value.enumerated.item[0] >= 3 ?
3362 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3369 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3370 struct snd_ctl_elem_info *uinfo)
3372 static char *texts[] = {
3373 "Front", "Surround", "CLFE", "Side"
3375 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3377 uinfo->value.enumerated.items = 4;
3378 if (uinfo->value.enumerated.item >= 4)
3379 uinfo->value.enumerated.item = 3;
3380 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3384 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3385 struct snd_ctl_elem_value *ucontrol)
3387 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3388 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3391 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3392 ucontrol->value.enumerated.item[0] = sel & 3;
3396 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3397 struct snd_ctl_elem_value *ucontrol)
3399 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3400 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3403 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3404 if (ucontrol->value.enumerated.item[0] != sel) {
3405 sel = ucontrol->value.enumerated.item[0] & 3;
3406 snd_hda_codec_write_cache(codec, nid, 0,
3407 AC_VERB_SET_CONNECT_SEL, sel);
3413 #define PIN_CTL_TEST(xname,nid) { \
3414 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3416 .info = alc_test_pin_ctl_info, \
3417 .get = alc_test_pin_ctl_get, \
3418 .put = alc_test_pin_ctl_put, \
3419 .private_value = nid \
3422 #define PIN_SRC_TEST(xname,nid) { \
3423 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3425 .info = alc_test_pin_src_info, \
3426 .get = alc_test_pin_src_get, \
3427 .put = alc_test_pin_src_put, \
3428 .private_value = nid \
3431 static struct snd_kcontrol_new alc880_test_mixer[] = {
3432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3433 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3434 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3435 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3436 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3437 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3438 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3439 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3440 PIN_CTL_TEST("Front Pin Mode", 0x14),
3441 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3442 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3443 PIN_CTL_TEST("Side Pin Mode", 0x17),
3444 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3445 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3446 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3447 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3448 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3449 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3450 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3451 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3452 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3453 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3454 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3455 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3456 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3457 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3458 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3459 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3460 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3461 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3463 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3464 .name = "Channel Mode",
3465 .info = alc_ch_mode_info,
3466 .get = alc_ch_mode_get,
3467 .put = alc_ch_mode_put,
3472 static struct hda_verb alc880_test_init_verbs[] = {
3473 /* Unmute inputs of 0x0c - 0x0f */
3474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3478 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3479 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3480 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3481 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3482 /* Vol output for 0x0c-0x0f */
3483 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3484 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3485 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3486 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3487 /* Set output pins 0x14-0x17 */
3488 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3490 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3491 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3492 /* Unmute output pins 0x14-0x17 */
3493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3495 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3496 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3497 /* Set input pins 0x18-0x1c */
3498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3499 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3500 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3501 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3502 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3503 /* Mute input pins 0x18-0x1b */
3504 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3505 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3507 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3510 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3511 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3512 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3513 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3514 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3515 /* Analog input/passthru */
3516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3528 static const char *alc880_models[ALC880_MODEL_LAST] = {
3529 [ALC880_3ST] = "3stack",
3530 [ALC880_TCL_S700] = "tcl",
3531 [ALC880_3ST_DIG] = "3stack-digout",
3532 [ALC880_CLEVO] = "clevo",
3533 [ALC880_5ST] = "5stack",
3534 [ALC880_5ST_DIG] = "5stack-digout",
3535 [ALC880_W810] = "w810",
3536 [ALC880_Z71V] = "z71v",
3537 [ALC880_6ST] = "6stack",
3538 [ALC880_6ST_DIG] = "6stack-digout",
3539 [ALC880_ASUS] = "asus",
3540 [ALC880_ASUS_W1V] = "asus-w1v",
3541 [ALC880_ASUS_DIG] = "asus-dig",
3542 [ALC880_ASUS_DIG2] = "asus-dig2",
3543 [ALC880_UNIWILL_DIG] = "uniwill",
3544 [ALC880_UNIWILL_P53] = "uniwill-p53",
3545 [ALC880_FUJITSU] = "fujitsu",
3546 [ALC880_F1734] = "F1734",
3548 [ALC880_LG_LW] = "lg-lw",
3549 [ALC880_MEDION_RIM] = "medion",
3550 #ifdef CONFIG_SND_DEBUG
3551 [ALC880_TEST] = "test",
3553 [ALC880_AUTO] = "auto",
3556 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3557 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3558 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3559 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3560 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3561 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3562 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3563 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3564 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3565 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3566 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3567 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3568 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3569 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3570 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3571 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3572 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3573 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3574 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3575 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3576 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3577 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3578 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3579 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3580 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3581 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3582 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3583 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3584 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3585 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3586 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3587 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3588 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3589 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3590 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3591 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3592 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3593 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3594 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3595 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3596 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3597 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3598 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3599 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3600 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3601 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3602 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3603 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3604 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3605 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3606 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3607 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3608 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3609 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3610 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3611 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3612 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3613 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3614 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3615 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3616 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3617 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3618 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3619 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3620 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3621 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3622 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3623 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3624 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3626 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3627 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3628 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3633 * ALC880 codec presets
3635 static struct alc_config_preset alc880_presets[] = {
3637 .mixers = { alc880_three_stack_mixer },
3638 .init_verbs = { alc880_volume_init_verbs,
3639 alc880_pin_3stack_init_verbs },
3640 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3641 .dac_nids = alc880_dac_nids,
3642 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3643 .channel_mode = alc880_threestack_modes,
3645 .input_mux = &alc880_capture_source,
3647 [ALC880_3ST_DIG] = {
3648 .mixers = { alc880_three_stack_mixer },
3649 .init_verbs = { alc880_volume_init_verbs,
3650 alc880_pin_3stack_init_verbs },
3651 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3652 .dac_nids = alc880_dac_nids,
3653 .dig_out_nid = ALC880_DIGOUT_NID,
3654 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3655 .channel_mode = alc880_threestack_modes,
3657 .input_mux = &alc880_capture_source,
3659 [ALC880_TCL_S700] = {
3660 .mixers = { alc880_tcl_s700_mixer },
3661 .init_verbs = { alc880_volume_init_verbs,
3662 alc880_pin_tcl_S700_init_verbs,
3663 alc880_gpio2_init_verbs },
3664 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3665 .dac_nids = alc880_dac_nids,
3666 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3667 .num_adc_nids = 1, /* single ADC */
3669 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3670 .channel_mode = alc880_2_jack_modes,
3671 .input_mux = &alc880_capture_source,
3674 .mixers = { alc880_three_stack_mixer,
3675 alc880_five_stack_mixer},
3676 .init_verbs = { alc880_volume_init_verbs,
3677 alc880_pin_5stack_init_verbs },
3678 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3679 .dac_nids = alc880_dac_nids,
3680 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3681 .channel_mode = alc880_fivestack_modes,
3682 .input_mux = &alc880_capture_source,
3684 [ALC880_5ST_DIG] = {
3685 .mixers = { alc880_three_stack_mixer,
3686 alc880_five_stack_mixer },
3687 .init_verbs = { alc880_volume_init_verbs,
3688 alc880_pin_5stack_init_verbs },
3689 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3690 .dac_nids = alc880_dac_nids,
3691 .dig_out_nid = ALC880_DIGOUT_NID,
3692 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3693 .channel_mode = alc880_fivestack_modes,
3694 .input_mux = &alc880_capture_source,
3697 .mixers = { alc880_six_stack_mixer },
3698 .init_verbs = { alc880_volume_init_verbs,
3699 alc880_pin_6stack_init_verbs },
3700 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3701 .dac_nids = alc880_6st_dac_nids,
3702 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3703 .channel_mode = alc880_sixstack_modes,
3704 .input_mux = &alc880_6stack_capture_source,
3706 [ALC880_6ST_DIG] = {
3707 .mixers = { alc880_six_stack_mixer },
3708 .init_verbs = { alc880_volume_init_verbs,
3709 alc880_pin_6stack_init_verbs },
3710 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3711 .dac_nids = alc880_6st_dac_nids,
3712 .dig_out_nid = ALC880_DIGOUT_NID,
3713 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3714 .channel_mode = alc880_sixstack_modes,
3715 .input_mux = &alc880_6stack_capture_source,
3718 .mixers = { alc880_w810_base_mixer },
3719 .init_verbs = { alc880_volume_init_verbs,
3720 alc880_pin_w810_init_verbs,
3721 alc880_gpio2_init_verbs },
3722 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3723 .dac_nids = alc880_w810_dac_nids,
3724 .dig_out_nid = ALC880_DIGOUT_NID,
3725 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3726 .channel_mode = alc880_w810_modes,
3727 .input_mux = &alc880_capture_source,
3730 .mixers = { alc880_z71v_mixer },
3731 .init_verbs = { alc880_volume_init_verbs,
3732 alc880_pin_z71v_init_verbs },
3733 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3734 .dac_nids = alc880_z71v_dac_nids,
3735 .dig_out_nid = ALC880_DIGOUT_NID,
3737 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3738 .channel_mode = alc880_2_jack_modes,
3739 .input_mux = &alc880_capture_source,
3742 .mixers = { alc880_f1734_mixer },
3743 .init_verbs = { alc880_volume_init_verbs,
3744 alc880_pin_f1734_init_verbs },
3745 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3746 .dac_nids = alc880_f1734_dac_nids,
3748 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3749 .channel_mode = alc880_2_jack_modes,
3750 .input_mux = &alc880_f1734_capture_source,
3751 .unsol_event = alc880_uniwill_p53_unsol_event,
3752 .init_hook = alc880_uniwill_p53_hp_automute,
3755 .mixers = { alc880_asus_mixer },
3756 .init_verbs = { alc880_volume_init_verbs,
3757 alc880_pin_asus_init_verbs,
3758 alc880_gpio1_init_verbs },
3759 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3760 .dac_nids = alc880_asus_dac_nids,
3761 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3762 .channel_mode = alc880_asus_modes,
3764 .input_mux = &alc880_capture_source,
3766 [ALC880_ASUS_DIG] = {
3767 .mixers = { alc880_asus_mixer },
3768 .init_verbs = { alc880_volume_init_verbs,
3769 alc880_pin_asus_init_verbs,
3770 alc880_gpio1_init_verbs },
3771 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3772 .dac_nids = alc880_asus_dac_nids,
3773 .dig_out_nid = ALC880_DIGOUT_NID,
3774 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3775 .channel_mode = alc880_asus_modes,
3777 .input_mux = &alc880_capture_source,
3779 [ALC880_ASUS_DIG2] = {
3780 .mixers = { alc880_asus_mixer },
3781 .init_verbs = { alc880_volume_init_verbs,
3782 alc880_pin_asus_init_verbs,
3783 alc880_gpio2_init_verbs }, /* use GPIO2 */
3784 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3785 .dac_nids = alc880_asus_dac_nids,
3786 .dig_out_nid = ALC880_DIGOUT_NID,
3787 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3788 .channel_mode = alc880_asus_modes,
3790 .input_mux = &alc880_capture_source,
3792 [ALC880_ASUS_W1V] = {
3793 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3794 .init_verbs = { alc880_volume_init_verbs,
3795 alc880_pin_asus_init_verbs,
3796 alc880_gpio1_init_verbs },
3797 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3798 .dac_nids = alc880_asus_dac_nids,
3799 .dig_out_nid = ALC880_DIGOUT_NID,
3800 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3801 .channel_mode = alc880_asus_modes,
3803 .input_mux = &alc880_capture_source,
3805 [ALC880_UNIWILL_DIG] = {
3806 .mixers = { alc880_asus_mixer },
3807 .init_verbs = { alc880_volume_init_verbs,
3808 alc880_pin_asus_init_verbs },
3809 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3810 .dac_nids = alc880_asus_dac_nids,
3811 .dig_out_nid = ALC880_DIGOUT_NID,
3812 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3813 .channel_mode = alc880_asus_modes,
3815 .input_mux = &alc880_capture_source,
3817 [ALC880_UNIWILL] = {
3818 .mixers = { alc880_uniwill_mixer },
3819 .init_verbs = { alc880_volume_init_verbs,
3820 alc880_uniwill_init_verbs },
3821 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3822 .dac_nids = alc880_asus_dac_nids,
3823 .dig_out_nid = ALC880_DIGOUT_NID,
3824 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3825 .channel_mode = alc880_threestack_modes,
3827 .input_mux = &alc880_capture_source,
3828 .unsol_event = alc880_uniwill_unsol_event,
3829 .init_hook = alc880_uniwill_automute,
3831 [ALC880_UNIWILL_P53] = {
3832 .mixers = { alc880_uniwill_p53_mixer },
3833 .init_verbs = { alc880_volume_init_verbs,
3834 alc880_uniwill_p53_init_verbs },
3835 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3836 .dac_nids = alc880_asus_dac_nids,
3837 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3838 .channel_mode = alc880_threestack_modes,
3839 .input_mux = &alc880_capture_source,
3840 .unsol_event = alc880_uniwill_p53_unsol_event,
3841 .init_hook = alc880_uniwill_p53_hp_automute,
3843 [ALC880_FUJITSU] = {
3844 .mixers = { alc880_fujitsu_mixer },
3845 .init_verbs = { alc880_volume_init_verbs,
3846 alc880_uniwill_p53_init_verbs,
3847 alc880_beep_init_verbs },
3848 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3849 .dac_nids = alc880_dac_nids,
3850 .dig_out_nid = ALC880_DIGOUT_NID,
3851 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3852 .channel_mode = alc880_2_jack_modes,
3853 .input_mux = &alc880_capture_source,
3854 .unsol_event = alc880_uniwill_p53_unsol_event,
3855 .init_hook = alc880_uniwill_p53_hp_automute,
3858 .mixers = { alc880_three_stack_mixer },
3859 .init_verbs = { alc880_volume_init_verbs,
3860 alc880_pin_clevo_init_verbs },
3861 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3862 .dac_nids = alc880_dac_nids,
3864 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3865 .channel_mode = alc880_threestack_modes,
3867 .input_mux = &alc880_capture_source,
3870 .mixers = { alc880_lg_mixer },
3871 .init_verbs = { alc880_volume_init_verbs,
3872 alc880_lg_init_verbs },
3873 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3874 .dac_nids = alc880_lg_dac_nids,
3875 .dig_out_nid = ALC880_DIGOUT_NID,
3876 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3877 .channel_mode = alc880_lg_ch_modes,
3879 .input_mux = &alc880_lg_capture_source,
3880 .unsol_event = alc880_lg_unsol_event,
3881 .init_hook = alc880_lg_automute,
3882 #ifdef CONFIG_SND_HDA_POWER_SAVE
3883 .loopbacks = alc880_lg_loopbacks,
3887 .mixers = { alc880_lg_lw_mixer },
3888 .init_verbs = { alc880_volume_init_verbs,
3889 alc880_lg_lw_init_verbs },
3890 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3891 .dac_nids = alc880_dac_nids,
3892 .dig_out_nid = ALC880_DIGOUT_NID,
3893 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3894 .channel_mode = alc880_lg_lw_modes,
3895 .input_mux = &alc880_lg_lw_capture_source,
3896 .unsol_event = alc880_lg_lw_unsol_event,
3897 .init_hook = alc880_lg_lw_automute,
3899 [ALC880_MEDION_RIM] = {
3900 .mixers = { alc880_medion_rim_mixer },
3901 .init_verbs = { alc880_volume_init_verbs,
3902 alc880_medion_rim_init_verbs,
3903 alc_gpio2_init_verbs },
3904 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3905 .dac_nids = alc880_dac_nids,
3906 .dig_out_nid = ALC880_DIGOUT_NID,
3907 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3908 .channel_mode = alc880_2_jack_modes,
3909 .input_mux = &alc880_medion_rim_capture_source,
3910 .unsol_event = alc880_medion_rim_unsol_event,
3911 .init_hook = alc880_medion_rim_automute,
3913 #ifdef CONFIG_SND_DEBUG
3915 .mixers = { alc880_test_mixer },
3916 .init_verbs = { alc880_test_init_verbs },
3917 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3918 .dac_nids = alc880_test_dac_nids,
3919 .dig_out_nid = ALC880_DIGOUT_NID,
3920 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3921 .channel_mode = alc880_test_modes,
3922 .input_mux = &alc880_test_capture_source,
3928 * Automatic parse of I/O pins from the BIOS configuration
3933 ALC_CTL_WIDGET_MUTE,
3936 static struct snd_kcontrol_new alc880_control_templates[] = {
3937 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3938 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3939 HDA_BIND_MUTE(NULL, 0, 0, 0),
3942 /* add dynamic controls */
3943 static int add_control(struct alc_spec *spec, int type, const char *name,
3946 struct snd_kcontrol_new *knew;
3948 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3949 knew = snd_array_new(&spec->kctls);
3952 *knew = alc880_control_templates[type];
3953 knew->name = kstrdup(name, GFP_KERNEL);
3956 knew->private_value = val;
3960 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3961 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3962 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3963 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3964 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3965 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3966 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3967 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3968 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3969 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3970 #define ALC880_PIN_CD_NID 0x1c
3972 /* fill in the dac_nids table from the parsed pin configuration */
3973 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3974 const struct auto_pin_cfg *cfg)
3980 memset(assigned, 0, sizeof(assigned));
3981 spec->multiout.dac_nids = spec->private_dac_nids;
3983 /* check the pins hardwired to audio widget */
3984 for (i = 0; i < cfg->line_outs; i++) {
3985 nid = cfg->line_out_pins[i];
3986 if (alc880_is_fixed_pin(nid)) {
3987 int idx = alc880_fixed_pin_idx(nid);
3988 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3992 /* left pins can be connect to any audio widget */
3993 for (i = 0; i < cfg->line_outs; i++) {
3994 nid = cfg->line_out_pins[i];
3995 if (alc880_is_fixed_pin(nid))
3997 /* search for an empty channel */
3998 for (j = 0; j < cfg->line_outs; j++) {
4000 spec->multiout.dac_nids[i] =
4001 alc880_idx_to_dac(j);
4007 spec->multiout.num_dacs = cfg->line_outs;
4011 /* add playback controls from the parsed DAC table */
4012 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4013 const struct auto_pin_cfg *cfg)
4016 static const char *chname[4] = {
4017 "Front", "Surround", NULL /*CLFE*/, "Side"
4022 for (i = 0; i < cfg->line_outs; i++) {
4023 if (!spec->multiout.dac_nids[i])
4025 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4028 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4029 "Center Playback Volume",
4030 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4034 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4035 "LFE Playback Volume",
4036 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4040 err = add_control(spec, ALC_CTL_BIND_MUTE,
4041 "Center Playback Switch",
4042 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4046 err = add_control(spec, ALC_CTL_BIND_MUTE,
4047 "LFE Playback Switch",
4048 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4053 sprintf(name, "%s Playback Volume", chname[i]);
4054 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4055 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4059 sprintf(name, "%s Playback Switch", chname[i]);
4060 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4061 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4070 /* add playback controls for speaker and HP outputs */
4071 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4081 if (alc880_is_fixed_pin(pin)) {
4082 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4083 /* specify the DAC as the extra output */
4084 if (!spec->multiout.hp_nid)
4085 spec->multiout.hp_nid = nid;
4087 spec->multiout.extra_out_nid[0] = nid;
4088 /* control HP volume/switch on the output mixer amp */
4089 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4090 sprintf(name, "%s Playback Volume", pfx);
4091 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4092 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4095 sprintf(name, "%s Playback Switch", pfx);
4096 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4097 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4100 } else if (alc880_is_multi_pin(pin)) {
4101 /* set manual connection */
4102 /* we have only a switch on HP-out PIN */
4103 sprintf(name, "%s Playback Switch", pfx);
4104 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4105 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4112 /* create input playback/capture controls for the given pin */
4113 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4114 const char *ctlname,
4115 int idx, hda_nid_t mix_nid)
4120 sprintf(name, "%s Playback Volume", ctlname);
4121 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4122 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4125 sprintf(name, "%s Playback Switch", ctlname);
4126 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4127 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4133 /* create playback/capture controls for input pins */
4134 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4135 const struct auto_pin_cfg *cfg)
4137 struct hda_input_mux *imux = &spec->private_imux[0];
4140 for (i = 0; i < AUTO_PIN_LAST; i++) {
4141 if (alc880_is_input_pin(cfg->input_pins[i])) {
4142 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4143 err = new_analog_input(spec, cfg->input_pins[i],
4144 auto_pin_cfg_labels[i],
4148 imux->items[imux->num_items].label =
4149 auto_pin_cfg_labels[i];
4150 imux->items[imux->num_items].index =
4151 alc880_input_pin_idx(cfg->input_pins[i]);
4158 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4159 unsigned int pin_type)
4161 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4164 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4168 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4169 hda_nid_t nid, int pin_type,
4172 alc_set_pin_output(codec, nid, pin_type);
4173 /* need the manual connection? */
4174 if (alc880_is_multi_pin(nid)) {
4175 struct alc_spec *spec = codec->spec;
4176 int idx = alc880_multi_pin_idx(nid);
4177 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4178 AC_VERB_SET_CONNECT_SEL,
4179 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4183 static int get_pin_type(int line_out_type)
4185 if (line_out_type == AUTO_PIN_HP_OUT)
4191 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4193 struct alc_spec *spec = codec->spec;
4196 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4197 for (i = 0; i < spec->autocfg.line_outs; i++) {
4198 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4199 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4200 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4204 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4206 struct alc_spec *spec = codec->spec;
4209 pin = spec->autocfg.speaker_pins[0];
4210 if (pin) /* connect to front */
4211 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4212 pin = spec->autocfg.hp_pins[0];
4213 if (pin) /* connect to front */
4214 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4217 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4219 struct alc_spec *spec = codec->spec;
4222 for (i = 0; i < AUTO_PIN_LAST; i++) {
4223 hda_nid_t nid = spec->autocfg.input_pins[i];
4224 if (alc880_is_input_pin(nid)) {
4225 alc_set_input_pin(codec, nid, i);
4226 if (nid != ALC880_PIN_CD_NID &&
4227 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4228 snd_hda_codec_write(codec, nid, 0,
4229 AC_VERB_SET_AMP_GAIN_MUTE,
4235 /* parse the BIOS configuration and set up the alc_spec */
4236 /* return 1 if successful, 0 if the proper config is not found,
4237 * or a negative error code
4239 static int alc880_parse_auto_config(struct hda_codec *codec)
4241 struct alc_spec *spec = codec->spec;
4243 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4245 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4249 if (!spec->autocfg.line_outs)
4250 return 0; /* can't find valid BIOS pin config */
4252 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4255 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4258 err = alc880_auto_create_extra_out(spec,
4259 spec->autocfg.speaker_pins[0],
4263 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4267 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4271 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4273 /* check multiple SPDIF-out (for recent codecs) */
4274 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4276 err = snd_hda_get_connections(codec,
4277 spec->autocfg.dig_out_pins[i],
4282 spec->multiout.dig_out_nid = dig_nid;
4284 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4285 spec->slave_dig_outs[i - 1] = dig_nid;
4286 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4290 if (spec->autocfg.dig_in_pin)
4291 spec->dig_in_nid = ALC880_DIGIN_NID;
4293 if (spec->kctls.list)
4294 add_mixer(spec, spec->kctls.list);
4296 add_verb(spec, alc880_volume_init_verbs);
4298 spec->num_mux_defs = 1;
4299 spec->input_mux = &spec->private_imux[0];
4304 /* additional initialization for auto-configuration model */
4305 static void alc880_auto_init(struct hda_codec *codec)
4307 struct alc_spec *spec = codec->spec;
4308 alc880_auto_init_multi_out(codec);
4309 alc880_auto_init_extra_out(codec);
4310 alc880_auto_init_analog_input(codec);
4311 if (spec->unsol_event)
4312 alc_inithook(codec);
4315 static void set_capture_mixer(struct alc_spec *spec)
4317 static struct snd_kcontrol_new *caps[2][3] = {
4318 { alc_capture_mixer_nosrc1,
4319 alc_capture_mixer_nosrc2,
4320 alc_capture_mixer_nosrc3 },
4321 { alc_capture_mixer1,
4323 alc_capture_mixer3 },
4325 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4327 if (spec->input_mux && spec->input_mux->num_items > 1)
4331 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4335 #define set_beep_amp(spec, nid, idx, dir) \
4336 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4339 * OK, here we have finally the patch for ALC880
4342 static int patch_alc880(struct hda_codec *codec)
4344 struct alc_spec *spec;
4348 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4354 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4357 if (board_config < 0) {
4358 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4359 "trying auto-probe from BIOS...\n");
4360 board_config = ALC880_AUTO;
4363 if (board_config == ALC880_AUTO) {
4364 /* automatic parse from the BIOS config */
4365 err = alc880_parse_auto_config(codec);
4371 "hda_codec: Cannot set up configuration "
4372 "from BIOS. Using 3-stack mode...\n");
4373 board_config = ALC880_3ST;
4377 err = snd_hda_attach_beep_device(codec, 0x1);
4383 if (board_config != ALC880_AUTO)
4384 setup_preset(spec, &alc880_presets[board_config]);
4386 spec->stream_name_analog = "ALC880 Analog";
4387 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4388 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4389 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4391 spec->stream_name_digital = "ALC880 Digital";
4392 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4393 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4395 if (!spec->adc_nids && spec->input_mux) {
4396 /* check whether NID 0x07 is valid */
4397 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4399 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4400 if (wcap != AC_WID_AUD_IN) {
4401 spec->adc_nids = alc880_adc_nids_alt;
4402 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4404 spec->adc_nids = alc880_adc_nids;
4405 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4408 set_capture_mixer(spec);
4409 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4411 spec->vmaster_nid = 0x0c;
4413 codec->patch_ops = alc_patch_ops;
4414 if (board_config == ALC880_AUTO)
4415 spec->init_hook = alc880_auto_init;
4416 #ifdef CONFIG_SND_HDA_POWER_SAVE
4417 if (!spec->loopback.amplist)
4418 spec->loopback.amplist = alc880_loopbacks;
4420 codec->proc_widget_hook = print_realtek_coef;
4430 static hda_nid_t alc260_dac_nids[1] = {
4435 static hda_nid_t alc260_adc_nids[1] = {
4440 static hda_nid_t alc260_adc_nids_alt[1] = {
4445 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4446 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4448 static hda_nid_t alc260_dual_adc_nids[2] = {
4453 #define ALC260_DIGOUT_NID 0x03
4454 #define ALC260_DIGIN_NID 0x06
4456 static struct hda_input_mux alc260_capture_source = {
4460 { "Front Mic", 0x1 },
4466 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4467 * headphone jack and the internal CD lines since these are the only pins at
4468 * which audio can appear. For flexibility, also allow the option of
4469 * recording the mixer output on the second ADC (ADC0 doesn't have a
4470 * connection to the mixer output).
4472 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4476 { "Mic/Line", 0x0 },
4478 { "Headphone", 0x2 },
4484 { "Mic/Line", 0x0 },
4486 { "Headphone", 0x2 },
4493 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4494 * the Fujitsu S702x, but jacks are marked differently.
4496 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4503 { "Headphone", 0x5 },
4512 { "Headphone", 0x6 },
4518 /* Maxdata Favorit 100XS */
4519 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4523 { "Line/Mic", 0x0 },
4530 { "Line/Mic", 0x0 },
4538 * This is just place-holder, so there's something for alc_build_pcms to look
4539 * at when it calculates the maximum number of channels. ALC260 has no mixer
4540 * element which allows changing the channel mode, so the verb list is
4543 static struct hda_channel_mode alc260_modes[1] = {
4548 /* Mixer combinations
4550 * basic: base_output + input + pc_beep + capture
4551 * HP: base_output + input + capture_alt
4552 * HP_3013: hp_3013 + input + capture
4553 * fujitsu: fujitsu + capture
4554 * acer: acer + capture
4557 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4558 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4559 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4560 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4561 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4562 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4563 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4567 static struct snd_kcontrol_new alc260_input_mixer[] = {
4568 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4569 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4570 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4571 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4573 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4574 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4575 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4579 /* update HP, line and mono out pins according to the master switch */
4580 static void alc260_hp_master_update(struct hda_codec *codec,
4581 hda_nid_t hp, hda_nid_t line,
4584 struct alc_spec *spec = codec->spec;
4585 unsigned int val = spec->master_sw ? PIN_HP : 0;
4586 /* change HP and line-out pins */
4587 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4589 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4591 /* mono (speaker) depending on the HP jack sense */
4592 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4593 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4597 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4598 struct snd_ctl_elem_value *ucontrol)
4600 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4601 struct alc_spec *spec = codec->spec;
4602 *ucontrol->value.integer.value = spec->master_sw;
4606 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4607 struct snd_ctl_elem_value *ucontrol)
4609 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4610 struct alc_spec *spec = codec->spec;
4611 int val = !!*ucontrol->value.integer.value;
4612 hda_nid_t hp, line, mono;
4614 if (val == spec->master_sw)
4616 spec->master_sw = val;
4617 hp = (kcontrol->private_value >> 16) & 0xff;
4618 line = (kcontrol->private_value >> 8) & 0xff;
4619 mono = kcontrol->private_value & 0xff;
4620 alc260_hp_master_update(codec, hp, line, mono);
4624 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4626 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4627 .name = "Master Playback Switch",
4628 .info = snd_ctl_boolean_mono_info,
4629 .get = alc260_hp_master_sw_get,
4630 .put = alc260_hp_master_sw_put,
4631 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4633 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4634 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4635 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4636 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4637 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4639 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4643 static struct hda_verb alc260_hp_unsol_verbs[] = {
4644 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4648 static void alc260_hp_automute(struct hda_codec *codec)
4650 struct alc_spec *spec = codec->spec;
4651 unsigned int present;
4653 present = snd_hda_codec_read(codec, 0x10, 0,
4654 AC_VERB_GET_PIN_SENSE, 0);
4655 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4656 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4659 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4661 if ((res >> 26) == ALC880_HP_EVENT)
4662 alc260_hp_automute(codec);
4665 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4667 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4668 .name = "Master Playback Switch",
4669 .info = snd_ctl_boolean_mono_info,
4670 .get = alc260_hp_master_sw_get,
4671 .put = alc260_hp_master_sw_put,
4672 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4674 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4675 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4676 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4677 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4678 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4680 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4681 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4685 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4686 .ops = &snd_hda_bind_vol,
4688 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4689 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4690 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4695 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4696 .ops = &snd_hda_bind_sw,
4698 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4699 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4704 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4705 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4706 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4707 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4708 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4712 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4713 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4717 static void alc260_hp_3013_automute(struct hda_codec *codec)
4719 struct alc_spec *spec = codec->spec;
4720 unsigned int present;
4722 present = snd_hda_codec_read(codec, 0x15, 0,
4723 AC_VERB_GET_PIN_SENSE, 0);
4724 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4725 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4728 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4731 if ((res >> 26) == ALC880_HP_EVENT)
4732 alc260_hp_3013_automute(codec);
4735 static void alc260_hp_3012_automute(struct hda_codec *codec)
4737 unsigned int present, bits;
4739 present = snd_hda_codec_read(codec, 0x10, 0,
4740 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4742 bits = present ? 0 : PIN_OUT;
4743 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4745 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4747 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4751 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4754 if ((res >> 26) == ALC880_HP_EVENT)
4755 alc260_hp_3012_automute(codec);
4758 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4759 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4761 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4762 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4763 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4764 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4765 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4766 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4767 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4768 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4769 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4770 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4771 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4775 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4776 * versions of the ALC260 don't act on requests to enable mic bias from NID
4777 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4778 * datasheet doesn't mention this restriction. At this stage it's not clear
4779 * whether this behaviour is intentional or is a hardware bug in chip
4780 * revisions available in early 2006. Therefore for now allow the
4781 * "Headphone Jack Mode" control to span all choices, but if it turns out
4782 * that the lack of mic bias for this NID is intentional we could change the
4783 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4785 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4786 * don't appear to make the mic bias available from the "line" jack, even
4787 * though the NID used for this jack (0x14) can supply it. The theory is
4788 * that perhaps Acer have included blocking capacitors between the ALC260
4789 * and the output jack. If this turns out to be the case for all such
4790 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4791 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4793 * The C20x Tablet series have a mono internal speaker which is controlled
4794 * via the chip's Mono sum widget and pin complex, so include the necessary
4795 * controls for such models. On models without a "mono speaker" the control
4796 * won't do anything.
4798 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4799 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4800 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4801 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4802 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4804 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4806 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4807 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4809 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4810 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4811 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4812 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4813 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4817 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4819 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4820 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4821 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4822 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4823 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4824 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4825 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4829 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4830 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4832 static struct snd_kcontrol_new alc260_will_mixer[] = {
4833 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4834 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4836 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4837 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4838 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4839 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4840 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4841 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4842 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4846 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4847 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4849 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4850 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4851 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4853 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4854 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4855 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4856 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4857 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4858 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4859 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4864 * initialization verbs
4866 static struct hda_verb alc260_init_verbs[] = {
4867 /* Line In pin widget for input */
4868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4869 /* CD pin widget for input */
4870 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4871 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4872 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4873 /* Mic2 (front panel) pin widget for input and vref at 80% */
4874 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4875 /* LINE-2 is used for line-out in rear */
4876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4877 /* select line-out */
4878 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4880 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4882 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4884 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4885 /* mute capture amp left and right */
4886 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4887 /* set connection select to line in (default select for this ADC) */
4888 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4889 /* mute capture amp left and right */
4890 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4891 /* set connection select to line in (default select for this ADC) */
4892 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4893 /* set vol=0 Line-Out mixer amp left and right */
4894 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4895 /* unmute pin widget amp left and right (no gain on this amp) */
4896 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4897 /* set vol=0 HP mixer amp left and right */
4898 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4899 /* unmute pin widget amp left and right (no gain on this amp) */
4900 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4901 /* set vol=0 Mono mixer amp left and right */
4902 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4903 /* unmute pin widget amp left and right (no gain on this amp) */
4904 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4905 /* unmute LINE-2 out pin */
4906 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4907 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4910 /* mute analog inputs */
4911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4916 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4917 /* mute Front out path */
4918 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4919 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4920 /* mute Headphone out path */
4921 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4922 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4923 /* mute Mono out path */
4924 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4925 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4929 #if 0 /* should be identical with alc260_init_verbs? */
4930 static struct hda_verb alc260_hp_init_verbs[] = {
4931 /* Headphone and output */
4932 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4934 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4935 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4936 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4937 /* Mic2 (front panel) pin widget for input and vref at 80% */
4938 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4939 /* Line In pin widget for input */
4940 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4941 /* Line-2 pin widget for output */
4942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4943 /* CD pin widget for input */
4944 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4945 /* unmute amp left and right */
4946 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4947 /* set connection select to line in (default select for this ADC) */
4948 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4949 /* unmute Line-Out mixer amp left and right (volume = 0) */
4950 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4951 /* mute pin widget amp left and right (no gain on this amp) */
4952 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4953 /* unmute HP mixer amp left and right (volume = 0) */
4954 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4955 /* mute pin widget amp left and right (no gain on this amp) */
4956 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4957 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4960 /* mute analog inputs */
4961 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4962 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4963 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4964 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4965 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4966 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4967 /* Unmute Front out path */
4968 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4969 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4970 /* Unmute Headphone out path */
4971 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4972 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4973 /* Unmute Mono out path */
4974 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4975 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4980 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4981 /* Line out and output */
4982 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4984 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4985 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4986 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4987 /* Mic2 (front panel) pin widget for input and vref at 80% */
4988 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4989 /* Line In pin widget for input */
4990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4991 /* Headphone pin widget for output */
4992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4993 /* CD pin widget for input */
4994 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4995 /* unmute amp left and right */
4996 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4997 /* set connection select to line in (default select for this ADC) */
4998 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4999 /* unmute Line-Out mixer amp left and right (volume = 0) */
5000 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5001 /* mute pin widget amp left and right (no gain on this amp) */
5002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5003 /* unmute HP mixer amp left and right (volume = 0) */
5004 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5005 /* mute pin widget amp left and right (no gain on this amp) */
5006 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5007 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5010 /* mute analog inputs */
5011 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5012 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5016 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5017 /* Unmute Front out path */
5018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5019 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5020 /* Unmute Headphone out path */
5021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5022 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5023 /* Unmute Mono out path */
5024 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5025 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5029 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5030 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5031 * audio = 0x16, internal speaker = 0x10.
5033 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5034 /* Disable all GPIOs */
5035 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5036 /* Internal speaker is connected to headphone pin */
5037 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5038 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5039 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5040 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5041 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5042 /* Ensure all other unused pins are disabled and muted. */
5043 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5044 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5045 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5046 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5047 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5048 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5049 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5052 /* Disable digital (SPDIF) pins */
5053 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5054 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5056 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5057 * when acting as an output.
5059 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5061 /* Start with output sum widgets muted and their output gains at min */
5062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5063 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5064 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5065 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5066 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5067 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5068 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5069 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5070 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5072 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5073 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5074 /* Unmute Line1 pin widget output buffer since it starts as an output.
5075 * If the pin mode is changed by the user the pin mode control will
5076 * take care of enabling the pin's input/output buffers as needed.
5077 * Therefore there's no need to enable the input buffer at this
5080 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5081 /* Unmute input buffer of pin widget used for Line-in (no equiv
5084 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5086 /* Mute capture amp left and right */
5087 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5088 /* Set ADC connection select to match default mixer setting - line
5091 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5093 /* Do the same for the second ADC: mute capture input amp and
5094 * set ADC connection to line in (on mic1 pin)
5096 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5097 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5099 /* Mute all inputs to mixer widget (even unconnected ones) */
5100 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5101 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5102 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5104 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5106 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5112 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5113 * similar laptops (adapted from Fujitsu init verbs).
5115 static struct hda_verb alc260_acer_init_verbs[] = {
5116 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5117 * the headphone jack. Turn this on and rely on the standard mute
5118 * methods whenever the user wants to turn these outputs off.
5120 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5121 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5122 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5123 /* Internal speaker/Headphone jack is connected to Line-out pin */
5124 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5125 /* Internal microphone/Mic jack is connected to Mic1 pin */
5126 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5127 /* Line In jack is connected to Line1 pin */
5128 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5129 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5130 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5131 /* Ensure all other unused pins are disabled and muted. */
5132 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5133 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5134 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5135 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5136 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5137 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5138 /* Disable digital (SPDIF) pins */
5139 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5140 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5142 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5143 * bus when acting as outputs.
5145 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5146 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5148 /* Start with output sum widgets muted and their output gains at min */
5149 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5150 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5151 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5152 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5153 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5154 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5155 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5156 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5157 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5159 /* Unmute Line-out pin widget amp left and right
5160 * (no equiv mixer ctrl)
5162 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5163 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5164 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5165 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5166 * inputs. If the pin mode is changed by the user the pin mode control
5167 * will take care of enabling the pin's input/output buffers as needed.
5168 * Therefore there's no need to enable the input buffer at this
5171 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5172 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5174 /* Mute capture amp left and right */
5175 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5176 /* Set ADC connection select to match default mixer setting - mic
5179 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5181 /* Do similar with the second ADC: mute capture input amp and
5182 * set ADC connection to mic to match ALSA's default state.
5184 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5185 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5187 /* Mute all inputs to mixer widget (even unconnected ones) */
5188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5189 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5190 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5191 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5192 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5193 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5194 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5200 /* Initialisation sequence for Maxdata Favorit 100XS
5201 * (adapted from Acer init verbs).
5203 static struct hda_verb alc260_favorit100_init_verbs[] = {
5204 /* GPIO 0 enables the output jack.
5205 * Turn this on and rely on the standard mute
5206 * methods whenever the user wants to turn these outputs off.
5208 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5209 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5210 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5211 /* Line/Mic input jack is connected to Mic1 pin */
5212 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5213 /* Ensure all other unused pins are disabled and muted. */
5214 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5215 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5216 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5217 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5218 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5219 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5222 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5224 /* Disable digital (SPDIF) pins */
5225 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5226 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5228 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5229 * bus when acting as outputs.
5231 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5232 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5234 /* Start with output sum widgets muted and their output gains at min */
5235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5240 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5241 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5242 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5243 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5245 /* Unmute Line-out pin widget amp left and right
5246 * (no equiv mixer ctrl)
5248 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5249 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5250 * inputs. If the pin mode is changed by the user the pin mode control
5251 * will take care of enabling the pin's input/output buffers as needed.
5252 * Therefore there's no need to enable the input buffer at this
5255 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5257 /* Mute capture amp left and right */
5258 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5259 /* Set ADC connection select to match default mixer setting - mic
5262 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5264 /* Do similar with the second ADC: mute capture input amp and
5265 * set ADC connection to mic to match ALSA's default state.
5267 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5268 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5270 /* Mute all inputs to mixer widget (even unconnected ones) */
5271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5283 static struct hda_verb alc260_will_verbs[] = {
5284 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5285 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5286 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5287 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5288 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5289 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5293 static struct hda_verb alc260_replacer_672v_verbs[] = {
5294 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5295 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5296 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5298 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5299 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5300 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5302 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5306 /* toggle speaker-output according to the hp-jack state */
5307 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5309 unsigned int present;
5311 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5312 present = snd_hda_codec_read(codec, 0x0f, 0,
5313 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5315 snd_hda_codec_write_cache(codec, 0x01, 0,
5316 AC_VERB_SET_GPIO_DATA, 1);
5317 snd_hda_codec_write_cache(codec, 0x0f, 0,
5318 AC_VERB_SET_PIN_WIDGET_CONTROL,
5321 snd_hda_codec_write_cache(codec, 0x01, 0,
5322 AC_VERB_SET_GPIO_DATA, 0);
5323 snd_hda_codec_write_cache(codec, 0x0f, 0,
5324 AC_VERB_SET_PIN_WIDGET_CONTROL,
5329 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5332 if ((res >> 26) == ALC880_HP_EVENT)
5333 alc260_replacer_672v_automute(codec);
5336 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5337 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5338 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5339 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5340 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5341 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5343 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5344 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5345 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5346 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5350 /* Test configuration for debugging, modelled after the ALC880 test
5353 #ifdef CONFIG_SND_DEBUG
5354 static hda_nid_t alc260_test_dac_nids[1] = {
5357 static hda_nid_t alc260_test_adc_nids[2] = {
5360 /* For testing the ALC260, each input MUX needs its own definition since
5361 * the signal assignments are different. This assumes that the first ADC
5364 static struct hda_input_mux alc260_test_capture_sources[2] = {
5368 { "MIC1 pin", 0x0 },
5369 { "MIC2 pin", 0x1 },
5370 { "LINE1 pin", 0x2 },
5371 { "LINE2 pin", 0x3 },
5373 { "LINE-OUT pin", 0x5 },
5374 { "HP-OUT pin", 0x6 },
5380 { "MIC1 pin", 0x0 },
5381 { "MIC2 pin", 0x1 },
5382 { "LINE1 pin", 0x2 },
5383 { "LINE2 pin", 0x3 },
5386 { "LINE-OUT pin", 0x6 },
5387 { "HP-OUT pin", 0x7 },
5391 static struct snd_kcontrol_new alc260_test_mixer[] = {
5392 /* Output driver widgets */
5393 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5394 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5395 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5396 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5397 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5398 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5400 /* Modes for retasking pin widgets
5401 * Note: the ALC260 doesn't seem to act on requests to enable mic
5402 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5403 * mention this restriction. At this stage it's not clear whether
5404 * this behaviour is intentional or is a hardware bug in chip
5405 * revisions available at least up until early 2006. Therefore for
5406 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5407 * choices, but if it turns out that the lack of mic bias for these
5408 * NIDs is intentional we could change their modes from
5409 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5411 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5412 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5413 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5414 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5415 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5416 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5418 /* Loopback mixer controls */
5419 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5420 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5421 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5422 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5423 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5424 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5425 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5426 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5427 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5428 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5429 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5430 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5431 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5432 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5434 /* Controls for GPIO pins, assuming they are configured as outputs */
5435 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5436 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5437 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5438 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5440 /* Switches to allow the digital IO pins to be enabled. The datasheet
5441 * is ambigious as to which NID is which; testing on laptops which
5442 * make this output available should provide clarification.
5444 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5445 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5447 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5448 * this output to turn on an external amplifier.
5450 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5451 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5455 static struct hda_verb alc260_test_init_verbs[] = {
5456 /* Enable all GPIOs as outputs with an initial value of 0 */
5457 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5458 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5459 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5461 /* Enable retasking pins as output, initially without power amp */
5462 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5463 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5466 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5467 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5469 /* Disable digital (SPDIF) pins initially, but users can enable
5470 * them via a mixer switch. In the case of SPDIF-out, this initverb
5471 * payload also sets the generation to 0, output to be in "consumer"
5472 * PCM format, copyright asserted, no pre-emphasis and no validity
5475 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5476 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5478 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5479 * OUT1 sum bus when acting as an output.
5481 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5482 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5483 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5484 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5486 /* Start with output sum widgets muted and their output gains at min */
5487 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5490 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5493 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5494 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5495 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5497 /* Unmute retasking pin widget output buffers since the default
5498 * state appears to be output. As the pin mode is changed by the
5499 * user the pin mode control will take care of enabling the pin's
5500 * input/output buffers as needed.
5502 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5503 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5506 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5507 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5508 /* Also unmute the mono-out pin widget */
5509 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5511 /* Mute capture amp left and right */
5512 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5513 /* Set ADC connection select to match default mixer setting (mic1
5516 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5518 /* Do the same for the second ADC: mute capture input amp and
5519 * set ADC connection to mic1 pin
5521 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5522 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5524 /* Mute all inputs to mixer widget (even unconnected ones) */
5525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5538 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5539 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5541 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5542 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5545 * for BIOS auto-configuration
5548 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5549 const char *pfx, int *vol_bits)
5552 unsigned long vol_val, sw_val;
5556 if (nid >= 0x0f && nid < 0x11) {
5557 nid_vol = nid - 0x7;
5558 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5559 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5560 } else if (nid == 0x11) {
5561 nid_vol = nid - 0x7;
5562 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5563 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5564 } else if (nid >= 0x12 && nid <= 0x15) {
5566 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5567 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5571 if (!(*vol_bits & (1 << nid_vol))) {
5572 /* first control for the volume widget */
5573 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5574 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5577 *vol_bits |= (1 << nid_vol);
5579 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5580 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5586 /* add playback controls from the parsed DAC table */
5587 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5588 const struct auto_pin_cfg *cfg)
5594 spec->multiout.num_dacs = 1;
5595 spec->multiout.dac_nids = spec->private_dac_nids;
5596 spec->multiout.dac_nids[0] = 0x02;
5598 nid = cfg->line_out_pins[0];
5600 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5605 nid = cfg->speaker_pins[0];
5607 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5612 nid = cfg->hp_pins[0];
5614 err = alc260_add_playback_controls(spec, nid, "Headphone",
5622 /* create playback/capture controls for input pins */
5623 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5624 const struct auto_pin_cfg *cfg)
5626 struct hda_input_mux *imux = &spec->private_imux[0];
5629 for (i = 0; i < AUTO_PIN_LAST; i++) {
5630 if (cfg->input_pins[i] >= 0x12) {
5631 idx = cfg->input_pins[i] - 0x12;
5632 err = new_analog_input(spec, cfg->input_pins[i],
5633 auto_pin_cfg_labels[i], idx,
5637 imux->items[imux->num_items].label =
5638 auto_pin_cfg_labels[i];
5639 imux->items[imux->num_items].index = idx;
5642 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5643 idx = cfg->input_pins[i] - 0x09;
5644 err = new_analog_input(spec, cfg->input_pins[i],
5645 auto_pin_cfg_labels[i], idx,
5649 imux->items[imux->num_items].label =
5650 auto_pin_cfg_labels[i];
5651 imux->items[imux->num_items].index = idx;
5658 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5659 hda_nid_t nid, int pin_type,
5662 alc_set_pin_output(codec, nid, pin_type);
5663 /* need the manual connection? */
5665 int idx = nid - 0x12;
5666 snd_hda_codec_write(codec, idx + 0x0b, 0,
5667 AC_VERB_SET_CONNECT_SEL, sel_idx);
5671 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5673 struct alc_spec *spec = codec->spec;
5676 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5677 nid = spec->autocfg.line_out_pins[0];
5679 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5680 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5683 nid = spec->autocfg.speaker_pins[0];
5685 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5687 nid = spec->autocfg.hp_pins[0];
5689 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5692 #define ALC260_PIN_CD_NID 0x16
5693 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5695 struct alc_spec *spec = codec->spec;
5698 for (i = 0; i < AUTO_PIN_LAST; i++) {
5699 hda_nid_t nid = spec->autocfg.input_pins[i];
5701 alc_set_input_pin(codec, nid, i);
5702 if (nid != ALC260_PIN_CD_NID &&
5703 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5704 snd_hda_codec_write(codec, nid, 0,
5705 AC_VERB_SET_AMP_GAIN_MUTE,
5712 * generic initialization of ADC, input mixers and output mixers
5714 static struct hda_verb alc260_volume_init_verbs[] = {
5716 * Unmute ADC0-1 and set the default input to mic-in
5718 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5719 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5720 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5721 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5723 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5725 * Note: PASD motherboards uses the Line In 2 as the input for
5726 * front panel mic (mic 2)
5728 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5729 /* mute analog inputs */
5730 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5731 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5732 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5734 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5737 * Set up output mixers (0x08 - 0x0a)
5739 /* set vol=0 to output mixers */
5740 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5742 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5743 /* set up input amps for analog loopback */
5744 /* Amp Indices: DAC = 0, mixer = 1 */
5745 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5746 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5747 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5748 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5749 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5750 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5755 static int alc260_parse_auto_config(struct hda_codec *codec)
5757 struct alc_spec *spec = codec->spec;
5759 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5761 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5765 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5768 if (!spec->kctls.list)
5769 return 0; /* can't find valid BIOS pin config */
5770 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5774 spec->multiout.max_channels = 2;
5776 if (spec->autocfg.dig_outs)
5777 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5778 if (spec->kctls.list)
5779 add_mixer(spec, spec->kctls.list);
5781 add_verb(spec, alc260_volume_init_verbs);
5783 spec->num_mux_defs = 1;
5784 spec->input_mux = &spec->private_imux[0];
5789 /* additional initialization for auto-configuration model */
5790 static void alc260_auto_init(struct hda_codec *codec)
5792 struct alc_spec *spec = codec->spec;
5793 alc260_auto_init_multi_out(codec);
5794 alc260_auto_init_analog_input(codec);
5795 if (spec->unsol_event)
5796 alc_inithook(codec);
5799 #ifdef CONFIG_SND_HDA_POWER_SAVE
5800 static struct hda_amp_list alc260_loopbacks[] = {
5801 { 0x07, HDA_INPUT, 0 },
5802 { 0x07, HDA_INPUT, 1 },
5803 { 0x07, HDA_INPUT, 2 },
5804 { 0x07, HDA_INPUT, 3 },
5805 { 0x07, HDA_INPUT, 4 },
5811 * ALC260 configurations
5813 static const char *alc260_models[ALC260_MODEL_LAST] = {
5814 [ALC260_BASIC] = "basic",
5816 [ALC260_HP_3013] = "hp-3013",
5817 [ALC260_HP_DC7600] = "hp-dc7600",
5818 [ALC260_FUJITSU_S702X] = "fujitsu",
5819 [ALC260_ACER] = "acer",
5820 [ALC260_WILL] = "will",
5821 [ALC260_REPLACER_672V] = "replacer",
5822 [ALC260_FAVORIT100] = "favorit100",
5823 #ifdef CONFIG_SND_DEBUG
5824 [ALC260_TEST] = "test",
5826 [ALC260_AUTO] = "auto",
5829 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5830 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5831 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5832 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
5833 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5834 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5835 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5836 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5837 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5838 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5839 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5840 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5841 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5842 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5843 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5844 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5845 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5846 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5847 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5848 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5852 static struct alc_config_preset alc260_presets[] = {
5854 .mixers = { alc260_base_output_mixer,
5855 alc260_input_mixer },
5856 .init_verbs = { alc260_init_verbs },
5857 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5858 .dac_nids = alc260_dac_nids,
5859 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5860 .adc_nids = alc260_adc_nids,
5861 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5862 .channel_mode = alc260_modes,
5863 .input_mux = &alc260_capture_source,
5866 .mixers = { alc260_hp_output_mixer,
5867 alc260_input_mixer },
5868 .init_verbs = { alc260_init_verbs,
5869 alc260_hp_unsol_verbs },
5870 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5871 .dac_nids = alc260_dac_nids,
5872 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5873 .adc_nids = alc260_adc_nids_alt,
5874 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5875 .channel_mode = alc260_modes,
5876 .input_mux = &alc260_capture_source,
5877 .unsol_event = alc260_hp_unsol_event,
5878 .init_hook = alc260_hp_automute,
5880 [ALC260_HP_DC7600] = {
5881 .mixers = { alc260_hp_dc7600_mixer,
5882 alc260_input_mixer },
5883 .init_verbs = { alc260_init_verbs,
5884 alc260_hp_dc7600_verbs },
5885 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5886 .dac_nids = alc260_dac_nids,
5887 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5888 .adc_nids = alc260_adc_nids_alt,
5889 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5890 .channel_mode = alc260_modes,
5891 .input_mux = &alc260_capture_source,
5892 .unsol_event = alc260_hp_3012_unsol_event,
5893 .init_hook = alc260_hp_3012_automute,
5895 [ALC260_HP_3013] = {
5896 .mixers = { alc260_hp_3013_mixer,
5897 alc260_input_mixer },
5898 .init_verbs = { alc260_hp_3013_init_verbs,
5899 alc260_hp_3013_unsol_verbs },
5900 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5901 .dac_nids = alc260_dac_nids,
5902 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5903 .adc_nids = alc260_adc_nids_alt,
5904 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5905 .channel_mode = alc260_modes,
5906 .input_mux = &alc260_capture_source,
5907 .unsol_event = alc260_hp_3013_unsol_event,
5908 .init_hook = alc260_hp_3013_automute,
5910 [ALC260_FUJITSU_S702X] = {
5911 .mixers = { alc260_fujitsu_mixer },
5912 .init_verbs = { alc260_fujitsu_init_verbs },
5913 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5914 .dac_nids = alc260_dac_nids,
5915 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5916 .adc_nids = alc260_dual_adc_nids,
5917 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5918 .channel_mode = alc260_modes,
5919 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5920 .input_mux = alc260_fujitsu_capture_sources,
5923 .mixers = { alc260_acer_mixer },
5924 .init_verbs = { alc260_acer_init_verbs },
5925 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5926 .dac_nids = alc260_dac_nids,
5927 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5928 .adc_nids = alc260_dual_adc_nids,
5929 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5930 .channel_mode = alc260_modes,
5931 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5932 .input_mux = alc260_acer_capture_sources,
5934 [ALC260_FAVORIT100] = {
5935 .mixers = { alc260_favorit100_mixer },
5936 .init_verbs = { alc260_favorit100_init_verbs },
5937 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5938 .dac_nids = alc260_dac_nids,
5939 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5940 .adc_nids = alc260_dual_adc_nids,
5941 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5942 .channel_mode = alc260_modes,
5943 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
5944 .input_mux = alc260_favorit100_capture_sources,
5947 .mixers = { alc260_will_mixer },
5948 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5949 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5950 .dac_nids = alc260_dac_nids,
5951 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5952 .adc_nids = alc260_adc_nids,
5953 .dig_out_nid = ALC260_DIGOUT_NID,
5954 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5955 .channel_mode = alc260_modes,
5956 .input_mux = &alc260_capture_source,
5958 [ALC260_REPLACER_672V] = {
5959 .mixers = { alc260_replacer_672v_mixer },
5960 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5961 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5962 .dac_nids = alc260_dac_nids,
5963 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5964 .adc_nids = alc260_adc_nids,
5965 .dig_out_nid = ALC260_DIGOUT_NID,
5966 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5967 .channel_mode = alc260_modes,
5968 .input_mux = &alc260_capture_source,
5969 .unsol_event = alc260_replacer_672v_unsol_event,
5970 .init_hook = alc260_replacer_672v_automute,
5972 #ifdef CONFIG_SND_DEBUG
5974 .mixers = { alc260_test_mixer },
5975 .init_verbs = { alc260_test_init_verbs },
5976 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5977 .dac_nids = alc260_test_dac_nids,
5978 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5979 .adc_nids = alc260_test_adc_nids,
5980 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5981 .channel_mode = alc260_modes,
5982 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5983 .input_mux = alc260_test_capture_sources,
5988 static int patch_alc260(struct hda_codec *codec)
5990 struct alc_spec *spec;
5991 int err, board_config;
5993 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5999 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6002 if (board_config < 0) {
6003 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
6004 "trying auto-probe from BIOS...\n");
6005 board_config = ALC260_AUTO;
6008 if (board_config == ALC260_AUTO) {
6009 /* automatic parse from the BIOS config */
6010 err = alc260_parse_auto_config(codec);
6016 "hda_codec: Cannot set up configuration "
6017 "from BIOS. Using base mode...\n");
6018 board_config = ALC260_BASIC;
6022 err = snd_hda_attach_beep_device(codec, 0x1);
6028 if (board_config != ALC260_AUTO)
6029 setup_preset(spec, &alc260_presets[board_config]);
6031 spec->stream_name_analog = "ALC260 Analog";
6032 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6033 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6035 spec->stream_name_digital = "ALC260 Digital";
6036 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6037 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6039 if (!spec->adc_nids && spec->input_mux) {
6040 /* check whether NID 0x04 is valid */
6041 unsigned int wcap = get_wcaps(codec, 0x04);
6042 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6044 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6045 spec->adc_nids = alc260_adc_nids_alt;
6046 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6048 spec->adc_nids = alc260_adc_nids;
6049 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6052 set_capture_mixer(spec);
6053 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6055 spec->vmaster_nid = 0x08;
6057 codec->patch_ops = alc_patch_ops;
6058 if (board_config == ALC260_AUTO)
6059 spec->init_hook = alc260_auto_init;
6060 #ifdef CONFIG_SND_HDA_POWER_SAVE
6061 if (!spec->loopback.amplist)
6062 spec->loopback.amplist = alc260_loopbacks;
6064 codec->proc_widget_hook = print_realtek_coef;
6073 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6074 * configuration. Each pin widget can choose any input DACs and a mixer.
6075 * Each ADC is connected from a mixer of all inputs. This makes possible
6076 * 6-channel independent captures.
6078 * In addition, an independent DAC for the multi-playback (not used in this
6081 #define ALC882_DIGOUT_NID 0x06
6082 #define ALC882_DIGIN_NID 0x0a
6084 static struct hda_channel_mode alc882_ch_modes[1] = {
6088 static hda_nid_t alc882_dac_nids[4] = {
6089 /* front, rear, clfe, rear_surr */
6090 0x02, 0x03, 0x04, 0x05
6093 /* identical with ALC880 */
6094 #define alc882_adc_nids alc880_adc_nids
6095 #define alc882_adc_nids_alt alc880_adc_nids_alt
6097 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6098 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6101 /* FIXME: should be a matrix-type input source selection */
6103 static struct hda_input_mux alc882_capture_source = {
6107 { "Front Mic", 0x1 },
6115 static struct hda_verb alc882_3ST_ch2_init[] = {
6116 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6117 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6118 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6119 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6126 static struct hda_verb alc882_3ST_ch6_init[] = {
6127 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6128 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6129 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6130 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6131 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6132 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6136 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6137 { 2, alc882_3ST_ch2_init },
6138 { 6, alc882_3ST_ch6_init },
6144 static struct hda_verb alc882_sixstack_ch6_init[] = {
6145 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6146 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6147 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6148 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6155 static struct hda_verb alc882_sixstack_ch8_init[] = {
6156 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6157 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6158 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6159 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6163 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6164 { 6, alc882_sixstack_ch6_init },
6165 { 8, alc882_sixstack_ch8_init },
6169 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6175 static struct hda_verb alc885_mbp_ch2_init[] = {
6176 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6177 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6178 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6185 static struct hda_verb alc885_mbp_ch6_init[] = {
6186 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6187 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6188 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6189 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6190 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6194 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6195 { 2, alc885_mbp_ch2_init },
6196 { 6, alc885_mbp_ch6_init },
6200 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6201 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6203 static struct snd_kcontrol_new alc882_base_mixer[] = {
6204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6205 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6206 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6207 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6208 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6209 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6210 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6211 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6212 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6213 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6215 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6216 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6220 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6222 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6223 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6228 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6229 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6230 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6231 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6232 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6234 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6236 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6237 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6238 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6241 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6246 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6247 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6249 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6254 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6255 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6256 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6257 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6258 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6259 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6260 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6261 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6263 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6264 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6265 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6266 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6267 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6271 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6272 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6274 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6275 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6276 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6277 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6278 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6279 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6280 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6281 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6282 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6283 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6284 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6285 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6287 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6291 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6292 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6293 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6294 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6296 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6297 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6298 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6300 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6305 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6307 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6308 .name = "Channel Mode",
6309 .info = alc_ch_mode_info,
6310 .get = alc_ch_mode_get,
6311 .put = alc_ch_mode_put,
6316 static struct hda_verb alc882_init_verbs[] = {
6317 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6319 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6322 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6323 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6324 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6326 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6327 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6330 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6331 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6332 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6334 /* Front Pin: output 0 (0x0c) */
6335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6336 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6337 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6338 /* Rear Pin: output 1 (0x0d) */
6339 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6341 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6342 /* CLFE Pin: output 2 (0x0e) */
6343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6344 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6345 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6346 /* Side Pin: output 3 (0x0f) */
6347 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6348 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6349 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6350 /* Mic (rear) pin: input vref at 80% */
6351 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6353 /* Front Mic pin: input vref at 80% */
6354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6355 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6356 /* Line In pin: input */
6357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6359 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6360 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6361 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6362 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6363 /* CD pin widget for input */
6364 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6366 /* FIXME: use matrix-type input source selection */
6367 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6368 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6379 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6383 /* ADC1: mute amp left and right */
6384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6385 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6386 /* ADC2: mute amp left and right */
6387 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6388 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6389 /* ADC3: mute amp left and right */
6390 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6391 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6396 static struct hda_verb alc882_eapd_verbs[] = {
6397 /* change to EAPD mode */
6398 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6399 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6404 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6405 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6406 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6407 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6408 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6409 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6410 /* FIXME: this looks suspicious...
6411 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6412 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6417 static struct hda_verb alc882_macpro_init_verbs[] = {
6418 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6421 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6422 /* Front Pin: output 0 (0x0c) */
6423 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6424 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6425 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6426 /* Front Mic pin: input vref at 80% */
6427 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6429 /* Speaker: output */
6430 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6431 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6432 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6433 /* Headphone output (output 0 - 0x0c) */
6434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6435 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6436 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6438 /* FIXME: use matrix-type input source selection */
6439 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6440 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6441 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6442 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6443 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6444 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6446 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6447 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6448 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6449 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6455 /* ADC1: mute amp left and right */
6456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6457 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6458 /* ADC2: mute amp left and right */
6459 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6460 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6461 /* ADC3: mute amp left and right */
6462 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6463 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6468 /* Macbook Pro rev3 */
6469 static struct hda_verb alc885_mbp3_init_verbs[] = {
6470 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6475 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6478 /* Front Pin: output 0 (0x0c) */
6479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6481 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6482 /* HP Pin: output 0 (0x0d) */
6483 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6485 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6486 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6487 /* Mic (rear) pin: input vref at 80% */
6488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6489 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6490 /* Front Mic pin: input vref at 80% */
6491 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6492 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6493 /* Line In pin: use output 1 when in LineOut mode */
6494 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6495 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6496 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6498 /* FIXME: use matrix-type input source selection */
6499 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6500 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6501 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6502 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6503 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6504 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6506 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6507 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6515 /* ADC1: mute amp left and right */
6516 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6517 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6518 /* ADC2: mute amp left and right */
6519 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6520 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6521 /* ADC3: mute amp left and right */
6522 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6523 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6528 /* iMac 24 mixer. */
6529 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6530 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6531 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6535 /* iMac 24 init verbs. */
6536 static struct hda_verb alc885_imac24_init_verbs[] = {
6537 /* Internal speakers: output 0 (0x0c) */
6538 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6539 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6540 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6541 /* Internal speakers: output 0 (0x0c) */
6542 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6543 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6544 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6545 /* Headphone: output 0 (0x0c) */
6546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6548 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6549 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6550 /* Front Mic: input vref at 80% */
6551 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6552 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6556 /* Toggle speaker-output according to the hp-jack state */
6557 static void alc885_imac24_automute(struct hda_codec *codec)
6559 unsigned int present;
6561 present = snd_hda_codec_read(codec, 0x14, 0,
6562 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6563 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6564 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6565 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6566 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6569 /* Processes unsolicited events. */
6570 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6573 /* Headphone insertion or removal. */
6574 if ((res >> 26) == ALC880_HP_EVENT)
6575 alc885_imac24_automute(codec);
6578 static void alc885_mbp3_automute(struct hda_codec *codec)
6580 unsigned int present;
6582 present = snd_hda_codec_read(codec, 0x15, 0,
6583 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6584 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6585 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6586 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6587 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6590 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6593 /* Headphone insertion or removal. */
6594 if ((res >> 26) == ALC880_HP_EVENT)
6595 alc885_mbp3_automute(codec);
6599 static struct hda_verb alc882_targa_verbs[] = {
6600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6604 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6606 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6607 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6608 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6610 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6611 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6612 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6613 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6617 /* toggle speaker-output according to the hp-jack state */
6618 static void alc882_targa_automute(struct hda_codec *codec)
6620 unsigned int present;
6622 present = snd_hda_codec_read(codec, 0x14, 0,
6623 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6624 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6625 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6626 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6630 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6632 /* Looks like the unsol event is incompatible with the standard
6633 * definition. 4bit tag is placed at 26 bit!
6635 if (((res >> 26) == ALC880_HP_EVENT)) {
6636 alc882_targa_automute(codec);
6640 static struct hda_verb alc882_asus_a7j_verbs[] = {
6641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6646 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6648 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6649 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6650 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6652 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6653 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6654 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6658 static struct hda_verb alc882_asus_a7m_verbs[] = {
6659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6662 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6663 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6666 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6668 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6670 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6671 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6672 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6676 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6678 unsigned int gpiostate, gpiomask, gpiodir;
6680 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6681 AC_VERB_GET_GPIO_DATA, 0);
6684 gpiostate |= (1 << pin);
6686 gpiostate &= ~(1 << pin);
6688 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6689 AC_VERB_GET_GPIO_MASK, 0);
6690 gpiomask |= (1 << pin);
6692 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6693 AC_VERB_GET_GPIO_DIRECTION, 0);
6694 gpiodir |= (1 << pin);
6697 snd_hda_codec_write(codec, codec->afg, 0,
6698 AC_VERB_SET_GPIO_MASK, gpiomask);
6699 snd_hda_codec_write(codec, codec->afg, 0,
6700 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6704 snd_hda_codec_write(codec, codec->afg, 0,
6705 AC_VERB_SET_GPIO_DATA, gpiostate);
6708 /* set up GPIO at initialization */
6709 static void alc885_macpro_init_hook(struct hda_codec *codec)
6711 alc882_gpio_mute(codec, 0, 0);
6712 alc882_gpio_mute(codec, 1, 0);
6715 /* set up GPIO and update auto-muting at initialization */
6716 static void alc885_imac24_init_hook(struct hda_codec *codec)
6718 alc885_macpro_init_hook(codec);
6719 alc885_imac24_automute(codec);
6723 * generic initialization of ADC, input mixers and output mixers
6725 static struct hda_verb alc882_auto_init_verbs[] = {
6727 * Unmute ADC0-2 and set the default input to mic-in
6729 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6730 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6731 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6733 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6736 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6738 * Note: PASD motherboards uses the Line In 2 as the input for
6739 * front panel mic (mic 2)
6741 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6744 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6745 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6749 * Set up output mixers (0x0c - 0x0f)
6751 /* set vol=0 to output mixers */
6752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6754 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6755 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6756 /* set up input amps for analog loopback */
6757 /* Amp Indices: DAC = 0, mixer = 1 */
6758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6759 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6760 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6761 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6762 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6763 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6764 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6765 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6766 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6767 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6769 /* FIXME: use matrix-type input source selection */
6770 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6771 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6772 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6773 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6777 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6778 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6779 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6783 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6784 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6790 #ifdef CONFIG_SND_HDA_POWER_SAVE
6791 #define alc882_loopbacks alc880_loopbacks
6794 /* pcm configuration: identiacal with ALC880 */
6795 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6796 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6797 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6798 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6801 * configuration and preset
6803 static const char *alc882_models[ALC882_MODEL_LAST] = {
6804 [ALC882_3ST_DIG] = "3stack-dig",
6805 [ALC882_6ST_DIG] = "6stack-dig",
6806 [ALC882_ARIMA] = "arima",
6807 [ALC882_W2JC] = "w2jc",
6808 [ALC882_TARGA] = "targa",
6809 [ALC882_ASUS_A7J] = "asus-a7j",
6810 [ALC882_ASUS_A7M] = "asus-a7m",
6811 [ALC885_MACPRO] = "macpro",
6812 [ALC885_MBP3] = "mbp3",
6813 [ALC885_IMAC24] = "imac24",
6814 [ALC882_AUTO] = "auto",
6817 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6818 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6819 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6820 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6821 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6822 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6823 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6824 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6825 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6826 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6827 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6828 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6829 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6833 static struct alc_config_preset alc882_presets[] = {
6834 [ALC882_3ST_DIG] = {
6835 .mixers = { alc882_base_mixer },
6836 .init_verbs = { alc882_init_verbs },
6837 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6838 .dac_nids = alc882_dac_nids,
6839 .dig_out_nid = ALC882_DIGOUT_NID,
6840 .dig_in_nid = ALC882_DIGIN_NID,
6841 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6842 .channel_mode = alc882_ch_modes,
6844 .input_mux = &alc882_capture_source,
6846 [ALC882_6ST_DIG] = {
6847 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6848 .init_verbs = { alc882_init_verbs },
6849 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6850 .dac_nids = alc882_dac_nids,
6851 .dig_out_nid = ALC882_DIGOUT_NID,
6852 .dig_in_nid = ALC882_DIGIN_NID,
6853 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6854 .channel_mode = alc882_sixstack_modes,
6855 .input_mux = &alc882_capture_source,
6858 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6859 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6860 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6861 .dac_nids = alc882_dac_nids,
6862 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6863 .channel_mode = alc882_sixstack_modes,
6864 .input_mux = &alc882_capture_source,
6867 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6868 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6869 alc880_gpio1_init_verbs },
6870 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6871 .dac_nids = alc882_dac_nids,
6872 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6873 .channel_mode = alc880_threestack_modes,
6875 .input_mux = &alc882_capture_source,
6876 .dig_out_nid = ALC882_DIGOUT_NID,
6879 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6880 .init_verbs = { alc885_mbp3_init_verbs,
6881 alc880_gpio1_init_verbs },
6882 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6883 .dac_nids = alc882_dac_nids,
6884 .channel_mode = alc885_mbp_6ch_modes,
6885 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6886 .input_mux = &alc882_capture_source,
6887 .dig_out_nid = ALC882_DIGOUT_NID,
6888 .dig_in_nid = ALC882_DIGIN_NID,
6889 .unsol_event = alc885_mbp3_unsol_event,
6890 .init_hook = alc885_mbp3_automute,
6893 .mixers = { alc882_macpro_mixer },
6894 .init_verbs = { alc882_macpro_init_verbs },
6895 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6896 .dac_nids = alc882_dac_nids,
6897 .dig_out_nid = ALC882_DIGOUT_NID,
6898 .dig_in_nid = ALC882_DIGIN_NID,
6899 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6900 .channel_mode = alc882_ch_modes,
6901 .input_mux = &alc882_capture_source,
6902 .init_hook = alc885_macpro_init_hook,
6905 .mixers = { alc885_imac24_mixer },
6906 .init_verbs = { alc885_imac24_init_verbs },
6907 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6908 .dac_nids = alc882_dac_nids,
6909 .dig_out_nid = ALC882_DIGOUT_NID,
6910 .dig_in_nid = ALC882_DIGIN_NID,
6911 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6912 .channel_mode = alc882_ch_modes,
6913 .input_mux = &alc882_capture_source,
6914 .unsol_event = alc885_imac24_unsol_event,
6915 .init_hook = alc885_imac24_init_hook,
6918 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6919 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6920 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6921 .dac_nids = alc882_dac_nids,
6922 .dig_out_nid = ALC882_DIGOUT_NID,
6923 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6924 .adc_nids = alc882_adc_nids,
6925 .capsrc_nids = alc882_capsrc_nids,
6926 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6927 .channel_mode = alc882_3ST_6ch_modes,
6929 .input_mux = &alc882_capture_source,
6930 .unsol_event = alc882_targa_unsol_event,
6931 .init_hook = alc882_targa_automute,
6933 [ALC882_ASUS_A7J] = {
6934 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6935 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6936 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6937 .dac_nids = alc882_dac_nids,
6938 .dig_out_nid = ALC882_DIGOUT_NID,
6939 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6940 .adc_nids = alc882_adc_nids,
6941 .capsrc_nids = alc882_capsrc_nids,
6942 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6943 .channel_mode = alc882_3ST_6ch_modes,
6945 .input_mux = &alc882_capture_source,
6947 [ALC882_ASUS_A7M] = {
6948 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6949 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6950 alc880_gpio1_init_verbs,
6951 alc882_asus_a7m_verbs },
6952 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6953 .dac_nids = alc882_dac_nids,
6954 .dig_out_nid = ALC882_DIGOUT_NID,
6955 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6956 .channel_mode = alc880_threestack_modes,
6958 .input_mux = &alc882_capture_source,
6967 PINFIX_ABIT_AW9D_MAX
6970 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6971 { 0x15, 0x01080104 }, /* side */
6972 { 0x16, 0x01011012 }, /* rear */
6973 { 0x17, 0x01016011 }, /* clfe */
6977 static const struct alc_pincfg *alc882_pin_fixes[] = {
6978 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6981 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6982 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6987 * BIOS auto configuration
6989 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6990 hda_nid_t nid, int pin_type,
6994 struct alc_spec *spec = codec->spec;
6997 alc_set_pin_output(codec, nid, pin_type);
6998 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7001 idx = spec->multiout.dac_nids[dac_idx] - 2;
7002 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7006 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7008 struct alc_spec *spec = codec->spec;
7011 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7012 for (i = 0; i <= HDA_SIDE; i++) {
7013 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7014 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7016 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7021 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7023 struct alc_spec *spec = codec->spec;
7026 pin = spec->autocfg.hp_pins[0];
7027 if (pin) /* connect to front */
7029 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7030 pin = spec->autocfg.speaker_pins[0];
7032 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7035 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7036 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7038 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7040 struct alc_spec *spec = codec->spec;
7043 for (i = 0; i < AUTO_PIN_LAST; i++) {
7044 hda_nid_t nid = spec->autocfg.input_pins[i];
7047 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7048 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7049 snd_hda_codec_write(codec, nid, 0,
7050 AC_VERB_SET_AMP_GAIN_MUTE,
7055 static void alc882_auto_init_input_src(struct hda_codec *codec)
7057 struct alc_spec *spec = codec->spec;
7060 for (c = 0; c < spec->num_adc_nids; c++) {
7061 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7062 hda_nid_t nid = spec->capsrc_nids[c];
7063 unsigned int mux_idx;
7064 const struct hda_input_mux *imux;
7065 int conns, mute, idx, item;
7067 conns = snd_hda_get_connections(codec, nid, conn_list,
7068 ARRAY_SIZE(conn_list));
7071 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7072 imux = &spec->input_mux[mux_idx];
7073 for (idx = 0; idx < conns; idx++) {
7074 /* if the current connection is the selected one,
7075 * unmute it as default - otherwise mute it
7077 mute = AMP_IN_MUTE(idx);
7078 for (item = 0; item < imux->num_items; item++) {
7079 if (imux->items[item].index == idx) {
7080 if (spec->cur_mux[c] == item)
7081 mute = AMP_IN_UNMUTE(idx);
7085 /* check if we have a selector or mixer
7086 * we could check for the widget type instead, but
7087 * just check for Amp-In presence (in case of mixer
7088 * without amp-in there is something wrong, this
7089 * function shouldn't be used or capsrc nid is wrong)
7091 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7092 snd_hda_codec_write(codec, nid, 0,
7093 AC_VERB_SET_AMP_GAIN_MUTE,
7095 else if (mute != AMP_IN_MUTE(idx))
7096 snd_hda_codec_write(codec, nid, 0,
7097 AC_VERB_SET_CONNECT_SEL,
7103 /* add mic boosts if needed */
7104 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7106 struct alc_spec *spec = codec->spec;
7110 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7111 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7112 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7114 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7118 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7119 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7120 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7122 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7129 /* almost identical with ALC880 parser... */
7130 static int alc882_parse_auto_config(struct hda_codec *codec)
7132 struct alc_spec *spec = codec->spec;
7133 int err = alc880_parse_auto_config(codec);
7138 return 0; /* no config found */
7140 err = alc_auto_add_mic_boost(codec);
7144 /* hack - override the init verbs */
7145 spec->init_verbs[0] = alc882_auto_init_verbs;
7147 return 1; /* config found */
7150 /* additional initialization for auto-configuration model */
7151 static void alc882_auto_init(struct hda_codec *codec)
7153 struct alc_spec *spec = codec->spec;
7154 alc882_auto_init_multi_out(codec);
7155 alc882_auto_init_hp_out(codec);
7156 alc882_auto_init_analog_input(codec);
7157 alc882_auto_init_input_src(codec);
7158 if (spec->unsol_event)
7159 alc_inithook(codec);
7162 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7164 static int patch_alc882(struct hda_codec *codec)
7166 struct alc_spec *spec;
7167 int err, board_config;
7169 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7175 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7179 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7180 /* Pick up systems that don't supply PCI SSID */
7181 switch (codec->subsystem_id) {
7182 case 0x106b0c00: /* Mac Pro */
7183 board_config = ALC885_MACPRO;
7185 case 0x106b1000: /* iMac 24 */
7186 case 0x106b2800: /* AppleTV */
7187 case 0x106b3e00: /* iMac 24 Aluminium */
7188 board_config = ALC885_IMAC24;
7190 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7191 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7192 case 0x106b00a4: /* MacbookPro4,1 */
7193 case 0x106b2c00: /* Macbook Pro rev3 */
7194 case 0x106b3600: /* Macbook 3.1 */
7195 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7196 board_config = ALC885_MBP3;
7199 /* ALC889A is handled better as ALC888-compatible */
7200 if (codec->revision_id == 0x100101 ||
7201 codec->revision_id == 0x100103) {
7203 return patch_alc883(codec);
7205 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7206 "trying auto-probe from BIOS...\n");
7207 board_config = ALC882_AUTO;
7211 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7213 if (board_config == ALC882_AUTO) {
7214 /* automatic parse from the BIOS config */
7215 err = alc882_parse_auto_config(codec);
7221 "hda_codec: Cannot set up configuration "
7222 "from BIOS. Using base mode...\n");
7223 board_config = ALC882_3ST_DIG;
7227 err = snd_hda_attach_beep_device(codec, 0x1);
7233 if (board_config != ALC882_AUTO)
7234 setup_preset(spec, &alc882_presets[board_config]);
7236 if (codec->vendor_id == 0x10ec0885) {
7237 spec->stream_name_analog = "ALC885 Analog";
7238 spec->stream_name_digital = "ALC885 Digital";
7240 spec->stream_name_analog = "ALC882 Analog";
7241 spec->stream_name_digital = "ALC882 Digital";
7244 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7245 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7246 /* FIXME: setup DAC5 */
7247 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7248 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7250 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7251 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7253 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7254 if (!spec->adc_nids && spec->input_mux) {
7255 /* check whether NID 0x07 is valid */
7256 unsigned int wcap = get_wcaps(codec, 0x07);
7258 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7259 if (wcap != AC_WID_AUD_IN) {
7260 spec->adc_nids = alc882_adc_nids_alt;
7261 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7262 spec->capsrc_nids = alc882_capsrc_nids_alt;
7264 spec->adc_nids = alc882_adc_nids;
7265 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7266 spec->capsrc_nids = alc882_capsrc_nids;
7269 set_capture_mixer(spec);
7270 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7272 spec->vmaster_nid = 0x0c;
7274 codec->patch_ops = alc_patch_ops;
7275 if (board_config == ALC882_AUTO)
7276 spec->init_hook = alc882_auto_init;
7277 #ifdef CONFIG_SND_HDA_POWER_SAVE
7278 if (!spec->loopback.amplist)
7279 spec->loopback.amplist = alc882_loopbacks;
7281 codec->proc_widget_hook = print_realtek_coef;
7289 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7290 * configuration. Each pin widget can choose any input DACs and a mixer.
7291 * Each ADC is connected from a mixer of all inputs. This makes possible
7292 * 6-channel independent captures.
7294 * In addition, an independent DAC for the multi-playback (not used in this
7297 #define ALC883_DIGOUT_NID 0x06
7298 #define ALC883_DIGIN_NID 0x0a
7300 #define ALC1200_DIGOUT_NID 0x10
7302 static hda_nid_t alc883_dac_nids[4] = {
7303 /* front, rear, clfe, rear_surr */
7304 0x02, 0x03, 0x04, 0x05
7307 static hda_nid_t alc883_adc_nids[2] = {
7312 static hda_nid_t alc883_adc_nids_alt[1] = {
7317 static hda_nid_t alc883_adc_nids_rev[2] = {
7322 #define alc889_adc_nids alc880_adc_nids
7324 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7326 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7328 #define alc889_capsrc_nids alc882_capsrc_nids
7331 /* FIXME: should be a matrix-type input source selection */
7333 static struct hda_input_mux alc883_capture_source = {
7337 { "Front Mic", 0x1 },
7343 static struct hda_input_mux alc883_3stack_6ch_intel = {
7347 { "Front Mic", 0x0 },
7353 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7361 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7371 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7379 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7383 { "Front Mic", 0x1 },
7388 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7399 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7406 static struct hda_verb alc883_3ST_ch2_init[] = {
7407 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7408 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7409 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7410 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7417 static struct hda_verb alc883_3ST_ch4_init[] = {
7418 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7419 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7420 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7421 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7422 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7429 static struct hda_verb alc883_3ST_ch6_init[] = {
7430 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7431 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7432 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7433 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7434 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7435 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7439 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7440 { 2, alc883_3ST_ch2_init },
7441 { 4, alc883_3ST_ch4_init },
7442 { 6, alc883_3ST_ch6_init },
7448 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7449 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7450 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7451 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7452 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7459 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7460 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7461 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7462 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7463 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7464 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7471 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7472 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7473 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7474 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7475 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7476 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7477 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7481 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7482 { 2, alc883_3ST_ch2_intel_init },
7483 { 4, alc883_3ST_ch4_intel_init },
7484 { 6, alc883_3ST_ch6_intel_init },
7490 static struct hda_verb alc883_sixstack_ch6_init[] = {
7491 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7492 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7493 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7494 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7501 static struct hda_verb alc883_sixstack_ch8_init[] = {
7502 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7503 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7504 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7505 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7509 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7510 { 6, alc883_sixstack_ch6_init },
7511 { 8, alc883_sixstack_ch8_init },
7514 static struct hda_verb alc883_medion_eapd_verbs[] = {
7515 /* eanable EAPD on medion laptop */
7516 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7517 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7521 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7522 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7525 static struct snd_kcontrol_new alc883_base_mixer[] = {
7526 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7527 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7528 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7529 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7530 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7531 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7532 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7533 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7534 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7535 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7537 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7538 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7539 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7540 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7542 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7543 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7545 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7546 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7550 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7551 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7552 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7553 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7554 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7555 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7556 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7559 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7560 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7561 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7562 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7563 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7567 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7568 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7569 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7570 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7571 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7573 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7574 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7575 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7576 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7577 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7581 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7582 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7583 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7584 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7585 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7587 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7590 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7591 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7595 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7596 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7597 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7598 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7599 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7600 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7604 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7605 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7606 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7607 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7608 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7612 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7613 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7614 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7615 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7616 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7617 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7618 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7619 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7620 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7622 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7623 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7624 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7625 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7627 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7631 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7635 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7636 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7637 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7638 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7639 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7640 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7642 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7643 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7644 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7645 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7646 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7647 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7648 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7649 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7651 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7652 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7653 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7654 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7655 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7659 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7660 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7661 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7662 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7663 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7664 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7665 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7666 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7667 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7669 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7670 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7671 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7672 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7674 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7675 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7676 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7677 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7678 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7682 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7683 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7685 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7686 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7687 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7688 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7689 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7690 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7691 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7692 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7693 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7694 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7695 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7697 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7698 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7702 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7703 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7705 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7706 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7707 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7709 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7710 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7711 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7712 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7713 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7717 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7718 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7719 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7720 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7721 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7722 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7725 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7729 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7730 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7731 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7733 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7734 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7737 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7738 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7742 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7743 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7744 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7745 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7746 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7747 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7749 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7750 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7751 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7755 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7756 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7757 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7759 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7760 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7763 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7767 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7769 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7770 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7771 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7772 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7773 0x0d, 1, 0x0, HDA_OUTPUT),
7774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7778 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7779 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7780 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7781 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7782 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7783 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7784 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7786 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7787 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7788 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7789 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7790 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7794 static struct hda_bind_ctls alc883_bind_cap_vol = {
7795 .ops = &snd_hda_bind_vol,
7797 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7798 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7803 static struct hda_bind_ctls alc883_bind_cap_switch = {
7804 .ops = &snd_hda_bind_sw,
7806 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7807 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7812 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7813 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7814 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7816 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7817 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7819 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7820 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7824 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7825 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7826 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7828 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7829 /* .name = "Capture Source", */
7830 .name = "Input Source",
7832 .info = alc_mux_enum_info,
7833 .get = alc_mux_enum_get,
7834 .put = alc_mux_enum_put,
7839 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7842 .name = "Channel Mode",
7843 .info = alc_ch_mode_info,
7844 .get = alc_ch_mode_get,
7845 .put = alc_ch_mode_put,
7850 static struct hda_verb alc883_init_verbs[] = {
7851 /* ADC1: mute amp left and right */
7852 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7853 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7854 /* ADC2: mute amp left and right */
7855 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7856 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7857 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7858 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7859 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7862 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7863 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7864 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7866 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7867 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7868 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7870 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7871 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7872 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7874 /* mute analog input loopbacks */
7875 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7876 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7877 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7881 /* Front Pin: output 0 (0x0c) */
7882 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7883 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7884 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7885 /* Rear Pin: output 1 (0x0d) */
7886 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7887 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7888 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7889 /* CLFE Pin: output 2 (0x0e) */
7890 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7891 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7892 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7893 /* Side Pin: output 3 (0x0f) */
7894 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7895 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7896 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7897 /* Mic (rear) pin: input vref at 80% */
7898 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7899 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7900 /* Front Mic pin: input vref at 80% */
7901 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7902 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7903 /* Line In pin: input */
7904 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7905 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7906 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7907 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7908 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7909 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7910 /* CD pin widget for input */
7911 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7913 /* FIXME: use matrix-type input source selection */
7914 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7916 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7917 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7918 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7919 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7921 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7928 /* toggle speaker-output according to the hp-jack state */
7929 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7931 unsigned int present;
7933 present = snd_hda_codec_read(codec, 0x15, 0,
7934 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7935 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7936 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7937 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7938 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7941 /* auto-toggle front mic */
7943 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7945 unsigned int present;
7948 present = snd_hda_codec_read(codec, 0x18, 0,
7949 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7950 bits = present ? HDA_AMP_MUTE : 0;
7951 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7955 static void alc883_mitac_automute(struct hda_codec *codec)
7957 alc883_mitac_hp_automute(codec);
7958 /* alc883_mitac_mic_automute(codec); */
7961 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7964 switch (res >> 26) {
7965 case ALC880_HP_EVENT:
7966 alc883_mitac_hp_automute(codec);
7968 case ALC880_MIC_EVENT:
7969 /* alc883_mitac_mic_automute(codec); */
7974 static struct hda_verb alc883_mitac_verbs[] = {
7976 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7979 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7980 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7982 /* enable unsolicited event */
7983 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7984 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7989 static struct hda_verb alc883_clevo_m720_verbs[] = {
7991 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7994 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7997 /* enable unsolicited event */
7998 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7999 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8004 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8006 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8009 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8012 /* enable unsolicited event */
8013 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8018 static struct hda_verb alc883_tagra_verbs[] = {
8019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8023 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8025 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8026 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8027 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8029 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8030 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8031 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8032 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8037 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8038 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8039 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8040 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8044 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8047 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8052 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8055 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8056 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8057 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8061 static struct hda_verb alc883_haier_w66_verbs[] = {
8062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8065 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8067 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8068 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8069 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8070 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8074 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8080 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8081 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8082 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8086 static struct hda_verb alc888_6st_dell_verbs[] = {
8087 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8091 static void alc888_3st_hp_front_automute(struct hda_codec *codec)
8093 unsigned int present, bits;
8095 present = snd_hda_codec_read(codec, 0x1b, 0,
8096 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8097 bits = present ? HDA_AMP_MUTE : 0;
8098 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8099 HDA_AMP_MUTE, bits);
8100 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8101 HDA_AMP_MUTE, bits);
8102 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
8103 HDA_AMP_MUTE, bits);
8106 static void alc888_3st_hp_unsol_event(struct hda_codec *codec,
8109 switch (res >> 26) {
8110 case ALC880_HP_EVENT:
8111 alc888_3st_hp_front_automute(codec);
8116 static struct hda_verb alc888_3st_hp_verbs[] = {
8117 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8118 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8119 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8120 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8127 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8128 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8129 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8130 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8131 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8138 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8139 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8140 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8141 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8142 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8143 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8150 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8151 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8152 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8153 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8154 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8155 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8156 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8160 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8161 { 2, alc888_3st_hp_2ch_init },
8162 { 4, alc888_3st_hp_4ch_init },
8163 { 6, alc888_3st_hp_6ch_init },
8166 /* toggle front-jack and RCA according to the hp-jack state */
8167 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8169 unsigned int present;
8171 present = snd_hda_codec_read(codec, 0x1b, 0,
8172 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8173 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8174 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8175 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8176 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8179 /* toggle RCA according to the front-jack state */
8180 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8182 unsigned int present;
8184 present = snd_hda_codec_read(codec, 0x14, 0,
8185 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8186 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8187 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8190 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8193 if ((res >> 26) == ALC880_HP_EVENT)
8194 alc888_lenovo_ms7195_front_automute(codec);
8195 if ((res >> 26) == ALC880_FRONT_EVENT)
8196 alc888_lenovo_ms7195_rca_automute(codec);
8199 static struct hda_verb alc883_medion_md2_verbs[] = {
8200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8205 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8209 /* toggle speaker-output according to the hp-jack state */
8210 static void alc883_medion_md2_automute(struct hda_codec *codec)
8212 unsigned int present;
8214 present = snd_hda_codec_read(codec, 0x14, 0,
8215 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8216 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8217 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8220 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8223 if ((res >> 26) == ALC880_HP_EVENT)
8224 alc883_medion_md2_automute(codec);
8227 /* toggle speaker-output according to the hp-jack state */
8228 static void alc883_tagra_automute(struct hda_codec *codec)
8230 unsigned int present;
8233 present = snd_hda_codec_read(codec, 0x14, 0,
8234 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8235 bits = present ? HDA_AMP_MUTE : 0;
8236 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8237 HDA_AMP_MUTE, bits);
8238 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8242 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8244 if ((res >> 26) == ALC880_HP_EVENT)
8245 alc883_tagra_automute(codec);
8248 /* toggle speaker-output according to the hp-jack state */
8249 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8251 unsigned int present;
8254 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8255 & AC_PINSENSE_PRESENCE;
8256 bits = present ? HDA_AMP_MUTE : 0;
8257 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8258 HDA_AMP_MUTE, bits);
8261 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8263 unsigned int present;
8265 present = snd_hda_codec_read(codec, 0x18, 0,
8266 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8267 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8268 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8271 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8273 alc883_clevo_m720_hp_automute(codec);
8274 alc883_clevo_m720_mic_automute(codec);
8277 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8280 switch (res >> 26) {
8281 case ALC880_HP_EVENT:
8282 alc883_clevo_m720_hp_automute(codec);
8284 case ALC880_MIC_EVENT:
8285 alc883_clevo_m720_mic_automute(codec);
8290 /* toggle speaker-output according to the hp-jack state */
8291 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8293 unsigned int present;
8296 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8297 & AC_PINSENSE_PRESENCE;
8298 bits = present ? HDA_AMP_MUTE : 0;
8299 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8300 HDA_AMP_MUTE, bits);
8303 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8306 if ((res >> 26) == ALC880_HP_EVENT)
8307 alc883_2ch_fujitsu_pi2515_automute(codec);
8310 static void alc883_haier_w66_automute(struct hda_codec *codec)
8312 unsigned int present;
8315 present = snd_hda_codec_read(codec, 0x1b, 0,
8316 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8317 bits = present ? 0x80 : 0;
8318 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8322 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8325 if ((res >> 26) == ALC880_HP_EVENT)
8326 alc883_haier_w66_automute(codec);
8329 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8331 unsigned int present;
8334 present = snd_hda_codec_read(codec, 0x14, 0,
8335 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8336 bits = present ? HDA_AMP_MUTE : 0;
8337 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8338 HDA_AMP_MUTE, bits);
8341 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8343 unsigned int present;
8346 present = snd_hda_codec_read(codec, 0x1b, 0,
8347 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8348 bits = present ? HDA_AMP_MUTE : 0;
8349 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8350 HDA_AMP_MUTE, bits);
8351 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8352 HDA_AMP_MUTE, bits);
8355 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8358 if ((res >> 26) == ALC880_HP_EVENT)
8359 alc883_lenovo_101e_all_automute(codec);
8360 if ((res >> 26) == ALC880_FRONT_EVENT)
8361 alc883_lenovo_101e_ispeaker_automute(codec);
8364 /* toggle speaker-output according to the hp-jack state */
8365 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8367 unsigned int present;
8369 present = snd_hda_codec_read(codec, 0x14, 0,
8370 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8371 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8372 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8373 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8374 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8377 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8380 if ((res >> 26) == ALC880_HP_EVENT)
8381 alc883_acer_aspire_automute(codec);
8384 static struct hda_verb alc883_acer_eapd_verbs[] = {
8385 /* HP Pin: output 0 (0x0c) */
8386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8388 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8389 /* Front Pin: output 0 (0x0c) */
8390 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8392 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8393 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8394 /* eanable EAPD on medion laptop */
8395 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8396 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8397 /* enable unsolicited event */
8398 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8402 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8404 unsigned int present;
8406 present = snd_hda_codec_read(codec, 0x1b, 0,
8407 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8408 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8409 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8410 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8411 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8412 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8413 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8414 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8415 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8418 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8421 switch (res >> 26) {
8422 case ALC880_HP_EVENT:
8423 /* printk(KERN_DEBUG "hp_event\n"); */
8424 alc888_6st_dell_front_automute(codec);
8429 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8432 unsigned int present;
8434 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8435 present = snd_hda_codec_read(codec, 0x1b, 0,
8436 AC_VERB_GET_PIN_SENSE, 0);
8437 present = (present & 0x80000000) != 0;
8439 /* mute internal speaker */
8440 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8441 HDA_AMP_MUTE, HDA_AMP_MUTE);
8442 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8443 HDA_AMP_MUTE, HDA_AMP_MUTE);
8444 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8445 HDA_AMP_MUTE, HDA_AMP_MUTE);
8446 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8447 HDA_AMP_MUTE, HDA_AMP_MUTE);
8448 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8449 HDA_AMP_MUTE, HDA_AMP_MUTE);
8451 /* unmute internal speaker if necessary */
8452 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8453 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8454 HDA_AMP_MUTE, mute);
8455 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8456 HDA_AMP_MUTE, mute);
8457 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8458 HDA_AMP_MUTE, mute);
8459 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8460 HDA_AMP_MUTE, mute);
8461 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8462 HDA_AMP_MUTE, mute);
8466 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8469 if ((res >> 26) == ALC880_HP_EVENT)
8470 alc888_lenovo_sky_front_automute(codec);
8474 * generic initialization of ADC, input mixers and output mixers
8476 static struct hda_verb alc883_auto_init_verbs[] = {
8478 * Unmute ADC0-2 and set the default input to mic-in
8480 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8482 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8485 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8487 * Note: PASD motherboards uses the Line In 2 as the input for
8488 * front panel mic (mic 2)
8490 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8491 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8492 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8493 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8494 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8495 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8498 * Set up output mixers (0x0c - 0x0f)
8500 /* set vol=0 to output mixers */
8501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8504 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8505 /* set up input amps for analog loopback */
8506 /* Amp Indices: DAC = 0, mixer = 1 */
8507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8511 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8513 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8515 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8516 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8518 /* FIXME: use matrix-type input source selection */
8519 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8524 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8530 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8536 static struct hda_verb alc888_asus_m90v_verbs[] = {
8537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8538 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8540 /* enable unsolicited event */
8541 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8542 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8546 static void alc883_nb_mic_automute(struct hda_codec *codec)
8548 unsigned int present;
8550 present = snd_hda_codec_read(codec, 0x18, 0,
8551 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8552 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8553 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8554 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8555 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8558 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8560 unsigned int present;
8563 present = snd_hda_codec_read(codec, 0x1b, 0,
8564 AC_VERB_GET_PIN_SENSE, 0)
8565 & AC_PINSENSE_PRESENCE;
8566 bits = present ? 0 : PIN_OUT;
8567 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8569 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8571 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8575 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8578 switch (res >> 26) {
8579 case ALC880_HP_EVENT:
8580 alc883_M90V_speaker_automute(codec);
8582 case ALC880_MIC_EVENT:
8583 alc883_nb_mic_automute(codec);
8588 static void alc883_mode2_inithook(struct hda_codec *codec)
8590 alc883_M90V_speaker_automute(codec);
8591 alc883_nb_mic_automute(codec);
8594 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8595 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8596 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8598 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8600 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8601 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8602 /* enable unsolicited event */
8603 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8607 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8609 unsigned int present;
8612 present = snd_hda_codec_read(codec, 0x14, 0,
8613 AC_VERB_GET_PIN_SENSE, 0)
8614 & AC_PINSENSE_PRESENCE;
8615 bits = present ? 0 : PIN_OUT;
8616 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8620 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8623 switch (res >> 26) {
8624 case ALC880_HP_EVENT:
8625 alc883_eee1601_speaker_automute(codec);
8630 static void alc883_eee1601_inithook(struct hda_codec *codec)
8632 alc883_eee1601_speaker_automute(codec);
8635 #ifdef CONFIG_SND_HDA_POWER_SAVE
8636 #define alc883_loopbacks alc880_loopbacks
8639 /* pcm configuration: identiacal with ALC880 */
8640 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8641 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8642 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8643 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8644 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8647 * configuration and preset
8649 static const char *alc883_models[ALC883_MODEL_LAST] = {
8650 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8651 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8652 [ALC883_3ST_6ch] = "3stack-6ch",
8653 [ALC883_6ST_DIG] = "6stack-dig",
8654 [ALC883_TARGA_DIG] = "targa-dig",
8655 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8656 [ALC883_ACER] = "acer",
8657 [ALC883_ACER_ASPIRE] = "acer-aspire",
8658 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8659 [ALC883_MEDION] = "medion",
8660 [ALC883_MEDION_MD2] = "medion-md2",
8661 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8662 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8663 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8664 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8665 [ALC888_LENOVO_SKY] = "lenovo-sky",
8666 [ALC883_HAIER_W66] = "haier-w66",
8667 [ALC888_3ST_HP] = "3stack-hp",
8668 [ALC888_6ST_DELL] = "6stack-dell",
8669 [ALC883_MITAC] = "mitac",
8670 [ALC883_CLEVO_M720] = "clevo-m720",
8671 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8672 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8673 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8674 [ALC1200_ASUS_P5Q] = "asus-p5q",
8675 [ALC883_AUTO] = "auto",
8678 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8679 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8680 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8681 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8682 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8683 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8684 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8685 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8686 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8687 ALC888_ACER_ASPIRE_4930G),
8688 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8689 ALC888_ACER_ASPIRE_4930G),
8690 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8691 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8692 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8693 ALC888_ACER_ASPIRE_4930G),
8694 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8695 ALC888_ACER_ASPIRE_4930G),
8697 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER),
8698 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8699 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8700 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8701 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8702 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8703 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8704 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8705 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8706 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8707 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8708 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8709 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8710 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8711 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8712 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8713 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8714 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8715 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8716 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8717 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8718 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8719 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8720 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8721 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8722 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8723 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8724 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8725 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8726 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8727 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8728 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8729 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8730 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8734 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8736 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8737 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8740 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8741 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8742 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8743 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8744 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8745 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8746 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8747 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8748 ALC883_FUJITSU_PI2515),
8749 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8750 ALC888_FUJITSU_XA3530),
8751 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8752 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8753 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8754 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8755 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8756 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8757 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8758 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8759 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8760 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8761 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8762 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8763 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8764 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8768 static hda_nid_t alc883_slave_dig_outs[] = {
8769 ALC1200_DIGOUT_NID, 0,
8772 static hda_nid_t alc1200_slave_dig_outs[] = {
8773 ALC883_DIGOUT_NID, 0,
8776 static struct alc_config_preset alc883_presets[] = {
8777 [ALC883_3ST_2ch_DIG] = {
8778 .mixers = { alc883_3ST_2ch_mixer },
8779 .init_verbs = { alc883_init_verbs },
8780 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8781 .dac_nids = alc883_dac_nids,
8782 .dig_out_nid = ALC883_DIGOUT_NID,
8783 .dig_in_nid = ALC883_DIGIN_NID,
8784 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8785 .channel_mode = alc883_3ST_2ch_modes,
8786 .input_mux = &alc883_capture_source,
8788 [ALC883_3ST_6ch_DIG] = {
8789 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8790 .init_verbs = { alc883_init_verbs },
8791 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8792 .dac_nids = alc883_dac_nids,
8793 .dig_out_nid = ALC883_DIGOUT_NID,
8794 .dig_in_nid = ALC883_DIGIN_NID,
8795 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8796 .channel_mode = alc883_3ST_6ch_modes,
8798 .input_mux = &alc883_capture_source,
8800 [ALC883_3ST_6ch] = {
8801 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8802 .init_verbs = { alc883_init_verbs },
8803 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8804 .dac_nids = alc883_dac_nids,
8805 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8806 .channel_mode = alc883_3ST_6ch_modes,
8808 .input_mux = &alc883_capture_source,
8810 [ALC883_3ST_6ch_INTEL] = {
8811 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8812 .init_verbs = { alc883_init_verbs },
8813 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8814 .dac_nids = alc883_dac_nids,
8815 .dig_out_nid = ALC883_DIGOUT_NID,
8816 .dig_in_nid = ALC883_DIGIN_NID,
8817 .slave_dig_outs = alc883_slave_dig_outs,
8818 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8819 .channel_mode = alc883_3ST_6ch_intel_modes,
8821 .input_mux = &alc883_3stack_6ch_intel,
8823 [ALC883_6ST_DIG] = {
8824 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8825 .init_verbs = { alc883_init_verbs },
8826 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8827 .dac_nids = alc883_dac_nids,
8828 .dig_out_nid = ALC883_DIGOUT_NID,
8829 .dig_in_nid = ALC883_DIGIN_NID,
8830 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8831 .channel_mode = alc883_sixstack_modes,
8832 .input_mux = &alc883_capture_source,
8834 [ALC883_TARGA_DIG] = {
8835 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8836 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8837 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8838 .dac_nids = alc883_dac_nids,
8839 .dig_out_nid = ALC883_DIGOUT_NID,
8840 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8841 .channel_mode = alc883_3ST_6ch_modes,
8843 .input_mux = &alc883_capture_source,
8844 .unsol_event = alc883_tagra_unsol_event,
8845 .init_hook = alc883_tagra_automute,
8847 [ALC883_TARGA_2ch_DIG] = {
8848 .mixers = { alc883_tagra_2ch_mixer},
8849 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8850 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8851 .dac_nids = alc883_dac_nids,
8852 .adc_nids = alc883_adc_nids_alt,
8853 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8854 .dig_out_nid = ALC883_DIGOUT_NID,
8855 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8856 .channel_mode = alc883_3ST_2ch_modes,
8857 .input_mux = &alc883_capture_source,
8858 .unsol_event = alc883_tagra_unsol_event,
8859 .init_hook = alc883_tagra_automute,
8862 .mixers = { alc883_base_mixer },
8863 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8864 * and the headphone jack. Turn this on and rely on the
8865 * standard mute methods whenever the user wants to turn
8866 * these outputs off.
8868 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8869 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8870 .dac_nids = alc883_dac_nids,
8871 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8872 .channel_mode = alc883_3ST_2ch_modes,
8873 .input_mux = &alc883_capture_source,
8875 [ALC883_ACER_ASPIRE] = {
8876 .mixers = { alc883_acer_aspire_mixer },
8877 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8878 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8879 .dac_nids = alc883_dac_nids,
8880 .dig_out_nid = ALC883_DIGOUT_NID,
8881 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8882 .channel_mode = alc883_3ST_2ch_modes,
8883 .input_mux = &alc883_capture_source,
8884 .unsol_event = alc883_acer_aspire_unsol_event,
8885 .init_hook = alc883_acer_aspire_automute,
8887 [ALC888_ACER_ASPIRE_4930G] = {
8888 .mixers = { alc888_base_mixer,
8889 alc883_chmode_mixer },
8890 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8891 alc888_acer_aspire_4930g_verbs },
8892 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8893 .dac_nids = alc883_dac_nids,
8894 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8895 .adc_nids = alc883_adc_nids_rev,
8896 .capsrc_nids = alc883_capsrc_nids_rev,
8897 .dig_out_nid = ALC883_DIGOUT_NID,
8898 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8899 .channel_mode = alc883_3ST_6ch_modes,
8902 ARRAY_SIZE(alc888_2_capture_sources),
8903 .input_mux = alc888_2_capture_sources,
8904 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8905 .init_hook = alc888_acer_aspire_4930g_automute,
8908 .mixers = { alc883_fivestack_mixer,
8909 alc883_chmode_mixer },
8910 .init_verbs = { alc883_init_verbs,
8911 alc883_medion_eapd_verbs },
8912 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8913 .dac_nids = alc883_dac_nids,
8914 .adc_nids = alc883_adc_nids_alt,
8915 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8916 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8917 .channel_mode = alc883_sixstack_modes,
8918 .input_mux = &alc883_capture_source,
8920 [ALC883_MEDION_MD2] = {
8921 .mixers = { alc883_medion_md2_mixer},
8922 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8923 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8924 .dac_nids = alc883_dac_nids,
8925 .dig_out_nid = ALC883_DIGOUT_NID,
8926 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8927 .channel_mode = alc883_3ST_2ch_modes,
8928 .input_mux = &alc883_capture_source,
8929 .unsol_event = alc883_medion_md2_unsol_event,
8930 .init_hook = alc883_medion_md2_automute,
8932 [ALC883_LAPTOP_EAPD] = {
8933 .mixers = { alc883_base_mixer },
8934 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8935 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8936 .dac_nids = alc883_dac_nids,
8937 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8938 .channel_mode = alc883_3ST_2ch_modes,
8939 .input_mux = &alc883_capture_source,
8941 [ALC883_CLEVO_M720] = {
8942 .mixers = { alc883_clevo_m720_mixer },
8943 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8944 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8945 .dac_nids = alc883_dac_nids,
8946 .dig_out_nid = ALC883_DIGOUT_NID,
8947 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8948 .channel_mode = alc883_3ST_2ch_modes,
8949 .input_mux = &alc883_capture_source,
8950 .unsol_event = alc883_clevo_m720_unsol_event,
8951 .init_hook = alc883_clevo_m720_automute,
8953 [ALC883_LENOVO_101E_2ch] = {
8954 .mixers = { alc883_lenovo_101e_2ch_mixer},
8955 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8956 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8957 .dac_nids = alc883_dac_nids,
8958 .adc_nids = alc883_adc_nids_alt,
8959 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8960 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8961 .channel_mode = alc883_3ST_2ch_modes,
8962 .input_mux = &alc883_lenovo_101e_capture_source,
8963 .unsol_event = alc883_lenovo_101e_unsol_event,
8964 .init_hook = alc883_lenovo_101e_all_automute,
8966 [ALC883_LENOVO_NB0763] = {
8967 .mixers = { alc883_lenovo_nb0763_mixer },
8968 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8969 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8970 .dac_nids = alc883_dac_nids,
8971 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8972 .channel_mode = alc883_3ST_2ch_modes,
8974 .input_mux = &alc883_lenovo_nb0763_capture_source,
8975 .unsol_event = alc883_medion_md2_unsol_event,
8976 .init_hook = alc883_medion_md2_automute,
8978 [ALC888_LENOVO_MS7195_DIG] = {
8979 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8980 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8981 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8982 .dac_nids = alc883_dac_nids,
8983 .dig_out_nid = ALC883_DIGOUT_NID,
8984 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8985 .channel_mode = alc883_3ST_6ch_modes,
8987 .input_mux = &alc883_capture_source,
8988 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8989 .init_hook = alc888_lenovo_ms7195_front_automute,
8991 [ALC883_HAIER_W66] = {
8992 .mixers = { alc883_tagra_2ch_mixer},
8993 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8994 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8995 .dac_nids = alc883_dac_nids,
8996 .dig_out_nid = ALC883_DIGOUT_NID,
8997 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8998 .channel_mode = alc883_3ST_2ch_modes,
8999 .input_mux = &alc883_capture_source,
9000 .unsol_event = alc883_haier_w66_unsol_event,
9001 .init_hook = alc883_haier_w66_automute,
9004 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9005 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9006 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9007 .dac_nids = alc883_dac_nids,
9008 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9009 .channel_mode = alc888_3st_hp_modes,
9011 .input_mux = &alc883_capture_source,
9012 .unsol_event = alc888_3st_hp_unsol_event,
9013 .init_hook = alc888_3st_hp_front_automute,
9015 [ALC888_6ST_DELL] = {
9016 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9017 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9018 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9019 .dac_nids = alc883_dac_nids,
9020 .dig_out_nid = ALC883_DIGOUT_NID,
9021 .dig_in_nid = ALC883_DIGIN_NID,
9022 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9023 .channel_mode = alc883_sixstack_modes,
9024 .input_mux = &alc883_capture_source,
9025 .unsol_event = alc888_6st_dell_unsol_event,
9026 .init_hook = alc888_6st_dell_front_automute,
9029 .mixers = { alc883_mitac_mixer },
9030 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9031 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9032 .dac_nids = alc883_dac_nids,
9033 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9034 .channel_mode = alc883_3ST_2ch_modes,
9035 .input_mux = &alc883_capture_source,
9036 .unsol_event = alc883_mitac_unsol_event,
9037 .init_hook = alc883_mitac_automute,
9039 [ALC883_FUJITSU_PI2515] = {
9040 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9041 .init_verbs = { alc883_init_verbs,
9042 alc883_2ch_fujitsu_pi2515_verbs},
9043 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9044 .dac_nids = alc883_dac_nids,
9045 .dig_out_nid = ALC883_DIGOUT_NID,
9046 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9047 .channel_mode = alc883_3ST_2ch_modes,
9048 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9049 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
9050 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
9052 [ALC888_FUJITSU_XA3530] = {
9053 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9054 .init_verbs = { alc883_init_verbs,
9055 alc888_fujitsu_xa3530_verbs },
9056 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9057 .dac_nids = alc883_dac_nids,
9058 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9059 .adc_nids = alc883_adc_nids_rev,
9060 .capsrc_nids = alc883_capsrc_nids_rev,
9061 .dig_out_nid = ALC883_DIGOUT_NID,
9062 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9063 .channel_mode = alc888_4ST_8ch_intel_modes,
9065 ARRAY_SIZE(alc888_2_capture_sources),
9066 .input_mux = alc888_2_capture_sources,
9067 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
9068 .init_hook = alc888_fujitsu_xa3530_automute,
9070 [ALC888_LENOVO_SKY] = {
9071 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9072 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9073 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9074 .dac_nids = alc883_dac_nids,
9075 .dig_out_nid = ALC883_DIGOUT_NID,
9076 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9077 .channel_mode = alc883_sixstack_modes,
9079 .input_mux = &alc883_lenovo_sky_capture_source,
9080 .unsol_event = alc883_lenovo_sky_unsol_event,
9081 .init_hook = alc888_lenovo_sky_front_automute,
9083 [ALC888_ASUS_M90V] = {
9084 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9085 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9086 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9087 .dac_nids = alc883_dac_nids,
9088 .dig_out_nid = ALC883_DIGOUT_NID,
9089 .dig_in_nid = ALC883_DIGIN_NID,
9090 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9091 .channel_mode = alc883_3ST_6ch_modes,
9093 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9094 .unsol_event = alc883_mode2_unsol_event,
9095 .init_hook = alc883_mode2_inithook,
9097 [ALC888_ASUS_EEE1601] = {
9098 .mixers = { alc883_asus_eee1601_mixer },
9099 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9100 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9101 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9102 .dac_nids = alc883_dac_nids,
9103 .dig_out_nid = ALC883_DIGOUT_NID,
9104 .dig_in_nid = ALC883_DIGIN_NID,
9105 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9106 .channel_mode = alc883_3ST_2ch_modes,
9108 .input_mux = &alc883_asus_eee1601_capture_source,
9109 .unsol_event = alc883_eee1601_unsol_event,
9110 .init_hook = alc883_eee1601_inithook,
9112 [ALC1200_ASUS_P5Q] = {
9113 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9114 .init_verbs = { alc883_init_verbs },
9115 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9116 .dac_nids = alc883_dac_nids,
9117 .dig_out_nid = ALC1200_DIGOUT_NID,
9118 .dig_in_nid = ALC883_DIGIN_NID,
9119 .slave_dig_outs = alc1200_slave_dig_outs,
9120 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9121 .channel_mode = alc883_sixstack_modes,
9122 .input_mux = &alc883_capture_source,
9128 * BIOS auto configuration
9130 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9131 hda_nid_t nid, int pin_type,
9135 struct alc_spec *spec = codec->spec;
9138 alc_set_pin_output(codec, nid, pin_type);
9139 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9142 idx = spec->multiout.dac_nids[dac_idx] - 2;
9143 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9147 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9149 struct alc_spec *spec = codec->spec;
9152 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
9153 for (i = 0; i <= HDA_SIDE; i++) {
9154 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9155 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9157 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9162 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9164 struct alc_spec *spec = codec->spec;
9167 pin = spec->autocfg.hp_pins[0];
9168 if (pin) /* connect to front */
9170 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9171 pin = spec->autocfg.speaker_pins[0];
9173 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9176 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9177 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9179 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9181 struct alc_spec *spec = codec->spec;
9184 for (i = 0; i < AUTO_PIN_LAST; i++) {
9185 hda_nid_t nid = spec->autocfg.input_pins[i];
9186 if (alc883_is_input_pin(nid)) {
9187 alc_set_input_pin(codec, nid, i);
9188 if (nid != ALC883_PIN_CD_NID &&
9189 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9190 snd_hda_codec_write(codec, nid, 0,
9191 AC_VERB_SET_AMP_GAIN_MUTE,
9197 #define alc883_auto_init_input_src alc882_auto_init_input_src
9199 /* almost identical with ALC880 parser... */
9200 static int alc883_parse_auto_config(struct hda_codec *codec)
9202 struct alc_spec *spec = codec->spec;
9203 int err = alc880_parse_auto_config(codec);
9204 struct auto_pin_cfg *cfg = &spec->autocfg;
9210 return 0; /* no config found */
9212 err = alc_auto_add_mic_boost(codec);
9216 /* hack - override the init verbs */
9217 spec->init_verbs[0] = alc883_auto_init_verbs;
9219 /* setup input_mux for ALC889 */
9220 if (codec->vendor_id == 0x10ec0889) {
9221 /* digital-mic input pin is excluded in alc880_auto_create..()
9222 * because it's under 0x18
9224 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9225 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9226 struct hda_input_mux *imux = &spec->private_imux[0];
9227 for (i = 1; i < 3; i++)
9228 memcpy(&spec->private_imux[i],
9229 &spec->private_imux[0],
9230 sizeof(spec->private_imux[0]));
9231 imux->items[imux->num_items].label = "Int DMic";
9232 imux->items[imux->num_items].index = 0x0b;
9234 spec->num_mux_defs = 3;
9235 spec->input_mux = spec->private_imux;
9239 return 1; /* config found */
9242 /* additional initialization for auto-configuration model */
9243 static void alc883_auto_init(struct hda_codec *codec)
9245 struct alc_spec *spec = codec->spec;
9246 alc883_auto_init_multi_out(codec);
9247 alc883_auto_init_hp_out(codec);
9248 alc883_auto_init_analog_input(codec);
9249 alc883_auto_init_input_src(codec);
9250 if (spec->unsol_event)
9251 alc_inithook(codec);
9254 static int patch_alc883(struct hda_codec *codec)
9256 struct alc_spec *spec;
9257 int err, board_config;
9259 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9265 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9267 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9270 if (board_config < 0) {
9271 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9272 "trying auto-probe from BIOS...\n");
9273 board_config = ALC883_AUTO;
9276 if (board_config == ALC883_AUTO) {
9277 /* automatic parse from the BIOS config */
9278 err = alc883_parse_auto_config(codec);
9284 "hda_codec: Cannot set up configuration "
9285 "from BIOS. Using base mode...\n");
9286 board_config = ALC883_3ST_2ch_DIG;
9290 err = snd_hda_attach_beep_device(codec, 0x1);
9296 if (board_config != ALC883_AUTO)
9297 setup_preset(spec, &alc883_presets[board_config]);
9299 switch (codec->vendor_id) {
9301 if (codec->revision_id == 0x100101) {
9302 spec->stream_name_analog = "ALC1200 Analog";
9303 spec->stream_name_digital = "ALC1200 Digital";
9305 spec->stream_name_analog = "ALC888 Analog";
9306 spec->stream_name_digital = "ALC888 Digital";
9308 if (!spec->num_adc_nids) {
9309 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9310 spec->adc_nids = alc883_adc_nids;
9312 if (!spec->capsrc_nids)
9313 spec->capsrc_nids = alc883_capsrc_nids;
9314 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9317 spec->stream_name_analog = "ALC889 Analog";
9318 spec->stream_name_digital = "ALC889 Digital";
9319 if (!spec->num_adc_nids) {
9320 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9321 spec->adc_nids = alc889_adc_nids;
9323 if (!spec->capsrc_nids)
9324 spec->capsrc_nids = alc889_capsrc_nids;
9325 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9329 spec->stream_name_analog = "ALC883 Analog";
9330 spec->stream_name_digital = "ALC883 Digital";
9331 if (!spec->num_adc_nids) {
9332 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9333 spec->adc_nids = alc883_adc_nids;
9335 if (!spec->capsrc_nids)
9336 spec->capsrc_nids = alc883_capsrc_nids;
9337 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9341 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9342 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9343 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9345 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9346 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9348 if (!spec->cap_mixer)
9349 set_capture_mixer(spec);
9350 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9352 spec->vmaster_nid = 0x0c;
9354 codec->patch_ops = alc_patch_ops;
9355 if (board_config == ALC883_AUTO)
9356 spec->init_hook = alc883_auto_init;
9358 #ifdef CONFIG_SND_HDA_POWER_SAVE
9359 if (!spec->loopback.amplist)
9360 spec->loopback.amplist = alc883_loopbacks;
9362 codec->proc_widget_hook = print_realtek_coef;
9371 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9372 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9374 #define alc262_dac_nids alc260_dac_nids
9375 #define alc262_adc_nids alc882_adc_nids
9376 #define alc262_adc_nids_alt alc882_adc_nids_alt
9377 #define alc262_capsrc_nids alc882_capsrc_nids
9378 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9380 #define alc262_modes alc260_modes
9381 #define alc262_capture_source alc882_capture_source
9383 static hda_nid_t alc262_dmic_adc_nids[1] = {
9388 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9390 static struct snd_kcontrol_new alc262_base_mixer[] = {
9391 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9392 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9393 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9394 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9395 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9396 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9397 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9400 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9401 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9402 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9403 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9405 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9406 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9410 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9411 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9412 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9413 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9414 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9415 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9416 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9418 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9419 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9420 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9421 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9422 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9423 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9428 /* update HP, line and mono-out pins according to the master switch */
9429 static void alc262_hp_master_update(struct hda_codec *codec)
9431 struct alc_spec *spec = codec->spec;
9432 int val = spec->master_sw;
9435 snd_hda_codec_write_cache(codec, 0x1b, 0,
9436 AC_VERB_SET_PIN_WIDGET_CONTROL,
9438 snd_hda_codec_write_cache(codec, 0x15, 0,
9439 AC_VERB_SET_PIN_WIDGET_CONTROL,
9441 /* mono (speaker) depending on the HP jack sense */
9442 val = val && !spec->jack_present;
9443 snd_hda_codec_write_cache(codec, 0x16, 0,
9444 AC_VERB_SET_PIN_WIDGET_CONTROL,
9448 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9450 struct alc_spec *spec = codec->spec;
9451 unsigned int presence;
9452 presence = snd_hda_codec_read(codec, 0x1b, 0,
9453 AC_VERB_GET_PIN_SENSE, 0);
9454 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9455 alc262_hp_master_update(codec);
9458 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9460 if ((res >> 26) != ALC880_HP_EVENT)
9462 alc262_hp_bpc_automute(codec);
9465 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9467 struct alc_spec *spec = codec->spec;
9468 unsigned int presence;
9469 presence = snd_hda_codec_read(codec, 0x15, 0,
9470 AC_VERB_GET_PIN_SENSE, 0);
9471 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9472 alc262_hp_master_update(codec);
9475 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9478 if ((res >> 26) != ALC880_HP_EVENT)
9480 alc262_hp_wildwest_automute(codec);
9483 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9484 struct snd_ctl_elem_value *ucontrol)
9486 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9487 struct alc_spec *spec = codec->spec;
9488 *ucontrol->value.integer.value = spec->master_sw;
9492 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9493 struct snd_ctl_elem_value *ucontrol)
9495 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9496 struct alc_spec *spec = codec->spec;
9497 int val = !!*ucontrol->value.integer.value;
9499 if (val == spec->master_sw)
9501 spec->master_sw = val;
9502 alc262_hp_master_update(codec);
9506 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9509 .name = "Master Playback Switch",
9510 .info = snd_ctl_boolean_mono_info,
9511 .get = alc262_hp_master_sw_get,
9512 .put = alc262_hp_master_sw_put,
9514 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9515 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9516 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9517 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9519 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9521 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9522 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9523 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9524 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9525 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9526 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9527 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9528 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9529 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9530 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9531 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9532 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9536 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9538 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9539 .name = "Master Playback Switch",
9540 .info = snd_ctl_boolean_mono_info,
9541 .get = alc262_hp_master_sw_get,
9542 .put = alc262_hp_master_sw_put,
9544 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9545 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9546 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9547 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9548 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9550 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9552 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9553 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9554 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9555 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9556 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9557 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9558 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9562 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9563 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9564 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9565 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9569 /* mute/unmute internal speaker according to the hp jack and mute state */
9570 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9572 struct alc_spec *spec = codec->spec;
9574 if (force || !spec->sense_updated) {
9575 unsigned int present;
9576 present = snd_hda_codec_read(codec, 0x15, 0,
9577 AC_VERB_GET_PIN_SENSE, 0);
9578 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9579 spec->sense_updated = 1;
9581 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9582 spec->jack_present ? HDA_AMP_MUTE : 0);
9585 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9588 if ((res >> 26) != ALC880_HP_EVENT)
9590 alc262_hp_t5735_automute(codec, 1);
9593 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9595 alc262_hp_t5735_automute(codec, 1);
9598 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9599 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9600 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9601 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9602 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9609 static struct hda_verb alc262_hp_t5735_verbs[] = {
9610 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9613 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9617 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9618 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9620 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9621 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9622 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9623 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9627 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9629 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9630 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9631 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9632 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9633 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9635 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9637 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9641 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9648 /* bind hp and internal speaker mute (with plug check) */
9649 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9650 struct snd_ctl_elem_value *ucontrol)
9652 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9653 long *valp = ucontrol->value.integer.value;
9656 /* change hp mute */
9657 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9659 valp[0] ? 0 : HDA_AMP_MUTE);
9660 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9662 valp[1] ? 0 : HDA_AMP_MUTE);
9664 /* change speaker according to HP jack state */
9665 struct alc_spec *spec = codec->spec;
9667 if (spec->jack_present)
9668 mute = HDA_AMP_MUTE;
9670 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9672 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9673 HDA_AMP_MUTE, mute);
9678 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9679 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9681 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9682 .name = "Master Playback Switch",
9683 .info = snd_hda_mixer_amp_switch_info,
9684 .get = snd_hda_mixer_amp_switch_get,
9685 .put = alc262_sony_master_sw_put,
9686 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9690 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9691 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9695 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9696 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9697 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9698 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9699 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9700 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9701 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9702 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9706 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9707 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9708 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9709 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9710 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9714 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9715 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9716 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9717 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9718 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9722 static struct hda_verb alc262_tyan_verbs[] = {
9723 /* Headphone automute */
9724 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9725 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9726 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9728 /* P11 AUX_IN, white 4-pin connector */
9729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9730 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9731 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9732 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9737 /* unsolicited event for HP jack sensing */
9738 static void alc262_tyan_automute(struct hda_codec *codec)
9741 unsigned int present;
9743 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9744 present = snd_hda_codec_read(codec, 0x1b, 0,
9745 AC_VERB_GET_PIN_SENSE, 0);
9746 present = (present & 0x80000000) != 0;
9748 /* mute line output on ATX panel */
9749 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9750 HDA_AMP_MUTE, HDA_AMP_MUTE);
9752 /* unmute line output if necessary */
9753 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9754 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9755 HDA_AMP_MUTE, mute);
9759 static void alc262_tyan_unsol_event(struct hda_codec *codec,
9762 if ((res >> 26) != ALC880_HP_EVENT)
9764 alc262_tyan_automute(codec);
9767 #define alc262_capture_mixer alc882_capture_mixer
9768 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9771 * generic initialization of ADC, input mixers and output mixers
9773 static struct hda_verb alc262_init_verbs[] = {
9775 * Unmute ADC0-2 and set the default input to mic-in
9777 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9778 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9779 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9780 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9781 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9782 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9784 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9786 * Note: PASD motherboards uses the Line In 2 as the input for
9787 * front panel mic (mic 2)
9789 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9790 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9791 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9792 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9797 * Set up output mixers (0x0c - 0x0e)
9799 /* set vol=0 to output mixers */
9800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9802 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9803 /* set up input amps for analog loopback */
9804 /* Amp Indices: DAC = 0, mixer = 1 */
9805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9812 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9813 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9816 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9817 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9819 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9821 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9822 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9823 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9825 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9826 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9828 /* FIXME: use matrix-type input source selection */
9829 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9830 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9831 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9832 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9833 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9834 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9836 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9837 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9838 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9842 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9849 static struct hda_verb alc262_eapd_verbs[] = {
9850 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9851 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9855 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9856 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9857 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9861 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9862 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9863 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9864 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9866 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9871 static struct hda_verb alc262_sony_unsol_verbs[] = {
9872 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9873 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9874 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9876 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9881 static struct hda_input_mux alc262_dmic_capture_source = {
9884 { "Int DMic", 0x9 },
9889 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9890 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9891 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9898 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9899 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9902 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9903 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9904 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9905 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9906 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9910 static void alc262_dmic_automute(struct hda_codec *codec)
9912 unsigned int present;
9914 present = snd_hda_codec_read(codec, 0x18, 0,
9915 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9916 snd_hda_codec_write(codec, 0x22, 0,
9917 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9920 /* toggle speaker-output according to the hp-jack state */
9921 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9923 unsigned int present;
9926 present = snd_hda_codec_read(codec, 0x15, 0,
9927 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9928 bits = present ? 0 : PIN_OUT;
9929 snd_hda_codec_write(codec, 0x14, 0,
9930 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9935 /* unsolicited event for HP jack sensing */
9936 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9939 if ((res >> 26) == ALC880_HP_EVENT)
9940 alc262_toshiba_s06_speaker_automute(codec);
9941 if ((res >> 26) == ALC880_MIC_EVENT)
9942 alc262_dmic_automute(codec);
9946 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9948 alc262_toshiba_s06_speaker_automute(codec);
9949 alc262_dmic_automute(codec);
9952 /* mute/unmute internal speaker according to the hp jack and mute state */
9953 static void alc262_hippo_automute(struct hda_codec *codec)
9955 struct alc_spec *spec = codec->spec;
9957 unsigned int present;
9959 /* need to execute and sync at first */
9960 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9961 present = snd_hda_codec_read(codec, 0x15, 0,
9962 AC_VERB_GET_PIN_SENSE, 0);
9963 spec->jack_present = (present & 0x80000000) != 0;
9964 if (spec->jack_present) {
9965 /* mute internal speaker */
9966 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9967 HDA_AMP_MUTE, HDA_AMP_MUTE);
9969 /* unmute internal speaker if necessary */
9970 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9971 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9972 HDA_AMP_MUTE, mute);
9976 /* unsolicited event for HP jack sensing */
9977 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9980 if ((res >> 26) != ALC880_HP_EVENT)
9982 alc262_hippo_automute(codec);
9985 static void alc262_hippo1_automute(struct hda_codec *codec)
9988 unsigned int present;
9990 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9991 present = snd_hda_codec_read(codec, 0x1b, 0,
9992 AC_VERB_GET_PIN_SENSE, 0);
9993 present = (present & 0x80000000) != 0;
9995 /* mute internal speaker */
9996 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9997 HDA_AMP_MUTE, HDA_AMP_MUTE);
9999 /* unmute internal speaker if necessary */
10000 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10001 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10002 HDA_AMP_MUTE, mute);
10006 /* unsolicited event for HP jack sensing */
10007 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
10010 if ((res >> 26) != ALC880_HP_EVENT)
10012 alc262_hippo1_automute(codec);
10018 * 0x16 = internal speaker
10019 * 0x18 = external mic
10022 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10023 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10024 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10028 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10030 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10031 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10035 static struct hda_verb alc262_nec_verbs[] = {
10036 /* Unmute Speaker */
10037 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10040 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10041 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10043 /* External mic to headphone */
10044 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10045 /* External mic to speaker */
10046 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10052 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10053 * 0x1b = port replicator headphone out
10056 #define ALC_HP_EVENT 0x37
10058 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10059 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10060 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10061 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10062 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10066 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10067 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10068 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10072 static struct hda_input_mux alc262_fujitsu_capture_source = {
10076 { "Int Mic", 0x1 },
10081 static struct hda_input_mux alc262_HP_capture_source = {
10085 { "Front Mic", 0x1 },
10092 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10096 { "Front Mic", 0x2 },
10102 /* mute/unmute internal speaker according to the hp jacks and mute state */
10103 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10105 struct alc_spec *spec = codec->spec;
10108 if (force || !spec->sense_updated) {
10109 unsigned int present;
10110 /* need to execute and sync at first */
10111 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10112 /* check laptop HP jack */
10113 present = snd_hda_codec_read(codec, 0x14, 0,
10114 AC_VERB_GET_PIN_SENSE, 0);
10115 /* need to execute and sync at first */
10116 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10117 /* check docking HP jack */
10118 present |= snd_hda_codec_read(codec, 0x1b, 0,
10119 AC_VERB_GET_PIN_SENSE, 0);
10120 if (present & AC_PINSENSE_PRESENCE)
10121 spec->jack_present = 1;
10123 spec->jack_present = 0;
10124 spec->sense_updated = 1;
10126 /* unmute internal speaker only if both HPs are unplugged and
10127 * master switch is on
10129 if (spec->jack_present)
10130 mute = HDA_AMP_MUTE;
10132 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10133 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10134 HDA_AMP_MUTE, mute);
10137 /* unsolicited event for HP jack sensing */
10138 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10141 if ((res >> 26) != ALC_HP_EVENT)
10143 alc262_fujitsu_automute(codec, 1);
10146 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10148 alc262_fujitsu_automute(codec, 1);
10151 /* bind volumes of both NID 0x0c and 0x0d */
10152 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10153 .ops = &snd_hda_bind_vol,
10155 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10156 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10161 /* mute/unmute internal speaker according to the hp jack and mute state */
10162 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10164 struct alc_spec *spec = codec->spec;
10167 if (force || !spec->sense_updated) {
10168 unsigned int present_int_hp;
10169 /* need to execute and sync at first */
10170 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10171 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10172 AC_VERB_GET_PIN_SENSE, 0);
10173 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10174 spec->sense_updated = 1;
10176 if (spec->jack_present) {
10177 /* mute internal speaker */
10178 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10179 HDA_AMP_MUTE, HDA_AMP_MUTE);
10180 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10181 HDA_AMP_MUTE, HDA_AMP_MUTE);
10183 /* unmute internal speaker if necessary */
10184 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10185 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10186 HDA_AMP_MUTE, mute);
10187 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10188 HDA_AMP_MUTE, mute);
10192 /* unsolicited event for HP jack sensing */
10193 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10196 if ((res >> 26) != ALC_HP_EVENT)
10198 alc262_lenovo_3000_automute(codec, 1);
10201 /* bind hp and internal speaker mute (with plug check) */
10202 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10203 struct snd_ctl_elem_value *ucontrol)
10205 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10206 long *valp = ucontrol->value.integer.value;
10209 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10211 valp ? 0 : HDA_AMP_MUTE);
10212 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10214 valp ? 0 : HDA_AMP_MUTE);
10217 alc262_fujitsu_automute(codec, 0);
10221 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10222 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10225 .name = "Master Playback Switch",
10226 .info = snd_hda_mixer_amp_switch_info,
10227 .get = snd_hda_mixer_amp_switch_get,
10228 .put = alc262_fujitsu_master_sw_put,
10229 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10233 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10236 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10237 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10238 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10242 /* bind hp and internal speaker mute (with plug check) */
10243 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10244 struct snd_ctl_elem_value *ucontrol)
10246 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10247 long *valp = ucontrol->value.integer.value;
10250 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10252 valp ? 0 : HDA_AMP_MUTE);
10255 alc262_lenovo_3000_automute(codec, 0);
10259 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10260 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10262 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10263 .name = "Master Playback Switch",
10264 .info = snd_hda_mixer_amp_switch_info,
10265 .get = snd_hda_mixer_amp_switch_get,
10266 .put = alc262_lenovo_3000_master_sw_put,
10267 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10269 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10270 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10271 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10274 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10275 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10276 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10280 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10281 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10283 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10284 .name = "Master Playback Switch",
10285 .info = snd_hda_mixer_amp_switch_info,
10286 .get = snd_hda_mixer_amp_switch_get,
10287 .put = alc262_sony_master_sw_put,
10288 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10292 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10293 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10294 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10295 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10299 /* additional init verbs for Benq laptops */
10300 static struct hda_verb alc262_EAPD_verbs[] = {
10301 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10302 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10306 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10307 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10308 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10310 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10311 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10315 /* Samsung Q1 Ultra Vista model setup */
10316 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10317 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10318 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10321 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10322 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10326 static struct hda_verb alc262_ultra_verbs[] = {
10328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10332 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10333 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10334 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10335 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10338 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10341 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10343 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10345 /* ADC, choose mic */
10346 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10348 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10349 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10355 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10359 /* mute/unmute internal speaker according to the hp jack and mute state */
10360 static void alc262_ultra_automute(struct hda_codec *codec)
10362 struct alc_spec *spec = codec->spec;
10366 /* auto-mute only when HP is used as HP */
10367 if (!spec->cur_mux[0]) {
10368 unsigned int present;
10369 /* need to execute and sync at first */
10370 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10371 present = snd_hda_codec_read(codec, 0x15, 0,
10372 AC_VERB_GET_PIN_SENSE, 0);
10373 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10374 if (spec->jack_present)
10375 mute = HDA_AMP_MUTE;
10377 /* mute/unmute internal speaker */
10378 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10379 HDA_AMP_MUTE, mute);
10380 /* mute/unmute HP */
10381 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10382 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10385 /* unsolicited event for HP jack sensing */
10386 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10389 if ((res >> 26) != ALC880_HP_EVENT)
10391 alc262_ultra_automute(codec);
10394 static struct hda_input_mux alc262_ultra_capture_source = {
10398 { "Headphone", 0x7 },
10402 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10403 struct snd_ctl_elem_value *ucontrol)
10405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10406 struct alc_spec *spec = codec->spec;
10409 ret = alc_mux_enum_put(kcontrol, ucontrol);
10412 /* reprogram the HP pin as mic or HP according to the input source */
10413 snd_hda_codec_write_cache(codec, 0x15, 0,
10414 AC_VERB_SET_PIN_WIDGET_CONTROL,
10415 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10416 alc262_ultra_automute(codec); /* mute/unmute HP */
10420 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10421 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10422 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10424 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10425 .name = "Capture Source",
10426 .info = alc_mux_enum_info,
10427 .get = alc_mux_enum_get,
10428 .put = alc262_ultra_mux_enum_put,
10433 /* add playback controls from the parsed DAC table */
10434 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10435 const struct auto_pin_cfg *cfg)
10440 spec->multiout.num_dacs = 1; /* only use one dac */
10441 spec->multiout.dac_nids = spec->private_dac_nids;
10442 spec->multiout.dac_nids[0] = 2;
10444 nid = cfg->line_out_pins[0];
10446 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10447 "Front Playback Volume",
10448 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10451 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10452 "Front Playback Switch",
10453 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10458 nid = cfg->speaker_pins[0];
10461 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10462 "Speaker Playback Volume",
10463 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10467 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10468 "Speaker Playback Switch",
10469 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10474 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10475 "Speaker Playback Switch",
10476 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10482 nid = cfg->hp_pins[0];
10484 /* spec->multiout.hp_nid = 2; */
10486 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10487 "Headphone Playback Volume",
10488 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10492 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10493 "Headphone Playback Switch",
10494 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10499 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10500 "Headphone Playback Switch",
10501 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10510 /* identical with ALC880 */
10511 #define alc262_auto_create_analog_input_ctls \
10512 alc880_auto_create_analog_input_ctls
10515 * generic initialization of ADC, input mixers and output mixers
10517 static struct hda_verb alc262_volume_init_verbs[] = {
10519 * Unmute ADC0-2 and set the default input to mic-in
10521 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10523 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10524 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10525 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10526 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10528 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10530 * Note: PASD motherboards uses the Line In 2 as the input for
10531 * front panel mic (mic 2)
10533 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10535 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10536 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10538 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10541 * Set up output mixers (0x0c - 0x0f)
10543 /* set vol=0 to output mixers */
10544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10546 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10548 /* set up input amps for analog loopback */
10549 /* Amp Indices: DAC = 0, mixer = 1 */
10550 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10552 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10553 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10554 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10555 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10557 /* FIXME: use matrix-type input source selection */
10558 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10559 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10563 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10568 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10578 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10580 * Unmute ADC0-2 and set the default input to mic-in
10582 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10583 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10584 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10585 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10586 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10587 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10589 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10591 * Note: PASD motherboards uses the Line In 2 as the input for
10592 * front panel mic (mic 2)
10594 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10596 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10597 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10598 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10599 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10601 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10604 * Set up output mixers (0x0c - 0x0e)
10606 /* set vol=0 to output mixers */
10607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10608 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10609 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10611 /* set up input amps for analog loopback */
10612 /* Amp Indices: DAC = 0, mixer = 1 */
10613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10620 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10622 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10624 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10625 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10627 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10628 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10631 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10632 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10633 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10634 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10637 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10640 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10641 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10644 /* FIXME: use matrix-type input source selection */
10645 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10646 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10650 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10662 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10667 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10669 * Unmute ADC0-2 and set the default input to mic-in
10671 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10673 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10674 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10675 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10676 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10678 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10680 * Note: PASD motherboards uses the Line In 2 as the input for front
10681 * panel mic (mic 2)
10683 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10684 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10685 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10691 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10693 * Set up output mixers (0x0c - 0x0e)
10695 /* set vol=0 to output mixers */
10696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10697 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10698 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10700 /* set up input amps for analog loopback */
10701 /* Amp Indices: DAC = 0, mixer = 1 */
10702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10705 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10707 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10711 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10712 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10713 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10714 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10715 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10716 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10718 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10721 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10722 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10724 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10725 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10726 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10728 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10729 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10731 /* FIXME: use matrix-type input source selection */
10732 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10733 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10734 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10735 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10736 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10737 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10738 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10739 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10742 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10745 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10746 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10747 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10748 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10750 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10752 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10753 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10754 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10755 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10756 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10758 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10763 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10766 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10767 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10769 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10770 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10771 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10772 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10775 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10776 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10781 #ifdef CONFIG_SND_HDA_POWER_SAVE
10782 #define alc262_loopbacks alc880_loopbacks
10785 /* pcm configuration: identiacal with ALC880 */
10786 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10787 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10788 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10789 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10792 * BIOS auto configuration
10794 static int alc262_parse_auto_config(struct hda_codec *codec)
10796 struct alc_spec *spec = codec->spec;
10798 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10800 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10804 if (!spec->autocfg.line_outs) {
10805 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10806 spec->multiout.max_channels = 2;
10807 spec->no_analog = 1;
10810 return 0; /* can't find valid BIOS pin config */
10812 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10815 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10819 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10822 if (spec->autocfg.dig_outs) {
10823 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10824 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10826 if (spec->autocfg.dig_in_pin)
10827 spec->dig_in_nid = ALC262_DIGIN_NID;
10829 if (spec->kctls.list)
10830 add_mixer(spec, spec->kctls.list);
10832 add_verb(spec, alc262_volume_init_verbs);
10833 spec->num_mux_defs = 1;
10834 spec->input_mux = &spec->private_imux[0];
10836 err = alc_auto_add_mic_boost(codec);
10843 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10844 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10845 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10846 #define alc262_auto_init_input_src alc882_auto_init_input_src
10849 /* init callback for auto-configuration model -- overriding the default init */
10850 static void alc262_auto_init(struct hda_codec *codec)
10852 struct alc_spec *spec = codec->spec;
10853 alc262_auto_init_multi_out(codec);
10854 alc262_auto_init_hp_out(codec);
10855 alc262_auto_init_analog_input(codec);
10856 alc262_auto_init_input_src(codec);
10857 if (spec->unsol_event)
10858 alc_inithook(codec);
10862 * configuration and preset
10864 static const char *alc262_models[ALC262_MODEL_LAST] = {
10865 [ALC262_BASIC] = "basic",
10866 [ALC262_HIPPO] = "hippo",
10867 [ALC262_HIPPO_1] = "hippo_1",
10868 [ALC262_FUJITSU] = "fujitsu",
10869 [ALC262_HP_BPC] = "hp-bpc",
10870 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10871 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10872 [ALC262_HP_RP5700] = "hp-rp5700",
10873 [ALC262_BENQ_ED8] = "benq",
10874 [ALC262_BENQ_T31] = "benq-t31",
10875 [ALC262_SONY_ASSAMD] = "sony-assamd",
10876 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10877 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10878 [ALC262_ULTRA] = "ultra",
10879 [ALC262_LENOVO_3000] = "lenovo-3000",
10880 [ALC262_NEC] = "nec",
10881 [ALC262_TYAN] = "tyan",
10882 [ALC262_AUTO] = "auto",
10885 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10886 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10887 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10888 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10890 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10892 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10894 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10895 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10896 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10897 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10898 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10899 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10900 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10901 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10902 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10903 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10904 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10905 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10906 ALC262_HP_TC_T5735),
10907 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10908 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10909 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10910 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10911 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10912 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10913 ALC262_SONY_ASSAMD),
10914 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10915 ALC262_TOSHIBA_RX1),
10916 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10917 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10918 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10919 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10920 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10922 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10923 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10924 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10925 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10926 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10930 static struct alc_config_preset alc262_presets[] = {
10932 .mixers = { alc262_base_mixer },
10933 .init_verbs = { alc262_init_verbs },
10934 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10935 .dac_nids = alc262_dac_nids,
10937 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10938 .channel_mode = alc262_modes,
10939 .input_mux = &alc262_capture_source,
10942 .mixers = { alc262_base_mixer },
10943 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10944 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10945 .dac_nids = alc262_dac_nids,
10947 .dig_out_nid = ALC262_DIGOUT_NID,
10948 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10949 .channel_mode = alc262_modes,
10950 .input_mux = &alc262_capture_source,
10951 .unsol_event = alc262_hippo_unsol_event,
10952 .init_hook = alc262_hippo_automute,
10954 [ALC262_HIPPO_1] = {
10955 .mixers = { alc262_hippo1_mixer },
10956 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10957 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10958 .dac_nids = alc262_dac_nids,
10960 .dig_out_nid = ALC262_DIGOUT_NID,
10961 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10962 .channel_mode = alc262_modes,
10963 .input_mux = &alc262_capture_source,
10964 .unsol_event = alc262_hippo1_unsol_event,
10965 .init_hook = alc262_hippo1_automute,
10967 [ALC262_FUJITSU] = {
10968 .mixers = { alc262_fujitsu_mixer },
10969 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10970 alc262_fujitsu_unsol_verbs },
10971 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10972 .dac_nids = alc262_dac_nids,
10974 .dig_out_nid = ALC262_DIGOUT_NID,
10975 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10976 .channel_mode = alc262_modes,
10977 .input_mux = &alc262_fujitsu_capture_source,
10978 .unsol_event = alc262_fujitsu_unsol_event,
10979 .init_hook = alc262_fujitsu_init_hook,
10981 [ALC262_HP_BPC] = {
10982 .mixers = { alc262_HP_BPC_mixer },
10983 .init_verbs = { alc262_HP_BPC_init_verbs },
10984 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10985 .dac_nids = alc262_dac_nids,
10987 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10988 .channel_mode = alc262_modes,
10989 .input_mux = &alc262_HP_capture_source,
10990 .unsol_event = alc262_hp_bpc_unsol_event,
10991 .init_hook = alc262_hp_bpc_automute,
10993 [ALC262_HP_BPC_D7000_WF] = {
10994 .mixers = { alc262_HP_BPC_WildWest_mixer },
10995 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10996 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10997 .dac_nids = alc262_dac_nids,
10999 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11000 .channel_mode = alc262_modes,
11001 .input_mux = &alc262_HP_D7000_capture_source,
11002 .unsol_event = alc262_hp_wildwest_unsol_event,
11003 .init_hook = alc262_hp_wildwest_automute,
11005 [ALC262_HP_BPC_D7000_WL] = {
11006 .mixers = { alc262_HP_BPC_WildWest_mixer,
11007 alc262_HP_BPC_WildWest_option_mixer },
11008 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11009 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11010 .dac_nids = alc262_dac_nids,
11012 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11013 .channel_mode = alc262_modes,
11014 .input_mux = &alc262_HP_D7000_capture_source,
11015 .unsol_event = alc262_hp_wildwest_unsol_event,
11016 .init_hook = alc262_hp_wildwest_automute,
11018 [ALC262_HP_TC_T5735] = {
11019 .mixers = { alc262_hp_t5735_mixer },
11020 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11021 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11022 .dac_nids = alc262_dac_nids,
11024 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11025 .channel_mode = alc262_modes,
11026 .input_mux = &alc262_capture_source,
11027 .unsol_event = alc262_hp_t5735_unsol_event,
11028 .init_hook = alc262_hp_t5735_init_hook,
11030 [ALC262_HP_RP5700] = {
11031 .mixers = { alc262_hp_rp5700_mixer },
11032 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11033 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11034 .dac_nids = alc262_dac_nids,
11035 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11036 .channel_mode = alc262_modes,
11037 .input_mux = &alc262_hp_rp5700_capture_source,
11039 [ALC262_BENQ_ED8] = {
11040 .mixers = { alc262_base_mixer },
11041 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11042 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11043 .dac_nids = alc262_dac_nids,
11045 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11046 .channel_mode = alc262_modes,
11047 .input_mux = &alc262_capture_source,
11049 [ALC262_SONY_ASSAMD] = {
11050 .mixers = { alc262_sony_mixer },
11051 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11052 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11053 .dac_nids = alc262_dac_nids,
11055 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11056 .channel_mode = alc262_modes,
11057 .input_mux = &alc262_capture_source,
11058 .unsol_event = alc262_hippo_unsol_event,
11059 .init_hook = alc262_hippo_automute,
11061 [ALC262_BENQ_T31] = {
11062 .mixers = { alc262_benq_t31_mixer },
11063 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11064 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11065 .dac_nids = alc262_dac_nids,
11067 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11068 .channel_mode = alc262_modes,
11069 .input_mux = &alc262_capture_source,
11070 .unsol_event = alc262_hippo_unsol_event,
11071 .init_hook = alc262_hippo_automute,
11074 .mixers = { alc262_ultra_mixer },
11075 .cap_mixer = alc262_ultra_capture_mixer,
11076 .init_verbs = { alc262_ultra_verbs },
11077 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11078 .dac_nids = alc262_dac_nids,
11079 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11080 .channel_mode = alc262_modes,
11081 .input_mux = &alc262_ultra_capture_source,
11082 .adc_nids = alc262_adc_nids, /* ADC0 */
11083 .capsrc_nids = alc262_capsrc_nids,
11084 .num_adc_nids = 1, /* single ADC */
11085 .unsol_event = alc262_ultra_unsol_event,
11086 .init_hook = alc262_ultra_automute,
11088 [ALC262_LENOVO_3000] = {
11089 .mixers = { alc262_lenovo_3000_mixer },
11090 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11091 alc262_lenovo_3000_unsol_verbs },
11092 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11093 .dac_nids = alc262_dac_nids,
11095 .dig_out_nid = ALC262_DIGOUT_NID,
11096 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11097 .channel_mode = alc262_modes,
11098 .input_mux = &alc262_fujitsu_capture_source,
11099 .unsol_event = alc262_lenovo_3000_unsol_event,
11102 .mixers = { alc262_nec_mixer },
11103 .init_verbs = { alc262_nec_verbs },
11104 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11105 .dac_nids = alc262_dac_nids,
11107 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11108 .channel_mode = alc262_modes,
11109 .input_mux = &alc262_capture_source,
11111 [ALC262_TOSHIBA_S06] = {
11112 .mixers = { alc262_toshiba_s06_mixer },
11113 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11114 alc262_eapd_verbs },
11115 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11116 .capsrc_nids = alc262_dmic_capsrc_nids,
11117 .dac_nids = alc262_dac_nids,
11118 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11119 .dig_out_nid = ALC262_DIGOUT_NID,
11120 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11121 .channel_mode = alc262_modes,
11122 .input_mux = &alc262_dmic_capture_source,
11123 .unsol_event = alc262_toshiba_s06_unsol_event,
11124 .init_hook = alc262_toshiba_s06_init_hook,
11126 [ALC262_TOSHIBA_RX1] = {
11127 .mixers = { alc262_toshiba_rx1_mixer },
11128 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11129 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11130 .dac_nids = alc262_dac_nids,
11132 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11133 .channel_mode = alc262_modes,
11134 .input_mux = &alc262_capture_source,
11135 .unsol_event = alc262_hippo_unsol_event,
11136 .init_hook = alc262_hippo_automute,
11139 .mixers = { alc262_tyan_mixer },
11140 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11141 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11142 .dac_nids = alc262_dac_nids,
11144 .dig_out_nid = ALC262_DIGOUT_NID,
11145 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11146 .channel_mode = alc262_modes,
11147 .input_mux = &alc262_capture_source,
11148 .unsol_event = alc262_tyan_unsol_event,
11149 .init_hook = alc262_tyan_automute,
11153 static int patch_alc262(struct hda_codec *codec)
11155 struct alc_spec *spec;
11159 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11163 codec->spec = spec;
11165 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11170 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11171 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11172 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11173 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11177 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11179 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11183 if (board_config < 0) {
11184 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
11185 "trying auto-probe from BIOS...\n");
11186 board_config = ALC262_AUTO;
11189 if (board_config == ALC262_AUTO) {
11190 /* automatic parse from the BIOS config */
11191 err = alc262_parse_auto_config(codec);
11197 "hda_codec: Cannot set up configuration "
11198 "from BIOS. Using base mode...\n");
11199 board_config = ALC262_BASIC;
11203 if (!spec->no_analog) {
11204 err = snd_hda_attach_beep_device(codec, 0x1);
11211 if (board_config != ALC262_AUTO)
11212 setup_preset(spec, &alc262_presets[board_config]);
11214 spec->stream_name_analog = "ALC262 Analog";
11215 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11216 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11218 spec->stream_name_digital = "ALC262 Digital";
11219 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11220 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11222 spec->capture_style = CAPT_MIX;
11223 if (!spec->adc_nids && spec->input_mux) {
11224 /* check whether NID 0x07 is valid */
11225 unsigned int wcap = get_wcaps(codec, 0x07);
11228 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11229 if (wcap != AC_WID_AUD_IN) {
11230 spec->adc_nids = alc262_adc_nids_alt;
11231 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11232 spec->capsrc_nids = alc262_capsrc_nids_alt;
11234 spec->adc_nids = alc262_adc_nids;
11235 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11236 spec->capsrc_nids = alc262_capsrc_nids;
11239 if (!spec->cap_mixer && !spec->no_analog)
11240 set_capture_mixer(spec);
11241 if (!spec->no_analog)
11242 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11244 spec->vmaster_nid = 0x0c;
11246 codec->patch_ops = alc_patch_ops;
11247 if (board_config == ALC262_AUTO)
11248 spec->init_hook = alc262_auto_init;
11249 #ifdef CONFIG_SND_HDA_POWER_SAVE
11250 if (!spec->loopback.amplist)
11251 spec->loopback.amplist = alc262_loopbacks;
11253 codec->proc_widget_hook = print_realtek_coef;
11259 * ALC268 channel source setting (2 channel)
11261 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11262 #define alc268_modes alc260_modes
11264 static hda_nid_t alc268_dac_nids[2] = {
11269 static hda_nid_t alc268_adc_nids[2] = {
11274 static hda_nid_t alc268_adc_nids_alt[1] = {
11279 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11281 static struct snd_kcontrol_new alc268_base_mixer[] = {
11282 /* output mixer control */
11283 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11284 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11285 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11286 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11287 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11288 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11289 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11293 /* bind Beep switches of both NID 0x0f and 0x10 */
11294 static struct hda_bind_ctls alc268_bind_beep_sw = {
11295 .ops = &snd_hda_bind_sw,
11297 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11298 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11303 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11304 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11305 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11309 static struct hda_verb alc268_eapd_verbs[] = {
11310 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11311 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11315 /* Toshiba specific */
11316 #define alc268_toshiba_automute alc262_hippo_automute
11318 static struct hda_verb alc268_toshiba_verbs[] = {
11319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11323 static struct hda_input_mux alc268_acer_lc_capture_source = {
11331 /* Acer specific */
11332 /* bind volumes of both NID 0x02 and 0x03 */
11333 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11334 .ops = &snd_hda_bind_vol,
11336 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11337 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11342 /* mute/unmute internal speaker according to the hp jack and mute state */
11343 static void alc268_acer_automute(struct hda_codec *codec, int force)
11345 struct alc_spec *spec = codec->spec;
11348 if (force || !spec->sense_updated) {
11349 unsigned int present;
11350 present = snd_hda_codec_read(codec, 0x14, 0,
11351 AC_VERB_GET_PIN_SENSE, 0);
11352 spec->jack_present = (present & 0x80000000) != 0;
11353 spec->sense_updated = 1;
11355 if (spec->jack_present)
11356 mute = HDA_AMP_MUTE; /* mute internal speaker */
11357 else /* unmute internal speaker if necessary */
11358 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11359 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11360 HDA_AMP_MUTE, mute);
11364 /* bind hp and internal speaker mute (with plug check) */
11365 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11366 struct snd_ctl_elem_value *ucontrol)
11368 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11369 long *valp = ucontrol->value.integer.value;
11372 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11374 valp[0] ? 0 : HDA_AMP_MUTE);
11375 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11377 valp[1] ? 0 : HDA_AMP_MUTE);
11379 alc268_acer_automute(codec, 0);
11383 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11384 /* output mixer control */
11385 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11388 .name = "Master Playback Switch",
11389 .info = snd_hda_mixer_amp_switch_info,
11390 .get = snd_hda_mixer_amp_switch_get,
11391 .put = alc268_acer_master_sw_put,
11392 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11394 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11398 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11399 /* output mixer control */
11400 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11402 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11403 .name = "Master Playback Switch",
11404 .info = snd_hda_mixer_amp_switch_info,
11405 .get = snd_hda_mixer_amp_switch_get,
11406 .put = alc268_acer_master_sw_put,
11407 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11409 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11410 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11411 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11415 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11416 /* output mixer control */
11417 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11420 .name = "Master Playback Switch",
11421 .info = snd_hda_mixer_amp_switch_info,
11422 .get = snd_hda_mixer_amp_switch_get,
11423 .put = alc268_acer_master_sw_put,
11424 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11426 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11427 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11431 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11433 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11434 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11435 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11436 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11437 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11441 static struct hda_verb alc268_acer_verbs[] = {
11442 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11443 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11446 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11447 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11448 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11452 /* unsolicited event for HP jack sensing */
11453 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11456 if ((res >> 26) != ALC880_HP_EVENT)
11458 alc268_toshiba_automute(codec);
11461 static void alc268_acer_unsol_event(struct hda_codec *codec,
11464 if ((res >> 26) != ALC880_HP_EVENT)
11466 alc268_acer_automute(codec, 1);
11469 static void alc268_acer_init_hook(struct hda_codec *codec)
11471 alc268_acer_automute(codec, 1);
11474 /* toggle speaker-output according to the hp-jack state */
11475 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11477 unsigned int present;
11478 unsigned char bits;
11480 present = snd_hda_codec_read(codec, 0x15, 0,
11481 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11482 bits = present ? AMP_IN_MUTE(0) : 0;
11483 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11484 AMP_IN_MUTE(0), bits);
11485 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11486 AMP_IN_MUTE(0), bits);
11490 static void alc268_acer_mic_automute(struct hda_codec *codec)
11492 unsigned int present;
11494 present = snd_hda_codec_read(codec, 0x18, 0,
11495 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11496 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11497 present ? 0x0 : 0x6);
11500 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11503 if ((res >> 26) == ALC880_HP_EVENT)
11504 alc268_aspire_one_speaker_automute(codec);
11505 if ((res >> 26) == ALC880_MIC_EVENT)
11506 alc268_acer_mic_automute(codec);
11509 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11511 alc268_aspire_one_speaker_automute(codec);
11512 alc268_acer_mic_automute(codec);
11515 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11516 /* output mixer control */
11517 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11518 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11521 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11522 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11526 static struct hda_verb alc268_dell_verbs[] = {
11527 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11529 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11533 /* mute/unmute internal speaker according to the hp jack and mute state */
11534 static void alc268_dell_automute(struct hda_codec *codec)
11536 unsigned int present;
11539 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11540 if (present & 0x80000000)
11541 mute = HDA_AMP_MUTE;
11543 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11544 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11545 HDA_AMP_MUTE, mute);
11548 static void alc268_dell_unsol_event(struct hda_codec *codec,
11551 if ((res >> 26) != ALC880_HP_EVENT)
11553 alc268_dell_automute(codec);
11556 #define alc268_dell_init_hook alc268_dell_automute
11558 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11559 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11560 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11561 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11562 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11563 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11564 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11565 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11566 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11570 static struct hda_verb alc267_quanta_il1_verbs[] = {
11571 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11572 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11576 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11578 unsigned int present;
11580 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11581 & AC_PINSENSE_PRESENCE;
11582 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11583 present ? 0 : PIN_OUT);
11586 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11588 unsigned int present;
11590 present = snd_hda_codec_read(codec, 0x18, 0,
11591 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11592 snd_hda_codec_write(codec, 0x23, 0,
11593 AC_VERB_SET_CONNECT_SEL,
11594 present ? 0x00 : 0x01);
11597 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11599 alc267_quanta_il1_hp_automute(codec);
11600 alc267_quanta_il1_mic_automute(codec);
11603 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11606 switch (res >> 26) {
11607 case ALC880_HP_EVENT:
11608 alc267_quanta_il1_hp_automute(codec);
11610 case ALC880_MIC_EVENT:
11611 alc267_quanta_il1_mic_automute(codec);
11617 * generic initialization of ADC, input mixers and output mixers
11619 static struct hda_verb alc268_base_init_verbs[] = {
11620 /* Unmute DAC0-1 and set vol = 0 */
11621 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11622 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11625 * Set up output mixers (0x0c - 0x0e)
11627 /* set vol=0 to output mixers */
11628 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11629 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11631 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11632 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11634 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11636 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11637 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11638 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11639 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11640 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11641 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11643 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11645 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11646 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11649 /* set PCBEEP vol = 0, mute connections */
11650 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11651 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11652 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11654 /* Unmute Selector 23h,24h and set the default input to mic-in */
11656 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11658 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11665 * generic initialization of ADC, input mixers and output mixers
11667 static struct hda_verb alc268_volume_init_verbs[] = {
11668 /* set output DAC */
11669 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11670 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11672 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11673 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11674 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11675 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11676 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11678 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11679 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11680 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11683 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11685 /* set PCBEEP vol = 0, mute connections */
11686 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11687 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11688 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11693 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11694 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11695 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11698 /* The multiple "Capture Source" controls confuse alsamixer
11699 * So call somewhat different..
11701 /* .name = "Capture Source", */
11702 .name = "Input Source",
11704 .info = alc_mux_enum_info,
11705 .get = alc_mux_enum_get,
11706 .put = alc_mux_enum_put,
11711 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11712 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11713 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11714 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11715 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11717 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11718 /* The multiple "Capture Source" controls confuse alsamixer
11719 * So call somewhat different..
11721 /* .name = "Capture Source", */
11722 .name = "Input Source",
11724 .info = alc_mux_enum_info,
11725 .get = alc_mux_enum_get,
11726 .put = alc_mux_enum_put,
11731 static struct hda_input_mux alc268_capture_source = {
11735 { "Front Mic", 0x1 },
11741 static struct hda_input_mux alc268_acer_capture_source = {
11745 { "Internal Mic", 0x1 },
11750 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11754 { "Internal Mic", 0x6 },
11759 #ifdef CONFIG_SND_DEBUG
11760 static struct snd_kcontrol_new alc268_test_mixer[] = {
11761 /* Volume widgets */
11762 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11763 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11764 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11765 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11766 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11767 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11768 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11769 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11770 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11771 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11772 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11773 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11774 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11775 /* The below appears problematic on some hardwares */
11776 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11777 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11778 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11779 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11780 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11782 /* Modes for retasking pin widgets */
11783 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11784 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11785 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11786 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11788 /* Controls for GPIO pins, assuming they are configured as outputs */
11789 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11790 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11791 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11792 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11794 /* Switches to allow the digital SPDIF output pin to be enabled.
11795 * The ALC268 does not have an SPDIF input.
11797 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11799 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11800 * this output to turn on an external amplifier.
11802 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11803 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11809 /* create input playback/capture controls for the given pin */
11810 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11811 const char *ctlname, int idx)
11816 sprintf(name, "%s Playback Volume", ctlname);
11818 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11819 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11823 } else if (nid == 0x15) {
11824 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11825 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11831 sprintf(name, "%s Playback Switch", ctlname);
11832 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11833 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11839 /* add playback controls from the parsed DAC table */
11840 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11841 const struct auto_pin_cfg *cfg)
11846 spec->multiout.num_dacs = 2; /* only use one dac */
11847 spec->multiout.dac_nids = spec->private_dac_nids;
11848 spec->multiout.dac_nids[0] = 2;
11849 spec->multiout.dac_nids[1] = 3;
11851 nid = cfg->line_out_pins[0];
11853 alc268_new_analog_output(spec, nid, "Front", 0);
11855 nid = cfg->speaker_pins[0];
11857 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11858 "Speaker Playback Volume",
11859 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11863 nid = cfg->hp_pins[0];
11865 alc268_new_analog_output(spec, nid, "Headphone", 0);
11867 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11869 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11870 "Mono Playback Switch",
11871 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11878 /* create playback/capture controls for input pins */
11879 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11880 const struct auto_pin_cfg *cfg)
11882 struct hda_input_mux *imux = &spec->private_imux[0];
11885 for (i = 0; i < AUTO_PIN_LAST; i++) {
11886 switch(cfg->input_pins[i]) {
11888 idx1 = 0; /* Mic 1 */
11891 idx1 = 1; /* Mic 2 */
11894 idx1 = 2; /* Line In */
11901 idx1 = 6; /* digital mics */
11906 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11907 imux->items[imux->num_items].index = idx1;
11913 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11915 struct alc_spec *spec = codec->spec;
11916 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11917 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11918 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11919 unsigned int dac_vol1, dac_vol2;
11922 snd_hda_codec_write(codec, speaker_nid, 0,
11923 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11924 snd_hda_codec_write(codec, 0x0f, 0,
11925 AC_VERB_SET_AMP_GAIN_MUTE,
11927 snd_hda_codec_write(codec, 0x10, 0,
11928 AC_VERB_SET_AMP_GAIN_MUTE,
11931 snd_hda_codec_write(codec, 0x0f, 0,
11932 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11933 snd_hda_codec_write(codec, 0x10, 0,
11934 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11937 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11938 if (line_nid == 0x14)
11939 dac_vol2 = AMP_OUT_ZERO;
11940 else if (line_nid == 0x15)
11941 dac_vol1 = AMP_OUT_ZERO;
11942 if (hp_nid == 0x14)
11943 dac_vol2 = AMP_OUT_ZERO;
11944 else if (hp_nid == 0x15)
11945 dac_vol1 = AMP_OUT_ZERO;
11946 if (line_nid != 0x16 || hp_nid != 0x16 ||
11947 spec->autocfg.line_out_pins[1] != 0x16 ||
11948 spec->autocfg.line_out_pins[2] != 0x16)
11949 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11951 snd_hda_codec_write(codec, 0x02, 0,
11952 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11953 snd_hda_codec_write(codec, 0x03, 0,
11954 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11957 /* pcm configuration: identiacal with ALC880 */
11958 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11959 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11960 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11961 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11964 * BIOS auto configuration
11966 static int alc268_parse_auto_config(struct hda_codec *codec)
11968 struct alc_spec *spec = codec->spec;
11970 static hda_nid_t alc268_ignore[] = { 0 };
11972 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11976 if (!spec->autocfg.line_outs) {
11977 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11978 spec->multiout.max_channels = 2;
11979 spec->no_analog = 1;
11982 return 0; /* can't find valid BIOS pin config */
11984 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11987 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11991 spec->multiout.max_channels = 2;
11994 /* digital only support output */
11995 if (spec->autocfg.dig_outs) {
11996 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11997 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11999 if (spec->kctls.list)
12000 add_mixer(spec, spec->kctls.list);
12002 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12003 add_mixer(spec, alc268_beep_mixer);
12005 add_verb(spec, alc268_volume_init_verbs);
12006 spec->num_mux_defs = 1;
12007 spec->input_mux = &spec->private_imux[0];
12009 err = alc_auto_add_mic_boost(codec);
12016 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12017 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12018 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12020 /* init callback for auto-configuration model -- overriding the default init */
12021 static void alc268_auto_init(struct hda_codec *codec)
12023 struct alc_spec *spec = codec->spec;
12024 alc268_auto_init_multi_out(codec);
12025 alc268_auto_init_hp_out(codec);
12026 alc268_auto_init_mono_speaker_out(codec);
12027 alc268_auto_init_analog_input(codec);
12028 if (spec->unsol_event)
12029 alc_inithook(codec);
12033 * configuration and preset
12035 static const char *alc268_models[ALC268_MODEL_LAST] = {
12036 [ALC267_QUANTA_IL1] = "quanta-il1",
12037 [ALC268_3ST] = "3stack",
12038 [ALC268_TOSHIBA] = "toshiba",
12039 [ALC268_ACER] = "acer",
12040 [ALC268_ACER_DMIC] = "acer-dmic",
12041 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12042 [ALC268_DELL] = "dell",
12043 [ALC268_ZEPTO] = "zepto",
12044 #ifdef CONFIG_SND_DEBUG
12045 [ALC268_TEST] = "test",
12047 [ALC268_AUTO] = "auto",
12050 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12051 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12052 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12053 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12054 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12055 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12056 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12057 ALC268_ACER_ASPIRE_ONE),
12058 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12059 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12060 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
12061 SND_PCI_QUIRK(0x103c, 0x30f1, "HP TX25xx series", ALC268_TOSHIBA),
12062 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12063 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
12064 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
12065 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
12066 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12067 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12068 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12069 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12073 static struct alc_config_preset alc268_presets[] = {
12074 [ALC267_QUANTA_IL1] = {
12075 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12076 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12077 alc267_quanta_il1_verbs },
12078 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12079 .dac_nids = alc268_dac_nids,
12080 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12081 .adc_nids = alc268_adc_nids_alt,
12083 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12084 .channel_mode = alc268_modes,
12085 .input_mux = &alc268_capture_source,
12086 .unsol_event = alc267_quanta_il1_unsol_event,
12087 .init_hook = alc267_quanta_il1_automute,
12090 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12091 alc268_beep_mixer },
12092 .init_verbs = { alc268_base_init_verbs },
12093 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12094 .dac_nids = alc268_dac_nids,
12095 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12096 .adc_nids = alc268_adc_nids_alt,
12097 .capsrc_nids = alc268_capsrc_nids,
12099 .dig_out_nid = ALC268_DIGOUT_NID,
12100 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12101 .channel_mode = alc268_modes,
12102 .input_mux = &alc268_capture_source,
12104 [ALC268_TOSHIBA] = {
12105 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12106 alc268_beep_mixer },
12107 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12108 alc268_toshiba_verbs },
12109 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12110 .dac_nids = alc268_dac_nids,
12111 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12112 .adc_nids = alc268_adc_nids_alt,
12113 .capsrc_nids = alc268_capsrc_nids,
12115 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12116 .channel_mode = alc268_modes,
12117 .input_mux = &alc268_capture_source,
12118 .unsol_event = alc268_toshiba_unsol_event,
12119 .init_hook = alc268_toshiba_automute,
12122 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12123 alc268_beep_mixer },
12124 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12125 alc268_acer_verbs },
12126 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12127 .dac_nids = alc268_dac_nids,
12128 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12129 .adc_nids = alc268_adc_nids_alt,
12130 .capsrc_nids = alc268_capsrc_nids,
12132 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12133 .channel_mode = alc268_modes,
12134 .input_mux = &alc268_acer_capture_source,
12135 .unsol_event = alc268_acer_unsol_event,
12136 .init_hook = alc268_acer_init_hook,
12138 [ALC268_ACER_DMIC] = {
12139 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12140 alc268_beep_mixer },
12141 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12142 alc268_acer_verbs },
12143 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12144 .dac_nids = alc268_dac_nids,
12145 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12146 .adc_nids = alc268_adc_nids_alt,
12147 .capsrc_nids = alc268_capsrc_nids,
12149 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12150 .channel_mode = alc268_modes,
12151 .input_mux = &alc268_acer_dmic_capture_source,
12152 .unsol_event = alc268_acer_unsol_event,
12153 .init_hook = alc268_acer_init_hook,
12155 [ALC268_ACER_ASPIRE_ONE] = {
12156 .mixers = { alc268_acer_aspire_one_mixer,
12158 alc268_capture_alt_mixer },
12159 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12160 alc268_acer_aspire_one_verbs },
12161 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12162 .dac_nids = alc268_dac_nids,
12163 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12164 .adc_nids = alc268_adc_nids_alt,
12165 .capsrc_nids = alc268_capsrc_nids,
12167 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12168 .channel_mode = alc268_modes,
12169 .input_mux = &alc268_acer_lc_capture_source,
12170 .unsol_event = alc268_acer_lc_unsol_event,
12171 .init_hook = alc268_acer_lc_init_hook,
12174 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12175 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12176 alc268_dell_verbs },
12177 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12178 .dac_nids = alc268_dac_nids,
12180 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12181 .channel_mode = alc268_modes,
12182 .unsol_event = alc268_dell_unsol_event,
12183 .init_hook = alc268_dell_init_hook,
12184 .input_mux = &alc268_capture_source,
12187 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12188 alc268_beep_mixer },
12189 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12190 alc268_toshiba_verbs },
12191 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12192 .dac_nids = alc268_dac_nids,
12193 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12194 .adc_nids = alc268_adc_nids_alt,
12195 .capsrc_nids = alc268_capsrc_nids,
12197 .dig_out_nid = ALC268_DIGOUT_NID,
12198 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12199 .channel_mode = alc268_modes,
12200 .input_mux = &alc268_capture_source,
12201 .unsol_event = alc268_toshiba_unsol_event,
12202 .init_hook = alc268_toshiba_automute
12204 #ifdef CONFIG_SND_DEBUG
12206 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12207 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12208 alc268_volume_init_verbs },
12209 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12210 .dac_nids = alc268_dac_nids,
12211 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12212 .adc_nids = alc268_adc_nids_alt,
12213 .capsrc_nids = alc268_capsrc_nids,
12215 .dig_out_nid = ALC268_DIGOUT_NID,
12216 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12217 .channel_mode = alc268_modes,
12218 .input_mux = &alc268_capture_source,
12223 static int patch_alc268(struct hda_codec *codec)
12225 struct alc_spec *spec;
12227 int i, has_beep, err;
12229 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12233 codec->spec = spec;
12235 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12239 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12240 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
12241 "trying auto-probe from BIOS...\n");
12242 board_config = ALC268_AUTO;
12245 if (board_config == ALC268_AUTO) {
12246 /* automatic parse from the BIOS config */
12247 err = alc268_parse_auto_config(codec);
12253 "hda_codec: Cannot set up configuration "
12254 "from BIOS. Using base mode...\n");
12255 board_config = ALC268_3ST;
12259 if (board_config != ALC268_AUTO)
12260 setup_preset(spec, &alc268_presets[board_config]);
12262 if (codec->vendor_id == 0x10ec0267) {
12263 spec->stream_name_analog = "ALC267 Analog";
12264 spec->stream_name_digital = "ALC267 Digital";
12266 spec->stream_name_analog = "ALC268 Analog";
12267 spec->stream_name_digital = "ALC268 Digital";
12270 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12271 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12272 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12274 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12277 for (i = 0; i < spec->num_mixers; i++) {
12278 if (spec->mixers[i] == alc268_beep_mixer) {
12285 err = snd_hda_attach_beep_device(codec, 0x1);
12290 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12291 /* override the amp caps for beep generator */
12292 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12293 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12294 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12295 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12296 (0 << AC_AMPCAP_MUTE_SHIFT));
12299 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12300 /* check whether NID 0x07 is valid */
12301 unsigned int wcap = get_wcaps(codec, 0x07);
12305 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12306 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12307 spec->adc_nids = alc268_adc_nids_alt;
12308 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12309 add_mixer(spec, alc268_capture_alt_mixer);
12311 spec->adc_nids = alc268_adc_nids;
12312 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12313 add_mixer(spec, alc268_capture_mixer);
12315 spec->capsrc_nids = alc268_capsrc_nids;
12316 /* set default input source */
12317 for (i = 0; i < spec->num_adc_nids; i++)
12318 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12319 0, AC_VERB_SET_CONNECT_SEL,
12320 spec->input_mux->items[0].index);
12323 spec->vmaster_nid = 0x02;
12325 codec->patch_ops = alc_patch_ops;
12326 if (board_config == ALC268_AUTO)
12327 spec->init_hook = alc268_auto_init;
12329 codec->proc_widget_hook = print_realtek_coef;
12335 * ALC269 channel source setting (2 channel)
12337 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12339 #define alc269_dac_nids alc260_dac_nids
12341 static hda_nid_t alc269_adc_nids[1] = {
12346 static hda_nid_t alc269_capsrc_nids[1] = {
12350 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12354 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12362 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12370 #define alc269_modes alc260_modes
12371 #define alc269_capture_source alc880_lg_lw_capture_source
12373 static struct snd_kcontrol_new alc269_base_mixer[] = {
12374 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12375 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12376 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12377 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12380 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12381 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12382 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12383 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12385 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12389 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12390 /* output mixer control */
12391 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12393 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12394 .name = "Master Playback Switch",
12395 .info = snd_hda_mixer_amp_switch_info,
12396 .get = snd_hda_mixer_amp_switch_get,
12397 .put = alc268_acer_master_sw_put,
12398 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12402 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12403 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12404 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12405 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12409 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12410 /* output mixer control */
12411 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12413 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12414 .name = "Master Playback Switch",
12415 .info = snd_hda_mixer_amp_switch_info,
12416 .get = snd_hda_mixer_amp_switch_get,
12417 .put = alc268_acer_master_sw_put,
12418 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12422 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12423 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12424 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12425 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12426 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12427 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12428 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12432 /* bind volumes of both NID 0x0c and 0x0d */
12433 static struct hda_bind_ctls alc269_epc_bind_vol = {
12434 .ops = &snd_hda_bind_vol,
12436 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12437 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12442 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12443 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12444 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12445 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12449 /* capture mixer elements */
12450 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12451 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12452 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12453 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12458 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12459 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12460 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12461 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12465 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12466 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12467 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12469 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12470 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12471 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12475 static struct hda_verb alc269_lifebook_verbs[] = {
12476 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12477 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12478 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12480 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12481 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12482 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12483 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12484 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12485 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12489 /* toggle speaker-output according to the hp-jack state */
12490 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12492 unsigned int present;
12493 unsigned char bits;
12495 present = snd_hda_codec_read(codec, 0x15, 0,
12496 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12497 bits = present ? AMP_IN_MUTE(0) : 0;
12498 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12499 AMP_IN_MUTE(0), bits);
12500 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12501 AMP_IN_MUTE(0), bits);
12503 snd_hda_codec_write(codec, 0x20, 0,
12504 AC_VERB_SET_COEF_INDEX, 0x0c);
12505 snd_hda_codec_write(codec, 0x20, 0,
12506 AC_VERB_SET_PROC_COEF, 0x680);
12508 snd_hda_codec_write(codec, 0x20, 0,
12509 AC_VERB_SET_COEF_INDEX, 0x0c);
12510 snd_hda_codec_write(codec, 0x20, 0,
12511 AC_VERB_SET_PROC_COEF, 0x480);
12514 /* toggle speaker-output according to the hp-jacks state */
12515 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12517 unsigned int present;
12518 unsigned char bits;
12520 /* Check laptop headphone socket */
12521 present = snd_hda_codec_read(codec, 0x15, 0,
12522 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12524 /* Check port replicator headphone socket */
12525 present |= snd_hda_codec_read(codec, 0x1a, 0,
12526 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12528 bits = present ? AMP_IN_MUTE(0) : 0;
12529 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12530 AMP_IN_MUTE(0), bits);
12531 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12532 AMP_IN_MUTE(0), bits);
12534 snd_hda_codec_write(codec, 0x20, 0,
12535 AC_VERB_SET_COEF_INDEX, 0x0c);
12536 snd_hda_codec_write(codec, 0x20, 0,
12537 AC_VERB_SET_PROC_COEF, 0x680);
12539 snd_hda_codec_write(codec, 0x20, 0,
12540 AC_VERB_SET_COEF_INDEX, 0x0c);
12541 snd_hda_codec_write(codec, 0x20, 0,
12542 AC_VERB_SET_PROC_COEF, 0x480);
12545 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12547 unsigned int present;
12549 present = snd_hda_codec_read(codec, 0x18, 0,
12550 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12551 snd_hda_codec_write(codec, 0x23, 0,
12552 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12555 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12557 unsigned int present_laptop;
12558 unsigned int present_dock;
12560 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12561 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12563 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12564 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12566 /* Laptop mic port overrides dock mic port, design decision */
12568 snd_hda_codec_write(codec, 0x23, 0,
12569 AC_VERB_SET_CONNECT_SEL, 0x3);
12570 if (present_laptop)
12571 snd_hda_codec_write(codec, 0x23, 0,
12572 AC_VERB_SET_CONNECT_SEL, 0x0);
12573 if (!present_dock && !present_laptop)
12574 snd_hda_codec_write(codec, 0x23, 0,
12575 AC_VERB_SET_CONNECT_SEL, 0x1);
12578 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12581 if ((res >> 26) == ALC880_HP_EVENT)
12582 alc269_quanta_fl1_speaker_automute(codec);
12583 if ((res >> 26) == ALC880_MIC_EVENT)
12584 alc269_quanta_fl1_mic_automute(codec);
12587 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12590 if ((res >> 26) == ALC880_HP_EVENT)
12591 alc269_lifebook_speaker_automute(codec);
12592 if ((res >> 26) == ALC880_MIC_EVENT)
12593 alc269_lifebook_mic_autoswitch(codec);
12596 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12598 alc269_quanta_fl1_speaker_automute(codec);
12599 alc269_quanta_fl1_mic_automute(codec);
12602 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12604 alc269_lifebook_speaker_automute(codec);
12605 alc269_lifebook_mic_autoswitch(codec);
12608 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12610 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12611 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12612 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12613 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12614 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12615 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12619 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12620 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12621 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12622 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12624 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12629 /* toggle speaker-output according to the hp-jack state */
12630 static void alc269_speaker_automute(struct hda_codec *codec)
12632 unsigned int present;
12633 unsigned char bits;
12635 present = snd_hda_codec_read(codec, 0x15, 0,
12636 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12637 bits = present ? AMP_IN_MUTE(0) : 0;
12638 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12639 AMP_IN_MUTE(0), bits);
12640 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12641 AMP_IN_MUTE(0), bits);
12644 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12646 unsigned int present;
12648 present = snd_hda_codec_read(codec, 0x18, 0,
12649 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12650 snd_hda_codec_write(codec, 0x23, 0,
12651 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12654 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12656 unsigned int present;
12658 present = snd_hda_codec_read(codec, 0x18, 0,
12659 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12660 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12661 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12662 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12663 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12666 /* unsolicited event for HP jack sensing */
12667 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12670 if ((res >> 26) == ALC880_HP_EVENT)
12671 alc269_speaker_automute(codec);
12673 if ((res >> 26) == ALC880_MIC_EVENT)
12674 alc269_eeepc_dmic_automute(codec);
12677 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12679 alc269_speaker_automute(codec);
12680 alc269_eeepc_dmic_automute(codec);
12683 /* unsolicited event for HP jack sensing */
12684 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12687 if ((res >> 26) == ALC880_HP_EVENT)
12688 alc269_speaker_automute(codec);
12690 if ((res >> 26) == ALC880_MIC_EVENT)
12691 alc269_eeepc_amic_automute(codec);
12694 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12696 alc269_speaker_automute(codec);
12697 alc269_eeepc_amic_automute(codec);
12701 * generic initialization of ADC, input mixers and output mixers
12703 static struct hda_verb alc269_init_verbs[] = {
12705 * Unmute ADC0 and set the default input to mic-in
12707 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12709 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12710 * analog-loopback mixer widget
12711 * Note: PASD motherboards uses the Line In 2 as the input for
12712 * front panel mic (mic 2)
12714 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12717 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12718 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12719 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12722 * Set up output mixers (0x0c - 0x0e)
12724 /* set vol=0 to output mixers */
12725 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12726 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12728 /* set up input amps for analog loopback */
12729 /* Amp Indices: DAC = 0, mixer = 1 */
12730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12737 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12738 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12739 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12742 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12743 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12746 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12748 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12750 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12751 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12753 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12754 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12756 /* FIXME: use matrix-type input source selection */
12757 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12758 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12765 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12766 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12770 /* add playback controls from the parsed DAC table */
12771 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12772 const struct auto_pin_cfg *cfg)
12777 spec->multiout.num_dacs = 1; /* only use one dac */
12778 spec->multiout.dac_nids = spec->private_dac_nids;
12779 spec->multiout.dac_nids[0] = 2;
12781 nid = cfg->line_out_pins[0];
12783 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12784 "Front Playback Volume",
12785 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12788 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12789 "Front Playback Switch",
12790 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12795 nid = cfg->speaker_pins[0];
12797 if (!cfg->line_out_pins[0]) {
12798 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12799 "Speaker Playback Volume",
12800 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12806 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12807 "Speaker Playback Switch",
12808 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12813 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12814 "Speaker Playback Switch",
12815 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12821 nid = cfg->hp_pins[0];
12823 /* spec->multiout.hp_nid = 2; */
12824 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12825 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12826 "Headphone Playback Volume",
12827 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12833 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12834 "Headphone Playback Switch",
12835 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12840 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12841 "Headphone Playback Switch",
12842 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12851 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12852 const struct auto_pin_cfg *cfg)
12856 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12859 /* digital-mic input pin is excluded in alc880_auto_create..()
12860 * because it's under 0x18
12862 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12863 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12864 struct hda_input_mux *imux = &spec->private_imux[0];
12865 imux->items[imux->num_items].label = "Int Mic";
12866 imux->items[imux->num_items].index = 0x05;
12872 #ifdef CONFIG_SND_HDA_POWER_SAVE
12873 #define alc269_loopbacks alc880_loopbacks
12876 /* pcm configuration: identiacal with ALC880 */
12877 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12878 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12879 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12880 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12882 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12886 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12887 /* NID is set in alc_build_pcms */
12889 .open = alc880_playback_pcm_open,
12890 .prepare = alc880_playback_pcm_prepare,
12891 .cleanup = alc880_playback_pcm_cleanup
12895 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12899 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12900 /* NID is set in alc_build_pcms */
12904 * BIOS auto configuration
12906 static int alc269_parse_auto_config(struct hda_codec *codec)
12908 struct alc_spec *spec = codec->spec;
12910 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12912 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12917 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12920 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12924 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12926 if (spec->autocfg.dig_outs)
12927 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12929 if (spec->kctls.list)
12930 add_mixer(spec, spec->kctls.list);
12932 add_verb(spec, alc269_init_verbs);
12933 spec->num_mux_defs = 1;
12934 spec->input_mux = &spec->private_imux[0];
12935 /* set default input source */
12936 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12937 0, AC_VERB_SET_CONNECT_SEL,
12938 spec->input_mux->items[0].index);
12940 err = alc_auto_add_mic_boost(codec);
12944 if (!spec->cap_mixer && !spec->no_analog)
12945 set_capture_mixer(spec);
12950 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12951 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12952 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12955 /* init callback for auto-configuration model -- overriding the default init */
12956 static void alc269_auto_init(struct hda_codec *codec)
12958 struct alc_spec *spec = codec->spec;
12959 alc269_auto_init_multi_out(codec);
12960 alc269_auto_init_hp_out(codec);
12961 alc269_auto_init_analog_input(codec);
12962 if (spec->unsol_event)
12963 alc_inithook(codec);
12967 * configuration and preset
12969 static const char *alc269_models[ALC269_MODEL_LAST] = {
12970 [ALC269_BASIC] = "basic",
12971 [ALC269_QUANTA_FL1] = "quanta",
12972 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12973 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12974 [ALC269_FUJITSU] = "fujitsu",
12975 [ALC269_LIFEBOOK] = "lifebook"
12978 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12979 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12980 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12981 ALC269_ASUS_EEEPC_P703),
12982 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
12983 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
12984 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
12985 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
12986 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
12987 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
12988 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12989 ALC269_ASUS_EEEPC_P901),
12990 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12991 ALC269_ASUS_EEEPC_P901),
12992 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
12993 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12994 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12998 static struct alc_config_preset alc269_presets[] = {
13000 .mixers = { alc269_base_mixer },
13001 .init_verbs = { alc269_init_verbs },
13002 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13003 .dac_nids = alc269_dac_nids,
13005 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13006 .channel_mode = alc269_modes,
13007 .input_mux = &alc269_capture_source,
13009 [ALC269_QUANTA_FL1] = {
13010 .mixers = { alc269_quanta_fl1_mixer },
13011 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13012 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13013 .dac_nids = alc269_dac_nids,
13015 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13016 .channel_mode = alc269_modes,
13017 .input_mux = &alc269_capture_source,
13018 .unsol_event = alc269_quanta_fl1_unsol_event,
13019 .init_hook = alc269_quanta_fl1_init_hook,
13021 [ALC269_ASUS_EEEPC_P703] = {
13022 .mixers = { alc269_eeepc_mixer },
13023 .cap_mixer = alc269_epc_capture_mixer,
13024 .init_verbs = { alc269_init_verbs,
13025 alc269_eeepc_amic_init_verbs },
13026 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13027 .dac_nids = alc269_dac_nids,
13029 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13030 .channel_mode = alc269_modes,
13031 .input_mux = &alc269_eeepc_amic_capture_source,
13032 .unsol_event = alc269_eeepc_amic_unsol_event,
13033 .init_hook = alc269_eeepc_amic_inithook,
13035 [ALC269_ASUS_EEEPC_P901] = {
13036 .mixers = { alc269_eeepc_mixer },
13037 .cap_mixer = alc269_epc_capture_mixer,
13038 .init_verbs = { alc269_init_verbs,
13039 alc269_eeepc_dmic_init_verbs },
13040 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13041 .dac_nids = alc269_dac_nids,
13043 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13044 .channel_mode = alc269_modes,
13045 .input_mux = &alc269_eeepc_dmic_capture_source,
13046 .unsol_event = alc269_eeepc_dmic_unsol_event,
13047 .init_hook = alc269_eeepc_dmic_inithook,
13049 [ALC269_FUJITSU] = {
13050 .mixers = { alc269_fujitsu_mixer },
13051 .cap_mixer = alc269_epc_capture_mixer,
13052 .init_verbs = { alc269_init_verbs,
13053 alc269_eeepc_dmic_init_verbs },
13054 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13055 .dac_nids = alc269_dac_nids,
13057 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13058 .channel_mode = alc269_modes,
13059 .input_mux = &alc269_eeepc_dmic_capture_source,
13060 .unsol_event = alc269_eeepc_dmic_unsol_event,
13061 .init_hook = alc269_eeepc_dmic_inithook,
13063 [ALC269_LIFEBOOK] = {
13064 .mixers = { alc269_lifebook_mixer },
13065 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13066 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13067 .dac_nids = alc269_dac_nids,
13069 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13070 .channel_mode = alc269_modes,
13071 .input_mux = &alc269_capture_source,
13072 .unsol_event = alc269_lifebook_unsol_event,
13073 .init_hook = alc269_lifebook_init_hook,
13077 static int patch_alc269(struct hda_codec *codec)
13079 struct alc_spec *spec;
13083 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13087 codec->spec = spec;
13089 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13091 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13095 if (board_config < 0) {
13096 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
13097 "trying auto-probe from BIOS...\n");
13098 board_config = ALC269_AUTO;
13101 if (board_config == ALC269_AUTO) {
13102 /* automatic parse from the BIOS config */
13103 err = alc269_parse_auto_config(codec);
13109 "hda_codec: Cannot set up configuration "
13110 "from BIOS. Using base mode...\n");
13111 board_config = ALC269_BASIC;
13115 err = snd_hda_attach_beep_device(codec, 0x1);
13121 if (board_config != ALC269_AUTO)
13122 setup_preset(spec, &alc269_presets[board_config]);
13124 spec->stream_name_analog = "ALC269 Analog";
13125 if (codec->subsystem_id == 0x17aa3bf8) {
13126 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13127 * fix the sample rate of analog I/O to 44.1kHz
13129 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13130 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13132 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13133 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13135 spec->stream_name_digital = "ALC269 Digital";
13136 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13137 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13139 spec->adc_nids = alc269_adc_nids;
13140 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13141 spec->capsrc_nids = alc269_capsrc_nids;
13142 if (!spec->cap_mixer)
13143 set_capture_mixer(spec);
13144 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13146 codec->patch_ops = alc_patch_ops;
13147 if (board_config == ALC269_AUTO)
13148 spec->init_hook = alc269_auto_init;
13149 #ifdef CONFIG_SND_HDA_POWER_SAVE
13150 if (!spec->loopback.amplist)
13151 spec->loopback.amplist = alc269_loopbacks;
13153 codec->proc_widget_hook = print_realtek_coef;
13159 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13163 * set the path ways for 2 channel output
13164 * need to set the codec line out and mic 1 pin widgets to inputs
13166 static struct hda_verb alc861_threestack_ch2_init[] = {
13167 /* set pin widget 1Ah (line in) for input */
13168 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13169 /* set pin widget 18h (mic1/2) for input, for mic also enable
13172 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13174 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13176 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13177 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13183 * need to set the codec line out and mic 1 pin widgets to outputs
13185 static struct hda_verb alc861_threestack_ch6_init[] = {
13186 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13187 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13188 /* set pin widget 18h (mic1) for output (CLFE)*/
13189 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13191 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13192 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13194 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13196 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13197 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13202 static struct hda_channel_mode alc861_threestack_modes[2] = {
13203 { 2, alc861_threestack_ch2_init },
13204 { 6, alc861_threestack_ch6_init },
13206 /* Set mic1 as input and unmute the mixer */
13207 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13208 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13209 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13212 /* Set mic1 as output and mute mixer */
13213 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13214 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13215 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13219 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13220 { 2, alc861_uniwill_m31_ch2_init },
13221 { 4, alc861_uniwill_m31_ch4_init },
13224 /* Set mic1 and line-in as input and unmute the mixer */
13225 static struct hda_verb alc861_asus_ch2_init[] = {
13226 /* set pin widget 1Ah (line in) for input */
13227 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13228 /* set pin widget 18h (mic1/2) for input, for mic also enable
13231 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13233 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13235 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13236 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13240 /* Set mic1 nad line-in as output and mute mixer */
13241 static struct hda_verb alc861_asus_ch6_init[] = {
13242 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13243 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13244 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13245 /* set pin widget 18h (mic1) for output (CLFE)*/
13246 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13247 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13248 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13249 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13251 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13253 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13254 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13259 static struct hda_channel_mode alc861_asus_modes[2] = {
13260 { 2, alc861_asus_ch2_init },
13261 { 6, alc861_asus_ch6_init },
13266 static struct snd_kcontrol_new alc861_base_mixer[] = {
13267 /* output mixer control */
13268 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13269 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13270 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13271 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13272 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13274 /*Input mixer control */
13275 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13276 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13277 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13278 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13279 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13280 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13282 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13283 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13284 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13289 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13290 /* output mixer control */
13291 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13292 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13293 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13294 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13295 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13297 /* Input mixer control */
13298 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13299 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13300 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13301 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13302 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13303 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13305 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13306 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13307 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13311 .name = "Channel Mode",
13312 .info = alc_ch_mode_info,
13313 .get = alc_ch_mode_get,
13314 .put = alc_ch_mode_put,
13315 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13320 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13321 /* output mixer control */
13322 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13324 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13329 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13330 /* output mixer control */
13331 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13332 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13333 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13334 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13335 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13337 /* Input mixer control */
13338 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13339 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13340 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13341 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13342 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13343 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13345 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13346 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13350 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13351 .name = "Channel Mode",
13352 .info = alc_ch_mode_info,
13353 .get = alc_ch_mode_get,
13354 .put = alc_ch_mode_put,
13355 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13360 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13361 /* output mixer control */
13362 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13363 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13364 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13365 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13366 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13368 /* Input mixer control */
13369 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13370 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13371 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13372 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13373 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13374 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13376 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13377 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13378 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13381 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13382 .name = "Channel Mode",
13383 .info = alc_ch_mode_info,
13384 .get = alc_ch_mode_get,
13385 .put = alc_ch_mode_put,
13386 .private_value = ARRAY_SIZE(alc861_asus_modes),
13391 /* additional mixer */
13392 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13393 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13394 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13399 * generic initialization of ADC, input mixers and output mixers
13401 static struct hda_verb alc861_base_init_verbs[] = {
13403 * Unmute ADC0 and set the default input to mic-in
13405 /* port-A for surround (rear panel) */
13406 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13407 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13408 /* port-B for mic-in (rear panel) with vref */
13409 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13410 /* port-C for line-in (rear panel) */
13411 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13412 /* port-D for Front */
13413 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13414 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13415 /* port-E for HP out (front panel) */
13416 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13417 /* route front PCM to HP */
13418 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13419 /* port-F for mic-in (front panel) with vref */
13420 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13421 /* port-G for CLFE (rear panel) */
13422 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13423 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13424 /* port-H for side (rear panel) */
13425 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13426 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13428 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13429 /* route front mic to ADC1*/
13430 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13433 /* Unmute DAC0~3 & spdif out*/
13434 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13435 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13436 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13437 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13440 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13441 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13442 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13443 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13444 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13446 /* Unmute Stereo Mixer 15 */
13447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13452 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13453 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13454 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13455 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13456 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13457 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13458 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13459 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13460 /* hp used DAC 3 (Front) */
13461 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13462 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13467 static struct hda_verb alc861_threestack_init_verbs[] = {
13469 * Unmute ADC0 and set the default input to mic-in
13471 /* port-A for surround (rear panel) */
13472 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13473 /* port-B for mic-in (rear panel) with vref */
13474 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13475 /* port-C for line-in (rear panel) */
13476 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13477 /* port-D for Front */
13478 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13479 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13480 /* port-E for HP out (front panel) */
13481 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13482 /* route front PCM to HP */
13483 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13484 /* port-F for mic-in (front panel) with vref */
13485 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13486 /* port-G for CLFE (rear panel) */
13487 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13488 /* port-H for side (rear panel) */
13489 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13491 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13492 /* route front mic to ADC1*/
13493 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13495 /* Unmute DAC0~3 & spdif out*/
13496 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13497 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13498 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13499 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13502 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13503 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13504 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13505 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13506 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13508 /* Unmute Stereo Mixer 15 */
13509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13511 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13512 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13514 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13515 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13516 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13518 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13519 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13520 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13522 /* hp used DAC 3 (Front) */
13523 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13524 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13528 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13530 * Unmute ADC0 and set the default input to mic-in
13532 /* port-A for surround (rear panel) */
13533 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13534 /* port-B for mic-in (rear panel) with vref */
13535 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13536 /* port-C for line-in (rear panel) */
13537 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13538 /* port-D for Front */
13539 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13540 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13541 /* port-E for HP out (front panel) */
13542 /* this has to be set to VREF80 */
13543 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13544 /* route front PCM to HP */
13545 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13546 /* port-F for mic-in (front panel) with vref */
13547 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13548 /* port-G for CLFE (rear panel) */
13549 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13550 /* port-H for side (rear panel) */
13551 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13553 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13554 /* route front mic to ADC1*/
13555 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13556 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13557 /* Unmute DAC0~3 & spdif out*/
13558 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13559 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13560 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13561 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13564 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13565 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13566 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13567 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13568 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13570 /* Unmute Stereo Mixer 15 */
13571 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13572 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13573 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13576 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13577 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13578 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13579 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13580 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13581 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13582 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13583 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13584 /* hp used DAC 3 (Front) */
13585 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13586 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13590 static struct hda_verb alc861_asus_init_verbs[] = {
13592 * Unmute ADC0 and set the default input to mic-in
13594 /* port-A for surround (rear panel)
13595 * according to codec#0 this is the HP jack
13597 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13598 /* route front PCM to HP */
13599 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13600 /* port-B for mic-in (rear panel) with vref */
13601 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13602 /* port-C for line-in (rear panel) */
13603 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13604 /* port-D for Front */
13605 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13606 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13607 /* port-E for HP out (front panel) */
13608 /* this has to be set to VREF80 */
13609 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13610 /* route front PCM to HP */
13611 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13612 /* port-F for mic-in (front panel) with vref */
13613 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13614 /* port-G for CLFE (rear panel) */
13615 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13616 /* port-H for side (rear panel) */
13617 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13619 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13620 /* route front mic to ADC1*/
13621 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13623 /* Unmute DAC0~3 & spdif out*/
13624 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13625 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13626 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13627 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13629 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13630 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13631 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13632 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13633 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13635 /* Unmute Stereo Mixer 15 */
13636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13641 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13642 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13643 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13644 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13646 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13647 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13648 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13649 /* hp used DAC 3 (Front) */
13650 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13651 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13655 /* additional init verbs for ASUS laptops */
13656 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13657 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13658 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13663 * generic initialization of ADC, input mixers and output mixers
13665 static struct hda_verb alc861_auto_init_verbs[] = {
13667 * Unmute ADC0 and set the default input to mic-in
13669 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13670 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13672 /* Unmute DAC0~3 & spdif out*/
13673 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13674 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13675 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13676 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13677 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13679 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13680 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13681 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13682 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13683 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13685 /* Unmute Stereo Mixer 15 */
13686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13687 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13692 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13694 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13695 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13697 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13700 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13701 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13702 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13703 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13704 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13705 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13706 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13707 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13709 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13714 static struct hda_verb alc861_toshiba_init_verbs[] = {
13715 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13720 /* toggle speaker-output according to the hp-jack state */
13721 static void alc861_toshiba_automute(struct hda_codec *codec)
13723 unsigned int present;
13725 present = snd_hda_codec_read(codec, 0x0f, 0,
13726 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13727 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13728 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13729 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13730 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13733 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13736 if ((res >> 26) == ALC880_HP_EVENT)
13737 alc861_toshiba_automute(codec);
13740 /* pcm configuration: identiacal with ALC880 */
13741 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13742 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13743 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13744 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13747 #define ALC861_DIGOUT_NID 0x07
13749 static struct hda_channel_mode alc861_8ch_modes[1] = {
13753 static hda_nid_t alc861_dac_nids[4] = {
13754 /* front, surround, clfe, side */
13755 0x03, 0x06, 0x05, 0x04
13758 static hda_nid_t alc660_dac_nids[3] = {
13759 /* front, clfe, surround */
13763 static hda_nid_t alc861_adc_nids[1] = {
13768 static struct hda_input_mux alc861_capture_source = {
13772 { "Front Mic", 0x3 },
13779 /* fill in the dac_nids table from the parsed pin configuration */
13780 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13781 const struct auto_pin_cfg *cfg)
13786 spec->multiout.dac_nids = spec->private_dac_nids;
13787 for (i = 0; i < cfg->line_outs; i++) {
13788 nid = cfg->line_out_pins[i];
13790 if (i >= ARRAY_SIZE(alc861_dac_nids))
13792 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13795 spec->multiout.num_dacs = cfg->line_outs;
13799 /* add playback controls from the parsed DAC table */
13800 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13801 const struct auto_pin_cfg *cfg)
13804 static const char *chname[4] = {
13805 "Front", "Surround", NULL /*CLFE*/, "Side"
13810 for (i = 0; i < cfg->line_outs; i++) {
13811 nid = spec->multiout.dac_nids[i];
13816 err = add_control(spec, ALC_CTL_BIND_MUTE,
13817 "Center Playback Switch",
13818 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13822 err = add_control(spec, ALC_CTL_BIND_MUTE,
13823 "LFE Playback Switch",
13824 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13829 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13831 if (nid == alc861_dac_nids[idx])
13833 sprintf(name, "%s Playback Switch", chname[idx]);
13834 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13835 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13844 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13852 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13854 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13855 "Headphone Playback Switch",
13856 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13859 spec->multiout.hp_nid = nid;
13864 /* create playback/capture controls for input pins */
13865 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13866 const struct auto_pin_cfg *cfg)
13868 struct hda_input_mux *imux = &spec->private_imux[0];
13869 int i, err, idx, idx1;
13871 for (i = 0; i < AUTO_PIN_LAST; i++) {
13872 switch (cfg->input_pins[i]) {
13875 idx = 2; /* Line In */
13879 idx = 2; /* Line In */
13883 idx = 1; /* Mic In */
13887 idx = 1; /* Mic In */
13897 err = new_analog_input(spec, cfg->input_pins[i],
13898 auto_pin_cfg_labels[i], idx, 0x15);
13902 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13903 imux->items[imux->num_items].index = idx1;
13909 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13911 int pin_type, int dac_idx)
13913 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13915 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13919 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13921 struct alc_spec *spec = codec->spec;
13924 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13925 for (i = 0; i < spec->autocfg.line_outs; i++) {
13926 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13927 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13929 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13930 spec->multiout.dac_nids[i]);
13934 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13936 struct alc_spec *spec = codec->spec;
13939 pin = spec->autocfg.hp_pins[0];
13940 if (pin) /* connect to front */
13941 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13942 spec->multiout.dac_nids[0]);
13943 pin = spec->autocfg.speaker_pins[0];
13945 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13948 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13950 struct alc_spec *spec = codec->spec;
13953 for (i = 0; i < AUTO_PIN_LAST; i++) {
13954 hda_nid_t nid = spec->autocfg.input_pins[i];
13955 if (nid >= 0x0c && nid <= 0x11)
13956 alc_set_input_pin(codec, nid, i);
13960 /* parse the BIOS configuration and set up the alc_spec */
13961 /* return 1 if successful, 0 if the proper config is not found,
13962 * or a negative error code
13964 static int alc861_parse_auto_config(struct hda_codec *codec)
13966 struct alc_spec *spec = codec->spec;
13968 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13970 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13974 if (!spec->autocfg.line_outs)
13975 return 0; /* can't find valid BIOS pin config */
13977 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13980 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13983 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13986 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13990 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13992 if (spec->autocfg.dig_outs)
13993 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13995 if (spec->kctls.list)
13996 add_mixer(spec, spec->kctls.list);
13998 add_verb(spec, alc861_auto_init_verbs);
14000 spec->num_mux_defs = 1;
14001 spec->input_mux = &spec->private_imux[0];
14003 spec->adc_nids = alc861_adc_nids;
14004 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14005 set_capture_mixer(spec);
14010 /* additional initialization for auto-configuration model */
14011 static void alc861_auto_init(struct hda_codec *codec)
14013 struct alc_spec *spec = codec->spec;
14014 alc861_auto_init_multi_out(codec);
14015 alc861_auto_init_hp_out(codec);
14016 alc861_auto_init_analog_input(codec);
14017 if (spec->unsol_event)
14018 alc_inithook(codec);
14021 #ifdef CONFIG_SND_HDA_POWER_SAVE
14022 static struct hda_amp_list alc861_loopbacks[] = {
14023 { 0x15, HDA_INPUT, 0 },
14024 { 0x15, HDA_INPUT, 1 },
14025 { 0x15, HDA_INPUT, 2 },
14026 { 0x15, HDA_INPUT, 3 },
14033 * configuration and preset
14035 static const char *alc861_models[ALC861_MODEL_LAST] = {
14036 [ALC861_3ST] = "3stack",
14037 [ALC660_3ST] = "3stack-660",
14038 [ALC861_3ST_DIG] = "3stack-dig",
14039 [ALC861_6ST_DIG] = "6stack-dig",
14040 [ALC861_UNIWILL_M31] = "uniwill-m31",
14041 [ALC861_TOSHIBA] = "toshiba",
14042 [ALC861_ASUS] = "asus",
14043 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14044 [ALC861_AUTO] = "auto",
14047 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14048 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14049 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14050 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14051 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14052 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14053 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14054 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14055 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14056 * Any other models that need this preset?
14058 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14059 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14060 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14061 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14062 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14063 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14064 /* FIXME: the below seems conflict */
14065 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14066 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14067 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14071 static struct alc_config_preset alc861_presets[] = {
14073 .mixers = { alc861_3ST_mixer },
14074 .init_verbs = { alc861_threestack_init_verbs },
14075 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14076 .dac_nids = alc861_dac_nids,
14077 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14078 .channel_mode = alc861_threestack_modes,
14080 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14081 .adc_nids = alc861_adc_nids,
14082 .input_mux = &alc861_capture_source,
14084 [ALC861_3ST_DIG] = {
14085 .mixers = { alc861_base_mixer },
14086 .init_verbs = { alc861_threestack_init_verbs },
14087 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14088 .dac_nids = alc861_dac_nids,
14089 .dig_out_nid = ALC861_DIGOUT_NID,
14090 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14091 .channel_mode = alc861_threestack_modes,
14093 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14094 .adc_nids = alc861_adc_nids,
14095 .input_mux = &alc861_capture_source,
14097 [ALC861_6ST_DIG] = {
14098 .mixers = { alc861_base_mixer },
14099 .init_verbs = { alc861_base_init_verbs },
14100 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14101 .dac_nids = alc861_dac_nids,
14102 .dig_out_nid = ALC861_DIGOUT_NID,
14103 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14104 .channel_mode = alc861_8ch_modes,
14105 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14106 .adc_nids = alc861_adc_nids,
14107 .input_mux = &alc861_capture_source,
14110 .mixers = { alc861_3ST_mixer },
14111 .init_verbs = { alc861_threestack_init_verbs },
14112 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14113 .dac_nids = alc660_dac_nids,
14114 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14115 .channel_mode = alc861_threestack_modes,
14117 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14118 .adc_nids = alc861_adc_nids,
14119 .input_mux = &alc861_capture_source,
14121 [ALC861_UNIWILL_M31] = {
14122 .mixers = { alc861_uniwill_m31_mixer },
14123 .init_verbs = { alc861_uniwill_m31_init_verbs },
14124 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14125 .dac_nids = alc861_dac_nids,
14126 .dig_out_nid = ALC861_DIGOUT_NID,
14127 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14128 .channel_mode = alc861_uniwill_m31_modes,
14130 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14131 .adc_nids = alc861_adc_nids,
14132 .input_mux = &alc861_capture_source,
14134 [ALC861_TOSHIBA] = {
14135 .mixers = { alc861_toshiba_mixer },
14136 .init_verbs = { alc861_base_init_verbs,
14137 alc861_toshiba_init_verbs },
14138 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14139 .dac_nids = alc861_dac_nids,
14140 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14141 .channel_mode = alc883_3ST_2ch_modes,
14142 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14143 .adc_nids = alc861_adc_nids,
14144 .input_mux = &alc861_capture_source,
14145 .unsol_event = alc861_toshiba_unsol_event,
14146 .init_hook = alc861_toshiba_automute,
14149 .mixers = { alc861_asus_mixer },
14150 .init_verbs = { alc861_asus_init_verbs },
14151 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14152 .dac_nids = alc861_dac_nids,
14153 .dig_out_nid = ALC861_DIGOUT_NID,
14154 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14155 .channel_mode = alc861_asus_modes,
14158 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14159 .adc_nids = alc861_adc_nids,
14160 .input_mux = &alc861_capture_source,
14162 [ALC861_ASUS_LAPTOP] = {
14163 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14164 .init_verbs = { alc861_asus_init_verbs,
14165 alc861_asus_laptop_init_verbs },
14166 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14167 .dac_nids = alc861_dac_nids,
14168 .dig_out_nid = ALC861_DIGOUT_NID,
14169 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14170 .channel_mode = alc883_3ST_2ch_modes,
14172 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14173 .adc_nids = alc861_adc_nids,
14174 .input_mux = &alc861_capture_source,
14179 static int patch_alc861(struct hda_codec *codec)
14181 struct alc_spec *spec;
14185 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14189 codec->spec = spec;
14191 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14195 if (board_config < 0) {
14196 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
14197 "trying auto-probe from BIOS...\n");
14198 board_config = ALC861_AUTO;
14201 if (board_config == ALC861_AUTO) {
14202 /* automatic parse from the BIOS config */
14203 err = alc861_parse_auto_config(codec);
14209 "hda_codec: Cannot set up configuration "
14210 "from BIOS. Using base mode...\n");
14211 board_config = ALC861_3ST_DIG;
14215 err = snd_hda_attach_beep_device(codec, 0x23);
14221 if (board_config != ALC861_AUTO)
14222 setup_preset(spec, &alc861_presets[board_config]);
14224 spec->stream_name_analog = "ALC861 Analog";
14225 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14226 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14228 spec->stream_name_digital = "ALC861 Digital";
14229 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14230 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14232 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14234 spec->vmaster_nid = 0x03;
14236 codec->patch_ops = alc_patch_ops;
14237 if (board_config == ALC861_AUTO)
14238 spec->init_hook = alc861_auto_init;
14239 #ifdef CONFIG_SND_HDA_POWER_SAVE
14240 if (!spec->loopback.amplist)
14241 spec->loopback.amplist = alc861_loopbacks;
14243 codec->proc_widget_hook = print_realtek_coef;
14249 * ALC861-VD support
14253 * In addition, an independent DAC
14255 #define ALC861VD_DIGOUT_NID 0x06
14257 static hda_nid_t alc861vd_dac_nids[4] = {
14258 /* front, surr, clfe, side surr */
14259 0x02, 0x03, 0x04, 0x05
14262 /* dac_nids for ALC660vd are in a different order - according to
14263 * Realtek's driver.
14264 * This should probably tesult in a different mixer for 6stack models
14265 * of ALC660vd codecs, but for now there is only 3stack mixer
14266 * - and it is the same as in 861vd.
14267 * adc_nids in ALC660vd are (is) the same as in 861vd
14269 static hda_nid_t alc660vd_dac_nids[3] = {
14270 /* front, rear, clfe, rear_surr */
14274 static hda_nid_t alc861vd_adc_nids[1] = {
14279 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14282 /* FIXME: should be a matrix-type input source selection */
14283 static struct hda_input_mux alc861vd_capture_source = {
14287 { "Front Mic", 0x1 },
14293 static struct hda_input_mux alc861vd_dallas_capture_source = {
14296 { "Ext Mic", 0x0 },
14297 { "Int Mic", 0x1 },
14301 static struct hda_input_mux alc861vd_hp_capture_source = {
14304 { "Front Mic", 0x0 },
14305 { "ATAPI Mic", 0x1 },
14312 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14319 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14320 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14321 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14322 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14323 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14330 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14331 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14332 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14333 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14334 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14338 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14339 { 6, alc861vd_6stack_ch6_init },
14340 { 8, alc861vd_6stack_ch8_init },
14343 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14345 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14346 .name = "Channel Mode",
14347 .info = alc_ch_mode_info,
14348 .get = alc_ch_mode_get,
14349 .put = alc_ch_mode_put,
14354 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14355 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14357 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14358 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14359 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14361 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14362 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14364 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14366 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14368 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14369 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14371 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14372 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14378 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14380 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14381 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14382 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14384 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14385 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14393 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14394 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14395 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14403 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14404 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14405 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14407 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14408 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14410 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14411 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14416 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14417 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14418 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14419 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14421 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14423 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14427 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14428 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14429 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14431 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14432 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14437 /* Pin assignment: Speaker=0x14, HP = 0x15,
14438 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14440 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14441 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14442 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14443 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14444 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14445 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14446 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14447 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14448 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14449 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14450 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14454 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14455 * Front Mic=0x18, ATAPI Mic = 0x19,
14457 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14458 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14459 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14460 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14461 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14462 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14463 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14464 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14465 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14471 * generic initialization of ADC, input mixers and output mixers
14473 static struct hda_verb alc861vd_volume_init_verbs[] = {
14475 * Unmute ADC0 and set the default input to mic-in
14477 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14478 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14480 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14481 * the analog-loopback mixer widget
14483 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14490 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14497 * Set up output mixers (0x02 - 0x05)
14499 /* set vol=0 to output mixers */
14500 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14501 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14502 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14503 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14505 /* set up input amps for analog loopback */
14506 /* Amp Indices: DAC = 0, mixer = 1 */
14507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14511 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14513 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14520 * 3-stack pin configuration:
14521 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14523 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14525 * Set pin mode and muting
14527 /* set front pin widgets 0x14 for output */
14528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14529 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14530 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14532 /* Mic (rear) pin: input vref at 80% */
14533 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14534 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14535 /* Front Mic pin: input vref at 80% */
14536 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14537 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14538 /* Line In pin: input */
14539 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14541 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14542 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14543 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14544 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14545 /* CD pin widget for input */
14546 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14552 * 6-stack pin configuration:
14554 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14556 * Set pin mode and muting
14558 /* set front pin widgets 0x14 for output */
14559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14561 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14563 /* Rear Pin: output 1 (0x0d) */
14564 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14566 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14567 /* CLFE Pin: output 2 (0x0e) */
14568 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14569 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14570 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14571 /* Side Pin: output 3 (0x0f) */
14572 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14573 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14574 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14576 /* Mic (rear) pin: input vref at 80% */
14577 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14578 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14579 /* Front Mic pin: input vref at 80% */
14580 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14581 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14582 /* Line In pin: input */
14583 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14584 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14585 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14586 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14587 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14588 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14589 /* CD pin widget for input */
14590 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14595 static struct hda_verb alc861vd_eapd_verbs[] = {
14596 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14600 static struct hda_verb alc660vd_eapd_verbs[] = {
14601 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14602 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14606 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14608 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14610 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14611 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14615 /* toggle speaker-output according to the hp-jack state */
14616 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14618 unsigned int present;
14619 unsigned char bits;
14621 present = snd_hda_codec_read(codec, 0x1b, 0,
14622 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14623 bits = present ? HDA_AMP_MUTE : 0;
14624 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14625 HDA_AMP_MUTE, bits);
14628 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14630 unsigned int present;
14631 unsigned char bits;
14633 present = snd_hda_codec_read(codec, 0x18, 0,
14634 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14635 bits = present ? HDA_AMP_MUTE : 0;
14636 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14637 HDA_AMP_MUTE, bits);
14640 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14642 alc861vd_lenovo_hp_automute(codec);
14643 alc861vd_lenovo_mic_automute(codec);
14646 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14649 switch (res >> 26) {
14650 case ALC880_HP_EVENT:
14651 alc861vd_lenovo_hp_automute(codec);
14653 case ALC880_MIC_EVENT:
14654 alc861vd_lenovo_mic_automute(codec);
14659 static struct hda_verb alc861vd_dallas_verbs[] = {
14660 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14661 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14662 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14663 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14665 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14667 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14668 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14670 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14671 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14672 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14674 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14675 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14676 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14678 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14679 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14680 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14681 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14683 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14684 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14685 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14686 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14687 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14689 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14690 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14692 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14693 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14694 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14695 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14697 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14698 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14699 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14704 /* toggle speaker-output according to the hp-jack state */
14705 static void alc861vd_dallas_automute(struct hda_codec *codec)
14707 unsigned int present;
14709 present = snd_hda_codec_read(codec, 0x15, 0,
14710 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14711 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14712 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14715 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14717 if ((res >> 26) == ALC880_HP_EVENT)
14718 alc861vd_dallas_automute(codec);
14721 #ifdef CONFIG_SND_HDA_POWER_SAVE
14722 #define alc861vd_loopbacks alc880_loopbacks
14725 /* pcm configuration: identiacal with ALC880 */
14726 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14727 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14728 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14729 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14732 * configuration and preset
14734 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14735 [ALC660VD_3ST] = "3stack-660",
14736 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14737 [ALC660VD_ASUS_V1S] = "asus-v1s",
14738 [ALC861VD_3ST] = "3stack",
14739 [ALC861VD_3ST_DIG] = "3stack-digout",
14740 [ALC861VD_6ST_DIG] = "6stack-digout",
14741 [ALC861VD_LENOVO] = "lenovo",
14742 [ALC861VD_DALLAS] = "dallas",
14743 [ALC861VD_HP] = "hp",
14744 [ALC861VD_AUTO] = "auto",
14747 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14748 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14749 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14750 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14751 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14752 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14753 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14754 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14755 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14756 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14757 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14758 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14759 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14760 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14761 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14762 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14766 static struct alc_config_preset alc861vd_presets[] = {
14768 .mixers = { alc861vd_3st_mixer },
14769 .init_verbs = { alc861vd_volume_init_verbs,
14770 alc861vd_3stack_init_verbs },
14771 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14772 .dac_nids = alc660vd_dac_nids,
14773 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14774 .channel_mode = alc861vd_3stack_2ch_modes,
14775 .input_mux = &alc861vd_capture_source,
14777 [ALC660VD_3ST_DIG] = {
14778 .mixers = { alc861vd_3st_mixer },
14779 .init_verbs = { alc861vd_volume_init_verbs,
14780 alc861vd_3stack_init_verbs },
14781 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14782 .dac_nids = alc660vd_dac_nids,
14783 .dig_out_nid = ALC861VD_DIGOUT_NID,
14784 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14785 .channel_mode = alc861vd_3stack_2ch_modes,
14786 .input_mux = &alc861vd_capture_source,
14789 .mixers = { alc861vd_3st_mixer },
14790 .init_verbs = { alc861vd_volume_init_verbs,
14791 alc861vd_3stack_init_verbs },
14792 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14793 .dac_nids = alc861vd_dac_nids,
14794 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14795 .channel_mode = alc861vd_3stack_2ch_modes,
14796 .input_mux = &alc861vd_capture_source,
14798 [ALC861VD_3ST_DIG] = {
14799 .mixers = { alc861vd_3st_mixer },
14800 .init_verbs = { alc861vd_volume_init_verbs,
14801 alc861vd_3stack_init_verbs },
14802 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14803 .dac_nids = alc861vd_dac_nids,
14804 .dig_out_nid = ALC861VD_DIGOUT_NID,
14805 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14806 .channel_mode = alc861vd_3stack_2ch_modes,
14807 .input_mux = &alc861vd_capture_source,
14809 [ALC861VD_6ST_DIG] = {
14810 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14811 .init_verbs = { alc861vd_volume_init_verbs,
14812 alc861vd_6stack_init_verbs },
14813 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14814 .dac_nids = alc861vd_dac_nids,
14815 .dig_out_nid = ALC861VD_DIGOUT_NID,
14816 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14817 .channel_mode = alc861vd_6stack_modes,
14818 .input_mux = &alc861vd_capture_source,
14820 [ALC861VD_LENOVO] = {
14821 .mixers = { alc861vd_lenovo_mixer },
14822 .init_verbs = { alc861vd_volume_init_verbs,
14823 alc861vd_3stack_init_verbs,
14824 alc861vd_eapd_verbs,
14825 alc861vd_lenovo_unsol_verbs },
14826 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14827 .dac_nids = alc660vd_dac_nids,
14828 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14829 .channel_mode = alc861vd_3stack_2ch_modes,
14830 .input_mux = &alc861vd_capture_source,
14831 .unsol_event = alc861vd_lenovo_unsol_event,
14832 .init_hook = alc861vd_lenovo_automute,
14834 [ALC861VD_DALLAS] = {
14835 .mixers = { alc861vd_dallas_mixer },
14836 .init_verbs = { alc861vd_dallas_verbs },
14837 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14838 .dac_nids = alc861vd_dac_nids,
14839 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14840 .channel_mode = alc861vd_3stack_2ch_modes,
14841 .input_mux = &alc861vd_dallas_capture_source,
14842 .unsol_event = alc861vd_dallas_unsol_event,
14843 .init_hook = alc861vd_dallas_automute,
14846 .mixers = { alc861vd_hp_mixer },
14847 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14848 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14849 .dac_nids = alc861vd_dac_nids,
14850 .dig_out_nid = ALC861VD_DIGOUT_NID,
14851 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14852 .channel_mode = alc861vd_3stack_2ch_modes,
14853 .input_mux = &alc861vd_hp_capture_source,
14854 .unsol_event = alc861vd_dallas_unsol_event,
14855 .init_hook = alc861vd_dallas_automute,
14857 [ALC660VD_ASUS_V1S] = {
14858 .mixers = { alc861vd_lenovo_mixer },
14859 .init_verbs = { alc861vd_volume_init_verbs,
14860 alc861vd_3stack_init_verbs,
14861 alc861vd_eapd_verbs,
14862 alc861vd_lenovo_unsol_verbs },
14863 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14864 .dac_nids = alc660vd_dac_nids,
14865 .dig_out_nid = ALC861VD_DIGOUT_NID,
14866 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14867 .channel_mode = alc861vd_3stack_2ch_modes,
14868 .input_mux = &alc861vd_capture_source,
14869 .unsol_event = alc861vd_lenovo_unsol_event,
14870 .init_hook = alc861vd_lenovo_automute,
14875 * BIOS auto configuration
14877 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14878 hda_nid_t nid, int pin_type, int dac_idx)
14880 alc_set_pin_output(codec, nid, pin_type);
14883 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14885 struct alc_spec *spec = codec->spec;
14888 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14889 for (i = 0; i <= HDA_SIDE; i++) {
14890 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14891 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14893 alc861vd_auto_set_output_and_unmute(codec, nid,
14899 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14901 struct alc_spec *spec = codec->spec;
14904 pin = spec->autocfg.hp_pins[0];
14905 if (pin) /* connect to front and use dac 0 */
14906 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14907 pin = spec->autocfg.speaker_pins[0];
14909 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14912 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14913 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14915 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14917 struct alc_spec *spec = codec->spec;
14920 for (i = 0; i < AUTO_PIN_LAST; i++) {
14921 hda_nid_t nid = spec->autocfg.input_pins[i];
14922 if (alc861vd_is_input_pin(nid)) {
14923 alc_set_input_pin(codec, nid, i);
14924 if (nid != ALC861VD_PIN_CD_NID &&
14925 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14926 snd_hda_codec_write(codec, nid, 0,
14927 AC_VERB_SET_AMP_GAIN_MUTE,
14933 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14935 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14936 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14938 /* add playback controls from the parsed DAC table */
14939 /* Based on ALC880 version. But ALC861VD has separate,
14940 * different NIDs for mute/unmute switch and volume control */
14941 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14942 const struct auto_pin_cfg *cfg)
14945 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14946 hda_nid_t nid_v, nid_s;
14949 for (i = 0; i < cfg->line_outs; i++) {
14950 if (!spec->multiout.dac_nids[i])
14952 nid_v = alc861vd_idx_to_mixer_vol(
14954 spec->multiout.dac_nids[i]));
14955 nid_s = alc861vd_idx_to_mixer_switch(
14957 spec->multiout.dac_nids[i]));
14961 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14962 "Center Playback Volume",
14963 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14967 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14968 "LFE Playback Volume",
14969 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14973 err = add_control(spec, ALC_CTL_BIND_MUTE,
14974 "Center Playback Switch",
14975 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14979 err = add_control(spec, ALC_CTL_BIND_MUTE,
14980 "LFE Playback Switch",
14981 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14986 sprintf(name, "%s Playback Volume", chname[i]);
14987 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14988 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14992 sprintf(name, "%s Playback Switch", chname[i]);
14993 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14994 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15003 /* add playback controls for speaker and HP outputs */
15004 /* Based on ALC880 version. But ALC861VD has separate,
15005 * different NIDs for mute/unmute switch and volume control */
15006 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15007 hda_nid_t pin, const char *pfx)
15009 hda_nid_t nid_v, nid_s;
15016 if (alc880_is_fixed_pin(pin)) {
15017 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15018 /* specify the DAC as the extra output */
15019 if (!spec->multiout.hp_nid)
15020 spec->multiout.hp_nid = nid_v;
15022 spec->multiout.extra_out_nid[0] = nid_v;
15023 /* control HP volume/switch on the output mixer amp */
15024 nid_v = alc861vd_idx_to_mixer_vol(
15025 alc880_fixed_pin_idx(pin));
15026 nid_s = alc861vd_idx_to_mixer_switch(
15027 alc880_fixed_pin_idx(pin));
15029 sprintf(name, "%s Playback Volume", pfx);
15030 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15031 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15034 sprintf(name, "%s Playback Switch", pfx);
15035 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15036 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15039 } else if (alc880_is_multi_pin(pin)) {
15040 /* set manual connection */
15041 /* we have only a switch on HP-out PIN */
15042 sprintf(name, "%s Playback Switch", pfx);
15043 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15044 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15051 /* parse the BIOS configuration and set up the alc_spec
15052 * return 1 if successful, 0 if the proper config is not found,
15053 * or a negative error code
15054 * Based on ALC880 version - had to change it to override
15055 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15056 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15058 struct alc_spec *spec = codec->spec;
15060 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15062 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15066 if (!spec->autocfg.line_outs)
15067 return 0; /* can't find valid BIOS pin config */
15069 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15072 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15075 err = alc861vd_auto_create_extra_out(spec,
15076 spec->autocfg.speaker_pins[0],
15080 err = alc861vd_auto_create_extra_out(spec,
15081 spec->autocfg.hp_pins[0],
15085 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15089 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15091 if (spec->autocfg.dig_outs)
15092 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15094 if (spec->kctls.list)
15095 add_mixer(spec, spec->kctls.list);
15097 add_verb(spec, alc861vd_volume_init_verbs);
15099 spec->num_mux_defs = 1;
15100 spec->input_mux = &spec->private_imux[0];
15102 err = alc_auto_add_mic_boost(codec);
15109 /* additional initialization for auto-configuration model */
15110 static void alc861vd_auto_init(struct hda_codec *codec)
15112 struct alc_spec *spec = codec->spec;
15113 alc861vd_auto_init_multi_out(codec);
15114 alc861vd_auto_init_hp_out(codec);
15115 alc861vd_auto_init_analog_input(codec);
15116 alc861vd_auto_init_input_src(codec);
15117 if (spec->unsol_event)
15118 alc_inithook(codec);
15121 static int patch_alc861vd(struct hda_codec *codec)
15123 struct alc_spec *spec;
15124 int err, board_config;
15126 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15130 codec->spec = spec;
15132 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15136 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15137 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
15138 "ALC861VD, trying auto-probe from BIOS...\n");
15139 board_config = ALC861VD_AUTO;
15142 if (board_config == ALC861VD_AUTO) {
15143 /* automatic parse from the BIOS config */
15144 err = alc861vd_parse_auto_config(codec);
15150 "hda_codec: Cannot set up configuration "
15151 "from BIOS. Using base mode...\n");
15152 board_config = ALC861VD_3ST;
15156 err = snd_hda_attach_beep_device(codec, 0x23);
15162 if (board_config != ALC861VD_AUTO)
15163 setup_preset(spec, &alc861vd_presets[board_config]);
15165 if (codec->vendor_id == 0x10ec0660) {
15166 spec->stream_name_analog = "ALC660-VD Analog";
15167 spec->stream_name_digital = "ALC660-VD Digital";
15168 /* always turn on EAPD */
15169 add_verb(spec, alc660vd_eapd_verbs);
15171 spec->stream_name_analog = "ALC861VD Analog";
15172 spec->stream_name_digital = "ALC861VD Digital";
15175 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15176 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15178 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15179 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15181 spec->adc_nids = alc861vd_adc_nids;
15182 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15183 spec->capsrc_nids = alc861vd_capsrc_nids;
15184 spec->capture_style = CAPT_MIX;
15186 set_capture_mixer(spec);
15187 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15189 spec->vmaster_nid = 0x02;
15191 codec->patch_ops = alc_patch_ops;
15193 if (board_config == ALC861VD_AUTO)
15194 spec->init_hook = alc861vd_auto_init;
15195 #ifdef CONFIG_SND_HDA_POWER_SAVE
15196 if (!spec->loopback.amplist)
15197 spec->loopback.amplist = alc861vd_loopbacks;
15199 codec->proc_widget_hook = print_realtek_coef;
15207 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15208 * configuration. Each pin widget can choose any input DACs and a mixer.
15209 * Each ADC is connected from a mixer of all inputs. This makes possible
15210 * 6-channel independent captures.
15212 * In addition, an independent DAC for the multi-playback (not used in this
15215 #define ALC662_DIGOUT_NID 0x06
15216 #define ALC662_DIGIN_NID 0x0a
15218 static hda_nid_t alc662_dac_nids[4] = {
15219 /* front, rear, clfe, rear_surr */
15223 static hda_nid_t alc272_dac_nids[2] = {
15227 static hda_nid_t alc662_adc_nids[1] = {
15232 static hda_nid_t alc272_adc_nids[1] = {
15237 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15238 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15242 /* FIXME: should be a matrix-type input source selection */
15243 static struct hda_input_mux alc662_capture_source = {
15247 { "Front Mic", 0x1 },
15253 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15261 static struct hda_input_mux alc662_eeepc_capture_source = {
15269 static struct hda_input_mux alc663_capture_source = {
15273 { "Front Mic", 0x1 },
15278 static struct hda_input_mux alc663_m51va_capture_source = {
15281 { "Ext-Mic", 0x0 },
15289 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15296 static struct hda_verb alc662_3ST_ch2_init[] = {
15297 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15298 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15299 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15300 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15307 static struct hda_verb alc662_3ST_ch6_init[] = {
15308 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15309 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15310 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15311 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15312 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15313 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15317 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15318 { 2, alc662_3ST_ch2_init },
15319 { 6, alc662_3ST_ch6_init },
15325 static struct hda_verb alc662_sixstack_ch6_init[] = {
15326 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15327 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15328 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15335 static struct hda_verb alc662_sixstack_ch8_init[] = {
15336 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15337 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15338 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15342 static struct hda_channel_mode alc662_5stack_modes[2] = {
15343 { 2, alc662_sixstack_ch6_init },
15344 { 6, alc662_sixstack_ch8_init },
15347 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15348 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15351 static struct snd_kcontrol_new alc662_base_mixer[] = {
15352 /* output mixer control */
15353 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15354 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15355 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15356 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15357 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15358 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15359 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15360 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15361 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15363 /*Input mixer control */
15364 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15365 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15366 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15367 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15368 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15369 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15370 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15371 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15375 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15376 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15377 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15378 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15379 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15380 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15381 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15382 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15384 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15385 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15386 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15390 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15391 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15392 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15393 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15394 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15395 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15396 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15397 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15398 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15399 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15400 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15401 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15402 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15403 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15406 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15407 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15411 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15412 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15413 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15414 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15415 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15416 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15417 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15418 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15420 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15424 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15425 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15427 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15428 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15430 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15431 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15432 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15434 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15435 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15436 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15440 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15441 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15442 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15443 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15444 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15445 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15446 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15447 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15448 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15449 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15450 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15458 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15459 .ops = &snd_hda_bind_vol,
15461 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15462 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15467 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15468 .ops = &snd_hda_bind_sw,
15470 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15471 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15476 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15477 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15478 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15479 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15480 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15484 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15485 .ops = &snd_hda_bind_sw,
15487 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15488 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15489 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15494 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15495 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15496 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15499 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15500 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15505 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15506 .ops = &snd_hda_bind_sw,
15508 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15509 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15510 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15515 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15516 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15517 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15518 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15519 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15520 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15521 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15525 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15526 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15527 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15531 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15532 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15536 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15537 .ops = &snd_hda_bind_vol,
15539 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15540 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15545 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15546 .ops = &snd_hda_bind_sw,
15548 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15549 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15554 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15555 HDA_BIND_VOL("Master Playback Volume",
15556 &alc663_asus_two_bind_master_vol),
15557 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15558 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15565 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15566 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15567 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15568 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15569 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15570 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15571 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15575 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15576 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15577 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15578 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15579 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15580 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15584 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15585 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15589 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15590 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15591 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15596 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15597 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15598 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15599 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15603 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15605 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15606 .name = "Channel Mode",
15607 .info = alc_ch_mode_info,
15608 .get = alc_ch_mode_get,
15609 .put = alc_ch_mode_put,
15614 static struct hda_verb alc662_init_verbs[] = {
15615 /* ADC: mute amp left and right */
15616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15617 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15618 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15620 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15621 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15622 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15633 /* Front Pin: output 0 (0x0c) */
15634 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15637 /* Rear Pin: output 1 (0x0d) */
15638 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15641 /* CLFE Pin: output 2 (0x0e) */
15642 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15643 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15645 /* Mic (rear) pin: input vref at 80% */
15646 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15647 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15648 /* Front Mic pin: input vref at 80% */
15649 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15650 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15651 /* Line In pin: input */
15652 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15653 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15654 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15655 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15656 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15657 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15658 /* CD pin widget for input */
15659 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15661 /* FIXME: use matrix-type input source selection */
15662 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15667 /* always trun on EAPD */
15668 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15669 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15674 static struct hda_verb alc662_sue_init_verbs[] = {
15675 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15676 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15680 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15681 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15682 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15686 /* Set Unsolicited Event*/
15687 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15689 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15694 * generic initialization of ADC, input mixers and output mixers
15696 static struct hda_verb alc662_auto_init_verbs[] = {
15698 * Unmute ADC and set the default input to mic-in
15700 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15703 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15705 * Note: PASD motherboards uses the Line In 2 as the input for front
15706 * panel mic (mic 2)
15708 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15716 * Set up output mixers (0x0c - 0x0f)
15718 /* set vol=0 to output mixers */
15719 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15720 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15721 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15723 /* set up input amps for analog loopback */
15724 /* Amp Indices: DAC = 0, mixer = 1 */
15725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15728 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15730 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15733 /* FIXME: use matrix-type input source selection */
15734 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15737 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15741 /* additional verbs for ALC663 */
15742 static struct hda_verb alc663_auto_init_verbs[] = {
15743 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15744 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15748 static struct hda_verb alc663_m51va_init_verbs[] = {
15749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15750 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15751 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15752 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15753 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15754 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15755 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15756 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15757 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15761 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15762 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15763 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15764 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15766 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15767 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15768 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15772 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15773 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15774 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15775 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15776 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15779 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15780 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15784 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15786 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15787 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15790 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15791 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15795 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15796 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15797 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15798 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15799 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15802 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15803 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15804 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15805 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15806 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15807 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15811 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15812 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15813 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15814 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15815 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15818 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15820 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15821 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15822 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15823 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15827 static struct hda_verb alc663_g71v_init_verbs[] = {
15828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15829 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15830 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15832 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15833 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15834 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15836 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15837 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15838 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15842 static struct hda_verb alc663_g50v_init_verbs[] = {
15843 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15844 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15845 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15847 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15848 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15852 static struct hda_verb alc662_ecs_init_verbs[] = {
15853 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15854 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15855 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15856 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15860 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15861 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15862 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15864 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15865 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15866 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15867 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15870 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15871 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15875 static struct hda_verb alc272_dell_init_verbs[] = {
15876 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15877 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15879 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15880 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15881 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15882 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15883 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15884 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15885 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15886 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15890 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15891 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15892 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15896 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
15897 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
15898 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
15902 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15904 unsigned int present;
15905 unsigned char bits;
15907 present = snd_hda_codec_read(codec, 0x14, 0,
15908 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15909 bits = present ? HDA_AMP_MUTE : 0;
15910 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15911 HDA_AMP_MUTE, bits);
15914 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15916 unsigned int present;
15917 unsigned char bits;
15919 present = snd_hda_codec_read(codec, 0x1b, 0,
15920 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15921 bits = present ? HDA_AMP_MUTE : 0;
15922 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15923 HDA_AMP_MUTE, bits);
15924 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15925 HDA_AMP_MUTE, bits);
15928 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15931 if ((res >> 26) == ALC880_HP_EVENT)
15932 alc662_lenovo_101e_all_automute(codec);
15933 if ((res >> 26) == ALC880_FRONT_EVENT)
15934 alc662_lenovo_101e_ispeaker_automute(codec);
15937 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15939 unsigned int present;
15941 present = snd_hda_codec_read(codec, 0x18, 0,
15942 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15943 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15944 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15945 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15946 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15947 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15948 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15949 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15950 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15953 /* unsolicited event for HP jack sensing */
15954 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15957 if ((res >> 26) == ALC880_HP_EVENT)
15958 alc262_hippo1_automute( codec );
15960 if ((res >> 26) == ALC880_MIC_EVENT)
15961 alc662_eeepc_mic_automute(codec);
15964 static void alc662_eeepc_inithook(struct hda_codec *codec)
15966 alc262_hippo1_automute( codec );
15967 alc662_eeepc_mic_automute(codec);
15970 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15973 unsigned int present;
15975 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15976 present = snd_hda_codec_read(codec, 0x14, 0,
15977 AC_VERB_GET_PIN_SENSE, 0);
15978 present = (present & 0x80000000) != 0;
15980 /* mute internal speaker */
15981 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15982 HDA_AMP_MUTE, HDA_AMP_MUTE);
15984 /* unmute internal speaker if necessary */
15985 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15986 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15987 HDA_AMP_MUTE, mute);
15991 /* unsolicited event for HP jack sensing */
15992 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15995 if ((res >> 26) == ALC880_HP_EVENT)
15996 alc662_eeepc_ep20_automute(codec);
15999 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16001 alc662_eeepc_ep20_automute(codec);
16004 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16006 unsigned int present;
16007 unsigned char bits;
16009 present = snd_hda_codec_read(codec, 0x21, 0,
16010 AC_VERB_GET_PIN_SENSE, 0)
16011 & AC_PINSENSE_PRESENCE;
16012 bits = present ? HDA_AMP_MUTE : 0;
16013 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16014 AMP_IN_MUTE(0), bits);
16015 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16016 AMP_IN_MUTE(0), bits);
16019 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16021 unsigned int present;
16022 unsigned char bits;
16024 present = snd_hda_codec_read(codec, 0x21, 0,
16025 AC_VERB_GET_PIN_SENSE, 0)
16026 & AC_PINSENSE_PRESENCE;
16027 bits = present ? HDA_AMP_MUTE : 0;
16028 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16029 AMP_IN_MUTE(0), bits);
16030 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16031 AMP_IN_MUTE(0), bits);
16032 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16033 AMP_IN_MUTE(0), bits);
16034 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16035 AMP_IN_MUTE(0), bits);
16038 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16040 unsigned int present;
16041 unsigned char bits;
16043 present = snd_hda_codec_read(codec, 0x15, 0,
16044 AC_VERB_GET_PIN_SENSE, 0)
16045 & AC_PINSENSE_PRESENCE;
16046 bits = present ? HDA_AMP_MUTE : 0;
16047 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16048 AMP_IN_MUTE(0), bits);
16049 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16050 AMP_IN_MUTE(0), bits);
16051 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16052 AMP_IN_MUTE(0), bits);
16053 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16054 AMP_IN_MUTE(0), bits);
16057 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16059 unsigned int present;
16060 unsigned char bits;
16062 present = snd_hda_codec_read(codec, 0x1b, 0,
16063 AC_VERB_GET_PIN_SENSE, 0)
16064 & AC_PINSENSE_PRESENCE;
16065 bits = present ? 0 : PIN_OUT;
16066 snd_hda_codec_write(codec, 0x14, 0,
16067 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16070 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16072 unsigned int present1, present2;
16074 present1 = snd_hda_codec_read(codec, 0x21, 0,
16075 AC_VERB_GET_PIN_SENSE, 0)
16076 & AC_PINSENSE_PRESENCE;
16077 present2 = snd_hda_codec_read(codec, 0x15, 0,
16078 AC_VERB_GET_PIN_SENSE, 0)
16079 & AC_PINSENSE_PRESENCE;
16081 if (present1 || present2) {
16082 snd_hda_codec_write_cache(codec, 0x14, 0,
16083 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16085 snd_hda_codec_write_cache(codec, 0x14, 0,
16086 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16090 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16092 unsigned int present1, present2;
16094 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16095 AC_VERB_GET_PIN_SENSE, 0)
16096 & AC_PINSENSE_PRESENCE;
16097 present2 = snd_hda_codec_read(codec, 0x15, 0,
16098 AC_VERB_GET_PIN_SENSE, 0)
16099 & AC_PINSENSE_PRESENCE;
16101 if (present1 || present2) {
16102 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16103 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16104 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16105 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16107 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16108 AMP_IN_MUTE(0), 0);
16109 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16110 AMP_IN_MUTE(0), 0);
16114 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16116 unsigned int present;
16118 present = snd_hda_codec_read(codec, 0x18, 0,
16119 AC_VERB_GET_PIN_SENSE, 0)
16120 & AC_PINSENSE_PRESENCE;
16121 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16122 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16123 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16124 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16125 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16126 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16127 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16128 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16131 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16134 switch (res >> 26) {
16135 case ALC880_HP_EVENT:
16136 alc663_m51va_speaker_automute(codec);
16138 case ALC880_MIC_EVENT:
16139 alc663_m51va_mic_automute(codec);
16144 static void alc663_m51va_inithook(struct hda_codec *codec)
16146 alc663_m51va_speaker_automute(codec);
16147 alc663_m51va_mic_automute(codec);
16150 /* ***************** Mode1 ******************************/
16151 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16154 switch (res >> 26) {
16155 case ALC880_HP_EVENT:
16156 alc663_m51va_speaker_automute(codec);
16158 case ALC880_MIC_EVENT:
16159 alc662_eeepc_mic_automute(codec);
16164 static void alc663_mode1_inithook(struct hda_codec *codec)
16166 alc663_m51va_speaker_automute(codec);
16167 alc662_eeepc_mic_automute(codec);
16169 /* ***************** Mode2 ******************************/
16170 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16173 switch (res >> 26) {
16174 case ALC880_HP_EVENT:
16175 alc662_f5z_speaker_automute(codec);
16177 case ALC880_MIC_EVENT:
16178 alc662_eeepc_mic_automute(codec);
16183 static void alc662_mode2_inithook(struct hda_codec *codec)
16185 alc662_f5z_speaker_automute(codec);
16186 alc662_eeepc_mic_automute(codec);
16188 /* ***************** Mode3 ******************************/
16189 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16192 switch (res >> 26) {
16193 case ALC880_HP_EVENT:
16194 alc663_two_hp_m1_speaker_automute(codec);
16196 case ALC880_MIC_EVENT:
16197 alc662_eeepc_mic_automute(codec);
16202 static void alc663_mode3_inithook(struct hda_codec *codec)
16204 alc663_two_hp_m1_speaker_automute(codec);
16205 alc662_eeepc_mic_automute(codec);
16207 /* ***************** Mode4 ******************************/
16208 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16211 switch (res >> 26) {
16212 case ALC880_HP_EVENT:
16213 alc663_21jd_two_speaker_automute(codec);
16215 case ALC880_MIC_EVENT:
16216 alc662_eeepc_mic_automute(codec);
16221 static void alc663_mode4_inithook(struct hda_codec *codec)
16223 alc663_21jd_two_speaker_automute(codec);
16224 alc662_eeepc_mic_automute(codec);
16226 /* ***************** Mode5 ******************************/
16227 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16230 switch (res >> 26) {
16231 case ALC880_HP_EVENT:
16232 alc663_15jd_two_speaker_automute(codec);
16234 case ALC880_MIC_EVENT:
16235 alc662_eeepc_mic_automute(codec);
16240 static void alc663_mode5_inithook(struct hda_codec *codec)
16242 alc663_15jd_two_speaker_automute(codec);
16243 alc662_eeepc_mic_automute(codec);
16245 /* ***************** Mode6 ******************************/
16246 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16249 switch (res >> 26) {
16250 case ALC880_HP_EVENT:
16251 alc663_two_hp_m2_speaker_automute(codec);
16253 case ALC880_MIC_EVENT:
16254 alc662_eeepc_mic_automute(codec);
16259 static void alc663_mode6_inithook(struct hda_codec *codec)
16261 alc663_two_hp_m2_speaker_automute(codec);
16262 alc662_eeepc_mic_automute(codec);
16265 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16267 unsigned int present;
16268 unsigned char bits;
16270 present = snd_hda_codec_read(codec, 0x21, 0,
16271 AC_VERB_GET_PIN_SENSE, 0)
16272 & AC_PINSENSE_PRESENCE;
16273 bits = present ? HDA_AMP_MUTE : 0;
16274 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16275 HDA_AMP_MUTE, bits);
16276 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16277 HDA_AMP_MUTE, bits);
16280 static void alc663_g71v_front_automute(struct hda_codec *codec)
16282 unsigned int present;
16283 unsigned char bits;
16285 present = snd_hda_codec_read(codec, 0x15, 0,
16286 AC_VERB_GET_PIN_SENSE, 0)
16287 & AC_PINSENSE_PRESENCE;
16288 bits = present ? HDA_AMP_MUTE : 0;
16289 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16290 HDA_AMP_MUTE, bits);
16293 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16296 switch (res >> 26) {
16297 case ALC880_HP_EVENT:
16298 alc663_g71v_hp_automute(codec);
16300 case ALC880_FRONT_EVENT:
16301 alc663_g71v_front_automute(codec);
16303 case ALC880_MIC_EVENT:
16304 alc662_eeepc_mic_automute(codec);
16309 static void alc663_g71v_inithook(struct hda_codec *codec)
16311 alc663_g71v_front_automute(codec);
16312 alc663_g71v_hp_automute(codec);
16313 alc662_eeepc_mic_automute(codec);
16316 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16319 switch (res >> 26) {
16320 case ALC880_HP_EVENT:
16321 alc663_m51va_speaker_automute(codec);
16323 case ALC880_MIC_EVENT:
16324 alc662_eeepc_mic_automute(codec);
16329 static void alc663_g50v_inithook(struct hda_codec *codec)
16331 alc663_m51va_speaker_automute(codec);
16332 alc662_eeepc_mic_automute(codec);
16335 /* bind hp and internal speaker mute (with plug check) */
16336 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16337 struct snd_ctl_elem_value *ucontrol)
16339 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16340 long *valp = ucontrol->value.integer.value;
16343 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16345 valp[0] ? 0 : HDA_AMP_MUTE);
16346 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16348 valp[1] ? 0 : HDA_AMP_MUTE);
16350 alc262_hippo1_automute(codec);
16354 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16355 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16358 .name = "Master Playback Switch",
16359 .info = snd_hda_mixer_amp_switch_info,
16360 .get = snd_hda_mixer_amp_switch_get,
16361 .put = alc662_ecs_master_sw_put,
16362 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16365 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16366 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16367 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16369 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16370 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16371 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16375 #ifdef CONFIG_SND_HDA_POWER_SAVE
16376 #define alc662_loopbacks alc880_loopbacks
16380 /* pcm configuration: identiacal with ALC880 */
16381 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16382 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16383 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16384 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16387 * configuration and preset
16389 static const char *alc662_models[ALC662_MODEL_LAST] = {
16390 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16391 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16392 [ALC662_3ST_6ch] = "3stack-6ch",
16393 [ALC662_5ST_DIG] = "6stack-dig",
16394 [ALC662_LENOVO_101E] = "lenovo-101e",
16395 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16396 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16397 [ALC662_ECS] = "ecs",
16398 [ALC663_ASUS_M51VA] = "m51va",
16399 [ALC663_ASUS_G71V] = "g71v",
16400 [ALC663_ASUS_H13] = "h13",
16401 [ALC663_ASUS_G50V] = "g50v",
16402 [ALC663_ASUS_MODE1] = "asus-mode1",
16403 [ALC662_ASUS_MODE2] = "asus-mode2",
16404 [ALC663_ASUS_MODE3] = "asus-mode3",
16405 [ALC663_ASUS_MODE4] = "asus-mode4",
16406 [ALC663_ASUS_MODE5] = "asus-mode5",
16407 [ALC663_ASUS_MODE6] = "asus-mode6",
16408 [ALC662_AUTO] = "auto",
16411 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16412 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16413 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16414 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16415 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16416 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16417 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16418 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16419 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16420 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16421 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16422 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16423 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16424 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16425 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16426 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16427 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16428 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16429 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16430 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16431 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16432 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16433 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16434 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16435 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16436 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16437 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16438 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16439 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16440 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16441 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16442 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16443 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16444 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16445 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16446 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16447 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16448 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16449 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16450 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16451 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16452 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16453 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16454 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16455 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16456 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16457 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16458 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16459 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16460 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16461 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16462 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16463 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16464 ALC662_3ST_6ch_DIG),
16465 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16466 ALC662_3ST_6ch_DIG),
16467 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16468 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16469 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16470 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16471 ALC662_3ST_6ch_DIG),
16472 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16477 static struct alc_config_preset alc662_presets[] = {
16478 [ALC662_3ST_2ch_DIG] = {
16479 .mixers = { alc662_3ST_2ch_mixer },
16480 .init_verbs = { alc662_init_verbs },
16481 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16482 .dac_nids = alc662_dac_nids,
16483 .dig_out_nid = ALC662_DIGOUT_NID,
16484 .dig_in_nid = ALC662_DIGIN_NID,
16485 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16486 .channel_mode = alc662_3ST_2ch_modes,
16487 .input_mux = &alc662_capture_source,
16489 [ALC662_3ST_6ch_DIG] = {
16490 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16491 .init_verbs = { alc662_init_verbs },
16492 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16493 .dac_nids = alc662_dac_nids,
16494 .dig_out_nid = ALC662_DIGOUT_NID,
16495 .dig_in_nid = ALC662_DIGIN_NID,
16496 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16497 .channel_mode = alc662_3ST_6ch_modes,
16499 .input_mux = &alc662_capture_source,
16501 [ALC662_3ST_6ch] = {
16502 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16503 .init_verbs = { alc662_init_verbs },
16504 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16505 .dac_nids = alc662_dac_nids,
16506 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16507 .channel_mode = alc662_3ST_6ch_modes,
16509 .input_mux = &alc662_capture_source,
16511 [ALC662_5ST_DIG] = {
16512 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16513 .init_verbs = { alc662_init_verbs },
16514 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16515 .dac_nids = alc662_dac_nids,
16516 .dig_out_nid = ALC662_DIGOUT_NID,
16517 .dig_in_nid = ALC662_DIGIN_NID,
16518 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16519 .channel_mode = alc662_5stack_modes,
16520 .input_mux = &alc662_capture_source,
16522 [ALC662_LENOVO_101E] = {
16523 .mixers = { alc662_lenovo_101e_mixer },
16524 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16525 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16526 .dac_nids = alc662_dac_nids,
16527 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16528 .channel_mode = alc662_3ST_2ch_modes,
16529 .input_mux = &alc662_lenovo_101e_capture_source,
16530 .unsol_event = alc662_lenovo_101e_unsol_event,
16531 .init_hook = alc662_lenovo_101e_all_automute,
16533 [ALC662_ASUS_EEEPC_P701] = {
16534 .mixers = { alc662_eeepc_p701_mixer },
16535 .init_verbs = { alc662_init_verbs,
16536 alc662_eeepc_sue_init_verbs },
16537 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16538 .dac_nids = alc662_dac_nids,
16539 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16540 .channel_mode = alc662_3ST_2ch_modes,
16541 .input_mux = &alc662_eeepc_capture_source,
16542 .unsol_event = alc662_eeepc_unsol_event,
16543 .init_hook = alc662_eeepc_inithook,
16545 [ALC662_ASUS_EEEPC_EP20] = {
16546 .mixers = { alc662_eeepc_ep20_mixer,
16547 alc662_chmode_mixer },
16548 .init_verbs = { alc662_init_verbs,
16549 alc662_eeepc_ep20_sue_init_verbs },
16550 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16551 .dac_nids = alc662_dac_nids,
16552 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16553 .channel_mode = alc662_3ST_6ch_modes,
16554 .input_mux = &alc662_lenovo_101e_capture_source,
16555 .unsol_event = alc662_eeepc_ep20_unsol_event,
16556 .init_hook = alc662_eeepc_ep20_inithook,
16559 .mixers = { alc662_ecs_mixer },
16560 .init_verbs = { alc662_init_verbs,
16561 alc662_ecs_init_verbs },
16562 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16563 .dac_nids = alc662_dac_nids,
16564 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16565 .channel_mode = alc662_3ST_2ch_modes,
16566 .input_mux = &alc662_eeepc_capture_source,
16567 .unsol_event = alc662_eeepc_unsol_event,
16568 .init_hook = alc662_eeepc_inithook,
16570 [ALC663_ASUS_M51VA] = {
16571 .mixers = { alc663_m51va_mixer },
16572 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16573 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16574 .dac_nids = alc662_dac_nids,
16575 .dig_out_nid = ALC662_DIGOUT_NID,
16576 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16577 .channel_mode = alc662_3ST_2ch_modes,
16578 .input_mux = &alc663_m51va_capture_source,
16579 .unsol_event = alc663_m51va_unsol_event,
16580 .init_hook = alc663_m51va_inithook,
16582 [ALC663_ASUS_G71V] = {
16583 .mixers = { alc663_g71v_mixer },
16584 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16585 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16586 .dac_nids = alc662_dac_nids,
16587 .dig_out_nid = ALC662_DIGOUT_NID,
16588 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16589 .channel_mode = alc662_3ST_2ch_modes,
16590 .input_mux = &alc662_eeepc_capture_source,
16591 .unsol_event = alc663_g71v_unsol_event,
16592 .init_hook = alc663_g71v_inithook,
16594 [ALC663_ASUS_H13] = {
16595 .mixers = { alc663_m51va_mixer },
16596 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16597 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16598 .dac_nids = alc662_dac_nids,
16599 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16600 .channel_mode = alc662_3ST_2ch_modes,
16601 .input_mux = &alc663_m51va_capture_source,
16602 .unsol_event = alc663_m51va_unsol_event,
16603 .init_hook = alc663_m51va_inithook,
16605 [ALC663_ASUS_G50V] = {
16606 .mixers = { alc663_g50v_mixer },
16607 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16608 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16609 .dac_nids = alc662_dac_nids,
16610 .dig_out_nid = ALC662_DIGOUT_NID,
16611 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16612 .channel_mode = alc662_3ST_6ch_modes,
16613 .input_mux = &alc663_capture_source,
16614 .unsol_event = alc663_g50v_unsol_event,
16615 .init_hook = alc663_g50v_inithook,
16617 [ALC663_ASUS_MODE1] = {
16618 .mixers = { alc663_m51va_mixer },
16619 .cap_mixer = alc662_auto_capture_mixer,
16620 .init_verbs = { alc662_init_verbs,
16621 alc663_21jd_amic_init_verbs },
16622 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16624 .dac_nids = alc662_dac_nids,
16625 .dig_out_nid = ALC662_DIGOUT_NID,
16626 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16627 .channel_mode = alc662_3ST_2ch_modes,
16628 .input_mux = &alc662_eeepc_capture_source,
16629 .unsol_event = alc663_mode1_unsol_event,
16630 .init_hook = alc663_mode1_inithook,
16632 [ALC662_ASUS_MODE2] = {
16633 .mixers = { alc662_1bjd_mixer },
16634 .cap_mixer = alc662_auto_capture_mixer,
16635 .init_verbs = { alc662_init_verbs,
16636 alc662_1bjd_amic_init_verbs },
16637 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16638 .dac_nids = alc662_dac_nids,
16639 .dig_out_nid = ALC662_DIGOUT_NID,
16640 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16641 .channel_mode = alc662_3ST_2ch_modes,
16642 .input_mux = &alc662_eeepc_capture_source,
16643 .unsol_event = alc662_mode2_unsol_event,
16644 .init_hook = alc662_mode2_inithook,
16646 [ALC663_ASUS_MODE3] = {
16647 .mixers = { alc663_two_hp_m1_mixer },
16648 .cap_mixer = alc662_auto_capture_mixer,
16649 .init_verbs = { alc662_init_verbs,
16650 alc663_two_hp_amic_m1_init_verbs },
16651 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16653 .dac_nids = alc662_dac_nids,
16654 .dig_out_nid = ALC662_DIGOUT_NID,
16655 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16656 .channel_mode = alc662_3ST_2ch_modes,
16657 .input_mux = &alc662_eeepc_capture_source,
16658 .unsol_event = alc663_mode3_unsol_event,
16659 .init_hook = alc663_mode3_inithook,
16661 [ALC663_ASUS_MODE4] = {
16662 .mixers = { alc663_asus_21jd_clfe_mixer },
16663 .cap_mixer = alc662_auto_capture_mixer,
16664 .init_verbs = { alc662_init_verbs,
16665 alc663_21jd_amic_init_verbs},
16666 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16668 .dac_nids = alc662_dac_nids,
16669 .dig_out_nid = ALC662_DIGOUT_NID,
16670 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16671 .channel_mode = alc662_3ST_2ch_modes,
16672 .input_mux = &alc662_eeepc_capture_source,
16673 .unsol_event = alc663_mode4_unsol_event,
16674 .init_hook = alc663_mode4_inithook,
16676 [ALC663_ASUS_MODE5] = {
16677 .mixers = { alc663_asus_15jd_clfe_mixer },
16678 .cap_mixer = alc662_auto_capture_mixer,
16679 .init_verbs = { alc662_init_verbs,
16680 alc663_15jd_amic_init_verbs },
16681 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16683 .dac_nids = alc662_dac_nids,
16684 .dig_out_nid = ALC662_DIGOUT_NID,
16685 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16686 .channel_mode = alc662_3ST_2ch_modes,
16687 .input_mux = &alc662_eeepc_capture_source,
16688 .unsol_event = alc663_mode5_unsol_event,
16689 .init_hook = alc663_mode5_inithook,
16691 [ALC663_ASUS_MODE6] = {
16692 .mixers = { alc663_two_hp_m2_mixer },
16693 .cap_mixer = alc662_auto_capture_mixer,
16694 .init_verbs = { alc662_init_verbs,
16695 alc663_two_hp_amic_m2_init_verbs },
16696 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16698 .dac_nids = alc662_dac_nids,
16699 .dig_out_nid = ALC662_DIGOUT_NID,
16700 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16701 .channel_mode = alc662_3ST_2ch_modes,
16702 .input_mux = &alc662_eeepc_capture_source,
16703 .unsol_event = alc663_mode6_unsol_event,
16704 .init_hook = alc663_mode6_inithook,
16707 .mixers = { alc663_m51va_mixer },
16708 .cap_mixer = alc272_auto_capture_mixer,
16709 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16710 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16711 .dac_nids = alc662_dac_nids,
16712 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16713 .adc_nids = alc272_adc_nids,
16714 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16715 .capsrc_nids = alc272_capsrc_nids,
16716 .channel_mode = alc662_3ST_2ch_modes,
16717 .input_mux = &alc663_m51va_capture_source,
16718 .unsol_event = alc663_m51va_unsol_event,
16719 .init_hook = alc663_m51va_inithook,
16721 [ALC272_DELL_ZM1] = {
16722 .mixers = { alc663_m51va_mixer },
16723 .cap_mixer = alc662_auto_capture_mixer,
16724 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16725 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16726 .dac_nids = alc662_dac_nids,
16727 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16728 .adc_nids = alc662_adc_nids,
16729 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16730 .capsrc_nids = alc662_capsrc_nids,
16731 .channel_mode = alc662_3ST_2ch_modes,
16732 .input_mux = &alc663_m51va_capture_source,
16733 .unsol_event = alc663_m51va_unsol_event,
16734 .init_hook = alc663_m51va_inithook,
16740 * BIOS auto configuration
16743 /* add playback controls from the parsed DAC table */
16744 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16745 const struct auto_pin_cfg *cfg)
16748 static const char *chname[4] = {
16749 "Front", "Surround", NULL /*CLFE*/, "Side"
16754 for (i = 0; i < cfg->line_outs; i++) {
16755 if (!spec->multiout.dac_nids[i])
16757 nid = alc880_idx_to_dac(i);
16760 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16761 "Center Playback Volume",
16762 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16766 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16767 "LFE Playback Volume",
16768 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16772 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16773 "Center Playback Switch",
16774 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16778 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16779 "LFE Playback Switch",
16780 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16785 sprintf(name, "%s Playback Volume", chname[i]);
16786 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16787 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16791 sprintf(name, "%s Playback Switch", chname[i]);
16792 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16793 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16802 /* add playback controls for speaker and HP outputs */
16803 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16814 /* ALC663 has a mono output pin on 0x17 */
16815 sprintf(name, "%s Playback Switch", pfx);
16816 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16817 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16821 if (alc880_is_fixed_pin(pin)) {
16822 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16823 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16824 /* specify the DAC as the extra output */
16825 if (!spec->multiout.hp_nid)
16826 spec->multiout.hp_nid = nid;
16828 spec->multiout.extra_out_nid[0] = nid;
16829 /* control HP volume/switch on the output mixer amp */
16830 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16831 sprintf(name, "%s Playback Volume", pfx);
16832 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16833 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16836 sprintf(name, "%s Playback Switch", pfx);
16837 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16838 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16841 } else if (alc880_is_multi_pin(pin)) {
16842 /* set manual connection */
16843 /* we have only a switch on HP-out PIN */
16844 sprintf(name, "%s Playback Switch", pfx);
16845 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16846 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16853 /* return the index of the src widget from the connection list of the nid.
16854 * return -1 if not found
16856 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16859 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16862 conns = snd_hda_get_connections(codec, nid, conn_list,
16863 ARRAY_SIZE(conn_list));
16866 for (i = 0; i < conns; i++)
16867 if (conn_list[i] == src)
16872 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16874 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16875 return (pincap & AC_PINCAP_IN) != 0;
16878 /* create playback/capture controls for input pins */
16879 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16880 const struct auto_pin_cfg *cfg)
16882 struct alc_spec *spec = codec->spec;
16883 struct hda_input_mux *imux = &spec->private_imux[0];
16886 for (i = 0; i < AUTO_PIN_LAST; i++) {
16887 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16888 idx = alc662_input_pin_idx(codec, 0x0b,
16889 cfg->input_pins[i]);
16891 err = new_analog_input(spec, cfg->input_pins[i],
16892 auto_pin_cfg_labels[i],
16897 idx = alc662_input_pin_idx(codec, 0x22,
16898 cfg->input_pins[i]);
16900 imux->items[imux->num_items].label =
16901 auto_pin_cfg_labels[i];
16902 imux->items[imux->num_items].index = idx;
16910 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16911 hda_nid_t nid, int pin_type,
16914 alc_set_pin_output(codec, nid, pin_type);
16915 /* need the manual connection? */
16916 if (alc880_is_multi_pin(nid)) {
16917 struct alc_spec *spec = codec->spec;
16918 int idx = alc880_multi_pin_idx(nid);
16919 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16920 AC_VERB_SET_CONNECT_SEL,
16921 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16925 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16927 struct alc_spec *spec = codec->spec;
16930 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16931 for (i = 0; i <= HDA_SIDE; i++) {
16932 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16933 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16935 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16940 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16942 struct alc_spec *spec = codec->spec;
16945 pin = spec->autocfg.hp_pins[0];
16946 if (pin) /* connect to front */
16948 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16949 pin = spec->autocfg.speaker_pins[0];
16951 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16954 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16956 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16958 struct alc_spec *spec = codec->spec;
16961 for (i = 0; i < AUTO_PIN_LAST; i++) {
16962 hda_nid_t nid = spec->autocfg.input_pins[i];
16963 if (alc662_is_input_pin(codec, nid)) {
16964 alc_set_input_pin(codec, nid, i);
16965 if (nid != ALC662_PIN_CD_NID &&
16966 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16967 snd_hda_codec_write(codec, nid, 0,
16968 AC_VERB_SET_AMP_GAIN_MUTE,
16974 #define alc662_auto_init_input_src alc882_auto_init_input_src
16976 static int alc662_parse_auto_config(struct hda_codec *codec)
16978 struct alc_spec *spec = codec->spec;
16980 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16982 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16986 if (!spec->autocfg.line_outs)
16987 return 0; /* can't find valid BIOS pin config */
16989 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16992 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16995 err = alc662_auto_create_extra_out(spec,
16996 spec->autocfg.speaker_pins[0],
17000 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17004 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17008 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17010 if (spec->autocfg.dig_outs)
17011 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17013 if (spec->kctls.list)
17014 add_mixer(spec, spec->kctls.list);
17016 spec->num_mux_defs = 1;
17017 spec->input_mux = &spec->private_imux[0];
17019 add_verb(spec, alc662_auto_init_verbs);
17020 if (codec->vendor_id == 0x10ec0663)
17021 add_verb(spec, alc663_auto_init_verbs);
17023 err = alc_auto_add_mic_boost(codec);
17030 /* additional initialization for auto-configuration model */
17031 static void alc662_auto_init(struct hda_codec *codec)
17033 struct alc_spec *spec = codec->spec;
17034 alc662_auto_init_multi_out(codec);
17035 alc662_auto_init_hp_out(codec);
17036 alc662_auto_init_analog_input(codec);
17037 alc662_auto_init_input_src(codec);
17038 if (spec->unsol_event)
17039 alc_inithook(codec);
17042 static int patch_alc662(struct hda_codec *codec)
17044 struct alc_spec *spec;
17045 int err, board_config;
17047 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17051 codec->spec = spec;
17053 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17055 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17058 if (board_config < 0) {
17059 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
17060 "trying auto-probe from BIOS...\n");
17061 board_config = ALC662_AUTO;
17064 if (board_config == ALC662_AUTO) {
17065 /* automatic parse from the BIOS config */
17066 err = alc662_parse_auto_config(codec);
17072 "hda_codec: Cannot set up configuration "
17073 "from BIOS. Using base mode...\n");
17074 board_config = ALC662_3ST_2ch_DIG;
17078 err = snd_hda_attach_beep_device(codec, 0x1);
17084 if (board_config != ALC662_AUTO)
17085 setup_preset(spec, &alc662_presets[board_config]);
17087 if (codec->vendor_id == 0x10ec0663) {
17088 spec->stream_name_analog = "ALC663 Analog";
17089 spec->stream_name_digital = "ALC663 Digital";
17090 } else if (codec->vendor_id == 0x10ec0272) {
17091 spec->stream_name_analog = "ALC272 Analog";
17092 spec->stream_name_digital = "ALC272 Digital";
17094 spec->stream_name_analog = "ALC662 Analog";
17095 spec->stream_name_digital = "ALC662 Digital";
17098 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17099 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17101 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17102 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17104 spec->adc_nids = alc662_adc_nids;
17105 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17106 spec->capsrc_nids = alc662_capsrc_nids;
17107 spec->capture_style = CAPT_MIX;
17109 if (!spec->cap_mixer)
17110 set_capture_mixer(spec);
17111 if (codec->vendor_id == 0x10ec0662)
17112 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17114 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17116 spec->vmaster_nid = 0x02;
17118 codec->patch_ops = alc_patch_ops;
17119 if (board_config == ALC662_AUTO)
17120 spec->init_hook = alc662_auto_init;
17121 #ifdef CONFIG_SND_HDA_POWER_SAVE
17122 if (!spec->loopback.amplist)
17123 spec->loopback.amplist = alc662_loopbacks;
17125 codec->proc_widget_hook = print_realtek_coef;
17133 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17134 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17135 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17136 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17137 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17138 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17139 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17140 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17141 .patch = patch_alc861 },
17142 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17143 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17144 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17145 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17146 .patch = patch_alc883 },
17147 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17148 .patch = patch_alc662 },
17149 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17150 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17151 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17152 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17153 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17154 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17155 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17156 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17157 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17158 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17159 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17160 .patch = patch_alc883 },
17161 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17162 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17163 {} /* terminator */
17166 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17168 MODULE_LICENSE("GPL");
17169 MODULE_DESCRIPTION("Realtek HD-audio codec");
17171 static struct hda_codec_preset_list realtek_list = {
17172 .preset = snd_hda_preset_realtek,
17173 .owner = THIS_MODULE,
17176 static int __init patch_realtek_init(void)
17178 return snd_hda_add_codec_preset(&realtek_list);
17181 static void __exit patch_realtek_exit(void)
17183 snd_hda_delete_codec_preset(&realtek_list);
17186 module_init(patch_realtek_init)
17187 module_exit(patch_realtek_exit)