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"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
81 #ifdef CONFIG_SND_DEBUG
85 ALC260_MODEL_LAST /* last tag */
95 ALC262_HP_BPC_D7000_WL,
96 ALC262_HP_BPC_D7000_WF,
108 ALC262_MODEL_LAST /* last tag */
118 ALC268_ACER_ASPIRE_ONE,
121 #ifdef CONFIG_SND_DEBUG
125 ALC268_MODEL_LAST /* last tag */
132 ALC269_ASUS_EEEPC_P703,
133 ALC269_ASUS_EEEPC_P901,
137 ALC269_MODEL_LAST /* last tag */
154 /* ALC861-VD models */
176 ALC662_ASUS_EEEPC_P701,
177 ALC662_ASUS_EEEPC_EP20,
216 ALC883_TARGA_2ch_DIG,
219 ALC888_ACER_ASPIRE_4930G,
223 ALC883_LENOVO_101E_2ch,
224 ALC883_LENOVO_NB0763,
225 ALC888_LENOVO_MS7195_DIG,
232 ALC883_FUJITSU_PI2515,
233 ALC888_FUJITSU_XA3530,
234 ALC883_3ST_6ch_INTEL,
243 #define GPIO_MASK 0x03
246 /* codec parameterization */
247 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
248 unsigned int num_mixers;
249 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
251 const struct hda_verb *init_verbs[5]; /* initialization verbs
255 unsigned int num_init_verbs;
257 char *stream_name_analog; /* analog PCM stream */
258 struct hda_pcm_stream *stream_analog_playback;
259 struct hda_pcm_stream *stream_analog_capture;
260 struct hda_pcm_stream *stream_analog_alt_playback;
261 struct hda_pcm_stream *stream_analog_alt_capture;
263 char *stream_name_digital; /* digital PCM stream */
264 struct hda_pcm_stream *stream_digital_playback;
265 struct hda_pcm_stream *stream_digital_capture;
268 struct hda_multi_out multiout; /* playback set-up
269 * max_channels, dacs must be set
270 * dig_out_nid and hp_nid are optional
272 hda_nid_t alt_dac_nid;
275 unsigned int num_adc_nids;
277 hda_nid_t *capsrc_nids;
278 hda_nid_t dig_in_nid; /* digital-in NID; optional */
279 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */
282 unsigned int num_mux_defs;
283 const struct hda_input_mux *input_mux;
284 unsigned int cur_mux[3];
287 const struct hda_channel_mode *channel_mode;
288 int num_channel_mode;
291 /* PCM information */
292 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
294 /* dynamic controls, init_verbs and input_mux */
295 struct auto_pin_cfg autocfg;
296 struct snd_array kctls;
297 struct hda_input_mux private_imux;
298 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
301 void (*init_hook)(struct hda_codec *codec);
302 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
304 /* for pin sensing */
305 unsigned int sense_updated: 1;
306 unsigned int jack_present: 1;
307 unsigned int master_sw: 1;
309 /* for virtual master */
310 hda_nid_t vmaster_nid;
311 #ifdef CONFIG_SND_HDA_POWER_SAVE
312 struct hda_loopback_check loopback;
317 unsigned int pll_coef_idx, pll_coef_bit;
319 #ifdef SND_HDA_NEEDS_RESUME
320 #define ALC_MAX_PINS 16
321 unsigned int num_pins;
322 hda_nid_t pin_nids[ALC_MAX_PINS];
323 unsigned int pin_cfgs[ALC_MAX_PINS];
328 * configuration template - to be copied to the spec instance
330 struct alc_config_preset {
331 struct snd_kcontrol_new *mixers[5]; /* should be identical size
334 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
335 const struct hda_verb *init_verbs[5];
336 unsigned int num_dacs;
338 hda_nid_t dig_out_nid; /* optional */
339 hda_nid_t hp_nid; /* optional */
340 unsigned int num_adc_nids;
342 hda_nid_t *capsrc_nids;
343 hda_nid_t dig_in_nid;
344 unsigned int num_channel_mode;
345 const struct hda_channel_mode *channel_mode;
347 unsigned int num_mux_defs;
348 const struct hda_input_mux *input_mux;
349 void (*unsol_event)(struct hda_codec *, unsigned int);
350 void (*init_hook)(struct hda_codec *);
351 #ifdef CONFIG_SND_HDA_POWER_SAVE
352 struct hda_amp_list *loopbacks;
360 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
361 struct snd_ctl_elem_info *uinfo)
363 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
364 struct alc_spec *spec = codec->spec;
365 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
366 if (mux_idx >= spec->num_mux_defs)
368 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
371 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
372 struct snd_ctl_elem_value *ucontrol)
374 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
375 struct alc_spec *spec = codec->spec;
376 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
378 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
382 static int alc_mux_enum_put(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 const struct hda_input_mux *imux;
388 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
389 unsigned int mux_idx;
390 hda_nid_t nid = spec->capsrc_nids ?
391 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
393 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
394 imux = &spec->input_mux[mux_idx];
396 if (spec->is_mix_capture) {
397 /* Matrix-mixer style (e.g. ALC882) */
398 unsigned int *cur_val = &spec->cur_mux[adc_idx];
401 idx = ucontrol->value.enumerated.item[0];
402 if (idx >= imux->num_items)
403 idx = imux->num_items - 1;
406 for (i = 0; i < imux->num_items; i++) {
407 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
408 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
409 imux->items[i].index,
415 /* MUX style (e.g. ALC880) */
416 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
417 &spec->cur_mux[adc_idx]);
422 * channel mode setting
424 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_info *uinfo)
427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
428 struct alc_spec *spec = codec->spec;
429 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
430 spec->num_channel_mode);
433 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
434 struct snd_ctl_elem_value *ucontrol)
436 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
437 struct alc_spec *spec = codec->spec;
438 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
439 spec->num_channel_mode,
440 spec->multiout.max_channels);
443 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
444 struct snd_ctl_elem_value *ucontrol)
446 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
447 struct alc_spec *spec = codec->spec;
448 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
449 spec->num_channel_mode,
450 &spec->multiout.max_channels);
451 if (err >= 0 && spec->need_dac_fix)
452 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
457 * Control the mode of pin widget settings via the mixer. "pc" is used
458 * instead of "%" to avoid consequences of accidently treating the % as
459 * being part of a format specifier. Maximum allowed length of a value is
460 * 63 characters plus NULL terminator.
462 * Note: some retasking pin complexes seem to ignore requests for input
463 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
464 * are requested. Therefore order this list so that this behaviour will not
465 * cause problems when mixer clients move through the enum sequentially.
466 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
469 static char *alc_pin_mode_names[] = {
470 "Mic 50pc bias", "Mic 80pc bias",
471 "Line in", "Line out", "Headphone out",
473 static unsigned char alc_pin_mode_values[] = {
474 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
476 /* The control can present all 5 options, or it can limit the options based
477 * in the pin being assumed to be exclusively an input or an output pin. In
478 * addition, "input" pins may or may not process the mic bias option
479 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
480 * accept requests for bias as of chip versions up to March 2006) and/or
481 * wiring in the computer.
483 #define ALC_PIN_DIR_IN 0x00
484 #define ALC_PIN_DIR_OUT 0x01
485 #define ALC_PIN_DIR_INOUT 0x02
486 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
487 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
489 /* Info about the pin modes supported by the different pin direction modes.
490 * For each direction the minimum and maximum values are given.
492 static signed char alc_pin_mode_dir_info[5][2] = {
493 { 0, 2 }, /* ALC_PIN_DIR_IN */
494 { 3, 4 }, /* ALC_PIN_DIR_OUT */
495 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
496 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
497 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
499 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
500 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
501 #define alc_pin_mode_n_items(_dir) \
502 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
504 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
505 struct snd_ctl_elem_info *uinfo)
507 unsigned int item_num = uinfo->value.enumerated.item;
508 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
510 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
512 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
514 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
515 item_num = alc_pin_mode_min(dir);
516 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
520 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
521 struct snd_ctl_elem_value *ucontrol)
524 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
525 hda_nid_t nid = kcontrol->private_value & 0xffff;
526 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
527 long *valp = ucontrol->value.integer.value;
528 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
529 AC_VERB_GET_PIN_WIDGET_CONTROL,
532 /* Find enumerated value for current pinctl setting */
533 i = alc_pin_mode_min(dir);
534 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
536 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
540 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
541 struct snd_ctl_elem_value *ucontrol)
544 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
545 hda_nid_t nid = kcontrol->private_value & 0xffff;
546 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
547 long val = *ucontrol->value.integer.value;
548 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
549 AC_VERB_GET_PIN_WIDGET_CONTROL,
552 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
553 val = alc_pin_mode_min(dir);
555 change = pinctl != alc_pin_mode_values[val];
557 /* Set pin mode to that requested */
558 snd_hda_codec_write_cache(codec, nid, 0,
559 AC_VERB_SET_PIN_WIDGET_CONTROL,
560 alc_pin_mode_values[val]);
562 /* Also enable the retasking pin's input/output as required
563 * for the requested pin mode. Enum values of 2 or less are
566 * Dynamically switching the input/output buffers probably
567 * reduces noise slightly (particularly on input) so we'll
568 * do it. However, having both input and output buffers
569 * enabled simultaneously doesn't seem to be problematic if
570 * this turns out to be necessary in the future.
573 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
574 HDA_AMP_MUTE, HDA_AMP_MUTE);
575 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
578 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
579 HDA_AMP_MUTE, HDA_AMP_MUTE);
580 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
587 #define ALC_PIN_MODE(xname, nid, dir) \
588 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
589 .info = alc_pin_mode_info, \
590 .get = alc_pin_mode_get, \
591 .put = alc_pin_mode_put, \
592 .private_value = nid | (dir<<16) }
594 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
595 * together using a mask with more than one bit set. This control is
596 * currently used only by the ALC260 test model. At this stage they are not
597 * needed for any "production" models.
599 #ifdef CONFIG_SND_DEBUG
600 #define alc_gpio_data_info snd_ctl_boolean_mono_info
602 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
603 struct snd_ctl_elem_value *ucontrol)
605 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
606 hda_nid_t nid = kcontrol->private_value & 0xffff;
607 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
608 long *valp = ucontrol->value.integer.value;
609 unsigned int val = snd_hda_codec_read(codec, nid, 0,
610 AC_VERB_GET_GPIO_DATA, 0x00);
612 *valp = (val & mask) != 0;
615 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
616 struct snd_ctl_elem_value *ucontrol)
619 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
620 hda_nid_t nid = kcontrol->private_value & 0xffff;
621 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
622 long val = *ucontrol->value.integer.value;
623 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
624 AC_VERB_GET_GPIO_DATA,
627 /* Set/unset the masked GPIO bit(s) as needed */
628 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
633 snd_hda_codec_write_cache(codec, nid, 0,
634 AC_VERB_SET_GPIO_DATA, gpio_data);
638 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
639 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
640 .info = alc_gpio_data_info, \
641 .get = alc_gpio_data_get, \
642 .put = alc_gpio_data_put, \
643 .private_value = nid | (mask<<16) }
644 #endif /* CONFIG_SND_DEBUG */
646 /* A switch control to allow the enabling of the digital IO pins on the
647 * ALC260. This is incredibly simplistic; the intention of this control is
648 * to provide something in the test model allowing digital outputs to be
649 * identified if present. If models are found which can utilise these
650 * outputs a more complete mixer control can be devised for those models if
653 #ifdef CONFIG_SND_DEBUG
654 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
656 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
657 struct snd_ctl_elem_value *ucontrol)
659 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
660 hda_nid_t nid = kcontrol->private_value & 0xffff;
661 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
662 long *valp = ucontrol->value.integer.value;
663 unsigned int val = snd_hda_codec_read(codec, nid, 0,
664 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
666 *valp = (val & mask) != 0;
669 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
670 struct snd_ctl_elem_value *ucontrol)
673 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
674 hda_nid_t nid = kcontrol->private_value & 0xffff;
675 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
676 long val = *ucontrol->value.integer.value;
677 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
678 AC_VERB_GET_DIGI_CONVERT_1,
681 /* Set/unset the masked control bit(s) as needed */
682 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
687 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
692 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
693 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
694 .info = alc_spdif_ctrl_info, \
695 .get = alc_spdif_ctrl_get, \
696 .put = alc_spdif_ctrl_put, \
697 .private_value = nid | (mask<<16) }
698 #endif /* CONFIG_SND_DEBUG */
700 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
701 * Again, this is only used in the ALC26x test models to help identify when
702 * the EAPD line must be asserted for features to work.
704 #ifdef CONFIG_SND_DEBUG
705 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
707 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
708 struct snd_ctl_elem_value *ucontrol)
710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
711 hda_nid_t nid = kcontrol->private_value & 0xffff;
712 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
713 long *valp = ucontrol->value.integer.value;
714 unsigned int val = snd_hda_codec_read(codec, nid, 0,
715 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
717 *valp = (val & mask) != 0;
721 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
722 struct snd_ctl_elem_value *ucontrol)
725 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
726 hda_nid_t nid = kcontrol->private_value & 0xffff;
727 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
728 long val = *ucontrol->value.integer.value;
729 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
730 AC_VERB_GET_EAPD_BTLENABLE,
733 /* Set/unset the masked control bit(s) as needed */
734 change = (!val ? 0 : mask) != (ctrl_data & mask);
739 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
745 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
746 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
747 .info = alc_eapd_ctrl_info, \
748 .get = alc_eapd_ctrl_get, \
749 .put = alc_eapd_ctrl_put, \
750 .private_value = nid | (mask<<16) }
751 #endif /* CONFIG_SND_DEBUG */
755 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
757 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
759 spec->mixers[spec->num_mixers++] = mix;
762 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
764 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
766 spec->init_verbs[spec->num_init_verbs++] = verb;
770 * set up from the preset table
772 static void setup_preset(struct alc_spec *spec,
773 const struct alc_config_preset *preset)
777 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
778 add_mixer(spec, preset->mixers[i]);
779 spec->cap_mixer = preset->cap_mixer;
780 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
782 add_verb(spec, preset->init_verbs[i]);
784 spec->channel_mode = preset->channel_mode;
785 spec->num_channel_mode = preset->num_channel_mode;
786 spec->need_dac_fix = preset->need_dac_fix;
788 spec->multiout.max_channels = spec->channel_mode[0].channels;
790 spec->multiout.num_dacs = preset->num_dacs;
791 spec->multiout.dac_nids = preset->dac_nids;
792 spec->multiout.dig_out_nid = preset->dig_out_nid;
793 spec->multiout.hp_nid = preset->hp_nid;
795 spec->num_mux_defs = preset->num_mux_defs;
796 if (!spec->num_mux_defs)
797 spec->num_mux_defs = 1;
798 spec->input_mux = preset->input_mux;
800 spec->num_adc_nids = preset->num_adc_nids;
801 spec->adc_nids = preset->adc_nids;
802 spec->capsrc_nids = preset->capsrc_nids;
803 spec->dig_in_nid = preset->dig_in_nid;
805 spec->unsol_event = preset->unsol_event;
806 spec->init_hook = preset->init_hook;
807 #ifdef CONFIG_SND_HDA_POWER_SAVE
808 spec->loopback.amplist = preset->loopbacks;
812 /* Enable GPIO mask and set output */
813 static struct hda_verb alc_gpio1_init_verbs[] = {
814 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
815 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
816 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
820 static struct hda_verb alc_gpio2_init_verbs[] = {
821 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
822 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
823 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
827 static struct hda_verb alc_gpio3_init_verbs[] = {
828 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
829 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
830 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
835 * Fix hardware PLL issue
836 * On some codecs, the analog PLL gating control must be off while
837 * the default value is 1.
839 static void alc_fix_pll(struct hda_codec *codec)
841 struct alc_spec *spec = codec->spec;
846 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
848 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
849 AC_VERB_GET_PROC_COEF, 0);
850 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
852 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
853 val & ~(1 << spec->pll_coef_bit));
856 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
857 unsigned int coef_idx, unsigned int coef_bit)
859 struct alc_spec *spec = codec->spec;
861 spec->pll_coef_idx = coef_idx;
862 spec->pll_coef_bit = coef_bit;
866 static void alc_sku_automute(struct hda_codec *codec)
868 struct alc_spec *spec = codec->spec;
869 unsigned int present;
870 unsigned int hp_nid = spec->autocfg.hp_pins[0];
871 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
873 /* need to execute and sync at first */
874 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
875 present = snd_hda_codec_read(codec, hp_nid, 0,
876 AC_VERB_GET_PIN_SENSE, 0);
877 spec->jack_present = (present & 0x80000000) != 0;
878 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
879 spec->jack_present ? 0 : PIN_OUT);
882 #if 0 /* it's broken in some acses -- temporarily disabled */
883 static void alc_mic_automute(struct hda_codec *codec)
885 struct alc_spec *spec = codec->spec;
886 unsigned int present;
887 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
888 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
889 unsigned int mix_nid = spec->capsrc_nids[0];
890 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
892 capsrc_idx_mic = mic_nid - 0x18;
893 capsrc_idx_fmic = fmic_nid - 0x18;
894 present = snd_hda_codec_read(codec, mic_nid, 0,
895 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
896 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
897 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
898 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
899 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
900 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
901 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
904 #define alc_mic_automute(codec) /* NOP */
905 #endif /* disabled */
907 /* unsolicited event for HP jack sensing */
908 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
910 if (codec->vendor_id == 0x10ec0880)
914 if (res == ALC880_HP_EVENT)
915 alc_sku_automute(codec);
917 if (res == ALC880_MIC_EVENT)
918 alc_mic_automute(codec);
921 static void alc_inithook(struct hda_codec *codec)
923 alc_sku_automute(codec);
924 alc_mic_automute(codec);
927 /* additional initialization for ALC888 variants */
928 static void alc888_coef_init(struct hda_codec *codec)
932 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
933 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
934 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
935 if ((tmp & 0xf0) == 2)
937 snd_hda_codec_read(codec, 0x20, 0,
938 AC_VERB_SET_PROC_COEF, 0x830);
941 snd_hda_codec_read(codec, 0x20, 0,
942 AC_VERB_SET_PROC_COEF, 0x3030);
945 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
946 * 31 ~ 16 : Manufacture ID
948 * 7 ~ 0 : Assembly ID
949 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
951 static void alc_subsystem_id(struct hda_codec *codec,
952 unsigned int porta, unsigned int porte,
955 unsigned int ass, tmp, i;
957 struct alc_spec *spec = codec->spec;
959 ass = codec->subsystem_id & 0xffff;
960 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
964 * 31~30 : port conetcivity
967 * 19~16 : Check sum (15:1)
972 if (codec->vendor_id == 0x10ec0260)
974 ass = snd_hda_codec_read(codec, nid, 0,
975 AC_VERB_GET_CONFIG_DEFAULT, 0);
976 if (!(ass & 1) && !(ass & 0x100000))
978 if ((ass >> 30) != 1) /* no physical connection */
983 for (i = 1; i < 16; i++) {
987 if (((ass >> 16) & 0xf) != tmp)
993 * 2 : 0 --> Desktop, 1 --> Laptop
994 * 3~5 : External Amplifier control
997 tmp = (ass & 0x38) >> 3; /* external Amp control */
1000 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1003 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1006 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1008 case 5: /* set EAPD output high */
1009 switch (codec->vendor_id) {
1011 snd_hda_codec_write(codec, 0x0f, 0,
1012 AC_VERB_SET_EAPD_BTLENABLE, 2);
1013 snd_hda_codec_write(codec, 0x10, 0,
1014 AC_VERB_SET_EAPD_BTLENABLE, 2);
1025 snd_hda_codec_write(codec, 0x14, 0,
1026 AC_VERB_SET_EAPD_BTLENABLE, 2);
1027 snd_hda_codec_write(codec, 0x15, 0,
1028 AC_VERB_SET_EAPD_BTLENABLE, 2);
1031 switch (codec->vendor_id) {
1033 snd_hda_codec_write(codec, 0x1a, 0,
1034 AC_VERB_SET_COEF_INDEX, 7);
1035 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1036 AC_VERB_GET_PROC_COEF, 0);
1037 snd_hda_codec_write(codec, 0x1a, 0,
1038 AC_VERB_SET_COEF_INDEX, 7);
1039 snd_hda_codec_write(codec, 0x1a, 0,
1040 AC_VERB_SET_PROC_COEF,
1049 snd_hda_codec_write(codec, 0x20, 0,
1050 AC_VERB_SET_COEF_INDEX, 7);
1051 tmp = snd_hda_codec_read(codec, 0x20, 0,
1052 AC_VERB_GET_PROC_COEF, 0);
1053 snd_hda_codec_write(codec, 0x20, 0,
1054 AC_VERB_SET_COEF_INDEX, 7);
1055 snd_hda_codec_write(codec, 0x20, 0,
1056 AC_VERB_SET_PROC_COEF,
1060 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1064 snd_hda_codec_write(codec, 0x20, 0,
1065 AC_VERB_SET_COEF_INDEX, 7);
1066 tmp = snd_hda_codec_read(codec, 0x20, 0,
1067 AC_VERB_GET_PROC_COEF, 0);
1068 snd_hda_codec_write(codec, 0x20, 0,
1069 AC_VERB_SET_COEF_INDEX, 7);
1070 snd_hda_codec_write(codec, 0x20, 0,
1071 AC_VERB_SET_PROC_COEF,
1079 /* is laptop or Desktop and enable the function "Mute internal speaker
1080 * when the external headphone out jack is plugged"
1082 if (!(ass & 0x8000))
1085 * 10~8 : Jack location
1086 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1088 * 15 : 1 --> enable the function "Mute internal speaker
1089 * when the external headphone out jack is plugged"
1091 if (!spec->autocfg.speaker_pins[0]) {
1092 if (spec->autocfg.line_out_pins[0])
1093 spec->autocfg.speaker_pins[0] =
1094 spec->autocfg.line_out_pins[0];
1099 if (!spec->autocfg.hp_pins[0]) {
1100 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1102 spec->autocfg.hp_pins[0] = porta;
1104 spec->autocfg.hp_pins[0] = porte;
1106 spec->autocfg.hp_pins[0] = portd;
1110 if (spec->autocfg.hp_pins[0])
1111 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1112 AC_VERB_SET_UNSOLICITED_ENABLE,
1113 AC_USRSP_EN | ALC880_HP_EVENT);
1115 #if 0 /* it's broken in some acses -- temporarily disabled */
1116 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1117 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1118 snd_hda_codec_write(codec,
1119 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1120 AC_VERB_SET_UNSOLICITED_ENABLE,
1121 AC_USRSP_EN | ALC880_MIC_EVENT);
1122 #endif /* disabled */
1124 spec->unsol_event = alc_sku_unsol_event;
1128 * Fix-up pin default configurations
1136 static void alc_fix_pincfg(struct hda_codec *codec,
1137 const struct snd_pci_quirk *quirk,
1138 const struct alc_pincfg **pinfix)
1140 const struct alc_pincfg *cfg;
1142 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1146 cfg = pinfix[quirk->value];
1147 for (; cfg->nid; cfg++) {
1150 for (i = 0; i < 4; i++) {
1151 snd_hda_codec_write(codec, cfg->nid, 0,
1152 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1166 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1167 /* Mic-in jack as mic in */
1168 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1169 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1170 /* Line-in jack as Line in */
1171 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1172 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1173 /* Line-Out as Front */
1174 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1181 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1182 /* Mic-in jack as mic in */
1183 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1184 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1185 /* Line-in jack as Surround */
1186 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1187 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1188 /* Line-Out as Front */
1189 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1196 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1197 /* Mic-in jack as CLFE */
1198 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1199 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1200 /* Line-in jack as Surround */
1201 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1202 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1203 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1204 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1211 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1212 /* Mic-in jack as CLFE */
1213 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1214 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1215 /* Line-in jack as Surround */
1216 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1217 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1218 /* Line-Out as Side */
1219 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1223 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1224 { 2, alc888_4ST_ch2_intel_init },
1225 { 4, alc888_4ST_ch4_intel_init },
1226 { 6, alc888_4ST_ch6_intel_init },
1227 { 8, alc888_4ST_ch8_intel_init },
1231 * ALC888 Fujitsu Siemens Amillo xa3530
1234 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1235 /* Front Mic: set to PIN_IN (empty by default) */
1236 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1237 /* Connect Internal HP to Front */
1238 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1239 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1240 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1241 /* Connect Bass HP to Front */
1242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1244 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1245 /* Connect Line-Out side jack (SPDIF) to Side */
1246 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1247 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1248 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1249 /* Connect Mic jack to CLFE */
1250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1252 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1253 /* Connect Line-in jack to Surround */
1254 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1255 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1256 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1257 /* Connect HP out jack to Front */
1258 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1259 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1260 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1261 /* Enable unsolicited event for HP jack and Line-out jack */
1262 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1263 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1267 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1269 unsigned int present;
1271 /* Line out presence */
1272 present = snd_hda_codec_read(codec, 0x17, 0,
1273 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1274 /* HP out presence */
1275 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1276 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1277 bits = present ? HDA_AMP_MUTE : 0;
1278 /* Toggle internal speakers muting */
1279 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1280 HDA_AMP_MUTE, bits);
1281 /* Toggle internal bass muting */
1282 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1283 HDA_AMP_MUTE, bits);
1286 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1289 if (res >> 26 == ALC880_HP_EVENT)
1290 alc888_fujitsu_xa3530_automute(codec);
1295 * ALC888 Acer Aspire 4930G model
1298 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1299 /* Front Mic: set to PIN_IN (empty by default) */
1300 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1301 /* Unselect Front Mic by default in input mixer 3 */
1302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1303 /* Enable unsolicited event for HP jack */
1304 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1305 /* Connect Internal HP to front */
1306 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1307 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1308 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1309 /* Connect HP out to front */
1310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1311 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1312 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1316 static struct hda_input_mux alc888_2_capture_sources[2] = {
1317 /* Front mic only available on one ADC */
1324 { "Front Mic", 0xb },
1337 static struct snd_kcontrol_new alc888_base_mixer[] = {
1338 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1339 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1340 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1341 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1342 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1344 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1345 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1346 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1347 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1348 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1349 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1350 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1351 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1352 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1354 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1356 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1357 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1361 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1363 unsigned int present;
1365 present = snd_hda_codec_read(codec, 0x15, 0,
1366 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1367 bits = present ? HDA_AMP_MUTE : 0;
1368 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1369 HDA_AMP_MUTE, bits);
1372 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1375 if (res >> 26 == ALC880_HP_EVENT)
1376 alc888_acer_aspire_4930g_automute(codec);
1380 * ALC880 3-stack model
1382 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1383 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1384 * F-Mic = 0x1b, HP = 0x19
1387 static hda_nid_t alc880_dac_nids[4] = {
1388 /* front, rear, clfe, rear_surr */
1389 0x02, 0x05, 0x04, 0x03
1392 static hda_nid_t alc880_adc_nids[3] = {
1397 /* The datasheet says the node 0x07 is connected from inputs,
1398 * but it shows zero connection in the real implementation on some devices.
1399 * Note: this is a 915GAV bug, fixed on 915GLV
1401 static hda_nid_t alc880_adc_nids_alt[2] = {
1406 #define ALC880_DIGOUT_NID 0x06
1407 #define ALC880_DIGIN_NID 0x0a
1409 static struct hda_input_mux alc880_capture_source = {
1413 { "Front Mic", 0x3 },
1419 /* channel source setting (2/6 channel selection for 3-stack) */
1421 static struct hda_verb alc880_threestack_ch2_init[] = {
1422 /* set line-in to input, mute it */
1423 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1424 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1425 /* set mic-in to input vref 80%, mute it */
1426 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1427 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1432 static struct hda_verb alc880_threestack_ch6_init[] = {
1433 /* set line-in to output, unmute it */
1434 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1435 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1436 /* set mic-in to output, unmute it */
1437 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1438 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1442 static struct hda_channel_mode alc880_threestack_modes[2] = {
1443 { 2, alc880_threestack_ch2_init },
1444 { 6, alc880_threestack_ch6_init },
1447 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1448 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1449 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1450 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1451 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1452 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1453 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1454 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1455 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1456 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1457 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1458 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1459 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1462 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1463 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1464 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1465 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1466 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1468 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1469 .name = "Channel Mode",
1470 .info = alc_ch_mode_info,
1471 .get = alc_ch_mode_get,
1472 .put = alc_ch_mode_put,
1477 /* capture mixer elements */
1478 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1479 struct snd_ctl_elem_info *uinfo)
1481 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1482 struct alc_spec *spec = codec->spec;
1485 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1486 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1488 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1489 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1493 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1494 unsigned int size, unsigned int __user *tlv)
1496 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1497 struct alc_spec *spec = codec->spec;
1500 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1501 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1503 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1504 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1508 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1509 struct snd_ctl_elem_value *ucontrol);
1511 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1512 struct snd_ctl_elem_value *ucontrol,
1515 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1516 struct alc_spec *spec = codec->spec;
1517 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1520 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1521 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1523 err = func(kcontrol, ucontrol);
1524 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1528 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1529 struct snd_ctl_elem_value *ucontrol)
1531 return alc_cap_getput_caller(kcontrol, ucontrol,
1532 snd_hda_mixer_amp_volume_get);
1535 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1536 struct snd_ctl_elem_value *ucontrol)
1538 return alc_cap_getput_caller(kcontrol, ucontrol,
1539 snd_hda_mixer_amp_volume_put);
1542 /* capture mixer elements */
1543 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1545 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1546 struct snd_ctl_elem_value *ucontrol)
1548 return alc_cap_getput_caller(kcontrol, ucontrol,
1549 snd_hda_mixer_amp_switch_get);
1552 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1553 struct snd_ctl_elem_value *ucontrol)
1555 return alc_cap_getput_caller(kcontrol, ucontrol,
1556 snd_hda_mixer_amp_switch_put);
1559 #define DEFINE_CAPMIX(num) \
1560 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1562 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1563 .name = "Capture Switch", \
1564 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1566 .info = alc_cap_sw_info, \
1567 .get = alc_cap_sw_get, \
1568 .put = alc_cap_sw_put, \
1571 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1572 .name = "Capture Volume", \
1573 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1574 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1575 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1577 .info = alc_cap_vol_info, \
1578 .get = alc_cap_vol_get, \
1579 .put = alc_cap_vol_put, \
1580 .tlv = { .c = alc_cap_vol_tlv }, \
1583 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1584 /* .name = "Capture Source", */ \
1585 .name = "Input Source", \
1587 .info = alc_mux_enum_info, \
1588 .get = alc_mux_enum_get, \
1589 .put = alc_mux_enum_put, \
1594 /* up to three ADCs */
1601 * ALC880 5-stack model
1603 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1605 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1606 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1609 /* additional mixers to alc880_three_stack_mixer */
1610 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1611 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1612 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1616 /* channel source setting (6/8 channel selection for 5-stack) */
1618 static struct hda_verb alc880_fivestack_ch6_init[] = {
1619 /* set line-in to input, mute it */
1620 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1621 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1626 static struct hda_verb alc880_fivestack_ch8_init[] = {
1627 /* set line-in to output, unmute it */
1628 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1629 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1633 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1634 { 6, alc880_fivestack_ch6_init },
1635 { 8, alc880_fivestack_ch8_init },
1640 * ALC880 6-stack model
1642 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1643 * Side = 0x05 (0x0f)
1644 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1645 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1648 static hda_nid_t alc880_6st_dac_nids[4] = {
1649 /* front, rear, clfe, rear_surr */
1650 0x02, 0x03, 0x04, 0x05
1653 static struct hda_input_mux alc880_6stack_capture_source = {
1657 { "Front Mic", 0x1 },
1663 /* fixed 8-channels */
1664 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1668 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1669 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1670 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1671 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1672 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1673 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1674 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1675 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1676 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1677 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1678 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1679 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1680 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1681 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1682 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1683 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1685 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1686 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1687 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1688 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1690 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1691 .name = "Channel Mode",
1692 .info = alc_ch_mode_info,
1693 .get = alc_ch_mode_get,
1694 .put = alc_ch_mode_put,
1703 * W810 has rear IO for:
1706 * Center/LFE (DAC 04)
1709 * The system also has a pair of internal speakers, and a headphone jack.
1710 * These are both connected to Line2 on the codec, hence to DAC 02.
1712 * There is a variable resistor to control the speaker or headphone
1713 * volume. This is a hardware-only device without a software API.
1715 * Plugging headphones in will disable the internal speakers. This is
1716 * implemented in hardware, not via the driver using jack sense. In
1717 * a similar fashion, plugging into the rear socket marked "front" will
1718 * disable both the speakers and headphones.
1720 * For input, there's a microphone jack, and an "audio in" jack.
1721 * These may not do anything useful with this driver yet, because I
1722 * haven't setup any initialization verbs for these yet...
1725 static hda_nid_t alc880_w810_dac_nids[3] = {
1726 /* front, rear/surround, clfe */
1730 /* fixed 6 channels */
1731 static struct hda_channel_mode alc880_w810_modes[1] = {
1735 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1736 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1737 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1738 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1739 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1740 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1741 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1742 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1743 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1744 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1753 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1754 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1758 static hda_nid_t alc880_z71v_dac_nids[1] = {
1761 #define ALC880_Z71V_HP_DAC 0x03
1763 /* fixed 2 channels */
1764 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1768 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1769 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1770 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1771 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1772 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1774 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1782 * ALC880 F1734 model
1784 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1785 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1788 static hda_nid_t alc880_f1734_dac_nids[1] = {
1791 #define ALC880_F1734_HP_DAC 0x02
1793 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1794 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1795 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1796 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1797 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1798 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1799 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1801 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1805 static struct hda_input_mux alc880_f1734_capture_source = {
1817 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1818 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1819 * Mic = 0x18, Line = 0x1a
1822 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1823 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1825 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1826 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1827 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1828 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1829 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1830 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1831 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1832 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1833 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1834 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1835 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1836 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1837 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1842 .name = "Channel Mode",
1843 .info = alc_ch_mode_info,
1844 .get = alc_ch_mode_get,
1845 .put = alc_ch_mode_put,
1851 * ALC880 ASUS W1V model
1853 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1854 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1855 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1858 /* additional mixers to alc880_asus_mixer */
1859 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1860 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1861 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1865 /* additional mixers to alc880_asus_mixer */
1866 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1867 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1868 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1873 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1874 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1875 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1876 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1877 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1878 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1881 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1882 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1887 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1888 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1889 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1890 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1891 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1892 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1893 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1894 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1895 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1896 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1897 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1898 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1899 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1902 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1903 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1904 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1905 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1907 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1908 .name = "Channel Mode",
1909 .info = alc_ch_mode_info,
1910 .get = alc_ch_mode_get,
1911 .put = alc_ch_mode_put,
1916 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1917 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1918 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1919 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1920 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1921 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1922 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1923 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1924 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1925 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1926 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1930 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1931 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1932 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1933 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1934 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1941 * virtual master controls
1945 * slave controls for virtual master
1947 static const char *alc_slave_vols[] = {
1948 "Front Playback Volume",
1949 "Surround Playback Volume",
1950 "Center Playback Volume",
1951 "LFE Playback Volume",
1952 "Side Playback Volume",
1953 "Headphone Playback Volume",
1954 "Speaker Playback Volume",
1955 "Mono Playback Volume",
1956 "Line-Out Playback Volume",
1957 "PCM Playback Volume",
1961 static const char *alc_slave_sws[] = {
1962 "Front Playback Switch",
1963 "Surround Playback Switch",
1964 "Center Playback Switch",
1965 "LFE Playback Switch",
1966 "Side Playback Switch",
1967 "Headphone Playback Switch",
1968 "Speaker Playback Switch",
1969 "Mono Playback Switch",
1970 "IEC958 Playback Switch",
1975 * build control elements
1978 static void alc_free_kctls(struct hda_codec *codec);
1980 static int alc_build_controls(struct hda_codec *codec)
1982 struct alc_spec *spec = codec->spec;
1986 for (i = 0; i < spec->num_mixers; i++) {
1987 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1991 if (spec->cap_mixer) {
1992 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
1996 if (spec->multiout.dig_out_nid) {
1997 err = snd_hda_create_spdif_out_ctls(codec,
1998 spec->multiout.dig_out_nid);
2001 err = snd_hda_create_spdif_share_sw(codec,
2005 spec->multiout.share_spdif = 1;
2007 if (spec->dig_in_nid) {
2008 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2013 /* if we have no master control, let's create it */
2014 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2015 unsigned int vmaster_tlv[4];
2016 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2017 HDA_OUTPUT, vmaster_tlv);
2018 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2019 vmaster_tlv, alc_slave_vols);
2023 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2024 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2025 NULL, alc_slave_sws);
2030 alc_free_kctls(codec); /* no longer needed */
2036 * initialize the codec volumes, etc
2040 * generic initialization of ADC, input mixers and output mixers
2042 static struct hda_verb alc880_volume_init_verbs[] = {
2044 * Unmute ADC0-2 and set the default input to mic-in
2046 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2047 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2048 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2049 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2050 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2051 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2053 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2055 * Note: PASD motherboards uses the Line In 2 as the input for front
2058 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2068 * Set up output mixers (0x0c - 0x0f)
2070 /* set vol=0 to output mixers */
2071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2072 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2073 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2074 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2075 /* set up input amps for analog loopback */
2076 /* Amp Indices: DAC = 0, mixer = 1 */
2077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2080 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2082 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2090 * 3-stack pin configuration:
2091 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2093 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2095 * preset connection lists of input pins
2096 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2098 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2099 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2100 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2103 * Set pin mode and muting
2105 /* set front pin widgets 0x14 for output */
2106 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2108 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2109 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2110 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2111 /* Mic2 (as headphone out) for HP output */
2112 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2113 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2114 /* Line In pin widget for input */
2115 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2116 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2117 /* Line2 (as front mic) pin widget for input and vref at 80% */
2118 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2120 /* CD pin widget for input */
2121 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2127 * 5-stack pin configuration:
2128 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2129 * line-in/side = 0x1a, f-mic = 0x1b
2131 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2133 * preset connection lists of input pins
2134 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2136 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2137 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2140 * Set pin mode and muting
2142 /* set pin widgets 0x14-0x17 for output */
2143 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2145 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2146 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2147 /* unmute pins for output (no gain on this amp) */
2148 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2149 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2150 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2151 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2153 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2154 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2155 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2156 /* Mic2 (as headphone out) for HP output */
2157 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2158 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2159 /* Line In pin widget for input */
2160 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2161 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2162 /* Line2 (as front mic) pin widget for input and vref at 80% */
2163 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2164 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2165 /* CD pin widget for input */
2166 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2172 * W810 pin configuration:
2173 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2175 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2176 /* hphone/speaker input selector: front DAC */
2177 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2179 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2180 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2184 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2187 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2193 * Z71V pin configuration:
2194 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2196 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2197 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2198 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2202 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2203 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2204 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2205 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2211 * 6-stack pin configuration:
2212 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2213 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2215 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2216 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2222 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2223 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2224 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2225 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2227 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2229 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2230 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2231 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2232 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2234 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2235 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2241 * Uniwill pin configuration:
2242 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2245 static struct hda_verb alc880_uniwill_init_verbs[] = {
2246 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2248 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2249 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2250 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2251 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2252 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2253 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2254 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2255 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2259 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2261 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2263 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2265 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2266 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2269 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2270 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2271 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2273 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2274 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2281 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2283 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2284 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2287 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2289 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2290 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2291 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2299 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2300 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2301 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2302 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2304 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2306 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2307 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2312 static struct hda_verb alc880_beep_init_verbs[] = {
2313 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2317 /* toggle speaker-output according to the hp-jack state */
2318 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2320 unsigned int present;
2323 present = snd_hda_codec_read(codec, 0x14, 0,
2324 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2325 bits = present ? HDA_AMP_MUTE : 0;
2326 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2327 HDA_AMP_MUTE, bits);
2328 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2329 HDA_AMP_MUTE, bits);
2332 /* auto-toggle front mic */
2333 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2335 unsigned int present;
2338 present = snd_hda_codec_read(codec, 0x18, 0,
2339 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2340 bits = present ? HDA_AMP_MUTE : 0;
2341 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2344 static void alc880_uniwill_automute(struct hda_codec *codec)
2346 alc880_uniwill_hp_automute(codec);
2347 alc880_uniwill_mic_automute(codec);
2350 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2353 /* Looks like the unsol event is incompatible with the standard
2354 * definition. 4bit tag is placed at 28 bit!
2356 switch (res >> 28) {
2357 case ALC880_HP_EVENT:
2358 alc880_uniwill_hp_automute(codec);
2360 case ALC880_MIC_EVENT:
2361 alc880_uniwill_mic_automute(codec);
2366 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2368 unsigned int present;
2371 present = snd_hda_codec_read(codec, 0x14, 0,
2372 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2373 bits = present ? HDA_AMP_MUTE : 0;
2374 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2377 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2379 unsigned int present;
2381 present = snd_hda_codec_read(codec, 0x21, 0,
2382 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2383 present &= HDA_AMP_VOLMASK;
2384 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2385 HDA_AMP_VOLMASK, present);
2386 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2387 HDA_AMP_VOLMASK, present);
2390 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2393 /* Looks like the unsol event is incompatible with the standard
2394 * definition. 4bit tag is placed at 28 bit!
2396 if ((res >> 28) == ALC880_HP_EVENT)
2397 alc880_uniwill_p53_hp_automute(codec);
2398 if ((res >> 28) == ALC880_DCVOL_EVENT)
2399 alc880_uniwill_p53_dcvol_automute(codec);
2403 * F1734 pin configuration:
2404 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2406 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2407 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2408 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2409 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2410 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2411 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2414 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2418 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2419 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2422 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2423 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2424 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2425 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2426 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2428 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2429 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2435 * ASUS pin configuration:
2436 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2438 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2439 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2440 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2441 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2442 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2446 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2447 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2448 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2449 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2450 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2453 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2454 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2455 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2456 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2457 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2458 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2459 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2460 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2461 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2466 /* Enable GPIO mask and set output */
2467 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2468 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2470 /* Clevo m520g init */
2471 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2472 /* headphone output */
2473 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2475 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2478 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2479 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2481 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2482 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2483 /* Mic1 (rear panel) */
2484 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2486 /* Mic2 (front panel) */
2487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2488 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2490 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2491 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2492 /* change to EAPD mode */
2493 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2494 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2499 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2500 /* change to EAPD mode */
2501 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2502 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2504 /* Headphone output */
2505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2508 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2510 /* Line In pin widget for input */
2511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2512 /* CD pin widget for input */
2513 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2514 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2515 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2517 /* change to EAPD mode */
2518 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2519 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2525 * LG m1 express dual
2528 * Rear Line-In/Out (blue): 0x14
2529 * Build-in Mic-In: 0x15
2531 * HP-Out (green): 0x1b
2532 * Mic-In/Out (red): 0x19
2536 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2537 static hda_nid_t alc880_lg_dac_nids[3] = {
2541 /* seems analog CD is not working */
2542 static struct hda_input_mux alc880_lg_capture_source = {
2547 { "Internal Mic", 0x6 },
2551 /* 2,4,6 channel modes */
2552 static struct hda_verb alc880_lg_ch2_init[] = {
2553 /* set line-in and mic-in to input */
2554 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2555 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2559 static struct hda_verb alc880_lg_ch4_init[] = {
2560 /* set line-in to out and mic-in to input */
2561 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2562 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2566 static struct hda_verb alc880_lg_ch6_init[] = {
2567 /* set line-in and mic-in to output */
2568 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2569 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2573 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2574 { 2, alc880_lg_ch2_init },
2575 { 4, alc880_lg_ch4_init },
2576 { 6, alc880_lg_ch6_init },
2579 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2580 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2581 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2582 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2583 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2584 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2585 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2586 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2587 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2590 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2591 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2592 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2593 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2595 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2596 .name = "Channel Mode",
2597 .info = alc_ch_mode_info,
2598 .get = alc_ch_mode_get,
2599 .put = alc_ch_mode_put,
2604 static struct hda_verb alc880_lg_init_verbs[] = {
2605 /* set capture source to mic-in */
2606 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2607 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2608 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2609 /* mute all amp mixer inputs */
2610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2613 /* line-in to input */
2614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2615 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2617 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2618 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2620 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2621 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2622 /* mic-in to input */
2623 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2624 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2625 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2627 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2628 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2631 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2635 /* toggle speaker-output according to the hp-jack state */
2636 static void alc880_lg_automute(struct hda_codec *codec)
2638 unsigned int present;
2641 present = snd_hda_codec_read(codec, 0x1b, 0,
2642 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2643 bits = present ? HDA_AMP_MUTE : 0;
2644 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2645 HDA_AMP_MUTE, bits);
2648 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2650 /* Looks like the unsol event is incompatible with the standard
2651 * definition. 4bit tag is placed at 28 bit!
2653 if ((res >> 28) == 0x01)
2654 alc880_lg_automute(codec);
2663 * Built-in Mic-In: 0x19
2669 static struct hda_input_mux alc880_lg_lw_capture_source = {
2673 { "Internal Mic", 0x1 },
2678 #define alc880_lg_lw_modes alc880_threestack_modes
2680 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2681 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2682 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2683 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2684 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2685 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2686 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2687 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2688 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2689 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2690 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2693 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2694 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2696 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2697 .name = "Channel Mode",
2698 .info = alc_ch_mode_info,
2699 .get = alc_ch_mode_get,
2700 .put = alc_ch_mode_put,
2705 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2706 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2707 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2708 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2710 /* set capture source to mic-in */
2711 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2712 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2713 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2719 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2720 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2721 /* mic-in to input */
2722 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2723 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2726 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2728 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2732 /* toggle speaker-output according to the hp-jack state */
2733 static void alc880_lg_lw_automute(struct hda_codec *codec)
2735 unsigned int present;
2738 present = snd_hda_codec_read(codec, 0x1b, 0,
2739 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2740 bits = present ? HDA_AMP_MUTE : 0;
2741 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2742 HDA_AMP_MUTE, bits);
2745 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2747 /* Looks like the unsol event is incompatible with the standard
2748 * definition. 4bit tag is placed at 28 bit!
2750 if ((res >> 28) == 0x01)
2751 alc880_lg_lw_automute(codec);
2754 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2755 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2756 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2759 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2760 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2764 static struct hda_input_mux alc880_medion_rim_capture_source = {
2768 { "Internal Mic", 0x1 },
2772 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2773 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2775 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2778 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2779 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2780 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2781 /* Mic2 (as headphone out) for HP output */
2782 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2783 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2784 /* Internal Speaker */
2785 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2786 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2788 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2789 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2791 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2795 /* toggle speaker-output according to the hp-jack state */
2796 static void alc880_medion_rim_automute(struct hda_codec *codec)
2798 unsigned int present;
2801 present = snd_hda_codec_read(codec, 0x14, 0,
2802 AC_VERB_GET_PIN_SENSE, 0)
2803 & AC_PINSENSE_PRESENCE;
2804 bits = present ? HDA_AMP_MUTE : 0;
2805 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2806 HDA_AMP_MUTE, bits);
2808 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2810 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2813 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2816 /* Looks like the unsol event is incompatible with the standard
2817 * definition. 4bit tag is placed at 28 bit!
2819 if ((res >> 28) == ALC880_HP_EVENT)
2820 alc880_medion_rim_automute(codec);
2823 #ifdef CONFIG_SND_HDA_POWER_SAVE
2824 static struct hda_amp_list alc880_loopbacks[] = {
2825 { 0x0b, HDA_INPUT, 0 },
2826 { 0x0b, HDA_INPUT, 1 },
2827 { 0x0b, HDA_INPUT, 2 },
2828 { 0x0b, HDA_INPUT, 3 },
2829 { 0x0b, HDA_INPUT, 4 },
2833 static struct hda_amp_list alc880_lg_loopbacks[] = {
2834 { 0x0b, HDA_INPUT, 1 },
2835 { 0x0b, HDA_INPUT, 6 },
2836 { 0x0b, HDA_INPUT, 7 },
2845 static int alc_init(struct hda_codec *codec)
2847 struct alc_spec *spec = codec->spec;
2851 if (codec->vendor_id == 0x10ec0888)
2852 alc888_coef_init(codec);
2854 for (i = 0; i < spec->num_init_verbs; i++)
2855 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2857 if (spec->init_hook)
2858 spec->init_hook(codec);
2863 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2865 struct alc_spec *spec = codec->spec;
2867 if (spec->unsol_event)
2868 spec->unsol_event(codec, res);
2871 #ifdef CONFIG_SND_HDA_POWER_SAVE
2872 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2874 struct alc_spec *spec = codec->spec;
2875 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2880 * Analog playback callbacks
2882 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2883 struct hda_codec *codec,
2884 struct snd_pcm_substream *substream)
2886 struct alc_spec *spec = codec->spec;
2887 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2891 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2892 struct hda_codec *codec,
2893 unsigned int stream_tag,
2894 unsigned int format,
2895 struct snd_pcm_substream *substream)
2897 struct alc_spec *spec = codec->spec;
2898 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2899 stream_tag, format, substream);
2902 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2903 struct hda_codec *codec,
2904 struct snd_pcm_substream *substream)
2906 struct alc_spec *spec = codec->spec;
2907 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2913 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2914 struct hda_codec *codec,
2915 struct snd_pcm_substream *substream)
2917 struct alc_spec *spec = codec->spec;
2918 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2921 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2922 struct hda_codec *codec,
2923 unsigned int stream_tag,
2924 unsigned int format,
2925 struct snd_pcm_substream *substream)
2927 struct alc_spec *spec = codec->spec;
2928 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2929 stream_tag, format, substream);
2932 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2933 struct hda_codec *codec,
2934 struct snd_pcm_substream *substream)
2936 struct alc_spec *spec = codec->spec;
2937 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2943 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2944 struct hda_codec *codec,
2945 unsigned int stream_tag,
2946 unsigned int format,
2947 struct snd_pcm_substream *substream)
2949 struct alc_spec *spec = codec->spec;
2951 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2952 stream_tag, 0, format);
2956 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2957 struct hda_codec *codec,
2958 struct snd_pcm_substream *substream)
2960 struct alc_spec *spec = codec->spec;
2962 snd_hda_codec_cleanup_stream(codec,
2963 spec->adc_nids[substream->number + 1]);
2970 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2974 /* NID is set in alc_build_pcms */
2976 .open = alc880_playback_pcm_open,
2977 .prepare = alc880_playback_pcm_prepare,
2978 .cleanup = alc880_playback_pcm_cleanup
2982 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2986 /* NID is set in alc_build_pcms */
2989 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2993 /* NID is set in alc_build_pcms */
2996 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2997 .substreams = 2, /* can be overridden */
3000 /* NID is set in alc_build_pcms */
3002 .prepare = alc880_alt_capture_pcm_prepare,
3003 .cleanup = alc880_alt_capture_pcm_cleanup
3007 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3011 /* NID is set in alc_build_pcms */
3013 .open = alc880_dig_playback_pcm_open,
3014 .close = alc880_dig_playback_pcm_close,
3015 .prepare = alc880_dig_playback_pcm_prepare
3019 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3023 /* NID is set in alc_build_pcms */
3026 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3027 static struct hda_pcm_stream alc_pcm_null_stream = {
3033 static int alc_build_pcms(struct hda_codec *codec)
3035 struct alc_spec *spec = codec->spec;
3036 struct hda_pcm *info = spec->pcm_rec;
3039 codec->num_pcms = 1;
3040 codec->pcm_info = info;
3042 info->name = spec->stream_name_analog;
3043 if (spec->stream_analog_playback) {
3044 if (snd_BUG_ON(!spec->multiout.dac_nids))
3046 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3047 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3049 if (spec->stream_analog_capture) {
3050 if (snd_BUG_ON(!spec->adc_nids))
3052 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3053 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3056 if (spec->channel_mode) {
3057 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3058 for (i = 0; i < spec->num_channel_mode; i++) {
3059 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3060 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3065 /* SPDIF for stream index #1 */
3066 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3067 codec->num_pcms = 2;
3068 info = spec->pcm_rec + 1;
3069 info->name = spec->stream_name_digital;
3070 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3071 if (spec->multiout.dig_out_nid &&
3072 spec->stream_digital_playback) {
3073 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3074 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3076 if (spec->dig_in_nid &&
3077 spec->stream_digital_capture) {
3078 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3079 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3081 /* FIXME: do we need this for all Realtek codec models? */
3082 codec->spdif_status_reset = 1;
3085 /* If the use of more than one ADC is requested for the current
3086 * model, configure a second analog capture-only PCM.
3088 /* Additional Analaog capture for index #2 */
3089 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3090 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3091 codec->num_pcms = 3;
3092 info = spec->pcm_rec + 2;
3093 info->name = spec->stream_name_analog;
3094 if (spec->alt_dac_nid) {
3095 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3096 *spec->stream_analog_alt_playback;
3097 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3100 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3101 alc_pcm_null_stream;
3102 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3104 if (spec->num_adc_nids > 1) {
3105 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3106 *spec->stream_analog_alt_capture;
3107 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3109 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3110 spec->num_adc_nids - 1;
3112 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3113 alc_pcm_null_stream;
3114 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3121 static void alc_free_kctls(struct hda_codec *codec)
3123 struct alc_spec *spec = codec->spec;
3125 if (spec->kctls.list) {
3126 struct snd_kcontrol_new *kctl = spec->kctls.list;
3128 for (i = 0; i < spec->kctls.used; i++)
3129 kfree(kctl[i].name);
3131 snd_array_free(&spec->kctls);
3134 static void alc_free(struct hda_codec *codec)
3136 struct alc_spec *spec = codec->spec;
3141 alc_free_kctls(codec);
3143 codec->spec = NULL; /* to be sure */
3146 #ifdef SND_HDA_NEEDS_RESUME
3147 static void store_pin_configs(struct hda_codec *codec)
3149 struct alc_spec *spec = codec->spec;
3150 hda_nid_t nid, end_nid;
3152 end_nid = codec->start_nid + codec->num_nodes;
3153 for (nid = codec->start_nid; nid < end_nid; nid++) {
3154 unsigned int wid_caps = get_wcaps(codec, nid);
3155 unsigned int wid_type =
3156 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3157 if (wid_type != AC_WID_PIN)
3159 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3161 spec->pin_nids[spec->num_pins] = nid;
3162 spec->pin_cfgs[spec->num_pins] =
3163 snd_hda_codec_read(codec, nid, 0,
3164 AC_VERB_GET_CONFIG_DEFAULT, 0);
3169 static void resume_pin_configs(struct hda_codec *codec)
3171 struct alc_spec *spec = codec->spec;
3174 for (i = 0; i < spec->num_pins; i++) {
3175 hda_nid_t pin_nid = spec->pin_nids[i];
3176 unsigned int pin_config = spec->pin_cfgs[i];
3177 snd_hda_codec_write(codec, pin_nid, 0,
3178 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3179 pin_config & 0x000000ff);
3180 snd_hda_codec_write(codec, pin_nid, 0,
3181 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3182 (pin_config & 0x0000ff00) >> 8);
3183 snd_hda_codec_write(codec, pin_nid, 0,
3184 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3185 (pin_config & 0x00ff0000) >> 16);
3186 snd_hda_codec_write(codec, pin_nid, 0,
3187 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3192 static int alc_resume(struct hda_codec *codec)
3194 resume_pin_configs(codec);
3195 codec->patch_ops.init(codec);
3196 snd_hda_codec_resume_amp(codec);
3197 snd_hda_codec_resume_cache(codec);
3201 #define store_pin_configs(codec)
3206 static struct hda_codec_ops alc_patch_ops = {
3207 .build_controls = alc_build_controls,
3208 .build_pcms = alc_build_pcms,
3211 .unsol_event = alc_unsol_event,
3212 #ifdef SND_HDA_NEEDS_RESUME
3213 .resume = alc_resume,
3215 #ifdef CONFIG_SND_HDA_POWER_SAVE
3216 .check_power_status = alc_check_power_status,
3222 * Test configuration for debugging
3224 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3227 #ifdef CONFIG_SND_DEBUG
3228 static hda_nid_t alc880_test_dac_nids[4] = {
3229 0x02, 0x03, 0x04, 0x05
3232 static struct hda_input_mux alc880_test_capture_source = {
3241 { "Surround", 0x6 },
3245 static struct hda_channel_mode alc880_test_modes[4] = {
3252 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3253 struct snd_ctl_elem_info *uinfo)
3255 static char *texts[] = {
3256 "N/A", "Line Out", "HP Out",
3257 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3259 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3261 uinfo->value.enumerated.items = 8;
3262 if (uinfo->value.enumerated.item >= 8)
3263 uinfo->value.enumerated.item = 7;
3264 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3268 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3269 struct snd_ctl_elem_value *ucontrol)
3271 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3272 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3273 unsigned int pin_ctl, item = 0;
3275 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3276 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3277 if (pin_ctl & AC_PINCTL_OUT_EN) {
3278 if (pin_ctl & AC_PINCTL_HP_EN)
3282 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3283 switch (pin_ctl & AC_PINCTL_VREFEN) {
3284 case AC_PINCTL_VREF_HIZ: item = 3; break;
3285 case AC_PINCTL_VREF_50: item = 4; break;
3286 case AC_PINCTL_VREF_GRD: item = 5; break;
3287 case AC_PINCTL_VREF_80: item = 6; break;
3288 case AC_PINCTL_VREF_100: item = 7; break;
3291 ucontrol->value.enumerated.item[0] = item;
3295 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3296 struct snd_ctl_elem_value *ucontrol)
3298 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3299 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3300 static unsigned int ctls[] = {
3301 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3302 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3303 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3304 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3305 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3306 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3308 unsigned int old_ctl, new_ctl;
3310 old_ctl = snd_hda_codec_read(codec, nid, 0,
3311 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3312 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3313 if (old_ctl != new_ctl) {
3315 snd_hda_codec_write_cache(codec, nid, 0,
3316 AC_VERB_SET_PIN_WIDGET_CONTROL,
3318 val = ucontrol->value.enumerated.item[0] >= 3 ?
3320 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3327 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3328 struct snd_ctl_elem_info *uinfo)
3330 static char *texts[] = {
3331 "Front", "Surround", "CLFE", "Side"
3333 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3335 uinfo->value.enumerated.items = 4;
3336 if (uinfo->value.enumerated.item >= 4)
3337 uinfo->value.enumerated.item = 3;
3338 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3342 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3343 struct snd_ctl_elem_value *ucontrol)
3345 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3346 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3349 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3350 ucontrol->value.enumerated.item[0] = sel & 3;
3354 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3355 struct snd_ctl_elem_value *ucontrol)
3357 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3358 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3361 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3362 if (ucontrol->value.enumerated.item[0] != sel) {
3363 sel = ucontrol->value.enumerated.item[0] & 3;
3364 snd_hda_codec_write_cache(codec, nid, 0,
3365 AC_VERB_SET_CONNECT_SEL, sel);
3371 #define PIN_CTL_TEST(xname,nid) { \
3372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3374 .info = alc_test_pin_ctl_info, \
3375 .get = alc_test_pin_ctl_get, \
3376 .put = alc_test_pin_ctl_put, \
3377 .private_value = nid \
3380 #define PIN_SRC_TEST(xname,nid) { \
3381 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3383 .info = alc_test_pin_src_info, \
3384 .get = alc_test_pin_src_get, \
3385 .put = alc_test_pin_src_put, \
3386 .private_value = nid \
3389 static struct snd_kcontrol_new alc880_test_mixer[] = {
3390 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3391 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3392 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3393 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3394 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3395 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3396 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3397 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3398 PIN_CTL_TEST("Front Pin Mode", 0x14),
3399 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3400 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3401 PIN_CTL_TEST("Side Pin Mode", 0x17),
3402 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3403 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3404 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3405 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3406 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3407 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3408 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3409 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3410 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3411 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3412 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3413 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3414 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3415 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3416 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3417 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3418 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3419 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3422 .name = "Channel Mode",
3423 .info = alc_ch_mode_info,
3424 .get = alc_ch_mode_get,
3425 .put = alc_ch_mode_put,
3430 static struct hda_verb alc880_test_init_verbs[] = {
3431 /* Unmute inputs of 0x0c - 0x0f */
3432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3433 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3435 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3437 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3438 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3439 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3440 /* Vol output for 0x0c-0x0f */
3441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3442 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3443 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3444 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3445 /* Set output pins 0x14-0x17 */
3446 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3447 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3448 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3449 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3450 /* Unmute output pins 0x14-0x17 */
3451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3452 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3453 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3454 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3455 /* Set input pins 0x18-0x1c */
3456 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3457 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3458 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3459 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3460 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3461 /* Mute input pins 0x18-0x1b */
3462 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3463 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3464 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3465 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3467 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3468 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3469 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3470 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3471 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3472 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3473 /* Analog input/passthru */
3474 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3475 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3477 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3478 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3486 static const char *alc880_models[ALC880_MODEL_LAST] = {
3487 [ALC880_3ST] = "3stack",
3488 [ALC880_TCL_S700] = "tcl",
3489 [ALC880_3ST_DIG] = "3stack-digout",
3490 [ALC880_CLEVO] = "clevo",
3491 [ALC880_5ST] = "5stack",
3492 [ALC880_5ST_DIG] = "5stack-digout",
3493 [ALC880_W810] = "w810",
3494 [ALC880_Z71V] = "z71v",
3495 [ALC880_6ST] = "6stack",
3496 [ALC880_6ST_DIG] = "6stack-digout",
3497 [ALC880_ASUS] = "asus",
3498 [ALC880_ASUS_W1V] = "asus-w1v",
3499 [ALC880_ASUS_DIG] = "asus-dig",
3500 [ALC880_ASUS_DIG2] = "asus-dig2",
3501 [ALC880_UNIWILL_DIG] = "uniwill",
3502 [ALC880_UNIWILL_P53] = "uniwill-p53",
3503 [ALC880_FUJITSU] = "fujitsu",
3504 [ALC880_F1734] = "F1734",
3506 [ALC880_LG_LW] = "lg-lw",
3507 [ALC880_MEDION_RIM] = "medion",
3508 #ifdef CONFIG_SND_DEBUG
3509 [ALC880_TEST] = "test",
3511 [ALC880_AUTO] = "auto",
3514 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3515 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3516 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3517 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3518 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3519 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3520 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3521 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3522 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3523 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3524 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3525 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3526 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3527 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3528 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3529 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3530 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3531 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3532 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3533 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3534 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3535 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3536 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3537 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3538 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3539 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3540 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3541 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3542 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3543 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3544 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3545 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3546 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3547 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3548 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3549 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3550 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3551 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3552 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3553 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3554 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3555 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3556 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3557 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3558 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3559 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3560 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3561 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3562 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3563 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3564 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3565 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3566 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3567 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3568 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3569 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3570 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3571 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3572 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3573 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3574 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3575 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3576 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3577 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3578 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3579 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3580 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3581 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3582 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3583 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3584 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3585 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3590 * ALC880 codec presets
3592 static struct alc_config_preset alc880_presets[] = {
3594 .mixers = { alc880_three_stack_mixer },
3595 .init_verbs = { alc880_volume_init_verbs,
3596 alc880_pin_3stack_init_verbs },
3597 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3598 .dac_nids = alc880_dac_nids,
3599 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3600 .channel_mode = alc880_threestack_modes,
3602 .input_mux = &alc880_capture_source,
3604 [ALC880_3ST_DIG] = {
3605 .mixers = { alc880_three_stack_mixer },
3606 .init_verbs = { alc880_volume_init_verbs,
3607 alc880_pin_3stack_init_verbs },
3608 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3609 .dac_nids = alc880_dac_nids,
3610 .dig_out_nid = ALC880_DIGOUT_NID,
3611 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3612 .channel_mode = alc880_threestack_modes,
3614 .input_mux = &alc880_capture_source,
3616 [ALC880_TCL_S700] = {
3617 .mixers = { alc880_tcl_s700_mixer },
3618 .init_verbs = { alc880_volume_init_verbs,
3619 alc880_pin_tcl_S700_init_verbs,
3620 alc880_gpio2_init_verbs },
3621 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3622 .dac_nids = alc880_dac_nids,
3623 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3624 .num_adc_nids = 1, /* single ADC */
3626 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3627 .channel_mode = alc880_2_jack_modes,
3628 .input_mux = &alc880_capture_source,
3631 .mixers = { alc880_three_stack_mixer,
3632 alc880_five_stack_mixer},
3633 .init_verbs = { alc880_volume_init_verbs,
3634 alc880_pin_5stack_init_verbs },
3635 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3636 .dac_nids = alc880_dac_nids,
3637 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3638 .channel_mode = alc880_fivestack_modes,
3639 .input_mux = &alc880_capture_source,
3641 [ALC880_5ST_DIG] = {
3642 .mixers = { alc880_three_stack_mixer,
3643 alc880_five_stack_mixer },
3644 .init_verbs = { alc880_volume_init_verbs,
3645 alc880_pin_5stack_init_verbs },
3646 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3647 .dac_nids = alc880_dac_nids,
3648 .dig_out_nid = ALC880_DIGOUT_NID,
3649 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3650 .channel_mode = alc880_fivestack_modes,
3651 .input_mux = &alc880_capture_source,
3654 .mixers = { alc880_six_stack_mixer },
3655 .init_verbs = { alc880_volume_init_verbs,
3656 alc880_pin_6stack_init_verbs },
3657 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3658 .dac_nids = alc880_6st_dac_nids,
3659 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3660 .channel_mode = alc880_sixstack_modes,
3661 .input_mux = &alc880_6stack_capture_source,
3663 [ALC880_6ST_DIG] = {
3664 .mixers = { alc880_six_stack_mixer },
3665 .init_verbs = { alc880_volume_init_verbs,
3666 alc880_pin_6stack_init_verbs },
3667 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3668 .dac_nids = alc880_6st_dac_nids,
3669 .dig_out_nid = ALC880_DIGOUT_NID,
3670 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3671 .channel_mode = alc880_sixstack_modes,
3672 .input_mux = &alc880_6stack_capture_source,
3675 .mixers = { alc880_w810_base_mixer },
3676 .init_verbs = { alc880_volume_init_verbs,
3677 alc880_pin_w810_init_verbs,
3678 alc880_gpio2_init_verbs },
3679 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3680 .dac_nids = alc880_w810_dac_nids,
3681 .dig_out_nid = ALC880_DIGOUT_NID,
3682 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3683 .channel_mode = alc880_w810_modes,
3684 .input_mux = &alc880_capture_source,
3687 .mixers = { alc880_z71v_mixer },
3688 .init_verbs = { alc880_volume_init_verbs,
3689 alc880_pin_z71v_init_verbs },
3690 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3691 .dac_nids = alc880_z71v_dac_nids,
3692 .dig_out_nid = ALC880_DIGOUT_NID,
3694 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3695 .channel_mode = alc880_2_jack_modes,
3696 .input_mux = &alc880_capture_source,
3699 .mixers = { alc880_f1734_mixer },
3700 .init_verbs = { alc880_volume_init_verbs,
3701 alc880_pin_f1734_init_verbs },
3702 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3703 .dac_nids = alc880_f1734_dac_nids,
3705 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3706 .channel_mode = alc880_2_jack_modes,
3707 .input_mux = &alc880_f1734_capture_source,
3708 .unsol_event = alc880_uniwill_p53_unsol_event,
3709 .init_hook = alc880_uniwill_p53_hp_automute,
3712 .mixers = { alc880_asus_mixer },
3713 .init_verbs = { alc880_volume_init_verbs,
3714 alc880_pin_asus_init_verbs,
3715 alc880_gpio1_init_verbs },
3716 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3717 .dac_nids = alc880_asus_dac_nids,
3718 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3719 .channel_mode = alc880_asus_modes,
3721 .input_mux = &alc880_capture_source,
3723 [ALC880_ASUS_DIG] = {
3724 .mixers = { alc880_asus_mixer },
3725 .init_verbs = { alc880_volume_init_verbs,
3726 alc880_pin_asus_init_verbs,
3727 alc880_gpio1_init_verbs },
3728 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3729 .dac_nids = alc880_asus_dac_nids,
3730 .dig_out_nid = ALC880_DIGOUT_NID,
3731 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3732 .channel_mode = alc880_asus_modes,
3734 .input_mux = &alc880_capture_source,
3736 [ALC880_ASUS_DIG2] = {
3737 .mixers = { alc880_asus_mixer },
3738 .init_verbs = { alc880_volume_init_verbs,
3739 alc880_pin_asus_init_verbs,
3740 alc880_gpio2_init_verbs }, /* use GPIO2 */
3741 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3742 .dac_nids = alc880_asus_dac_nids,
3743 .dig_out_nid = ALC880_DIGOUT_NID,
3744 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3745 .channel_mode = alc880_asus_modes,
3747 .input_mux = &alc880_capture_source,
3749 [ALC880_ASUS_W1V] = {
3750 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3751 .init_verbs = { alc880_volume_init_verbs,
3752 alc880_pin_asus_init_verbs,
3753 alc880_gpio1_init_verbs },
3754 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3755 .dac_nids = alc880_asus_dac_nids,
3756 .dig_out_nid = ALC880_DIGOUT_NID,
3757 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3758 .channel_mode = alc880_asus_modes,
3760 .input_mux = &alc880_capture_source,
3762 [ALC880_UNIWILL_DIG] = {
3763 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3764 .init_verbs = { alc880_volume_init_verbs,
3765 alc880_pin_asus_init_verbs },
3766 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3767 .dac_nids = alc880_asus_dac_nids,
3768 .dig_out_nid = ALC880_DIGOUT_NID,
3769 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3770 .channel_mode = alc880_asus_modes,
3772 .input_mux = &alc880_capture_source,
3774 [ALC880_UNIWILL] = {
3775 .mixers = { alc880_uniwill_mixer },
3776 .init_verbs = { alc880_volume_init_verbs,
3777 alc880_uniwill_init_verbs },
3778 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3779 .dac_nids = alc880_asus_dac_nids,
3780 .dig_out_nid = ALC880_DIGOUT_NID,
3781 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3782 .channel_mode = alc880_threestack_modes,
3784 .input_mux = &alc880_capture_source,
3785 .unsol_event = alc880_uniwill_unsol_event,
3786 .init_hook = alc880_uniwill_automute,
3788 [ALC880_UNIWILL_P53] = {
3789 .mixers = { alc880_uniwill_p53_mixer },
3790 .init_verbs = { alc880_volume_init_verbs,
3791 alc880_uniwill_p53_init_verbs },
3792 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3793 .dac_nids = alc880_asus_dac_nids,
3794 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3795 .channel_mode = alc880_threestack_modes,
3796 .input_mux = &alc880_capture_source,
3797 .unsol_event = alc880_uniwill_p53_unsol_event,
3798 .init_hook = alc880_uniwill_p53_hp_automute,
3800 [ALC880_FUJITSU] = {
3801 .mixers = { alc880_fujitsu_mixer,
3802 alc880_pcbeep_mixer, },
3803 .init_verbs = { alc880_volume_init_verbs,
3804 alc880_uniwill_p53_init_verbs,
3805 alc880_beep_init_verbs },
3806 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3807 .dac_nids = alc880_dac_nids,
3808 .dig_out_nid = ALC880_DIGOUT_NID,
3809 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3810 .channel_mode = alc880_2_jack_modes,
3811 .input_mux = &alc880_capture_source,
3812 .unsol_event = alc880_uniwill_p53_unsol_event,
3813 .init_hook = alc880_uniwill_p53_hp_automute,
3816 .mixers = { alc880_three_stack_mixer },
3817 .init_verbs = { alc880_volume_init_verbs,
3818 alc880_pin_clevo_init_verbs },
3819 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3820 .dac_nids = alc880_dac_nids,
3822 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3823 .channel_mode = alc880_threestack_modes,
3825 .input_mux = &alc880_capture_source,
3828 .mixers = { alc880_lg_mixer },
3829 .init_verbs = { alc880_volume_init_verbs,
3830 alc880_lg_init_verbs },
3831 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3832 .dac_nids = alc880_lg_dac_nids,
3833 .dig_out_nid = ALC880_DIGOUT_NID,
3834 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3835 .channel_mode = alc880_lg_ch_modes,
3837 .input_mux = &alc880_lg_capture_source,
3838 .unsol_event = alc880_lg_unsol_event,
3839 .init_hook = alc880_lg_automute,
3840 #ifdef CONFIG_SND_HDA_POWER_SAVE
3841 .loopbacks = alc880_lg_loopbacks,
3845 .mixers = { alc880_lg_lw_mixer },
3846 .init_verbs = { alc880_volume_init_verbs,
3847 alc880_lg_lw_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_lg_lw_modes),
3852 .channel_mode = alc880_lg_lw_modes,
3853 .input_mux = &alc880_lg_lw_capture_source,
3854 .unsol_event = alc880_lg_lw_unsol_event,
3855 .init_hook = alc880_lg_lw_automute,
3857 [ALC880_MEDION_RIM] = {
3858 .mixers = { alc880_medion_rim_mixer },
3859 .init_verbs = { alc880_volume_init_verbs,
3860 alc880_medion_rim_init_verbs,
3861 alc_gpio2_init_verbs },
3862 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3863 .dac_nids = alc880_dac_nids,
3864 .dig_out_nid = ALC880_DIGOUT_NID,
3865 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3866 .channel_mode = alc880_2_jack_modes,
3867 .input_mux = &alc880_medion_rim_capture_source,
3868 .unsol_event = alc880_medion_rim_unsol_event,
3869 .init_hook = alc880_medion_rim_automute,
3871 #ifdef CONFIG_SND_DEBUG
3873 .mixers = { alc880_test_mixer },
3874 .init_verbs = { alc880_test_init_verbs },
3875 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3876 .dac_nids = alc880_test_dac_nids,
3877 .dig_out_nid = ALC880_DIGOUT_NID,
3878 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3879 .channel_mode = alc880_test_modes,
3880 .input_mux = &alc880_test_capture_source,
3886 * Automatic parse of I/O pins from the BIOS configuration
3891 ALC_CTL_WIDGET_MUTE,
3894 static struct snd_kcontrol_new alc880_control_templates[] = {
3895 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3896 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3897 HDA_BIND_MUTE(NULL, 0, 0, 0),
3900 /* add dynamic controls */
3901 static int add_control(struct alc_spec *spec, int type, const char *name,
3904 struct snd_kcontrol_new *knew;
3906 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3907 knew = snd_array_new(&spec->kctls);
3910 *knew = alc880_control_templates[type];
3911 knew->name = kstrdup(name, GFP_KERNEL);
3914 knew->private_value = val;
3918 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3919 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3920 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3921 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3922 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3923 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3924 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3925 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3926 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3927 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3928 #define ALC880_PIN_CD_NID 0x1c
3930 /* fill in the dac_nids table from the parsed pin configuration */
3931 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3932 const struct auto_pin_cfg *cfg)
3938 memset(assigned, 0, sizeof(assigned));
3939 spec->multiout.dac_nids = spec->private_dac_nids;
3941 /* check the pins hardwired to audio widget */
3942 for (i = 0; i < cfg->line_outs; i++) {
3943 nid = cfg->line_out_pins[i];
3944 if (alc880_is_fixed_pin(nid)) {
3945 int idx = alc880_fixed_pin_idx(nid);
3946 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3950 /* left pins can be connect to any audio widget */
3951 for (i = 0; i < cfg->line_outs; i++) {
3952 nid = cfg->line_out_pins[i];
3953 if (alc880_is_fixed_pin(nid))
3955 /* search for an empty channel */
3956 for (j = 0; j < cfg->line_outs; j++) {
3958 spec->multiout.dac_nids[i] =
3959 alc880_idx_to_dac(j);
3965 spec->multiout.num_dacs = cfg->line_outs;
3969 /* add playback controls from the parsed DAC table */
3970 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3971 const struct auto_pin_cfg *cfg)
3974 static const char *chname[4] = {
3975 "Front", "Surround", NULL /*CLFE*/, "Side"
3980 for (i = 0; i < cfg->line_outs; i++) {
3981 if (!spec->multiout.dac_nids[i])
3983 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3986 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3987 "Center Playback Volume",
3988 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3992 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3993 "LFE Playback Volume",
3994 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3998 err = add_control(spec, ALC_CTL_BIND_MUTE,
3999 "Center Playback Switch",
4000 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4004 err = add_control(spec, ALC_CTL_BIND_MUTE,
4005 "LFE Playback Switch",
4006 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4011 sprintf(name, "%s Playback Volume", chname[i]);
4012 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4013 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4017 sprintf(name, "%s Playback Switch", chname[i]);
4018 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4019 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4028 /* add playback controls for speaker and HP outputs */
4029 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4039 if (alc880_is_fixed_pin(pin)) {
4040 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4041 /* specify the DAC as the extra output */
4042 if (!spec->multiout.hp_nid)
4043 spec->multiout.hp_nid = nid;
4045 spec->multiout.extra_out_nid[0] = nid;
4046 /* control HP volume/switch on the output mixer amp */
4047 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4048 sprintf(name, "%s Playback Volume", pfx);
4049 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4050 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4053 sprintf(name, "%s Playback Switch", pfx);
4054 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4055 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4058 } else if (alc880_is_multi_pin(pin)) {
4059 /* set manual connection */
4060 /* we have only a switch on HP-out PIN */
4061 sprintf(name, "%s Playback Switch", pfx);
4062 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4063 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4070 /* create input playback/capture controls for the given pin */
4071 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4072 const char *ctlname,
4073 int idx, hda_nid_t mix_nid)
4078 sprintf(name, "%s Playback Volume", ctlname);
4079 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4080 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4083 sprintf(name, "%s Playback Switch", ctlname);
4084 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4085 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4091 /* create playback/capture controls for input pins */
4092 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4093 const struct auto_pin_cfg *cfg)
4095 struct hda_input_mux *imux = &spec->private_imux;
4098 for (i = 0; i < AUTO_PIN_LAST; i++) {
4099 if (alc880_is_input_pin(cfg->input_pins[i])) {
4100 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4101 err = new_analog_input(spec, cfg->input_pins[i],
4102 auto_pin_cfg_labels[i],
4106 imux->items[imux->num_items].label =
4107 auto_pin_cfg_labels[i];
4108 imux->items[imux->num_items].index =
4109 alc880_input_pin_idx(cfg->input_pins[i]);
4116 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4117 unsigned int pin_type)
4119 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4122 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4126 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4127 hda_nid_t nid, int pin_type,
4130 alc_set_pin_output(codec, nid, pin_type);
4131 /* need the manual connection? */
4132 if (alc880_is_multi_pin(nid)) {
4133 struct alc_spec *spec = codec->spec;
4134 int idx = alc880_multi_pin_idx(nid);
4135 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4136 AC_VERB_SET_CONNECT_SEL,
4137 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4141 static int get_pin_type(int line_out_type)
4143 if (line_out_type == AUTO_PIN_HP_OUT)
4149 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4151 struct alc_spec *spec = codec->spec;
4154 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4155 for (i = 0; i < spec->autocfg.line_outs; i++) {
4156 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4157 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4158 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4162 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4164 struct alc_spec *spec = codec->spec;
4167 pin = spec->autocfg.speaker_pins[0];
4168 if (pin) /* connect to front */
4169 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4170 pin = spec->autocfg.hp_pins[0];
4171 if (pin) /* connect to front */
4172 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4175 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4177 struct alc_spec *spec = codec->spec;
4180 for (i = 0; i < AUTO_PIN_LAST; i++) {
4181 hda_nid_t nid = spec->autocfg.input_pins[i];
4182 if (alc880_is_input_pin(nid)) {
4183 snd_hda_codec_write(codec, nid, 0,
4184 AC_VERB_SET_PIN_WIDGET_CONTROL,
4185 i <= AUTO_PIN_FRONT_MIC ?
4186 PIN_VREF80 : PIN_IN);
4187 if (nid != ALC880_PIN_CD_NID)
4188 snd_hda_codec_write(codec, nid, 0,
4189 AC_VERB_SET_AMP_GAIN_MUTE,
4195 /* parse the BIOS configuration and set up the alc_spec */
4196 /* return 1 if successful, 0 if the proper config is not found,
4197 * or a negative error code
4199 static int alc880_parse_auto_config(struct hda_codec *codec)
4201 struct alc_spec *spec = codec->spec;
4203 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4205 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4209 if (!spec->autocfg.line_outs)
4210 return 0; /* can't find valid BIOS pin config */
4212 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4215 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4218 err = alc880_auto_create_extra_out(spec,
4219 spec->autocfg.speaker_pins[0],
4223 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4227 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4231 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4233 if (spec->autocfg.dig_out_pin)
4234 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4235 if (spec->autocfg.dig_in_pin)
4236 spec->dig_in_nid = ALC880_DIGIN_NID;
4238 if (spec->kctls.list)
4239 add_mixer(spec, spec->kctls.list);
4241 add_verb(spec, alc880_volume_init_verbs);
4243 spec->num_mux_defs = 1;
4244 spec->input_mux = &spec->private_imux;
4246 store_pin_configs(codec);
4250 /* additional initialization for auto-configuration model */
4251 static void alc880_auto_init(struct hda_codec *codec)
4253 struct alc_spec *spec = codec->spec;
4254 alc880_auto_init_multi_out(codec);
4255 alc880_auto_init_extra_out(codec);
4256 alc880_auto_init_analog_input(codec);
4257 if (spec->unsol_event)
4258 alc_inithook(codec);
4262 * OK, here we have finally the patch for ALC880
4265 static void set_capture_mixer(struct alc_spec *spec)
4267 static struct snd_kcontrol_new *caps[3] = {
4272 if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3)
4273 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4276 static int patch_alc880(struct hda_codec *codec)
4278 struct alc_spec *spec;
4282 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4288 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4291 if (board_config < 0) {
4292 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4293 "trying auto-probe from BIOS...\n");
4294 board_config = ALC880_AUTO;
4297 if (board_config == ALC880_AUTO) {
4298 /* automatic parse from the BIOS config */
4299 err = alc880_parse_auto_config(codec);
4305 "hda_codec: Cannot set up configuration "
4306 "from BIOS. Using 3-stack mode...\n");
4307 board_config = ALC880_3ST;
4311 if (board_config != ALC880_AUTO)
4312 setup_preset(spec, &alc880_presets[board_config]);
4314 spec->stream_name_analog = "ALC880 Analog";
4315 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4316 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4317 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4319 spec->stream_name_digital = "ALC880 Digital";
4320 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4321 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4323 if (!spec->adc_nids && spec->input_mux) {
4324 /* check whether NID 0x07 is valid */
4325 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4327 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4328 if (wcap != AC_WID_AUD_IN) {
4329 spec->adc_nids = alc880_adc_nids_alt;
4330 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4332 spec->adc_nids = alc880_adc_nids;
4333 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4336 set_capture_mixer(spec);
4338 spec->vmaster_nid = 0x0c;
4340 codec->patch_ops = alc_patch_ops;
4341 if (board_config == ALC880_AUTO)
4342 spec->init_hook = alc880_auto_init;
4343 #ifdef CONFIG_SND_HDA_POWER_SAVE
4344 if (!spec->loopback.amplist)
4345 spec->loopback.amplist = alc880_loopbacks;
4356 static hda_nid_t alc260_dac_nids[1] = {
4361 static hda_nid_t alc260_adc_nids[1] = {
4366 static hda_nid_t alc260_adc_nids_alt[1] = {
4371 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4372 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4374 static hda_nid_t alc260_dual_adc_nids[2] = {
4379 #define ALC260_DIGOUT_NID 0x03
4380 #define ALC260_DIGIN_NID 0x06
4382 static struct hda_input_mux alc260_capture_source = {
4386 { "Front Mic", 0x1 },
4392 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4393 * headphone jack and the internal CD lines since these are the only pins at
4394 * which audio can appear. For flexibility, also allow the option of
4395 * recording the mixer output on the second ADC (ADC0 doesn't have a
4396 * connection to the mixer output).
4398 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4402 { "Mic/Line", 0x0 },
4404 { "Headphone", 0x2 },
4410 { "Mic/Line", 0x0 },
4412 { "Headphone", 0x2 },
4419 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4420 * the Fujitsu S702x, but jacks are marked differently.
4422 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4429 { "Headphone", 0x5 },
4438 { "Headphone", 0x6 },
4444 * This is just place-holder, so there's something for alc_build_pcms to look
4445 * at when it calculates the maximum number of channels. ALC260 has no mixer
4446 * element which allows changing the channel mode, so the verb list is
4449 static struct hda_channel_mode alc260_modes[1] = {
4454 /* Mixer combinations
4456 * basic: base_output + input + pc_beep + capture
4457 * HP: base_output + input + capture_alt
4458 * HP_3013: hp_3013 + input + capture
4459 * fujitsu: fujitsu + capture
4460 * acer: acer + capture
4463 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4464 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4465 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4466 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4467 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4468 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4469 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4473 static struct snd_kcontrol_new alc260_input_mixer[] = {
4474 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4475 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4476 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4477 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4479 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4480 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4481 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4485 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4486 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4487 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4491 /* update HP, line and mono out pins according to the master switch */
4492 static void alc260_hp_master_update(struct hda_codec *codec,
4493 hda_nid_t hp, hda_nid_t line,
4496 struct alc_spec *spec = codec->spec;
4497 unsigned int val = spec->master_sw ? PIN_HP : 0;
4498 /* change HP and line-out pins */
4499 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4501 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4503 /* mono (speaker) depending on the HP jack sense */
4504 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4505 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4509 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4510 struct snd_ctl_elem_value *ucontrol)
4512 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4513 struct alc_spec *spec = codec->spec;
4514 *ucontrol->value.integer.value = spec->master_sw;
4518 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4519 struct snd_ctl_elem_value *ucontrol)
4521 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4522 struct alc_spec *spec = codec->spec;
4523 int val = !!*ucontrol->value.integer.value;
4524 hda_nid_t hp, line, mono;
4526 if (val == spec->master_sw)
4528 spec->master_sw = val;
4529 hp = (kcontrol->private_value >> 16) & 0xff;
4530 line = (kcontrol->private_value >> 8) & 0xff;
4531 mono = kcontrol->private_value & 0xff;
4532 alc260_hp_master_update(codec, hp, line, mono);
4536 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4538 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4539 .name = "Master Playback Switch",
4540 .info = snd_ctl_boolean_mono_info,
4541 .get = alc260_hp_master_sw_get,
4542 .put = alc260_hp_master_sw_put,
4543 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4545 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4546 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4547 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4548 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4549 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4551 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4555 static struct hda_verb alc260_hp_unsol_verbs[] = {
4556 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4560 static void alc260_hp_automute(struct hda_codec *codec)
4562 struct alc_spec *spec = codec->spec;
4563 unsigned int present;
4565 present = snd_hda_codec_read(codec, 0x10, 0,
4566 AC_VERB_GET_PIN_SENSE, 0);
4567 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4568 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4571 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4573 if ((res >> 26) == ALC880_HP_EVENT)
4574 alc260_hp_automute(codec);
4577 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4579 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4580 .name = "Master Playback Switch",
4581 .info = snd_ctl_boolean_mono_info,
4582 .get = alc260_hp_master_sw_get,
4583 .put = alc260_hp_master_sw_put,
4584 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4586 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4587 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4588 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4589 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4590 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4591 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4592 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4593 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4597 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4598 .ops = &snd_hda_bind_vol,
4600 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4601 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4602 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4607 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4608 .ops = &snd_hda_bind_sw,
4610 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4611 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4616 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4617 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4618 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4619 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4620 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4624 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4625 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4629 static void alc260_hp_3013_automute(struct hda_codec *codec)
4631 struct alc_spec *spec = codec->spec;
4632 unsigned int present;
4634 present = snd_hda_codec_read(codec, 0x15, 0,
4635 AC_VERB_GET_PIN_SENSE, 0);
4636 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4637 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4640 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4643 if ((res >> 26) == ALC880_HP_EVENT)
4644 alc260_hp_3013_automute(codec);
4647 static void alc260_hp_3012_automute(struct hda_codec *codec)
4649 unsigned int present, bits;
4651 present = snd_hda_codec_read(codec, 0x10, 0,
4652 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4654 bits = present ? 0 : PIN_OUT;
4655 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4657 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4659 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4663 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4666 if ((res >> 26) == ALC880_HP_EVENT)
4667 alc260_hp_3012_automute(codec);
4670 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4671 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4673 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4674 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4675 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4676 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4677 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4678 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4679 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4680 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4681 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4682 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4683 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4684 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4685 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4689 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4690 * versions of the ALC260 don't act on requests to enable mic bias from NID
4691 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4692 * datasheet doesn't mention this restriction. At this stage it's not clear
4693 * whether this behaviour is intentional or is a hardware bug in chip
4694 * revisions available in early 2006. Therefore for now allow the
4695 * "Headphone Jack Mode" control to span all choices, but if it turns out
4696 * that the lack of mic bias for this NID is intentional we could change the
4697 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4699 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4700 * don't appear to make the mic bias available from the "line" jack, even
4701 * though the NID used for this jack (0x14) can supply it. The theory is
4702 * that perhaps Acer have included blocking capacitors between the ALC260
4703 * and the output jack. If this turns out to be the case for all such
4704 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4705 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4707 * The C20x Tablet series have a mono internal speaker which is controlled
4708 * via the chip's Mono sum widget and pin complex, so include the necessary
4709 * controls for such models. On models without a "mono speaker" the control
4710 * won't do anything.
4712 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4713 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4714 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4715 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4716 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4718 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4720 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4721 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4723 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4724 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4725 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4726 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4727 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4728 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4729 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4733 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4734 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4736 static struct snd_kcontrol_new alc260_will_mixer[] = {
4737 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4738 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4740 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4741 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4742 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4743 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4744 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4745 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4746 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4747 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4748 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4752 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4753 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4755 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4756 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4757 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4759 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4760 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4761 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4762 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4763 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4764 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4765 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4770 * initialization verbs
4772 static struct hda_verb alc260_init_verbs[] = {
4773 /* Line In pin widget for input */
4774 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4775 /* CD pin widget for input */
4776 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4777 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4778 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4779 /* Mic2 (front panel) pin widget for input and vref at 80% */
4780 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4781 /* LINE-2 is used for line-out in rear */
4782 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4783 /* select line-out */
4784 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4786 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4788 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4790 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4791 /* mute capture amp left and right */
4792 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4793 /* set connection select to line in (default select for this ADC) */
4794 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4795 /* mute capture amp left and right */
4796 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4797 /* set connection select to line in (default select for this ADC) */
4798 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4799 /* set vol=0 Line-Out mixer amp left and right */
4800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4801 /* unmute pin widget amp left and right (no gain on this amp) */
4802 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4803 /* set vol=0 HP mixer amp left and right */
4804 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4805 /* unmute pin widget amp left and right (no gain on this amp) */
4806 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4807 /* set vol=0 Mono mixer amp left and right */
4808 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4809 /* unmute pin widget amp left and right (no gain on this amp) */
4810 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4811 /* unmute LINE-2 out pin */
4812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4813 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4816 /* mute analog inputs */
4817 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4820 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4822 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4823 /* mute Front out path */
4824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4825 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4826 /* mute Headphone out path */
4827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4829 /* mute Mono out path */
4830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4831 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4835 #if 0 /* should be identical with alc260_init_verbs? */
4836 static struct hda_verb alc260_hp_init_verbs[] = {
4837 /* Headphone and output */
4838 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4840 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4841 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4842 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4843 /* Mic2 (front panel) pin widget for input and vref at 80% */
4844 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4845 /* Line In pin widget for input */
4846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4847 /* Line-2 pin widget for output */
4848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4849 /* CD pin widget for input */
4850 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4851 /* unmute amp left and right */
4852 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4853 /* set connection select to line in (default select for this ADC) */
4854 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4855 /* unmute Line-Out mixer amp left and right (volume = 0) */
4856 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4857 /* mute pin widget amp left and right (no gain on this amp) */
4858 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4859 /* unmute HP mixer amp left and right (volume = 0) */
4860 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4861 /* mute pin widget amp left and right (no gain on this amp) */
4862 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4863 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4866 /* mute analog inputs */
4867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4868 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4869 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4870 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4871 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4872 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4873 /* Unmute Front out path */
4874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4875 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4876 /* Unmute Headphone out path */
4877 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4878 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4879 /* Unmute Mono out path */
4880 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4881 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4886 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4887 /* Line out and output */
4888 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4890 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4891 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4892 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4893 /* Mic2 (front panel) pin widget for input and vref at 80% */
4894 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4895 /* Line In pin widget for input */
4896 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4897 /* Headphone pin widget for output */
4898 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4899 /* CD pin widget for input */
4900 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4901 /* unmute amp left and right */
4902 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4903 /* set connection select to line in (default select for this ADC) */
4904 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4905 /* unmute Line-Out mixer amp left and right (volume = 0) */
4906 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4907 /* mute pin widget amp left and right (no gain on this amp) */
4908 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4909 /* unmute HP mixer amp left and right (volume = 0) */
4910 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4911 /* mute pin widget amp left and right (no gain on this amp) */
4912 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4913 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4916 /* mute analog inputs */
4917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4921 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4922 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4923 /* Unmute Front out path */
4924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4925 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4926 /* Unmute Headphone out path */
4927 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4928 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4929 /* Unmute Mono out path */
4930 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4931 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4935 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4936 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4937 * audio = 0x16, internal speaker = 0x10.
4939 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4940 /* Disable all GPIOs */
4941 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4942 /* Internal speaker is connected to headphone pin */
4943 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4944 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4945 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4946 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4947 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4948 /* Ensure all other unused pins are disabled and muted. */
4949 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4950 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4951 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4952 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4953 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4954 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4955 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4956 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4958 /* Disable digital (SPDIF) pins */
4959 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4960 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4962 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4963 * when acting as an output.
4965 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4967 /* Start with output sum widgets muted and their output gains at min */
4968 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4969 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4970 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4971 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4972 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4973 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4974 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4975 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4976 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4978 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4979 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4980 /* Unmute Line1 pin widget output buffer since it starts as an output.
4981 * If the pin mode is changed by the user the pin mode control will
4982 * take care of enabling the pin's input/output buffers as needed.
4983 * Therefore there's no need to enable the input buffer at this
4986 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4987 /* Unmute input buffer of pin widget used for Line-in (no equiv
4990 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4992 /* Mute capture amp left and right */
4993 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4994 /* Set ADC connection select to match default mixer setting - line
4997 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4999 /* Do the same for the second ADC: mute capture input amp and
5000 * set ADC connection to line in (on mic1 pin)
5002 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5003 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5005 /* Mute all inputs to mixer widget (even unconnected ones) */
5006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5008 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5010 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5011 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5012 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5018 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5019 * similar laptops (adapted from Fujitsu init verbs).
5021 static struct hda_verb alc260_acer_init_verbs[] = {
5022 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5023 * the headphone jack. Turn this on and rely on the standard mute
5024 * methods whenever the user wants to turn these outputs off.
5026 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5027 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5028 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5029 /* Internal speaker/Headphone jack is connected to Line-out pin */
5030 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5031 /* Internal microphone/Mic jack is connected to Mic1 pin */
5032 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5033 /* Line In jack is connected to Line1 pin */
5034 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5035 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5036 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5037 /* Ensure all other unused pins are disabled and muted. */
5038 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5039 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5040 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5041 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5042 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5044 /* Disable digital (SPDIF) pins */
5045 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5046 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5048 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5049 * bus when acting as outputs.
5051 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5052 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5054 /* Start with output sum widgets muted and their output gains at min */
5055 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5056 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5057 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5058 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5059 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5060 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5061 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5062 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5063 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5065 /* Unmute Line-out pin widget amp left and right
5066 * (no equiv mixer ctrl)
5068 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5069 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5070 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5071 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5072 * inputs. If the pin mode is changed by the user the pin mode control
5073 * will take care of enabling the pin's input/output buffers as needed.
5074 * Therefore there's no need to enable the input buffer at this
5077 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5078 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5080 /* Mute capture amp left and right */
5081 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5082 /* Set ADC connection select to match default mixer setting - mic
5085 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5087 /* Do similar with the second ADC: mute capture input amp and
5088 * set ADC connection to mic to match ALSA's default state.
5090 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5091 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5093 /* Mute all inputs to mixer widget (even unconnected ones) */
5094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5095 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5100 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5101 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5106 static struct hda_verb alc260_will_verbs[] = {
5107 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5108 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5109 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5110 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5111 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5112 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5116 static struct hda_verb alc260_replacer_672v_verbs[] = {
5117 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5118 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5119 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5121 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5122 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5123 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5125 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5129 /* toggle speaker-output according to the hp-jack state */
5130 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5132 unsigned int present;
5134 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5135 present = snd_hda_codec_read(codec, 0x0f, 0,
5136 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5138 snd_hda_codec_write_cache(codec, 0x01, 0,
5139 AC_VERB_SET_GPIO_DATA, 1);
5140 snd_hda_codec_write_cache(codec, 0x0f, 0,
5141 AC_VERB_SET_PIN_WIDGET_CONTROL,
5144 snd_hda_codec_write_cache(codec, 0x01, 0,
5145 AC_VERB_SET_GPIO_DATA, 0);
5146 snd_hda_codec_write_cache(codec, 0x0f, 0,
5147 AC_VERB_SET_PIN_WIDGET_CONTROL,
5152 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5155 if ((res >> 26) == ALC880_HP_EVENT)
5156 alc260_replacer_672v_automute(codec);
5159 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5160 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5162 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5163 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5164 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5166 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5167 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5168 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5169 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5173 /* Test configuration for debugging, modelled after the ALC880 test
5176 #ifdef CONFIG_SND_DEBUG
5177 static hda_nid_t alc260_test_dac_nids[1] = {
5180 static hda_nid_t alc260_test_adc_nids[2] = {
5183 /* For testing the ALC260, each input MUX needs its own definition since
5184 * the signal assignments are different. This assumes that the first ADC
5187 static struct hda_input_mux alc260_test_capture_sources[2] = {
5191 { "MIC1 pin", 0x0 },
5192 { "MIC2 pin", 0x1 },
5193 { "LINE1 pin", 0x2 },
5194 { "LINE2 pin", 0x3 },
5196 { "LINE-OUT pin", 0x5 },
5197 { "HP-OUT pin", 0x6 },
5203 { "MIC1 pin", 0x0 },
5204 { "MIC2 pin", 0x1 },
5205 { "LINE1 pin", 0x2 },
5206 { "LINE2 pin", 0x3 },
5209 { "LINE-OUT pin", 0x6 },
5210 { "HP-OUT pin", 0x7 },
5214 static struct snd_kcontrol_new alc260_test_mixer[] = {
5215 /* Output driver widgets */
5216 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5217 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5218 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5219 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5220 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5221 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5223 /* Modes for retasking pin widgets
5224 * Note: the ALC260 doesn't seem to act on requests to enable mic
5225 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5226 * mention this restriction. At this stage it's not clear whether
5227 * this behaviour is intentional or is a hardware bug in chip
5228 * revisions available at least up until early 2006. Therefore for
5229 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5230 * choices, but if it turns out that the lack of mic bias for these
5231 * NIDs is intentional we could change their modes from
5232 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5234 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5235 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5236 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5237 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5238 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5239 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5241 /* Loopback mixer controls */
5242 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5243 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5244 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5245 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5246 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5247 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5248 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5249 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5250 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5251 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5252 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5253 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5254 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5255 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5256 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5257 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5259 /* Controls for GPIO pins, assuming they are configured as outputs */
5260 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5261 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5262 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5263 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5265 /* Switches to allow the digital IO pins to be enabled. The datasheet
5266 * is ambigious as to which NID is which; testing on laptops which
5267 * make this output available should provide clarification.
5269 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5270 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5272 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5273 * this output to turn on an external amplifier.
5275 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5276 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5280 static struct hda_verb alc260_test_init_verbs[] = {
5281 /* Enable all GPIOs as outputs with an initial value of 0 */
5282 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5283 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5284 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5286 /* Enable retasking pins as output, initially without power amp */
5287 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5288 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5289 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5290 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5291 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5292 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5294 /* Disable digital (SPDIF) pins initially, but users can enable
5295 * them via a mixer switch. In the case of SPDIF-out, this initverb
5296 * payload also sets the generation to 0, output to be in "consumer"
5297 * PCM format, copyright asserted, no pre-emphasis and no validity
5300 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5301 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5303 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5304 * OUT1 sum bus when acting as an output.
5306 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5307 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5308 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5309 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5311 /* Start with output sum widgets muted and their output gains at min */
5312 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5313 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5314 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5315 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5318 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5319 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5320 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5322 /* Unmute retasking pin widget output buffers since the default
5323 * state appears to be output. As the pin mode is changed by the
5324 * user the pin mode control will take care of enabling the pin's
5325 * input/output buffers as needed.
5327 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5328 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5329 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5330 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5331 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5332 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5333 /* Also unmute the mono-out pin widget */
5334 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5336 /* Mute capture amp left and right */
5337 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5338 /* Set ADC connection select to match default mixer setting (mic1
5341 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5343 /* Do the same for the second ADC: mute capture input amp and
5344 * set ADC connection to mic1 pin
5346 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5347 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5349 /* Mute all inputs to mixer widget (even unconnected ones) */
5350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5352 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5354 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5355 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5363 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5364 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5366 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5367 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5370 * for BIOS auto-configuration
5373 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5374 const char *pfx, int *vol_bits)
5377 unsigned long vol_val, sw_val;
5381 if (nid >= 0x0f && nid < 0x11) {
5382 nid_vol = nid - 0x7;
5383 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5384 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5385 } else if (nid == 0x11) {
5386 nid_vol = nid - 0x7;
5387 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5388 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5389 } else if (nid >= 0x12 && nid <= 0x15) {
5391 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5392 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5396 if (!(*vol_bits & (1 << nid_vol))) {
5397 /* first control for the volume widget */
5398 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5399 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5402 *vol_bits |= (1 << nid_vol);
5404 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5405 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5411 /* add playback controls from the parsed DAC table */
5412 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5413 const struct auto_pin_cfg *cfg)
5419 spec->multiout.num_dacs = 1;
5420 spec->multiout.dac_nids = spec->private_dac_nids;
5421 spec->multiout.dac_nids[0] = 0x02;
5423 nid = cfg->line_out_pins[0];
5425 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5430 nid = cfg->speaker_pins[0];
5432 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5437 nid = cfg->hp_pins[0];
5439 err = alc260_add_playback_controls(spec, nid, "Headphone",
5447 /* create playback/capture controls for input pins */
5448 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5449 const struct auto_pin_cfg *cfg)
5451 struct hda_input_mux *imux = &spec->private_imux;
5454 for (i = 0; i < AUTO_PIN_LAST; i++) {
5455 if (cfg->input_pins[i] >= 0x12) {
5456 idx = cfg->input_pins[i] - 0x12;
5457 err = new_analog_input(spec, cfg->input_pins[i],
5458 auto_pin_cfg_labels[i], idx,
5462 imux->items[imux->num_items].label =
5463 auto_pin_cfg_labels[i];
5464 imux->items[imux->num_items].index = idx;
5467 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5468 idx = cfg->input_pins[i] - 0x09;
5469 err = new_analog_input(spec, cfg->input_pins[i],
5470 auto_pin_cfg_labels[i], idx,
5474 imux->items[imux->num_items].label =
5475 auto_pin_cfg_labels[i];
5476 imux->items[imux->num_items].index = idx;
5483 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5484 hda_nid_t nid, int pin_type,
5487 alc_set_pin_output(codec, nid, pin_type);
5488 /* need the manual connection? */
5490 int idx = nid - 0x12;
5491 snd_hda_codec_write(codec, idx + 0x0b, 0,
5492 AC_VERB_SET_CONNECT_SEL, sel_idx);
5496 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5498 struct alc_spec *spec = codec->spec;
5501 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5502 nid = spec->autocfg.line_out_pins[0];
5504 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5505 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5508 nid = spec->autocfg.speaker_pins[0];
5510 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5512 nid = spec->autocfg.hp_pins[0];
5514 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5517 #define ALC260_PIN_CD_NID 0x16
5518 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5520 struct alc_spec *spec = codec->spec;
5523 for (i = 0; i < AUTO_PIN_LAST; i++) {
5524 hda_nid_t nid = spec->autocfg.input_pins[i];
5526 snd_hda_codec_write(codec, nid, 0,
5527 AC_VERB_SET_PIN_WIDGET_CONTROL,
5528 i <= AUTO_PIN_FRONT_MIC ?
5529 PIN_VREF80 : PIN_IN);
5530 if (nid != ALC260_PIN_CD_NID)
5531 snd_hda_codec_write(codec, nid, 0,
5532 AC_VERB_SET_AMP_GAIN_MUTE,
5539 * generic initialization of ADC, input mixers and output mixers
5541 static struct hda_verb alc260_volume_init_verbs[] = {
5543 * Unmute ADC0-1 and set the default input to mic-in
5545 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5546 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5547 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5548 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5550 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5552 * Note: PASD motherboards uses the Line In 2 as the input for
5553 * front panel mic (mic 2)
5555 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5556 /* mute analog inputs */
5557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5560 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5561 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5564 * Set up output mixers (0x08 - 0x0a)
5566 /* set vol=0 to output mixers */
5567 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5568 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5569 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5570 /* set up input amps for analog loopback */
5571 /* Amp Indices: DAC = 0, mixer = 1 */
5572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5573 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5576 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5582 static int alc260_parse_auto_config(struct hda_codec *codec)
5584 struct alc_spec *spec = codec->spec;
5586 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5588 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5592 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5595 if (!spec->kctls.list)
5596 return 0; /* can't find valid BIOS pin config */
5597 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5601 spec->multiout.max_channels = 2;
5603 if (spec->autocfg.dig_out_pin)
5604 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5605 if (spec->kctls.list)
5606 add_mixer(spec, spec->kctls.list);
5608 add_verb(spec, alc260_volume_init_verbs);
5610 spec->num_mux_defs = 1;
5611 spec->input_mux = &spec->private_imux;
5613 store_pin_configs(codec);
5617 /* additional initialization for auto-configuration model */
5618 static void alc260_auto_init(struct hda_codec *codec)
5620 struct alc_spec *spec = codec->spec;
5621 alc260_auto_init_multi_out(codec);
5622 alc260_auto_init_analog_input(codec);
5623 if (spec->unsol_event)
5624 alc_inithook(codec);
5627 #ifdef CONFIG_SND_HDA_POWER_SAVE
5628 static struct hda_amp_list alc260_loopbacks[] = {
5629 { 0x07, HDA_INPUT, 0 },
5630 { 0x07, HDA_INPUT, 1 },
5631 { 0x07, HDA_INPUT, 2 },
5632 { 0x07, HDA_INPUT, 3 },
5633 { 0x07, HDA_INPUT, 4 },
5639 * ALC260 configurations
5641 static const char *alc260_models[ALC260_MODEL_LAST] = {
5642 [ALC260_BASIC] = "basic",
5644 [ALC260_HP_3013] = "hp-3013",
5645 [ALC260_HP_DC7600] = "hp-dc7600",
5646 [ALC260_FUJITSU_S702X] = "fujitsu",
5647 [ALC260_ACER] = "acer",
5648 [ALC260_WILL] = "will",
5649 [ALC260_REPLACER_672V] = "replacer",
5650 #ifdef CONFIG_SND_DEBUG
5651 [ALC260_TEST] = "test",
5653 [ALC260_AUTO] = "auto",
5656 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5657 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5658 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5659 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5660 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5661 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5662 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5663 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5664 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5665 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5666 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5667 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5668 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5669 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5670 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5671 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5672 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5673 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5674 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5678 static struct alc_config_preset alc260_presets[] = {
5680 .mixers = { alc260_base_output_mixer,
5682 alc260_pc_beep_mixer },
5683 .init_verbs = { alc260_init_verbs },
5684 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5685 .dac_nids = alc260_dac_nids,
5686 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5687 .adc_nids = alc260_adc_nids,
5688 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5689 .channel_mode = alc260_modes,
5690 .input_mux = &alc260_capture_source,
5693 .mixers = { alc260_hp_output_mixer,
5694 alc260_input_mixer },
5695 .init_verbs = { alc260_init_verbs,
5696 alc260_hp_unsol_verbs },
5697 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5698 .dac_nids = alc260_dac_nids,
5699 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5700 .adc_nids = alc260_adc_nids_alt,
5701 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5702 .channel_mode = alc260_modes,
5703 .input_mux = &alc260_capture_source,
5704 .unsol_event = alc260_hp_unsol_event,
5705 .init_hook = alc260_hp_automute,
5707 [ALC260_HP_DC7600] = {
5708 .mixers = { alc260_hp_dc7600_mixer,
5709 alc260_input_mixer },
5710 .init_verbs = { alc260_init_verbs,
5711 alc260_hp_dc7600_verbs },
5712 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5713 .dac_nids = alc260_dac_nids,
5714 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5715 .adc_nids = alc260_adc_nids_alt,
5716 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5717 .channel_mode = alc260_modes,
5718 .input_mux = &alc260_capture_source,
5719 .unsol_event = alc260_hp_3012_unsol_event,
5720 .init_hook = alc260_hp_3012_automute,
5722 [ALC260_HP_3013] = {
5723 .mixers = { alc260_hp_3013_mixer,
5724 alc260_input_mixer },
5725 .init_verbs = { alc260_hp_3013_init_verbs,
5726 alc260_hp_3013_unsol_verbs },
5727 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5728 .dac_nids = alc260_dac_nids,
5729 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5730 .adc_nids = alc260_adc_nids_alt,
5731 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5732 .channel_mode = alc260_modes,
5733 .input_mux = &alc260_capture_source,
5734 .unsol_event = alc260_hp_3013_unsol_event,
5735 .init_hook = alc260_hp_3013_automute,
5737 [ALC260_FUJITSU_S702X] = {
5738 .mixers = { alc260_fujitsu_mixer },
5739 .init_verbs = { alc260_fujitsu_init_verbs },
5740 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5741 .dac_nids = alc260_dac_nids,
5742 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5743 .adc_nids = alc260_dual_adc_nids,
5744 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5745 .channel_mode = alc260_modes,
5746 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5747 .input_mux = alc260_fujitsu_capture_sources,
5750 .mixers = { alc260_acer_mixer },
5751 .init_verbs = { alc260_acer_init_verbs },
5752 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5753 .dac_nids = alc260_dac_nids,
5754 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5755 .adc_nids = alc260_dual_adc_nids,
5756 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5757 .channel_mode = alc260_modes,
5758 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5759 .input_mux = alc260_acer_capture_sources,
5762 .mixers = { alc260_will_mixer },
5763 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5764 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5765 .dac_nids = alc260_dac_nids,
5766 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5767 .adc_nids = alc260_adc_nids,
5768 .dig_out_nid = ALC260_DIGOUT_NID,
5769 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5770 .channel_mode = alc260_modes,
5771 .input_mux = &alc260_capture_source,
5773 [ALC260_REPLACER_672V] = {
5774 .mixers = { alc260_replacer_672v_mixer },
5775 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5776 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5777 .dac_nids = alc260_dac_nids,
5778 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5779 .adc_nids = alc260_adc_nids,
5780 .dig_out_nid = ALC260_DIGOUT_NID,
5781 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5782 .channel_mode = alc260_modes,
5783 .input_mux = &alc260_capture_source,
5784 .unsol_event = alc260_replacer_672v_unsol_event,
5785 .init_hook = alc260_replacer_672v_automute,
5787 #ifdef CONFIG_SND_DEBUG
5789 .mixers = { alc260_test_mixer },
5790 .init_verbs = { alc260_test_init_verbs },
5791 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5792 .dac_nids = alc260_test_dac_nids,
5793 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5794 .adc_nids = alc260_test_adc_nids,
5795 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5796 .channel_mode = alc260_modes,
5797 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5798 .input_mux = alc260_test_capture_sources,
5803 static int patch_alc260(struct hda_codec *codec)
5805 struct alc_spec *spec;
5806 int err, board_config;
5808 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5814 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5817 if (board_config < 0) {
5818 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5819 "trying auto-probe from BIOS...\n");
5820 board_config = ALC260_AUTO;
5823 if (board_config == ALC260_AUTO) {
5824 /* automatic parse from the BIOS config */
5825 err = alc260_parse_auto_config(codec);
5831 "hda_codec: Cannot set up configuration "
5832 "from BIOS. Using base mode...\n");
5833 board_config = ALC260_BASIC;
5837 if (board_config != ALC260_AUTO)
5838 setup_preset(spec, &alc260_presets[board_config]);
5840 spec->stream_name_analog = "ALC260 Analog";
5841 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5842 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5844 spec->stream_name_digital = "ALC260 Digital";
5845 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5846 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5848 if (!spec->adc_nids && spec->input_mux) {
5849 /* check whether NID 0x04 is valid */
5850 unsigned int wcap = get_wcaps(codec, 0x04);
5851 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5853 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5854 spec->adc_nids = alc260_adc_nids_alt;
5855 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5857 spec->adc_nids = alc260_adc_nids;
5858 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5861 set_capture_mixer(spec);
5863 spec->vmaster_nid = 0x08;
5865 codec->patch_ops = alc_patch_ops;
5866 if (board_config == ALC260_AUTO)
5867 spec->init_hook = alc260_auto_init;
5868 #ifdef CONFIG_SND_HDA_POWER_SAVE
5869 if (!spec->loopback.amplist)
5870 spec->loopback.amplist = alc260_loopbacks;
5880 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5881 * configuration. Each pin widget can choose any input DACs and a mixer.
5882 * Each ADC is connected from a mixer of all inputs. This makes possible
5883 * 6-channel independent captures.
5885 * In addition, an independent DAC for the multi-playback (not used in this
5888 #define ALC882_DIGOUT_NID 0x06
5889 #define ALC882_DIGIN_NID 0x0a
5891 static struct hda_channel_mode alc882_ch_modes[1] = {
5895 static hda_nid_t alc882_dac_nids[4] = {
5896 /* front, rear, clfe, rear_surr */
5897 0x02, 0x03, 0x04, 0x05
5900 /* identical with ALC880 */
5901 #define alc882_adc_nids alc880_adc_nids
5902 #define alc882_adc_nids_alt alc880_adc_nids_alt
5904 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5905 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5908 /* FIXME: should be a matrix-type input source selection */
5910 static struct hda_input_mux alc882_capture_source = {
5914 { "Front Mic", 0x1 },
5922 static struct hda_verb alc882_3ST_ch2_init[] = {
5923 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5924 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5925 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5926 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5933 static struct hda_verb alc882_3ST_ch6_init[] = {
5934 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5935 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5936 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5937 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5938 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5939 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5943 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5944 { 2, alc882_3ST_ch2_init },
5945 { 6, alc882_3ST_ch6_init },
5951 static struct hda_verb alc882_sixstack_ch6_init[] = {
5952 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5953 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5954 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5955 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5962 static struct hda_verb alc882_sixstack_ch8_init[] = {
5963 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5964 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5965 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5966 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5970 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5971 { 6, alc882_sixstack_ch6_init },
5972 { 8, alc882_sixstack_ch8_init },
5976 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5982 static struct hda_verb alc885_mbp_ch2_init[] = {
5983 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5984 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5985 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5992 static struct hda_verb alc885_mbp_ch6_init[] = {
5993 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5994 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5995 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5996 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5997 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6001 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6002 { 2, alc885_mbp_ch2_init },
6003 { 6, alc885_mbp_ch6_init },
6007 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6008 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6010 static struct snd_kcontrol_new alc882_base_mixer[] = {
6011 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6012 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6013 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6014 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6015 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6016 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6017 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6018 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6019 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6020 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6022 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6023 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6029 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6030 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6032 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6033 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6037 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6038 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6039 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6040 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6041 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6042 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6043 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6044 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6045 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6046 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6047 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6050 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6051 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6052 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6053 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6054 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6055 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6056 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6058 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6060 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6061 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6065 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6066 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6067 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6068 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6069 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6070 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6071 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6072 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6073 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6075 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6076 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6077 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6078 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6082 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6083 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6085 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6087 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6088 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6089 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6092 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6093 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6094 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6095 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6102 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6103 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6104 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6105 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6111 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6113 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6114 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6118 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6121 .name = "Channel Mode",
6122 .info = alc_ch_mode_info,
6123 .get = alc_ch_mode_get,
6124 .put = alc_ch_mode_put,
6129 static struct hda_verb alc882_init_verbs[] = {
6130 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6132 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6133 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6141 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6143 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6144 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6145 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6147 /* Front Pin: output 0 (0x0c) */
6148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6150 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6151 /* Rear Pin: output 1 (0x0d) */
6152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6153 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6154 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6155 /* CLFE Pin: output 2 (0x0e) */
6156 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6157 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6158 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6159 /* Side Pin: output 3 (0x0f) */
6160 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6161 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6162 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6163 /* Mic (rear) pin: input vref at 80% */
6164 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6165 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6166 /* Front Mic pin: input vref at 80% */
6167 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6168 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6169 /* Line In pin: input */
6170 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6171 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6172 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6173 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6174 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6175 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6176 /* CD pin widget for input */
6177 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6179 /* FIXME: use matrix-type input source selection */
6180 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6181 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6188 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6196 /* ADC1: mute amp left and right */
6197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6198 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6199 /* ADC2: mute amp left and right */
6200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6201 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6202 /* ADC3: mute amp left and right */
6203 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6204 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6209 static struct hda_verb alc882_eapd_verbs[] = {
6210 /* change to EAPD mode */
6211 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6212 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6217 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6218 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6219 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6223 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6224 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6228 static struct hda_verb alc882_macpro_init_verbs[] = {
6229 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6231 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6232 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6233 /* Front Pin: output 0 (0x0c) */
6234 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6235 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6236 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6237 /* Front Mic pin: input vref at 80% */
6238 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6239 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6240 /* Speaker: output */
6241 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6242 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6243 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6244 /* Headphone output (output 0 - 0x0c) */
6245 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6246 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6247 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6249 /* FIXME: use matrix-type input source selection */
6250 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6251 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6252 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6253 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6255 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6257 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6266 /* ADC1: mute amp left and right */
6267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6268 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6269 /* ADC2: mute amp left and right */
6270 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6271 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6272 /* ADC3: mute amp left and right */
6273 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6274 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6279 /* Macbook Pro rev3 */
6280 static struct hda_verb alc885_mbp3_init_verbs[] = {
6281 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6286 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6288 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6289 /* Front Pin: output 0 (0x0c) */
6290 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6291 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6292 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6293 /* HP Pin: output 0 (0x0d) */
6294 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6295 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6296 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6297 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6298 /* Mic (rear) pin: input vref at 80% */
6299 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6300 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6301 /* Front Mic pin: input vref at 80% */
6302 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6303 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6304 /* Line In pin: use output 1 when in LineOut mode */
6305 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6307 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6309 /* FIXME: use matrix-type input source selection */
6310 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6311 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6320 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6325 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6326 /* ADC1: mute amp left and right */
6327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6328 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6329 /* ADC2: mute amp left and right */
6330 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6331 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6332 /* ADC3: mute amp left and right */
6333 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6334 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6339 /* iMac 24 mixer. */
6340 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6341 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6342 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6346 /* iMac 24 init verbs. */
6347 static struct hda_verb alc885_imac24_init_verbs[] = {
6348 /* Internal speakers: output 0 (0x0c) */
6349 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6351 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6352 /* Internal speakers: output 0 (0x0c) */
6353 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6354 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6355 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6356 /* Headphone: output 0 (0x0c) */
6357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6358 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6359 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6360 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6361 /* Front Mic: input vref at 80% */
6362 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6363 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6367 /* Toggle speaker-output according to the hp-jack state */
6368 static void alc885_imac24_automute(struct hda_codec *codec)
6370 unsigned int present;
6372 present = snd_hda_codec_read(codec, 0x14, 0,
6373 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6374 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6375 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6376 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6377 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6380 /* Processes unsolicited events. */
6381 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6384 /* Headphone insertion or removal. */
6385 if ((res >> 26) == ALC880_HP_EVENT)
6386 alc885_imac24_automute(codec);
6389 static void alc885_mbp3_automute(struct hda_codec *codec)
6391 unsigned int present;
6393 present = snd_hda_codec_read(codec, 0x15, 0,
6394 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6395 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6396 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6397 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6398 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6401 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6404 /* Headphone insertion or removal. */
6405 if ((res >> 26) == ALC880_HP_EVENT)
6406 alc885_mbp3_automute(codec);
6410 static struct hda_verb alc882_targa_verbs[] = {
6411 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6412 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6415 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6417 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6418 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6419 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6421 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6422 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6423 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6424 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6428 /* toggle speaker-output according to the hp-jack state */
6429 static void alc882_targa_automute(struct hda_codec *codec)
6431 unsigned int present;
6433 present = snd_hda_codec_read(codec, 0x14, 0,
6434 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6435 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6436 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6437 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6441 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6443 /* Looks like the unsol event is incompatible with the standard
6444 * definition. 4bit tag is placed at 26 bit!
6446 if (((res >> 26) == ALC880_HP_EVENT)) {
6447 alc882_targa_automute(codec);
6451 static struct hda_verb alc882_asus_a7j_verbs[] = {
6452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6456 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6457 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6459 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6461 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6463 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6464 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6465 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6469 static struct hda_verb alc882_asus_a7m_verbs[] = {
6470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6473 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6475 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6477 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6478 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6479 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6481 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6482 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6483 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6487 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6489 unsigned int gpiostate, gpiomask, gpiodir;
6491 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6492 AC_VERB_GET_GPIO_DATA, 0);
6495 gpiostate |= (1 << pin);
6497 gpiostate &= ~(1 << pin);
6499 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6500 AC_VERB_GET_GPIO_MASK, 0);
6501 gpiomask |= (1 << pin);
6503 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6504 AC_VERB_GET_GPIO_DIRECTION, 0);
6505 gpiodir |= (1 << pin);
6508 snd_hda_codec_write(codec, codec->afg, 0,
6509 AC_VERB_SET_GPIO_MASK, gpiomask);
6510 snd_hda_codec_write(codec, codec->afg, 0,
6511 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6515 snd_hda_codec_write(codec, codec->afg, 0,
6516 AC_VERB_SET_GPIO_DATA, gpiostate);
6519 /* set up GPIO at initialization */
6520 static void alc885_macpro_init_hook(struct hda_codec *codec)
6522 alc882_gpio_mute(codec, 0, 0);
6523 alc882_gpio_mute(codec, 1, 0);
6526 /* set up GPIO and update auto-muting at initialization */
6527 static void alc885_imac24_init_hook(struct hda_codec *codec)
6529 alc885_macpro_init_hook(codec);
6530 alc885_imac24_automute(codec);
6534 * generic initialization of ADC, input mixers and output mixers
6536 static struct hda_verb alc882_auto_init_verbs[] = {
6538 * Unmute ADC0-2 and set the default input to mic-in
6540 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6541 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6542 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6543 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6544 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6545 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6547 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6549 * Note: PASD motherboards uses the Line In 2 as the input for
6550 * front panel mic (mic 2)
6552 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6555 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6556 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6557 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6560 * Set up output mixers (0x0c - 0x0f)
6562 /* set vol=0 to output mixers */
6563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6566 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6567 /* set up input amps for analog loopback */
6568 /* Amp Indices: DAC = 0, mixer = 1 */
6569 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6571 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6573 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6574 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6575 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6576 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6577 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6578 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6580 /* FIXME: use matrix-type input source selection */
6581 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6582 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6583 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6584 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6585 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6586 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6588 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6591 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6601 #ifdef CONFIG_SND_HDA_POWER_SAVE
6602 #define alc882_loopbacks alc880_loopbacks
6605 /* pcm configuration: identiacal with ALC880 */
6606 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6607 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6608 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6609 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6612 * configuration and preset
6614 static const char *alc882_models[ALC882_MODEL_LAST] = {
6615 [ALC882_3ST_DIG] = "3stack-dig",
6616 [ALC882_6ST_DIG] = "6stack-dig",
6617 [ALC882_ARIMA] = "arima",
6618 [ALC882_W2JC] = "w2jc",
6619 [ALC882_TARGA] = "targa",
6620 [ALC882_ASUS_A7J] = "asus-a7j",
6621 [ALC882_ASUS_A7M] = "asus-a7m",
6622 [ALC885_MACPRO] = "macpro",
6623 [ALC885_MBP3] = "mbp3",
6624 [ALC885_IMAC24] = "imac24",
6625 [ALC882_AUTO] = "auto",
6628 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6629 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6630 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6631 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6632 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6633 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6634 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6635 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6636 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6637 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6638 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6639 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6640 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6644 static struct alc_config_preset alc882_presets[] = {
6645 [ALC882_3ST_DIG] = {
6646 .mixers = { alc882_base_mixer },
6647 .init_verbs = { alc882_init_verbs },
6648 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6649 .dac_nids = alc882_dac_nids,
6650 .dig_out_nid = ALC882_DIGOUT_NID,
6651 .dig_in_nid = ALC882_DIGIN_NID,
6652 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6653 .channel_mode = alc882_ch_modes,
6655 .input_mux = &alc882_capture_source,
6657 [ALC882_6ST_DIG] = {
6658 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6659 .init_verbs = { alc882_init_verbs },
6660 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6661 .dac_nids = alc882_dac_nids,
6662 .dig_out_nid = ALC882_DIGOUT_NID,
6663 .dig_in_nid = ALC882_DIGIN_NID,
6664 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6665 .channel_mode = alc882_sixstack_modes,
6666 .input_mux = &alc882_capture_source,
6669 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6670 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6671 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6672 .dac_nids = alc882_dac_nids,
6673 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6674 .channel_mode = alc882_sixstack_modes,
6675 .input_mux = &alc882_capture_source,
6678 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6679 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6680 alc880_gpio1_init_verbs },
6681 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6682 .dac_nids = alc882_dac_nids,
6683 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6684 .channel_mode = alc880_threestack_modes,
6686 .input_mux = &alc882_capture_source,
6687 .dig_out_nid = ALC882_DIGOUT_NID,
6690 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6691 .init_verbs = { alc885_mbp3_init_verbs,
6692 alc880_gpio1_init_verbs },
6693 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6694 .dac_nids = alc882_dac_nids,
6695 .channel_mode = alc885_mbp_6ch_modes,
6696 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6697 .input_mux = &alc882_capture_source,
6698 .dig_out_nid = ALC882_DIGOUT_NID,
6699 .dig_in_nid = ALC882_DIGIN_NID,
6700 .unsol_event = alc885_mbp3_unsol_event,
6701 .init_hook = alc885_mbp3_automute,
6704 .mixers = { alc882_macpro_mixer },
6705 .init_verbs = { alc882_macpro_init_verbs },
6706 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6707 .dac_nids = alc882_dac_nids,
6708 .dig_out_nid = ALC882_DIGOUT_NID,
6709 .dig_in_nid = ALC882_DIGIN_NID,
6710 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6711 .channel_mode = alc882_ch_modes,
6712 .input_mux = &alc882_capture_source,
6713 .init_hook = alc885_macpro_init_hook,
6716 .mixers = { alc885_imac24_mixer },
6717 .init_verbs = { alc885_imac24_init_verbs },
6718 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6719 .dac_nids = alc882_dac_nids,
6720 .dig_out_nid = ALC882_DIGOUT_NID,
6721 .dig_in_nid = ALC882_DIGIN_NID,
6722 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6723 .channel_mode = alc882_ch_modes,
6724 .input_mux = &alc882_capture_source,
6725 .unsol_event = alc885_imac24_unsol_event,
6726 .init_hook = alc885_imac24_init_hook,
6729 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6730 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6731 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6732 .dac_nids = alc882_dac_nids,
6733 .dig_out_nid = ALC882_DIGOUT_NID,
6734 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6735 .adc_nids = alc882_adc_nids,
6736 .capsrc_nids = alc882_capsrc_nids,
6737 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6738 .channel_mode = alc882_3ST_6ch_modes,
6740 .input_mux = &alc882_capture_source,
6741 .unsol_event = alc882_targa_unsol_event,
6742 .init_hook = alc882_targa_automute,
6744 [ALC882_ASUS_A7J] = {
6745 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6746 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6747 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6748 .dac_nids = alc882_dac_nids,
6749 .dig_out_nid = ALC882_DIGOUT_NID,
6750 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6751 .adc_nids = alc882_adc_nids,
6752 .capsrc_nids = alc882_capsrc_nids,
6753 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6754 .channel_mode = alc882_3ST_6ch_modes,
6756 .input_mux = &alc882_capture_source,
6758 [ALC882_ASUS_A7M] = {
6759 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6760 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6761 alc880_gpio1_init_verbs,
6762 alc882_asus_a7m_verbs },
6763 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6764 .dac_nids = alc882_dac_nids,
6765 .dig_out_nid = ALC882_DIGOUT_NID,
6766 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6767 .channel_mode = alc880_threestack_modes,
6769 .input_mux = &alc882_capture_source,
6778 PINFIX_ABIT_AW9D_MAX
6781 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6782 { 0x15, 0x01080104 }, /* side */
6783 { 0x16, 0x01011012 }, /* rear */
6784 { 0x17, 0x01016011 }, /* clfe */
6788 static const struct alc_pincfg *alc882_pin_fixes[] = {
6789 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6792 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6793 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6798 * BIOS auto configuration
6800 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6801 hda_nid_t nid, int pin_type,
6805 struct alc_spec *spec = codec->spec;
6808 alc_set_pin_output(codec, nid, pin_type);
6809 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6812 idx = spec->multiout.dac_nids[dac_idx] - 2;
6813 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6817 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6819 struct alc_spec *spec = codec->spec;
6822 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6823 for (i = 0; i <= HDA_SIDE; i++) {
6824 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6825 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6827 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6832 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6834 struct alc_spec *spec = codec->spec;
6837 pin = spec->autocfg.hp_pins[0];
6838 if (pin) /* connect to front */
6840 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6841 pin = spec->autocfg.speaker_pins[0];
6843 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6846 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6847 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6849 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6851 struct alc_spec *spec = codec->spec;
6854 for (i = 0; i < AUTO_PIN_LAST; i++) {
6855 hda_nid_t nid = spec->autocfg.input_pins[i];
6860 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6861 unsigned int pincap;
6862 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6863 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6867 snd_hda_codec_write(codec, nid, 0,
6868 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6869 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6870 snd_hda_codec_write(codec, nid, 0,
6871 AC_VERB_SET_AMP_GAIN_MUTE,
6876 static void alc882_auto_init_input_src(struct hda_codec *codec)
6878 struct alc_spec *spec = codec->spec;
6879 const struct hda_input_mux *imux = spec->input_mux;
6882 for (c = 0; c < spec->num_adc_nids; c++) {
6883 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6884 hda_nid_t nid = spec->capsrc_nids[c];
6885 int conns, mute, idx, item;
6887 conns = snd_hda_get_connections(codec, nid, conn_list,
6888 ARRAY_SIZE(conn_list));
6891 for (idx = 0; idx < conns; idx++) {
6892 /* if the current connection is the selected one,
6893 * unmute it as default - otherwise mute it
6895 mute = AMP_IN_MUTE(idx);
6896 for (item = 0; item < imux->num_items; item++) {
6897 if (imux->items[item].index == idx) {
6898 if (spec->cur_mux[c] == item)
6899 mute = AMP_IN_UNMUTE(idx);
6903 snd_hda_codec_write(codec, nid, 0,
6904 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6909 /* add mic boosts if needed */
6910 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6912 struct alc_spec *spec = codec->spec;
6916 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6917 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6918 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6920 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6924 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6925 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6926 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6928 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6935 /* almost identical with ALC880 parser... */
6936 static int alc882_parse_auto_config(struct hda_codec *codec)
6938 struct alc_spec *spec = codec->spec;
6939 int err = alc880_parse_auto_config(codec);
6944 return 0; /* no config found */
6946 err = alc_auto_add_mic_boost(codec);
6950 /* hack - override the init verbs */
6951 spec->init_verbs[0] = alc882_auto_init_verbs;
6953 return 1; /* config found */
6956 /* additional initialization for auto-configuration model */
6957 static void alc882_auto_init(struct hda_codec *codec)
6959 struct alc_spec *spec = codec->spec;
6960 alc882_auto_init_multi_out(codec);
6961 alc882_auto_init_hp_out(codec);
6962 alc882_auto_init_analog_input(codec);
6963 alc882_auto_init_input_src(codec);
6964 if (spec->unsol_event)
6965 alc_inithook(codec);
6968 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6970 static int patch_alc882(struct hda_codec *codec)
6972 struct alc_spec *spec;
6973 int err, board_config;
6975 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6981 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6985 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6986 /* Pick up systems that don't supply PCI SSID */
6987 switch (codec->subsystem_id) {
6988 case 0x106b0c00: /* Mac Pro */
6989 board_config = ALC885_MACPRO;
6991 case 0x106b1000: /* iMac 24 */
6992 case 0x106b2800: /* AppleTV */
6993 board_config = ALC885_IMAC24;
6995 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6996 case 0x106b00a4: /* MacbookPro4,1 */
6997 case 0x106b2c00: /* Macbook Pro rev3 */
6998 case 0x106b3600: /* Macbook 3.1 */
6999 board_config = ALC885_MBP3;
7002 /* ALC889A is handled better as ALC888-compatible */
7003 if (codec->revision_id == 0x100101 ||
7004 codec->revision_id == 0x100103) {
7006 return patch_alc883(codec);
7008 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7009 "trying auto-probe from BIOS...\n");
7010 board_config = ALC882_AUTO;
7014 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7016 if (board_config == ALC882_AUTO) {
7017 /* automatic parse from the BIOS config */
7018 err = alc882_parse_auto_config(codec);
7024 "hda_codec: Cannot set up configuration "
7025 "from BIOS. Using base mode...\n");
7026 board_config = ALC882_3ST_DIG;
7030 if (board_config != ALC882_AUTO)
7031 setup_preset(spec, &alc882_presets[board_config]);
7033 if (codec->vendor_id == 0x10ec0885) {
7034 spec->stream_name_analog = "ALC885 Analog";
7035 spec->stream_name_digital = "ALC885 Digital";
7037 spec->stream_name_analog = "ALC882 Analog";
7038 spec->stream_name_digital = "ALC882 Digital";
7041 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7042 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7043 /* FIXME: setup DAC5 */
7044 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7045 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7047 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7048 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7050 spec->is_mix_capture = 1; /* matrix-style capture */
7051 if (!spec->adc_nids && spec->input_mux) {
7052 /* check whether NID 0x07 is valid */
7053 unsigned int wcap = get_wcaps(codec, 0x07);
7055 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7056 if (wcap != AC_WID_AUD_IN) {
7057 spec->adc_nids = alc882_adc_nids_alt;
7058 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7059 spec->capsrc_nids = alc882_capsrc_nids_alt;
7061 spec->adc_nids = alc882_adc_nids;
7062 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7063 spec->capsrc_nids = alc882_capsrc_nids;
7066 set_capture_mixer(spec);
7068 spec->vmaster_nid = 0x0c;
7070 codec->patch_ops = alc_patch_ops;
7071 if (board_config == ALC882_AUTO)
7072 spec->init_hook = alc882_auto_init;
7073 #ifdef CONFIG_SND_HDA_POWER_SAVE
7074 if (!spec->loopback.amplist)
7075 spec->loopback.amplist = alc882_loopbacks;
7084 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7085 * configuration. Each pin widget can choose any input DACs and a mixer.
7086 * Each ADC is connected from a mixer of all inputs. This makes possible
7087 * 6-channel independent captures.
7089 * In addition, an independent DAC for the multi-playback (not used in this
7092 #define ALC883_DIGOUT_NID 0x06
7093 #define ALC883_DIGIN_NID 0x0a
7095 #define ALC1200_DIGOUT_NID 0x10
7097 static hda_nid_t alc883_dac_nids[4] = {
7098 /* front, rear, clfe, rear_surr */
7099 0x02, 0x03, 0x04, 0x05
7102 static hda_nid_t alc883_adc_nids[2] = {
7107 static hda_nid_t alc883_adc_nids_alt[1] = {
7112 static hda_nid_t alc883_adc_nids_rev[2] = {
7117 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7119 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7122 /* FIXME: should be a matrix-type input source selection */
7124 static struct hda_input_mux alc883_capture_source = {
7128 { "Front Mic", 0x1 },
7134 static struct hda_input_mux alc883_3stack_6ch_intel = {
7138 { "Front Mic", 0x0 },
7144 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7152 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7162 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7170 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7174 { "Front Mic", 0x1 },
7179 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7190 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7197 static struct hda_verb alc883_3ST_ch2_init[] = {
7198 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7199 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7200 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7201 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7208 static struct hda_verb alc883_3ST_ch4_init[] = {
7209 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7210 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7211 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7212 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7213 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7220 static struct hda_verb alc883_3ST_ch6_init[] = {
7221 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7222 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7223 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7224 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7225 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7226 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7230 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7231 { 2, alc883_3ST_ch2_init },
7232 { 4, alc883_3ST_ch4_init },
7233 { 6, alc883_3ST_ch6_init },
7239 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7240 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7241 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7242 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7243 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7250 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7251 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7252 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7253 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7254 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7255 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7262 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7263 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7264 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7265 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7266 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7267 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7268 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7272 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7273 { 2, alc883_3ST_ch2_intel_init },
7274 { 4, alc883_3ST_ch4_intel_init },
7275 { 6, alc883_3ST_ch6_intel_init },
7281 static struct hda_verb alc883_sixstack_ch6_init[] = {
7282 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7283 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7284 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7285 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7292 static struct hda_verb alc883_sixstack_ch8_init[] = {
7293 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7294 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7295 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7296 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7300 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7301 { 6, alc883_sixstack_ch6_init },
7302 { 8, alc883_sixstack_ch8_init },
7305 static struct hda_verb alc883_medion_eapd_verbs[] = {
7306 /* eanable EAPD on medion laptop */
7307 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7308 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7312 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7313 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7316 static struct snd_kcontrol_new alc883_base_mixer[] = {
7317 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7318 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7319 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7320 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7321 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7322 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7323 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7324 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7325 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7326 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7327 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7328 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7329 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7330 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7331 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7333 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7334 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7335 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7336 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7337 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7338 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7339 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7343 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7344 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7345 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7346 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7347 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7348 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7349 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7352 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7355 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7356 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7360 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7361 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7362 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7363 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7364 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7366 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7367 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7368 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7369 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7370 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7374 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7375 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7376 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7377 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7378 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7379 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7380 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7382 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7383 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7384 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7388 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7389 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7390 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7391 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7392 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7393 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7394 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7395 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7397 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7399 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7400 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7401 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7402 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7403 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7407 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7408 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7409 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7410 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7411 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7412 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7413 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7414 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7415 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7416 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7419 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7420 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7425 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7426 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7427 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7428 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7432 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7433 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7434 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7435 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7436 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7437 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7439 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7440 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7441 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7442 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7443 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7444 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7450 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7452 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7453 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7454 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7458 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7459 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7460 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7461 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7462 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7463 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7464 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7465 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7466 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7467 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7468 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7469 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7471 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7473 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7475 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7477 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7478 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7479 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7483 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7484 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7485 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7486 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7487 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7488 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7489 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7490 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7491 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7492 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7493 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7494 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7496 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7498 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7499 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7503 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7504 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7506 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7507 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7508 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7510 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7511 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7512 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7513 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7514 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7518 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7519 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7520 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7521 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7522 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7523 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7525 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7526 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7530 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7531 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7532 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7533 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7534 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7535 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7538 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7539 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7543 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7544 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7545 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7546 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7547 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7548 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7549 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7550 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7551 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7552 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7556 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7557 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7558 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7560 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7561 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7563 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7568 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7569 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7570 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7571 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7572 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7573 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7574 0x0d, 1, 0x0, HDA_OUTPUT),
7575 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7576 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7577 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7579 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7580 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7581 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7582 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7583 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7584 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7585 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7590 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7591 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7595 static struct hda_bind_ctls alc883_bind_cap_vol = {
7596 .ops = &snd_hda_bind_vol,
7598 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7599 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7604 static struct hda_bind_ctls alc883_bind_cap_switch = {
7605 .ops = &snd_hda_bind_sw,
7607 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7608 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7613 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7614 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7615 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7617 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7618 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7620 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7621 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7625 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7626 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7627 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7629 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7630 /* .name = "Capture Source", */
7631 .name = "Input Source",
7633 .info = alc_mux_enum_info,
7634 .get = alc_mux_enum_get,
7635 .put = alc_mux_enum_put,
7640 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7643 .name = "Channel Mode",
7644 .info = alc_ch_mode_info,
7645 .get = alc_ch_mode_get,
7646 .put = alc_ch_mode_put,
7651 static struct hda_verb alc883_init_verbs[] = {
7652 /* ADC1: mute amp left and right */
7653 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7654 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7655 /* ADC2: mute amp left and right */
7656 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7657 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7658 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7663 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7667 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7668 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7671 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7672 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7675 /* mute analog input loopbacks */
7676 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7677 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7678 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7679 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7680 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7682 /* Front Pin: output 0 (0x0c) */
7683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7684 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7685 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7686 /* Rear Pin: output 1 (0x0d) */
7687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7689 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7690 /* CLFE Pin: output 2 (0x0e) */
7691 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7692 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7693 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7694 /* Side Pin: output 3 (0x0f) */
7695 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7696 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7697 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7698 /* Mic (rear) pin: input vref at 80% */
7699 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7701 /* Front Mic pin: input vref at 80% */
7702 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7703 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7704 /* Line In pin: input */
7705 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7706 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7707 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7708 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7709 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7710 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7711 /* CD pin widget for input */
7712 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7714 /* FIXME: use matrix-type input source selection */
7715 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7717 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7718 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7719 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7720 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7722 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7723 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7724 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7725 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7729 /* toggle speaker-output according to the hp-jack state */
7730 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7732 unsigned int present;
7734 present = snd_hda_codec_read(codec, 0x15, 0,
7735 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7736 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7737 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7738 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7739 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7742 /* auto-toggle front mic */
7744 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7746 unsigned int present;
7749 present = snd_hda_codec_read(codec, 0x18, 0,
7750 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7751 bits = present ? HDA_AMP_MUTE : 0;
7752 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7756 static void alc883_mitac_automute(struct hda_codec *codec)
7758 alc883_mitac_hp_automute(codec);
7759 /* alc883_mitac_mic_automute(codec); */
7762 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7765 switch (res >> 26) {
7766 case ALC880_HP_EVENT:
7767 alc883_mitac_hp_automute(codec);
7769 case ALC880_MIC_EVENT:
7770 /* alc883_mitac_mic_automute(codec); */
7775 static struct hda_verb alc883_mitac_verbs[] = {
7777 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7780 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7781 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7783 /* enable unsolicited event */
7784 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7785 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7790 static struct hda_verb alc883_clevo_m720_verbs[] = {
7792 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7793 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7795 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7798 /* enable unsolicited event */
7799 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7800 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7805 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7807 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7810 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7811 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7813 /* enable unsolicited event */
7814 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7819 static struct hda_verb alc883_tagra_verbs[] = {
7820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7826 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7827 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7828 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7830 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7831 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7832 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7833 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7838 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7839 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7840 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7841 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7845 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7846 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7848 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7853 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7856 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7857 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7858 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7862 static struct hda_verb alc883_haier_w66_verbs[] = {
7863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7864 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7866 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7868 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7869 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7870 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7871 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7875 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7877 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7880 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7881 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7882 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7883 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7887 static struct hda_verb alc888_3st_hp_verbs[] = {
7888 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7889 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7890 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7894 static struct hda_verb alc888_6st_dell_verbs[] = {
7895 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7899 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7900 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7901 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7902 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7903 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7907 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7908 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7909 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7910 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7911 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7915 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7916 { 2, alc888_3st_hp_2ch_init },
7917 { 6, alc888_3st_hp_6ch_init },
7920 /* toggle front-jack and RCA according to the hp-jack state */
7921 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7923 unsigned int present;
7925 present = snd_hda_codec_read(codec, 0x1b, 0,
7926 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7927 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7928 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7929 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7930 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7933 /* toggle RCA according to the front-jack state */
7934 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7936 unsigned int present;
7938 present = snd_hda_codec_read(codec, 0x14, 0,
7939 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7940 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7941 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7944 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7947 if ((res >> 26) == ALC880_HP_EVENT)
7948 alc888_lenovo_ms7195_front_automute(codec);
7949 if ((res >> 26) == ALC880_FRONT_EVENT)
7950 alc888_lenovo_ms7195_rca_automute(codec);
7953 static struct hda_verb alc883_medion_md2_verbs[] = {
7954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7957 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7959 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7963 /* toggle speaker-output according to the hp-jack state */
7964 static void alc883_medion_md2_automute(struct hda_codec *codec)
7966 unsigned int present;
7968 present = snd_hda_codec_read(codec, 0x14, 0,
7969 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7970 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7971 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7974 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7977 if ((res >> 26) == ALC880_HP_EVENT)
7978 alc883_medion_md2_automute(codec);
7981 /* toggle speaker-output according to the hp-jack state */
7982 static void alc883_tagra_automute(struct hda_codec *codec)
7984 unsigned int present;
7987 present = snd_hda_codec_read(codec, 0x14, 0,
7988 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7989 bits = present ? HDA_AMP_MUTE : 0;
7990 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7991 HDA_AMP_MUTE, bits);
7992 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7996 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7998 if ((res >> 26) == ALC880_HP_EVENT)
7999 alc883_tagra_automute(codec);
8002 /* toggle speaker-output according to the hp-jack state */
8003 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8005 unsigned int present;
8008 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8009 & AC_PINSENSE_PRESENCE;
8010 bits = present ? HDA_AMP_MUTE : 0;
8011 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8012 HDA_AMP_MUTE, bits);
8015 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8017 unsigned int present;
8019 present = snd_hda_codec_read(codec, 0x18, 0,
8020 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8021 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8022 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8025 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8027 alc883_clevo_m720_hp_automute(codec);
8028 alc883_clevo_m720_mic_automute(codec);
8031 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8034 switch (res >> 26) {
8035 case ALC880_HP_EVENT:
8036 alc883_clevo_m720_hp_automute(codec);
8038 case ALC880_MIC_EVENT:
8039 alc883_clevo_m720_mic_automute(codec);
8044 /* toggle speaker-output according to the hp-jack state */
8045 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8047 unsigned int present;
8050 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8051 & AC_PINSENSE_PRESENCE;
8052 bits = present ? HDA_AMP_MUTE : 0;
8053 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8054 HDA_AMP_MUTE, bits);
8057 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8060 if ((res >> 26) == ALC880_HP_EVENT)
8061 alc883_2ch_fujitsu_pi2515_automute(codec);
8064 static void alc883_haier_w66_automute(struct hda_codec *codec)
8066 unsigned int present;
8069 present = snd_hda_codec_read(codec, 0x1b, 0,
8070 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8071 bits = present ? 0x80 : 0;
8072 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8076 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8079 if ((res >> 26) == ALC880_HP_EVENT)
8080 alc883_haier_w66_automute(codec);
8083 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8085 unsigned int present;
8088 present = snd_hda_codec_read(codec, 0x14, 0,
8089 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8090 bits = present ? HDA_AMP_MUTE : 0;
8091 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8092 HDA_AMP_MUTE, bits);
8095 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8097 unsigned int present;
8100 present = snd_hda_codec_read(codec, 0x1b, 0,
8101 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8102 bits = present ? HDA_AMP_MUTE : 0;
8103 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8104 HDA_AMP_MUTE, bits);
8105 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8106 HDA_AMP_MUTE, bits);
8109 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8112 if ((res >> 26) == ALC880_HP_EVENT)
8113 alc883_lenovo_101e_all_automute(codec);
8114 if ((res >> 26) == ALC880_FRONT_EVENT)
8115 alc883_lenovo_101e_ispeaker_automute(codec);
8118 /* toggle speaker-output according to the hp-jack state */
8119 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8121 unsigned int present;
8123 present = snd_hda_codec_read(codec, 0x14, 0,
8124 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8125 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8126 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8127 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8128 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8131 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8134 if ((res >> 26) == ALC880_HP_EVENT)
8135 alc883_acer_aspire_automute(codec);
8138 static struct hda_verb alc883_acer_eapd_verbs[] = {
8139 /* HP Pin: output 0 (0x0c) */
8140 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8141 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8142 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8143 /* Front Pin: output 0 (0x0c) */
8144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8145 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8147 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8148 /* eanable EAPD on medion laptop */
8149 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8150 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8151 /* enable unsolicited event */
8152 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8156 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8158 unsigned int present;
8160 present = snd_hda_codec_read(codec, 0x1b, 0,
8161 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8162 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8163 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8164 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8165 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8166 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8167 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8168 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8169 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8172 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8175 switch (res >> 26) {
8176 case ALC880_HP_EVENT:
8177 printk("hp_event\n");
8178 alc888_6st_dell_front_automute(codec);
8183 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8186 unsigned int present;
8188 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8189 present = snd_hda_codec_read(codec, 0x1b, 0,
8190 AC_VERB_GET_PIN_SENSE, 0);
8191 present = (present & 0x80000000) != 0;
8193 /* mute internal speaker */
8194 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8195 HDA_AMP_MUTE, HDA_AMP_MUTE);
8196 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8197 HDA_AMP_MUTE, HDA_AMP_MUTE);
8198 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8199 HDA_AMP_MUTE, HDA_AMP_MUTE);
8200 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8201 HDA_AMP_MUTE, HDA_AMP_MUTE);
8202 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8203 HDA_AMP_MUTE, HDA_AMP_MUTE);
8205 /* unmute internal speaker if necessary */
8206 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8207 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8208 HDA_AMP_MUTE, mute);
8209 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8210 HDA_AMP_MUTE, mute);
8211 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8212 HDA_AMP_MUTE, mute);
8213 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8214 HDA_AMP_MUTE, mute);
8215 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8216 HDA_AMP_MUTE, mute);
8220 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8223 if ((res >> 26) == ALC880_HP_EVENT)
8224 alc888_lenovo_sky_front_automute(codec);
8228 * generic initialization of ADC, input mixers and output mixers
8230 static struct hda_verb alc883_auto_init_verbs[] = {
8232 * Unmute ADC0-2 and set the default input to mic-in
8234 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8236 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8239 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8241 * Note: PASD motherboards uses the Line In 2 as the input for
8242 * front panel mic (mic 2)
8244 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8252 * Set up output mixers (0x0c - 0x0f)
8254 /* set vol=0 to output mixers */
8255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8256 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8257 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8258 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8259 /* set up input amps for analog loopback */
8260 /* Amp Indices: DAC = 0, mixer = 1 */
8261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8263 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8264 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8266 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8267 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8268 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8269 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8270 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8272 /* FIXME: use matrix-type input source selection */
8273 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8275 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8276 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8277 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8278 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8281 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8282 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8283 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8284 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8290 static struct hda_verb alc888_asus_m90v_verbs[] = {
8291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8294 /* enable unsolicited event */
8295 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8296 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8300 static void alc883_nb_mic_automute(struct hda_codec *codec)
8302 unsigned int present;
8304 present = snd_hda_codec_read(codec, 0x18, 0,
8305 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8306 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8307 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8308 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8309 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8312 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8314 unsigned int present;
8317 present = snd_hda_codec_read(codec, 0x1b, 0,
8318 AC_VERB_GET_PIN_SENSE, 0)
8319 & AC_PINSENSE_PRESENCE;
8320 bits = present ? 0 : PIN_OUT;
8321 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8323 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8325 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8329 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8332 switch (res >> 26) {
8333 case ALC880_HP_EVENT:
8334 alc883_M90V_speaker_automute(codec);
8336 case ALC880_MIC_EVENT:
8337 alc883_nb_mic_automute(codec);
8342 static void alc883_mode2_inithook(struct hda_codec *codec)
8344 alc883_M90V_speaker_automute(codec);
8345 alc883_nb_mic_automute(codec);
8348 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8350 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8352 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8353 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8354 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8355 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8356 /* enable unsolicited event */
8357 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8361 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8363 unsigned int present;
8366 present = snd_hda_codec_read(codec, 0x14, 0,
8367 AC_VERB_GET_PIN_SENSE, 0)
8368 & AC_PINSENSE_PRESENCE;
8369 bits = present ? 0 : PIN_OUT;
8370 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8374 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8377 switch (res >> 26) {
8378 case ALC880_HP_EVENT:
8379 alc883_eee1601_speaker_automute(codec);
8384 static void alc883_eee1601_inithook(struct hda_codec *codec)
8386 alc883_eee1601_speaker_automute(codec);
8389 #ifdef CONFIG_SND_HDA_POWER_SAVE
8390 #define alc883_loopbacks alc880_loopbacks
8393 /* pcm configuration: identiacal with ALC880 */
8394 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8395 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8396 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8397 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8398 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8401 * configuration and preset
8403 static const char *alc883_models[ALC883_MODEL_LAST] = {
8404 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8405 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8406 [ALC883_3ST_6ch] = "3stack-6ch",
8407 [ALC883_6ST_DIG] = "6stack-dig",
8408 [ALC883_TARGA_DIG] = "targa-dig",
8409 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8410 [ALC883_ACER] = "acer",
8411 [ALC883_ACER_ASPIRE] = "acer-aspire",
8412 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8413 [ALC883_MEDION] = "medion",
8414 [ALC883_MEDION_MD2] = "medion-md2",
8415 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8416 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8417 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8418 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8419 [ALC888_LENOVO_SKY] = "lenovo-sky",
8420 [ALC883_HAIER_W66] = "haier-w66",
8421 [ALC888_3ST_HP] = "3stack-hp",
8422 [ALC888_6ST_DELL] = "6stack-dell",
8423 [ALC883_MITAC] = "mitac",
8424 [ALC883_CLEVO_M720] = "clevo-m720",
8425 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8426 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8427 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8428 [ALC1200_ASUS_P5Q] = "asus-p5q",
8429 [ALC883_AUTO] = "auto",
8432 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8433 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8434 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8435 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8436 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8437 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8438 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8439 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8440 ALC888_ACER_ASPIRE_4930G),
8441 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8442 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8443 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8444 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8445 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8446 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8447 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8448 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8449 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8450 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8451 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8452 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8453 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8454 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8455 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8456 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8457 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8458 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8459 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8460 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8461 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8462 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8463 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8464 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8465 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8466 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8467 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8468 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8469 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8470 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8471 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8472 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8473 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8474 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8475 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8476 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8477 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8478 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8479 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8480 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8481 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8482 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8483 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8484 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8485 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8486 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8487 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8488 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8489 ALC888_FUJITSU_XA3530),
8490 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8491 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8492 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8493 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8494 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8495 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8496 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8497 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8498 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8499 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8500 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8501 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8505 static struct alc_config_preset alc883_presets[] = {
8506 [ALC883_3ST_2ch_DIG] = {
8507 .mixers = { alc883_3ST_2ch_mixer },
8508 .init_verbs = { alc883_init_verbs },
8509 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8510 .dac_nids = alc883_dac_nids,
8511 .dig_out_nid = ALC883_DIGOUT_NID,
8512 .dig_in_nid = ALC883_DIGIN_NID,
8513 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8514 .channel_mode = alc883_3ST_2ch_modes,
8515 .input_mux = &alc883_capture_source,
8517 [ALC883_3ST_6ch_DIG] = {
8518 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8519 .init_verbs = { alc883_init_verbs },
8520 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8521 .dac_nids = alc883_dac_nids,
8522 .dig_out_nid = ALC883_DIGOUT_NID,
8523 .dig_in_nid = ALC883_DIGIN_NID,
8524 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8525 .channel_mode = alc883_3ST_6ch_modes,
8527 .input_mux = &alc883_capture_source,
8529 [ALC883_3ST_6ch] = {
8530 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8531 .init_verbs = { alc883_init_verbs },
8532 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8533 .dac_nids = alc883_dac_nids,
8534 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8535 .channel_mode = alc883_3ST_6ch_modes,
8537 .input_mux = &alc883_capture_source,
8539 [ALC883_3ST_6ch_INTEL] = {
8540 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8541 .init_verbs = { alc883_init_verbs },
8542 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8543 .dac_nids = alc883_dac_nids,
8544 .dig_out_nid = ALC883_DIGOUT_NID,
8545 .dig_in_nid = ALC883_DIGIN_NID,
8546 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8547 .channel_mode = alc883_3ST_6ch_intel_modes,
8549 .input_mux = &alc883_3stack_6ch_intel,
8551 [ALC883_6ST_DIG] = {
8552 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8553 .init_verbs = { alc883_init_verbs },
8554 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8555 .dac_nids = alc883_dac_nids,
8556 .dig_out_nid = ALC883_DIGOUT_NID,
8557 .dig_in_nid = ALC883_DIGIN_NID,
8558 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8559 .channel_mode = alc883_sixstack_modes,
8560 .input_mux = &alc883_capture_source,
8562 [ALC883_TARGA_DIG] = {
8563 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8564 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8565 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8566 .dac_nids = alc883_dac_nids,
8567 .dig_out_nid = ALC883_DIGOUT_NID,
8568 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8569 .channel_mode = alc883_3ST_6ch_modes,
8571 .input_mux = &alc883_capture_source,
8572 .unsol_event = alc883_tagra_unsol_event,
8573 .init_hook = alc883_tagra_automute,
8575 [ALC883_TARGA_2ch_DIG] = {
8576 .mixers = { alc883_tagra_2ch_mixer},
8577 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8579 .dac_nids = alc883_dac_nids,
8580 .adc_nids = alc883_adc_nids_alt,
8581 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8582 .dig_out_nid = ALC883_DIGOUT_NID,
8583 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8584 .channel_mode = alc883_3ST_2ch_modes,
8585 .input_mux = &alc883_capture_source,
8586 .unsol_event = alc883_tagra_unsol_event,
8587 .init_hook = alc883_tagra_automute,
8590 .mixers = { alc883_base_mixer },
8591 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8592 * and the headphone jack. Turn this on and rely on the
8593 * standard mute methods whenever the user wants to turn
8594 * these outputs off.
8596 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8597 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8598 .dac_nids = alc883_dac_nids,
8599 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8600 .channel_mode = alc883_3ST_2ch_modes,
8601 .input_mux = &alc883_capture_source,
8603 [ALC883_ACER_ASPIRE] = {
8604 .mixers = { alc883_acer_aspire_mixer },
8605 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8606 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8607 .dac_nids = alc883_dac_nids,
8608 .dig_out_nid = ALC883_DIGOUT_NID,
8609 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8610 .channel_mode = alc883_3ST_2ch_modes,
8611 .input_mux = &alc883_capture_source,
8612 .unsol_event = alc883_acer_aspire_unsol_event,
8613 .init_hook = alc883_acer_aspire_automute,
8615 [ALC888_ACER_ASPIRE_4930G] = {
8616 .mixers = { alc888_base_mixer,
8617 alc883_chmode_mixer },
8618 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8619 alc888_acer_aspire_4930g_verbs },
8620 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8621 .dac_nids = alc883_dac_nids,
8622 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8623 .adc_nids = alc883_adc_nids_rev,
8624 .capsrc_nids = alc883_capsrc_nids_rev,
8625 .dig_out_nid = ALC883_DIGOUT_NID,
8626 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8627 .channel_mode = alc883_3ST_6ch_modes,
8630 ARRAY_SIZE(alc888_2_capture_sources),
8631 .input_mux = alc888_2_capture_sources,
8632 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8633 .init_hook = alc888_acer_aspire_4930g_automute,
8636 .mixers = { alc883_fivestack_mixer,
8637 alc883_chmode_mixer },
8638 .init_verbs = { alc883_init_verbs,
8639 alc883_medion_eapd_verbs },
8640 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8641 .dac_nids = alc883_dac_nids,
8642 .adc_nids = alc883_adc_nids_alt,
8643 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8644 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8645 .channel_mode = alc883_sixstack_modes,
8646 .input_mux = &alc883_capture_source,
8648 [ALC883_MEDION_MD2] = {
8649 .mixers = { alc883_medion_md2_mixer},
8650 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8651 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8652 .dac_nids = alc883_dac_nids,
8653 .dig_out_nid = ALC883_DIGOUT_NID,
8654 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8655 .channel_mode = alc883_3ST_2ch_modes,
8656 .input_mux = &alc883_capture_source,
8657 .unsol_event = alc883_medion_md2_unsol_event,
8658 .init_hook = alc883_medion_md2_automute,
8660 [ALC883_LAPTOP_EAPD] = {
8661 .mixers = { alc883_base_mixer },
8662 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8663 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8664 .dac_nids = alc883_dac_nids,
8665 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8666 .channel_mode = alc883_3ST_2ch_modes,
8667 .input_mux = &alc883_capture_source,
8669 [ALC883_CLEVO_M720] = {
8670 .mixers = { alc883_clevo_m720_mixer },
8671 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8672 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8673 .dac_nids = alc883_dac_nids,
8674 .dig_out_nid = ALC883_DIGOUT_NID,
8675 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8676 .channel_mode = alc883_3ST_2ch_modes,
8677 .input_mux = &alc883_capture_source,
8678 .unsol_event = alc883_clevo_m720_unsol_event,
8679 .init_hook = alc883_clevo_m720_automute,
8681 [ALC883_LENOVO_101E_2ch] = {
8682 .mixers = { alc883_lenovo_101e_2ch_mixer},
8683 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8684 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8685 .dac_nids = alc883_dac_nids,
8686 .adc_nids = alc883_adc_nids_alt,
8687 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8688 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8689 .channel_mode = alc883_3ST_2ch_modes,
8690 .input_mux = &alc883_lenovo_101e_capture_source,
8691 .unsol_event = alc883_lenovo_101e_unsol_event,
8692 .init_hook = alc883_lenovo_101e_all_automute,
8694 [ALC883_LENOVO_NB0763] = {
8695 .mixers = { alc883_lenovo_nb0763_mixer },
8696 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8697 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8698 .dac_nids = alc883_dac_nids,
8699 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8700 .channel_mode = alc883_3ST_2ch_modes,
8702 .input_mux = &alc883_lenovo_nb0763_capture_source,
8703 .unsol_event = alc883_medion_md2_unsol_event,
8704 .init_hook = alc883_medion_md2_automute,
8706 [ALC888_LENOVO_MS7195_DIG] = {
8707 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8708 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8709 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8710 .dac_nids = alc883_dac_nids,
8711 .dig_out_nid = ALC883_DIGOUT_NID,
8712 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8713 .channel_mode = alc883_3ST_6ch_modes,
8715 .input_mux = &alc883_capture_source,
8716 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8717 .init_hook = alc888_lenovo_ms7195_front_automute,
8719 [ALC883_HAIER_W66] = {
8720 .mixers = { alc883_tagra_2ch_mixer},
8721 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8722 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8723 .dac_nids = alc883_dac_nids,
8724 .dig_out_nid = ALC883_DIGOUT_NID,
8725 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8726 .channel_mode = alc883_3ST_2ch_modes,
8727 .input_mux = &alc883_capture_source,
8728 .unsol_event = alc883_haier_w66_unsol_event,
8729 .init_hook = alc883_haier_w66_automute,
8732 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8733 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8734 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8735 .dac_nids = alc883_dac_nids,
8736 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8737 .channel_mode = alc888_3st_hp_modes,
8739 .input_mux = &alc883_capture_source,
8741 [ALC888_6ST_DELL] = {
8742 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8743 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8744 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8745 .dac_nids = alc883_dac_nids,
8746 .dig_out_nid = ALC883_DIGOUT_NID,
8747 .dig_in_nid = ALC883_DIGIN_NID,
8748 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8749 .channel_mode = alc883_sixstack_modes,
8750 .input_mux = &alc883_capture_source,
8751 .unsol_event = alc888_6st_dell_unsol_event,
8752 .init_hook = alc888_6st_dell_front_automute,
8755 .mixers = { alc883_mitac_mixer },
8756 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8757 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8758 .dac_nids = alc883_dac_nids,
8759 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8760 .channel_mode = alc883_3ST_2ch_modes,
8761 .input_mux = &alc883_capture_source,
8762 .unsol_event = alc883_mitac_unsol_event,
8763 .init_hook = alc883_mitac_automute,
8765 [ALC883_FUJITSU_PI2515] = {
8766 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8767 .init_verbs = { alc883_init_verbs,
8768 alc883_2ch_fujitsu_pi2515_verbs},
8769 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8770 .dac_nids = alc883_dac_nids,
8771 .dig_out_nid = ALC883_DIGOUT_NID,
8772 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8773 .channel_mode = alc883_3ST_2ch_modes,
8774 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8775 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8776 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8778 [ALC888_FUJITSU_XA3530] = {
8779 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8780 .init_verbs = { alc883_init_verbs,
8781 alc888_fujitsu_xa3530_verbs },
8782 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8783 .dac_nids = alc883_dac_nids,
8784 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8785 .adc_nids = alc883_adc_nids_rev,
8786 .capsrc_nids = alc883_capsrc_nids_rev,
8787 .dig_out_nid = ALC883_DIGOUT_NID,
8788 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8789 .channel_mode = alc888_4ST_8ch_intel_modes,
8791 ARRAY_SIZE(alc888_2_capture_sources),
8792 .input_mux = alc888_2_capture_sources,
8793 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8794 .init_hook = alc888_fujitsu_xa3530_automute,
8796 [ALC888_LENOVO_SKY] = {
8797 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8798 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8799 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8800 .dac_nids = alc883_dac_nids,
8801 .dig_out_nid = ALC883_DIGOUT_NID,
8802 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8803 .channel_mode = alc883_sixstack_modes,
8805 .input_mux = &alc883_lenovo_sky_capture_source,
8806 .unsol_event = alc883_lenovo_sky_unsol_event,
8807 .init_hook = alc888_lenovo_sky_front_automute,
8809 [ALC888_ASUS_M90V] = {
8810 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8811 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8812 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8813 .dac_nids = alc883_dac_nids,
8814 .dig_out_nid = ALC883_DIGOUT_NID,
8815 .dig_in_nid = ALC883_DIGIN_NID,
8816 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8817 .channel_mode = alc883_3ST_6ch_modes,
8819 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8820 .unsol_event = alc883_mode2_unsol_event,
8821 .init_hook = alc883_mode2_inithook,
8823 [ALC888_ASUS_EEE1601] = {
8824 .mixers = { alc883_asus_eee1601_mixer },
8825 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8826 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8827 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8828 .dac_nids = alc883_dac_nids,
8829 .dig_out_nid = ALC883_DIGOUT_NID,
8830 .dig_in_nid = ALC883_DIGIN_NID,
8831 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8832 .channel_mode = alc883_3ST_2ch_modes,
8834 .input_mux = &alc883_asus_eee1601_capture_source,
8835 .unsol_event = alc883_eee1601_unsol_event,
8836 .init_hook = alc883_eee1601_inithook,
8838 [ALC1200_ASUS_P5Q] = {
8839 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8840 .init_verbs = { alc883_init_verbs },
8841 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8842 .dac_nids = alc883_dac_nids,
8843 .dig_out_nid = ALC1200_DIGOUT_NID,
8844 .dig_in_nid = ALC883_DIGIN_NID,
8845 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8846 .channel_mode = alc883_sixstack_modes,
8847 .input_mux = &alc883_capture_source,
8853 * BIOS auto configuration
8855 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8856 hda_nid_t nid, int pin_type,
8860 struct alc_spec *spec = codec->spec;
8863 alc_set_pin_output(codec, nid, pin_type);
8864 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8867 idx = spec->multiout.dac_nids[dac_idx] - 2;
8868 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8872 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8874 struct alc_spec *spec = codec->spec;
8877 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8878 for (i = 0; i <= HDA_SIDE; i++) {
8879 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8880 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8882 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8887 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8889 struct alc_spec *spec = codec->spec;
8892 pin = spec->autocfg.hp_pins[0];
8893 if (pin) /* connect to front */
8895 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8896 pin = spec->autocfg.speaker_pins[0];
8898 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8901 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8902 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8904 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8906 struct alc_spec *spec = codec->spec;
8909 for (i = 0; i < AUTO_PIN_LAST; i++) {
8910 hda_nid_t nid = spec->autocfg.input_pins[i];
8911 if (alc883_is_input_pin(nid)) {
8912 snd_hda_codec_write(codec, nid, 0,
8913 AC_VERB_SET_PIN_WIDGET_CONTROL,
8914 (i <= AUTO_PIN_FRONT_MIC ?
8915 PIN_VREF80 : PIN_IN));
8916 if (nid != ALC883_PIN_CD_NID)
8917 snd_hda_codec_write(codec, nid, 0,
8918 AC_VERB_SET_AMP_GAIN_MUTE,
8924 #define alc883_auto_init_input_src alc882_auto_init_input_src
8926 /* almost identical with ALC880 parser... */
8927 static int alc883_parse_auto_config(struct hda_codec *codec)
8929 struct alc_spec *spec = codec->spec;
8930 int err = alc880_parse_auto_config(codec);
8935 return 0; /* no config found */
8937 err = alc_auto_add_mic_boost(codec);
8941 /* hack - override the init verbs */
8942 spec->init_verbs[0] = alc883_auto_init_verbs;
8944 return 1; /* config found */
8947 /* additional initialization for auto-configuration model */
8948 static void alc883_auto_init(struct hda_codec *codec)
8950 struct alc_spec *spec = codec->spec;
8951 alc883_auto_init_multi_out(codec);
8952 alc883_auto_init_hp_out(codec);
8953 alc883_auto_init_analog_input(codec);
8954 alc883_auto_init_input_src(codec);
8955 if (spec->unsol_event)
8956 alc_inithook(codec);
8959 static int patch_alc883(struct hda_codec *codec)
8961 struct alc_spec *spec;
8962 int err, board_config;
8964 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8970 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8972 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8975 if (board_config < 0) {
8976 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8977 "trying auto-probe from BIOS...\n");
8978 board_config = ALC883_AUTO;
8981 if (board_config == ALC883_AUTO) {
8982 /* automatic parse from the BIOS config */
8983 err = alc883_parse_auto_config(codec);
8989 "hda_codec: Cannot set up configuration "
8990 "from BIOS. Using base mode...\n");
8991 board_config = ALC883_3ST_2ch_DIG;
8995 if (board_config != ALC883_AUTO)
8996 setup_preset(spec, &alc883_presets[board_config]);
8998 switch (codec->vendor_id) {
9000 if (codec->revision_id == 0x100101) {
9001 spec->stream_name_analog = "ALC1200 Analog";
9002 spec->stream_name_digital = "ALC1200 Digital";
9004 spec->stream_name_analog = "ALC888 Analog";
9005 spec->stream_name_digital = "ALC888 Digital";
9009 spec->stream_name_analog = "ALC889 Analog";
9010 spec->stream_name_digital = "ALC889 Digital";
9013 spec->stream_name_analog = "ALC883 Analog";
9014 spec->stream_name_digital = "ALC883 Digital";
9018 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9019 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9020 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9022 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9023 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9025 if (!spec->num_adc_nids) {
9026 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9027 spec->adc_nids = alc883_adc_nids;
9029 if (!spec->capsrc_nids)
9030 spec->capsrc_nids = alc883_capsrc_nids;
9031 spec->is_mix_capture = 1; /* matrix-style capture */
9032 if (!spec->cap_mixer)
9033 set_capture_mixer(spec);
9035 spec->vmaster_nid = 0x0c;
9037 codec->patch_ops = alc_patch_ops;
9038 if (board_config == ALC883_AUTO)
9039 spec->init_hook = alc883_auto_init;
9041 #ifdef CONFIG_SND_HDA_POWER_SAVE
9042 if (!spec->loopback.amplist)
9043 spec->loopback.amplist = alc883_loopbacks;
9053 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9054 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9056 #define alc262_dac_nids alc260_dac_nids
9057 #define alc262_adc_nids alc882_adc_nids
9058 #define alc262_adc_nids_alt alc882_adc_nids_alt
9059 #define alc262_capsrc_nids alc882_capsrc_nids
9060 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9062 #define alc262_modes alc260_modes
9063 #define alc262_capture_source alc882_capture_source
9065 static hda_nid_t alc262_dmic_adc_nids[1] = {
9070 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9072 static struct snd_kcontrol_new alc262_base_mixer[] = {
9073 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9074 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9075 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9076 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9077 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9078 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9082 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9083 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9084 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9085 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9086 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9087 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9088 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9089 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9090 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9094 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9095 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9096 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9097 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9098 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9103 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9105 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9106 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9107 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9108 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9109 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9110 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9114 /* update HP, line and mono-out pins according to the master switch */
9115 static void alc262_hp_master_update(struct hda_codec *codec)
9117 struct alc_spec *spec = codec->spec;
9118 int val = spec->master_sw;
9121 snd_hda_codec_write_cache(codec, 0x1b, 0,
9122 AC_VERB_SET_PIN_WIDGET_CONTROL,
9124 snd_hda_codec_write_cache(codec, 0x15, 0,
9125 AC_VERB_SET_PIN_WIDGET_CONTROL,
9127 /* mono (speaker) depending on the HP jack sense */
9128 val = val && !spec->jack_present;
9129 snd_hda_codec_write_cache(codec, 0x16, 0,
9130 AC_VERB_SET_PIN_WIDGET_CONTROL,
9134 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9136 struct alc_spec *spec = codec->spec;
9137 unsigned int presence;
9138 presence = snd_hda_codec_read(codec, 0x1b, 0,
9139 AC_VERB_GET_PIN_SENSE, 0);
9140 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9141 alc262_hp_master_update(codec);
9144 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9146 if ((res >> 26) != ALC880_HP_EVENT)
9148 alc262_hp_bpc_automute(codec);
9151 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9153 struct alc_spec *spec = codec->spec;
9154 unsigned int presence;
9155 presence = snd_hda_codec_read(codec, 0x15, 0,
9156 AC_VERB_GET_PIN_SENSE, 0);
9157 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9158 alc262_hp_master_update(codec);
9161 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9164 if ((res >> 26) != ALC880_HP_EVENT)
9166 alc262_hp_wildwest_automute(codec);
9169 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9170 struct snd_ctl_elem_value *ucontrol)
9172 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9173 struct alc_spec *spec = codec->spec;
9174 *ucontrol->value.integer.value = spec->master_sw;
9178 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9179 struct snd_ctl_elem_value *ucontrol)
9181 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9182 struct alc_spec *spec = codec->spec;
9183 int val = !!*ucontrol->value.integer.value;
9185 if (val == spec->master_sw)
9187 spec->master_sw = val;
9188 alc262_hp_master_update(codec);
9192 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9194 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9195 .name = "Master Playback Switch",
9196 .info = snd_ctl_boolean_mono_info,
9197 .get = alc262_hp_master_sw_get,
9198 .put = alc262_hp_master_sw_put,
9200 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9201 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9203 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9205 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9208 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9209 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9210 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9211 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9212 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9215 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9216 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9217 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9218 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9219 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9220 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9224 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9226 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9227 .name = "Master Playback Switch",
9228 .info = snd_ctl_boolean_mono_info,
9229 .get = alc262_hp_master_sw_get,
9230 .put = alc262_hp_master_sw_put,
9232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9233 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9234 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9235 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9236 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9238 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9240 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9241 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9242 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9243 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9244 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9245 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9246 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9247 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9248 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9252 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9253 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9254 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9255 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9259 /* mute/unmute internal speaker according to the hp jack and mute state */
9260 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9262 struct alc_spec *spec = codec->spec;
9264 if (force || !spec->sense_updated) {
9265 unsigned int present;
9266 present = snd_hda_codec_read(codec, 0x15, 0,
9267 AC_VERB_GET_PIN_SENSE, 0);
9268 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9269 spec->sense_updated = 1;
9271 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9272 spec->jack_present ? HDA_AMP_MUTE : 0);
9275 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9278 if ((res >> 26) != ALC880_HP_EVENT)
9280 alc262_hp_t5735_automute(codec, 1);
9283 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9285 alc262_hp_t5735_automute(codec, 1);
9288 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9289 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9290 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9291 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9294 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9295 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9299 static struct hda_verb alc262_hp_t5735_verbs[] = {
9300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9303 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9307 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9308 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9309 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9310 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9311 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9312 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9313 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9317 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9318 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9319 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9320 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9321 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9322 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9323 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9327 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9331 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9338 /* bind hp and internal speaker mute (with plug check) */
9339 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9340 struct snd_ctl_elem_value *ucontrol)
9342 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9343 long *valp = ucontrol->value.integer.value;
9346 /* change hp mute */
9347 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9349 valp[0] ? 0 : HDA_AMP_MUTE);
9350 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9352 valp[1] ? 0 : HDA_AMP_MUTE);
9354 /* change speaker according to HP jack state */
9355 struct alc_spec *spec = codec->spec;
9357 if (spec->jack_present)
9358 mute = HDA_AMP_MUTE;
9360 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9362 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9363 HDA_AMP_MUTE, mute);
9368 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9369 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9372 .name = "Master Playback Switch",
9373 .info = snd_hda_mixer_amp_switch_info,
9374 .get = snd_hda_mixer_amp_switch_get,
9375 .put = alc262_sony_master_sw_put,
9376 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9380 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9381 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9385 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9386 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9387 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9388 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9391 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9392 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9396 #define alc262_capture_mixer alc882_capture_mixer
9397 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9400 * generic initialization of ADC, input mixers and output mixers
9402 static struct hda_verb alc262_init_verbs[] = {
9404 * Unmute ADC0-2 and set the default input to mic-in
9406 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9408 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9409 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9410 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9411 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9413 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9415 * Note: PASD motherboards uses the Line In 2 as the input for
9416 * front panel mic (mic 2)
9418 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9421 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9422 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9423 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9426 * Set up output mixers (0x0c - 0x0e)
9428 /* set vol=0 to output mixers */
9429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9430 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9431 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9432 /* set up input amps for analog loopback */
9433 /* Amp Indices: DAC = 0, mixer = 1 */
9434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9437 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9439 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9443 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9444 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9445 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9446 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9448 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9450 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9451 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9452 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9454 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9455 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9457 /* FIXME: use matrix-type input source selection */
9458 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9459 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9463 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9468 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9478 static struct hda_verb alc262_eapd_verbs[] = {
9479 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9480 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9484 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9485 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9490 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9491 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9492 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9493 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9495 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9496 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9500 static struct hda_verb alc262_sony_unsol_verbs[] = {
9501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9502 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9503 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9505 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9506 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9510 static struct hda_input_mux alc262_dmic_capture_source = {
9513 { "Int DMic", 0x9 },
9518 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9519 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9520 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9523 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9527 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9528 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9530 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9531 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9532 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9533 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9534 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9535 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9539 static void alc262_dmic_automute(struct hda_codec *codec)
9541 unsigned int present;
9543 present = snd_hda_codec_read(codec, 0x18, 0,
9544 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9545 snd_hda_codec_write(codec, 0x22, 0,
9546 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9549 /* toggle speaker-output according to the hp-jack state */
9550 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9552 unsigned int present;
9555 present = snd_hda_codec_read(codec, 0x15, 0,
9556 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9557 bits = present ? 0 : PIN_OUT;
9558 snd_hda_codec_write(codec, 0x14, 0,
9559 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9564 /* unsolicited event for HP jack sensing */
9565 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9568 if ((res >> 26) == ALC880_HP_EVENT)
9569 alc262_toshiba_s06_speaker_automute(codec);
9570 if ((res >> 26) == ALC880_MIC_EVENT)
9571 alc262_dmic_automute(codec);
9575 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9577 alc262_toshiba_s06_speaker_automute(codec);
9578 alc262_dmic_automute(codec);
9581 /* mute/unmute internal speaker according to the hp jack and mute state */
9582 static void alc262_hippo_automute(struct hda_codec *codec)
9584 struct alc_spec *spec = codec->spec;
9586 unsigned int present;
9588 /* need to execute and sync at first */
9589 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9590 present = snd_hda_codec_read(codec, 0x15, 0,
9591 AC_VERB_GET_PIN_SENSE, 0);
9592 spec->jack_present = (present & 0x80000000) != 0;
9593 if (spec->jack_present) {
9594 /* mute internal speaker */
9595 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9596 HDA_AMP_MUTE, HDA_AMP_MUTE);
9598 /* unmute internal speaker if necessary */
9599 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9600 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9601 HDA_AMP_MUTE, mute);
9605 /* unsolicited event for HP jack sensing */
9606 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9609 if ((res >> 26) != ALC880_HP_EVENT)
9611 alc262_hippo_automute(codec);
9614 static void alc262_hippo1_automute(struct hda_codec *codec)
9617 unsigned int present;
9619 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9620 present = snd_hda_codec_read(codec, 0x1b, 0,
9621 AC_VERB_GET_PIN_SENSE, 0);
9622 present = (present & 0x80000000) != 0;
9624 /* mute internal speaker */
9625 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9626 HDA_AMP_MUTE, HDA_AMP_MUTE);
9628 /* unmute internal speaker if necessary */
9629 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9630 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9631 HDA_AMP_MUTE, mute);
9635 /* unsolicited event for HP jack sensing */
9636 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9639 if ((res >> 26) != ALC880_HP_EVENT)
9641 alc262_hippo1_automute(codec);
9647 * 0x16 = internal speaker
9648 * 0x18 = external mic
9651 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9652 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9653 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9659 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9660 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9664 static struct hda_verb alc262_nec_verbs[] = {
9665 /* Unmute Speaker */
9666 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9669 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9672 /* External mic to headphone */
9673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9674 /* External mic to speaker */
9675 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9681 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9682 * 0x1b = port replicator headphone out
9685 #define ALC_HP_EVENT 0x37
9687 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9688 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9690 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9691 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9695 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9696 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9697 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9701 static struct hda_input_mux alc262_fujitsu_capture_source = {
9710 static struct hda_input_mux alc262_HP_capture_source = {
9714 { "Front Mic", 0x1 },
9721 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9725 { "Front Mic", 0x2 },
9731 /* mute/unmute internal speaker according to the hp jacks and mute state */
9732 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9734 struct alc_spec *spec = codec->spec;
9737 if (force || !spec->sense_updated) {
9738 unsigned int present;
9739 /* need to execute and sync at first */
9740 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9741 /* check laptop HP jack */
9742 present = snd_hda_codec_read(codec, 0x14, 0,
9743 AC_VERB_GET_PIN_SENSE, 0);
9744 /* need to execute and sync at first */
9745 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9746 /* check docking HP jack */
9747 present |= snd_hda_codec_read(codec, 0x1b, 0,
9748 AC_VERB_GET_PIN_SENSE, 0);
9749 if (present & AC_PINSENSE_PRESENCE)
9750 spec->jack_present = 1;
9752 spec->jack_present = 0;
9753 spec->sense_updated = 1;
9755 /* unmute internal speaker only if both HPs are unplugged and
9756 * master switch is on
9758 if (spec->jack_present)
9759 mute = HDA_AMP_MUTE;
9761 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9762 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9763 HDA_AMP_MUTE, mute);
9766 /* unsolicited event for HP jack sensing */
9767 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9770 if ((res >> 26) != ALC_HP_EVENT)
9772 alc262_fujitsu_automute(codec, 1);
9775 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9777 alc262_fujitsu_automute(codec, 1);
9780 /* bind volumes of both NID 0x0c and 0x0d */
9781 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9782 .ops = &snd_hda_bind_vol,
9784 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9785 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9790 /* mute/unmute internal speaker according to the hp jack and mute state */
9791 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9793 struct alc_spec *spec = codec->spec;
9796 if (force || !spec->sense_updated) {
9797 unsigned int present_int_hp;
9798 /* need to execute and sync at first */
9799 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9800 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9801 AC_VERB_GET_PIN_SENSE, 0);
9802 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9803 spec->sense_updated = 1;
9805 if (spec->jack_present) {
9806 /* mute internal speaker */
9807 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9808 HDA_AMP_MUTE, HDA_AMP_MUTE);
9809 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9810 HDA_AMP_MUTE, HDA_AMP_MUTE);
9812 /* unmute internal speaker if necessary */
9813 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9814 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9815 HDA_AMP_MUTE, mute);
9816 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9817 HDA_AMP_MUTE, mute);
9821 /* unsolicited event for HP jack sensing */
9822 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9825 if ((res >> 26) != ALC_HP_EVENT)
9827 alc262_lenovo_3000_automute(codec, 1);
9830 /* bind hp and internal speaker mute (with plug check) */
9831 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9832 struct snd_ctl_elem_value *ucontrol)
9834 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9835 long *valp = ucontrol->value.integer.value;
9838 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9840 valp ? 0 : HDA_AMP_MUTE);
9841 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9843 valp ? 0 : HDA_AMP_MUTE);
9846 alc262_fujitsu_automute(codec, 0);
9850 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9851 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9854 .name = "Master Playback Switch",
9855 .info = snd_hda_mixer_amp_switch_info,
9856 .get = snd_hda_mixer_amp_switch_get,
9857 .put = alc262_fujitsu_master_sw_put,
9858 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9860 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9861 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9862 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9863 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9864 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9865 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9866 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9867 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9868 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9869 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9873 /* bind hp and internal speaker mute (with plug check) */
9874 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9875 struct snd_ctl_elem_value *ucontrol)
9877 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9878 long *valp = ucontrol->value.integer.value;
9881 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9883 valp ? 0 : HDA_AMP_MUTE);
9886 alc262_lenovo_3000_automute(codec, 0);
9890 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9891 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9894 .name = "Master Playback Switch",
9895 .info = snd_hda_mixer_amp_switch_info,
9896 .get = snd_hda_mixer_amp_switch_get,
9897 .put = alc262_lenovo_3000_master_sw_put,
9898 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9900 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9901 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9902 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9904 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9905 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9906 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9907 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9911 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9912 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9914 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9915 .name = "Master Playback Switch",
9916 .info = snd_hda_mixer_amp_switch_info,
9917 .get = snd_hda_mixer_amp_switch_get,
9918 .put = alc262_sony_master_sw_put,
9919 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9923 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9924 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9926 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9930 /* additional init verbs for Benq laptops */
9931 static struct hda_verb alc262_EAPD_verbs[] = {
9932 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9933 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9937 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9938 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9939 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9941 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9942 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9946 /* Samsung Q1 Ultra Vista model setup */
9947 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9948 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9949 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9952 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9953 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9957 static struct hda_verb alc262_ultra_verbs[] = {
9959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9961 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9963 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9964 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9965 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9966 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9970 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9971 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9972 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9974 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9976 /* ADC, choose mic */
9977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9978 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9980 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9982 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9990 /* mute/unmute internal speaker according to the hp jack and mute state */
9991 static void alc262_ultra_automute(struct hda_codec *codec)
9993 struct alc_spec *spec = codec->spec;
9997 /* auto-mute only when HP is used as HP */
9998 if (!spec->cur_mux[0]) {
9999 unsigned int present;
10000 /* need to execute and sync at first */
10001 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10002 present = snd_hda_codec_read(codec, 0x15, 0,
10003 AC_VERB_GET_PIN_SENSE, 0);
10004 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10005 if (spec->jack_present)
10006 mute = HDA_AMP_MUTE;
10008 /* mute/unmute internal speaker */
10009 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10010 HDA_AMP_MUTE, mute);
10011 /* mute/unmute HP */
10012 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10013 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10016 /* unsolicited event for HP jack sensing */
10017 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10020 if ((res >> 26) != ALC880_HP_EVENT)
10022 alc262_ultra_automute(codec);
10025 static struct hda_input_mux alc262_ultra_capture_source = {
10029 { "Headphone", 0x7 },
10033 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10034 struct snd_ctl_elem_value *ucontrol)
10036 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10037 struct alc_spec *spec = codec->spec;
10040 ret = alc_mux_enum_put(kcontrol, ucontrol);
10043 /* reprogram the HP pin as mic or HP according to the input source */
10044 snd_hda_codec_write_cache(codec, 0x15, 0,
10045 AC_VERB_SET_PIN_WIDGET_CONTROL,
10046 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10047 alc262_ultra_automute(codec); /* mute/unmute HP */
10051 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10052 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10053 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10056 .name = "Capture Source",
10057 .info = alc_mux_enum_info,
10058 .get = alc_mux_enum_get,
10059 .put = alc262_ultra_mux_enum_put,
10064 /* add playback controls from the parsed DAC table */
10065 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10066 const struct auto_pin_cfg *cfg)
10071 spec->multiout.num_dacs = 1; /* only use one dac */
10072 spec->multiout.dac_nids = spec->private_dac_nids;
10073 spec->multiout.dac_nids[0] = 2;
10075 nid = cfg->line_out_pins[0];
10077 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10078 "Front Playback Volume",
10079 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10082 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10083 "Front Playback Switch",
10084 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10089 nid = cfg->speaker_pins[0];
10092 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10093 "Speaker Playback Volume",
10094 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10098 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10099 "Speaker Playback Switch",
10100 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10105 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10106 "Speaker Playback Switch",
10107 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10113 nid = cfg->hp_pins[0];
10115 /* spec->multiout.hp_nid = 2; */
10117 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10118 "Headphone Playback Volume",
10119 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10123 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10124 "Headphone Playback Switch",
10125 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10130 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10131 "Headphone Playback Switch",
10132 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10141 /* identical with ALC880 */
10142 #define alc262_auto_create_analog_input_ctls \
10143 alc880_auto_create_analog_input_ctls
10146 * generic initialization of ADC, input mixers and output mixers
10148 static struct hda_verb alc262_volume_init_verbs[] = {
10150 * Unmute ADC0-2 and set the default input to mic-in
10152 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10153 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10154 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10155 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10156 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10159 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10161 * Note: PASD motherboards uses the Line In 2 as the input for
10162 * front panel mic (mic 2)
10164 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10172 * Set up output mixers (0x0c - 0x0f)
10174 /* set vol=0 to output mixers */
10175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10176 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10177 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10179 /* set up input amps for analog loopback */
10180 /* Amp Indices: DAC = 0, mixer = 1 */
10181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10183 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10184 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10185 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10186 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10188 /* FIXME: use matrix-type input source selection */
10189 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10190 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10197 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10209 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10211 * Unmute ADC0-2 and set the default input to mic-in
10213 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10214 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10215 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10216 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10217 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10220 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10222 * Note: PASD motherboards uses the Line In 2 as the input for
10223 * front panel mic (mic 2)
10225 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10226 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10227 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10235 * Set up output mixers (0x0c - 0x0e)
10237 /* set vol=0 to output mixers */
10238 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10239 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10240 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10242 /* set up input amps for analog loopback */
10243 /* Amp Indices: DAC = 0, mixer = 1 */
10244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10245 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10246 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10247 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10248 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10249 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10251 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10253 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10255 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10258 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10261 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10262 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10263 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10264 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10265 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10267 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10268 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10269 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10271 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10272 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10275 /* FIXME: use matrix-type input source selection */
10276 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10277 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10286 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10290 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10293 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10298 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10300 * Unmute ADC0-2 and set the default input to mic-in
10302 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10303 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10304 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10306 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10307 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10309 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10311 * Note: PASD motherboards uses the Line In 2 as the input for front
10312 * panel mic (mic 2)
10314 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10324 * Set up output mixers (0x0c - 0x0e)
10326 /* set vol=0 to output mixers */
10327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10329 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10331 /* set up input amps for analog loopback */
10332 /* Amp Indices: DAC = 0, mixer = 1 */
10333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10342 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10343 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10344 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10345 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10346 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10347 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10349 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10352 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10353 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10355 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10356 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10357 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10359 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10360 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10362 /* FIXME: use matrix-type input source selection */
10363 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10364 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10370 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10378 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10386 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10389 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10394 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10396 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10397 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10398 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10400 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10401 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10402 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10405 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10406 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10407 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10412 #ifdef CONFIG_SND_HDA_POWER_SAVE
10413 #define alc262_loopbacks alc880_loopbacks
10416 /* pcm configuration: identiacal with ALC880 */
10417 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10418 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10419 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10420 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10423 * BIOS auto configuration
10425 static int alc262_parse_auto_config(struct hda_codec *codec)
10427 struct alc_spec *spec = codec->spec;
10429 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10431 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10435 if (!spec->autocfg.line_outs)
10436 return 0; /* can't find valid BIOS pin config */
10437 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10440 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10444 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10446 if (spec->autocfg.dig_out_pin)
10447 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10448 if (spec->autocfg.dig_in_pin)
10449 spec->dig_in_nid = ALC262_DIGIN_NID;
10451 if (spec->kctls.list)
10452 add_mixer(spec, spec->kctls.list);
10454 add_verb(spec, alc262_volume_init_verbs);
10455 spec->num_mux_defs = 1;
10456 spec->input_mux = &spec->private_imux;
10458 err = alc_auto_add_mic_boost(codec);
10462 store_pin_configs(codec);
10466 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10467 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10468 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10469 #define alc262_auto_init_input_src alc882_auto_init_input_src
10472 /* init callback for auto-configuration model -- overriding the default init */
10473 static void alc262_auto_init(struct hda_codec *codec)
10475 struct alc_spec *spec = codec->spec;
10476 alc262_auto_init_multi_out(codec);
10477 alc262_auto_init_hp_out(codec);
10478 alc262_auto_init_analog_input(codec);
10479 alc262_auto_init_input_src(codec);
10480 if (spec->unsol_event)
10481 alc_inithook(codec);
10485 * configuration and preset
10487 static const char *alc262_models[ALC262_MODEL_LAST] = {
10488 [ALC262_BASIC] = "basic",
10489 [ALC262_HIPPO] = "hippo",
10490 [ALC262_HIPPO_1] = "hippo_1",
10491 [ALC262_FUJITSU] = "fujitsu",
10492 [ALC262_HP_BPC] = "hp-bpc",
10493 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10494 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10495 [ALC262_HP_RP5700] = "hp-rp5700",
10496 [ALC262_BENQ_ED8] = "benq",
10497 [ALC262_BENQ_T31] = "benq-t31",
10498 [ALC262_SONY_ASSAMD] = "sony-assamd",
10499 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10500 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10501 [ALC262_ULTRA] = "ultra",
10502 [ALC262_LENOVO_3000] = "lenovo-3000",
10503 [ALC262_NEC] = "nec",
10504 [ALC262_AUTO] = "auto",
10507 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10508 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10509 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10510 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10511 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10512 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10513 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10514 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10515 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10516 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10517 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10518 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10519 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10520 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10521 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10522 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10523 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10524 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10525 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10526 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10527 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10528 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10529 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10530 ALC262_HP_TC_T5735),
10531 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10532 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10533 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10534 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10535 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10536 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10537 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10538 ALC262_TOSHIBA_RX1),
10539 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10540 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10541 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10542 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10543 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10544 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10545 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10546 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10547 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10551 static struct alc_config_preset alc262_presets[] = {
10553 .mixers = { alc262_base_mixer },
10554 .init_verbs = { alc262_init_verbs },
10555 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10556 .dac_nids = alc262_dac_nids,
10558 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10559 .channel_mode = alc262_modes,
10560 .input_mux = &alc262_capture_source,
10563 .mixers = { alc262_base_mixer },
10564 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10565 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10566 .dac_nids = alc262_dac_nids,
10568 .dig_out_nid = ALC262_DIGOUT_NID,
10569 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10570 .channel_mode = alc262_modes,
10571 .input_mux = &alc262_capture_source,
10572 .unsol_event = alc262_hippo_unsol_event,
10573 .init_hook = alc262_hippo_automute,
10575 [ALC262_HIPPO_1] = {
10576 .mixers = { alc262_hippo1_mixer },
10577 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10578 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10579 .dac_nids = alc262_dac_nids,
10581 .dig_out_nid = ALC262_DIGOUT_NID,
10582 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10583 .channel_mode = alc262_modes,
10584 .input_mux = &alc262_capture_source,
10585 .unsol_event = alc262_hippo1_unsol_event,
10586 .init_hook = alc262_hippo1_automute,
10588 [ALC262_FUJITSU] = {
10589 .mixers = { alc262_fujitsu_mixer },
10590 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10591 alc262_fujitsu_unsol_verbs },
10592 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10593 .dac_nids = alc262_dac_nids,
10595 .dig_out_nid = ALC262_DIGOUT_NID,
10596 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10597 .channel_mode = alc262_modes,
10598 .input_mux = &alc262_fujitsu_capture_source,
10599 .unsol_event = alc262_fujitsu_unsol_event,
10600 .init_hook = alc262_fujitsu_init_hook,
10602 [ALC262_HP_BPC] = {
10603 .mixers = { alc262_HP_BPC_mixer },
10604 .init_verbs = { alc262_HP_BPC_init_verbs },
10605 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10606 .dac_nids = alc262_dac_nids,
10608 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10609 .channel_mode = alc262_modes,
10610 .input_mux = &alc262_HP_capture_source,
10611 .unsol_event = alc262_hp_bpc_unsol_event,
10612 .init_hook = alc262_hp_bpc_automute,
10614 [ALC262_HP_BPC_D7000_WF] = {
10615 .mixers = { alc262_HP_BPC_WildWest_mixer },
10616 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10617 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10618 .dac_nids = alc262_dac_nids,
10620 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10621 .channel_mode = alc262_modes,
10622 .input_mux = &alc262_HP_D7000_capture_source,
10623 .unsol_event = alc262_hp_wildwest_unsol_event,
10624 .init_hook = alc262_hp_wildwest_automute,
10626 [ALC262_HP_BPC_D7000_WL] = {
10627 .mixers = { alc262_HP_BPC_WildWest_mixer,
10628 alc262_HP_BPC_WildWest_option_mixer },
10629 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10630 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10631 .dac_nids = alc262_dac_nids,
10633 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10634 .channel_mode = alc262_modes,
10635 .input_mux = &alc262_HP_D7000_capture_source,
10636 .unsol_event = alc262_hp_wildwest_unsol_event,
10637 .init_hook = alc262_hp_wildwest_automute,
10639 [ALC262_HP_TC_T5735] = {
10640 .mixers = { alc262_hp_t5735_mixer },
10641 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10642 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10643 .dac_nids = alc262_dac_nids,
10645 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10646 .channel_mode = alc262_modes,
10647 .input_mux = &alc262_capture_source,
10648 .unsol_event = alc262_hp_t5735_unsol_event,
10649 .init_hook = alc262_hp_t5735_init_hook,
10651 [ALC262_HP_RP5700] = {
10652 .mixers = { alc262_hp_rp5700_mixer },
10653 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10654 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10655 .dac_nids = alc262_dac_nids,
10656 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10657 .channel_mode = alc262_modes,
10658 .input_mux = &alc262_hp_rp5700_capture_source,
10660 [ALC262_BENQ_ED8] = {
10661 .mixers = { alc262_base_mixer },
10662 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10663 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10664 .dac_nids = alc262_dac_nids,
10666 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10667 .channel_mode = alc262_modes,
10668 .input_mux = &alc262_capture_source,
10670 [ALC262_SONY_ASSAMD] = {
10671 .mixers = { alc262_sony_mixer },
10672 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10673 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10674 .dac_nids = alc262_dac_nids,
10676 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10677 .channel_mode = alc262_modes,
10678 .input_mux = &alc262_capture_source,
10679 .unsol_event = alc262_hippo_unsol_event,
10680 .init_hook = alc262_hippo_automute,
10682 [ALC262_BENQ_T31] = {
10683 .mixers = { alc262_benq_t31_mixer },
10684 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10685 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10686 .dac_nids = alc262_dac_nids,
10688 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10689 .channel_mode = alc262_modes,
10690 .input_mux = &alc262_capture_source,
10691 .unsol_event = alc262_hippo_unsol_event,
10692 .init_hook = alc262_hippo_automute,
10695 .mixers = { alc262_ultra_mixer },
10696 .cap_mixer = alc262_ultra_capture_mixer,
10697 .init_verbs = { alc262_ultra_verbs },
10698 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10699 .dac_nids = alc262_dac_nids,
10700 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10701 .channel_mode = alc262_modes,
10702 .input_mux = &alc262_ultra_capture_source,
10703 .adc_nids = alc262_adc_nids, /* ADC0 */
10704 .capsrc_nids = alc262_capsrc_nids,
10705 .num_adc_nids = 1, /* single ADC */
10706 .unsol_event = alc262_ultra_unsol_event,
10707 .init_hook = alc262_ultra_automute,
10709 [ALC262_LENOVO_3000] = {
10710 .mixers = { alc262_lenovo_3000_mixer },
10711 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10712 alc262_lenovo_3000_unsol_verbs },
10713 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10714 .dac_nids = alc262_dac_nids,
10716 .dig_out_nid = ALC262_DIGOUT_NID,
10717 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10718 .channel_mode = alc262_modes,
10719 .input_mux = &alc262_fujitsu_capture_source,
10720 .unsol_event = alc262_lenovo_3000_unsol_event,
10723 .mixers = { alc262_nec_mixer },
10724 .init_verbs = { alc262_nec_verbs },
10725 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10726 .dac_nids = alc262_dac_nids,
10728 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10729 .channel_mode = alc262_modes,
10730 .input_mux = &alc262_capture_source,
10732 [ALC262_TOSHIBA_S06] = {
10733 .mixers = { alc262_toshiba_s06_mixer },
10734 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10735 alc262_eapd_verbs },
10736 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10737 .capsrc_nids = alc262_dmic_capsrc_nids,
10738 .dac_nids = alc262_dac_nids,
10739 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10740 .dig_out_nid = ALC262_DIGOUT_NID,
10741 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10742 .channel_mode = alc262_modes,
10743 .input_mux = &alc262_dmic_capture_source,
10744 .unsol_event = alc262_toshiba_s06_unsol_event,
10745 .init_hook = alc262_toshiba_s06_init_hook,
10747 [ALC262_TOSHIBA_RX1] = {
10748 .mixers = { alc262_toshiba_rx1_mixer },
10749 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10750 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10751 .dac_nids = alc262_dac_nids,
10753 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10754 .channel_mode = alc262_modes,
10755 .input_mux = &alc262_capture_source,
10756 .unsol_event = alc262_hippo_unsol_event,
10757 .init_hook = alc262_hippo_automute,
10761 static int patch_alc262(struct hda_codec *codec)
10763 struct alc_spec *spec;
10767 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10771 codec->spec = spec;
10773 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10778 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10779 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10780 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10781 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10785 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10787 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10791 if (board_config < 0) {
10792 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10793 "trying auto-probe from BIOS...\n");
10794 board_config = ALC262_AUTO;
10797 if (board_config == ALC262_AUTO) {
10798 /* automatic parse from the BIOS config */
10799 err = alc262_parse_auto_config(codec);
10805 "hda_codec: Cannot set up configuration "
10806 "from BIOS. Using base mode...\n");
10807 board_config = ALC262_BASIC;
10811 if (board_config != ALC262_AUTO)
10812 setup_preset(spec, &alc262_presets[board_config]);
10814 spec->stream_name_analog = "ALC262 Analog";
10815 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10816 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10818 spec->stream_name_digital = "ALC262 Digital";
10819 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10820 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10822 spec->is_mix_capture = 1;
10823 if (!spec->adc_nids && spec->input_mux) {
10824 /* check whether NID 0x07 is valid */
10825 unsigned int wcap = get_wcaps(codec, 0x07);
10828 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10829 if (wcap != AC_WID_AUD_IN) {
10830 spec->adc_nids = alc262_adc_nids_alt;
10831 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10832 spec->capsrc_nids = alc262_capsrc_nids_alt;
10834 spec->adc_nids = alc262_adc_nids;
10835 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10836 spec->capsrc_nids = alc262_capsrc_nids;
10839 if (!spec->cap_mixer)
10840 set_capture_mixer(spec);
10842 spec->vmaster_nid = 0x0c;
10844 codec->patch_ops = alc_patch_ops;
10845 if (board_config == ALC262_AUTO)
10846 spec->init_hook = alc262_auto_init;
10847 #ifdef CONFIG_SND_HDA_POWER_SAVE
10848 if (!spec->loopback.amplist)
10849 spec->loopback.amplist = alc262_loopbacks;
10856 * ALC268 channel source setting (2 channel)
10858 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10859 #define alc268_modes alc260_modes
10861 static hda_nid_t alc268_dac_nids[2] = {
10866 static hda_nid_t alc268_adc_nids[2] = {
10871 static hda_nid_t alc268_adc_nids_alt[1] = {
10876 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10878 static struct snd_kcontrol_new alc268_base_mixer[] = {
10879 /* output mixer control */
10880 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10881 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10882 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10883 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10885 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10886 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10890 /* bind Beep switches of both NID 0x0f and 0x10 */
10891 static struct hda_bind_ctls alc268_bind_beep_sw = {
10892 .ops = &snd_hda_bind_sw,
10894 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10895 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10900 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10901 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10902 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10906 static struct hda_verb alc268_eapd_verbs[] = {
10907 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10908 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10912 /* Toshiba specific */
10913 #define alc268_toshiba_automute alc262_hippo_automute
10915 static struct hda_verb alc268_toshiba_verbs[] = {
10916 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10920 static struct hda_input_mux alc268_acer_lc_capture_source = {
10928 /* Acer specific */
10929 /* bind volumes of both NID 0x02 and 0x03 */
10930 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10931 .ops = &snd_hda_bind_vol,
10933 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10934 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10939 /* mute/unmute internal speaker according to the hp jack and mute state */
10940 static void alc268_acer_automute(struct hda_codec *codec, int force)
10942 struct alc_spec *spec = codec->spec;
10945 if (force || !spec->sense_updated) {
10946 unsigned int present;
10947 present = snd_hda_codec_read(codec, 0x14, 0,
10948 AC_VERB_GET_PIN_SENSE, 0);
10949 spec->jack_present = (present & 0x80000000) != 0;
10950 spec->sense_updated = 1;
10952 if (spec->jack_present)
10953 mute = HDA_AMP_MUTE; /* mute internal speaker */
10954 else /* unmute internal speaker if necessary */
10955 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10956 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10957 HDA_AMP_MUTE, mute);
10961 /* bind hp and internal speaker mute (with plug check) */
10962 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10963 struct snd_ctl_elem_value *ucontrol)
10965 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10966 long *valp = ucontrol->value.integer.value;
10969 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10971 valp[0] ? 0 : HDA_AMP_MUTE);
10972 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10974 valp[1] ? 0 : HDA_AMP_MUTE);
10976 alc268_acer_automute(codec, 0);
10980 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10981 /* output mixer control */
10982 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10984 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10985 .name = "Master Playback Switch",
10986 .info = snd_hda_mixer_amp_switch_info,
10987 .get = snd_hda_mixer_amp_switch_get,
10988 .put = alc268_acer_master_sw_put,
10989 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10991 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10995 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10996 /* output mixer control */
10997 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11000 .name = "Master Playback Switch",
11001 .info = snd_hda_mixer_amp_switch_info,
11002 .get = snd_hda_mixer_amp_switch_get,
11003 .put = alc268_acer_master_sw_put,
11004 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11006 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11007 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11008 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11012 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11013 /* output mixer control */
11014 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11016 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11017 .name = "Master Playback Switch",
11018 .info = snd_hda_mixer_amp_switch_info,
11019 .get = snd_hda_mixer_amp_switch_get,
11020 .put = alc268_acer_master_sw_put,
11021 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11023 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11024 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11028 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11029 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11030 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11031 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11032 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11033 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11038 static struct hda_verb alc268_acer_verbs[] = {
11039 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11040 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11041 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11042 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11043 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11044 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11045 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11049 /* unsolicited event for HP jack sensing */
11050 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11053 if ((res >> 26) != ALC880_HP_EVENT)
11055 alc268_toshiba_automute(codec);
11058 static void alc268_acer_unsol_event(struct hda_codec *codec,
11061 if ((res >> 26) != ALC880_HP_EVENT)
11063 alc268_acer_automute(codec, 1);
11066 static void alc268_acer_init_hook(struct hda_codec *codec)
11068 alc268_acer_automute(codec, 1);
11071 /* toggle speaker-output according to the hp-jack state */
11072 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11074 unsigned int present;
11075 unsigned char bits;
11077 present = snd_hda_codec_read(codec, 0x15, 0,
11078 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11079 bits = present ? AMP_IN_MUTE(0) : 0;
11080 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11081 AMP_IN_MUTE(0), bits);
11082 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11083 AMP_IN_MUTE(0), bits);
11087 static void alc268_acer_mic_automute(struct hda_codec *codec)
11089 unsigned int present;
11091 present = snd_hda_codec_read(codec, 0x18, 0,
11092 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11093 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11094 present ? 0x0 : 0x6);
11097 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11100 if ((res >> 26) == ALC880_HP_EVENT)
11101 alc268_aspire_one_speaker_automute(codec);
11102 if ((res >> 26) == ALC880_MIC_EVENT)
11103 alc268_acer_mic_automute(codec);
11106 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11108 alc268_aspire_one_speaker_automute(codec);
11109 alc268_acer_mic_automute(codec);
11112 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11113 /* output mixer control */
11114 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11115 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11116 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11118 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11119 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11123 static struct hda_verb alc268_dell_verbs[] = {
11124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11125 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11126 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11130 /* mute/unmute internal speaker according to the hp jack and mute state */
11131 static void alc268_dell_automute(struct hda_codec *codec)
11133 unsigned int present;
11136 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11137 if (present & 0x80000000)
11138 mute = HDA_AMP_MUTE;
11140 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11141 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11142 HDA_AMP_MUTE, mute);
11145 static void alc268_dell_unsol_event(struct hda_codec *codec,
11148 if ((res >> 26) != ALC880_HP_EVENT)
11150 alc268_dell_automute(codec);
11153 #define alc268_dell_init_hook alc268_dell_automute
11155 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11156 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11157 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11158 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11160 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11161 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11162 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11163 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11167 static struct hda_verb alc267_quanta_il1_verbs[] = {
11168 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11169 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11173 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11175 unsigned int present;
11177 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11178 & AC_PINSENSE_PRESENCE;
11179 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11180 present ? 0 : PIN_OUT);
11183 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11185 unsigned int present;
11187 present = snd_hda_codec_read(codec, 0x18, 0,
11188 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11189 snd_hda_codec_write(codec, 0x23, 0,
11190 AC_VERB_SET_CONNECT_SEL,
11191 present ? 0x00 : 0x01);
11194 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11196 alc267_quanta_il1_hp_automute(codec);
11197 alc267_quanta_il1_mic_automute(codec);
11200 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11203 switch (res >> 26) {
11204 case ALC880_HP_EVENT:
11205 alc267_quanta_il1_hp_automute(codec);
11207 case ALC880_MIC_EVENT:
11208 alc267_quanta_il1_mic_automute(codec);
11214 * generic initialization of ADC, input mixers and output mixers
11216 static struct hda_verb alc268_base_init_verbs[] = {
11217 /* Unmute DAC0-1 and set vol = 0 */
11218 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11219 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11220 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11221 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11222 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11223 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11226 * Set up output mixers (0x0c - 0x0e)
11228 /* set vol=0 to output mixers */
11229 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11230 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11231 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11232 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11234 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11235 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11238 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11239 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11240 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11241 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11242 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11243 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11244 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11246 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11248 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11249 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11251 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11252 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11254 /* set PCBEEP vol = 0, mute connections */
11255 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11256 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11257 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11259 /* Unmute Selector 23h,24h and set the default input to mic-in */
11261 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11263 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11270 * generic initialization of ADC, input mixers and output mixers
11272 static struct hda_verb alc268_volume_init_verbs[] = {
11273 /* set output DAC */
11274 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11275 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11276 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11277 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11279 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11280 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11281 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11282 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11283 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11285 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11287 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11288 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11289 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11292 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11293 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11294 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11296 /* set PCBEEP vol = 0, mute connections */
11297 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11298 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11299 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11304 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11305 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11306 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11308 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11309 /* The multiple "Capture Source" controls confuse alsamixer
11310 * So call somewhat different..
11312 /* .name = "Capture Source", */
11313 .name = "Input Source",
11315 .info = alc_mux_enum_info,
11316 .get = alc_mux_enum_get,
11317 .put = alc_mux_enum_put,
11322 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11323 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11324 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11325 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11326 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11328 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11329 /* The multiple "Capture Source" controls confuse alsamixer
11330 * So call somewhat different..
11332 /* .name = "Capture Source", */
11333 .name = "Input Source",
11335 .info = alc_mux_enum_info,
11336 .get = alc_mux_enum_get,
11337 .put = alc_mux_enum_put,
11342 static struct hda_input_mux alc268_capture_source = {
11346 { "Front Mic", 0x1 },
11352 static struct hda_input_mux alc268_acer_capture_source = {
11356 { "Internal Mic", 0x1 },
11361 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11365 { "Internal Mic", 0x6 },
11370 #ifdef CONFIG_SND_DEBUG
11371 static struct snd_kcontrol_new alc268_test_mixer[] = {
11372 /* Volume widgets */
11373 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11374 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11375 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11376 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11377 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11378 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11379 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11380 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11381 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11382 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11383 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11384 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11385 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11386 /* The below appears problematic on some hardwares */
11387 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11388 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11389 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11390 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11391 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11393 /* Modes for retasking pin widgets */
11394 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11395 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11396 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11397 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11399 /* Controls for GPIO pins, assuming they are configured as outputs */
11400 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11401 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11402 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11403 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11405 /* Switches to allow the digital SPDIF output pin to be enabled.
11406 * The ALC268 does not have an SPDIF input.
11408 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11410 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11411 * this output to turn on an external amplifier.
11413 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11414 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11420 /* create input playback/capture controls for the given pin */
11421 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11422 const char *ctlname, int idx)
11427 sprintf(name, "%s Playback Volume", ctlname);
11429 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11430 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11434 } else if (nid == 0x15) {
11435 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11436 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11442 sprintf(name, "%s Playback Switch", ctlname);
11443 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11444 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11450 /* add playback controls from the parsed DAC table */
11451 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11452 const struct auto_pin_cfg *cfg)
11457 spec->multiout.num_dacs = 2; /* only use one dac */
11458 spec->multiout.dac_nids = spec->private_dac_nids;
11459 spec->multiout.dac_nids[0] = 2;
11460 spec->multiout.dac_nids[1] = 3;
11462 nid = cfg->line_out_pins[0];
11464 alc268_new_analog_output(spec, nid, "Front", 0);
11466 nid = cfg->speaker_pins[0];
11468 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11469 "Speaker Playback Volume",
11470 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11474 nid = cfg->hp_pins[0];
11476 alc268_new_analog_output(spec, nid, "Headphone", 0);
11478 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11480 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11481 "Mono Playback Switch",
11482 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11489 /* create playback/capture controls for input pins */
11490 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11491 const struct auto_pin_cfg *cfg)
11493 struct hda_input_mux *imux = &spec->private_imux;
11496 for (i = 0; i < AUTO_PIN_LAST; i++) {
11497 switch(cfg->input_pins[i]) {
11499 idx1 = 0; /* Mic 1 */
11502 idx1 = 1; /* Mic 2 */
11505 idx1 = 2; /* Line In */
11512 idx1 = 6; /* digital mics */
11517 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11518 imux->items[imux->num_items].index = idx1;
11524 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11526 struct alc_spec *spec = codec->spec;
11527 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11528 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11529 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11530 unsigned int dac_vol1, dac_vol2;
11533 snd_hda_codec_write(codec, speaker_nid, 0,
11534 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11535 snd_hda_codec_write(codec, 0x0f, 0,
11536 AC_VERB_SET_AMP_GAIN_MUTE,
11538 snd_hda_codec_write(codec, 0x10, 0,
11539 AC_VERB_SET_AMP_GAIN_MUTE,
11542 snd_hda_codec_write(codec, 0x0f, 0,
11543 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11544 snd_hda_codec_write(codec, 0x10, 0,
11545 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11548 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11549 if (line_nid == 0x14)
11550 dac_vol2 = AMP_OUT_ZERO;
11551 else if (line_nid == 0x15)
11552 dac_vol1 = AMP_OUT_ZERO;
11553 if (hp_nid == 0x14)
11554 dac_vol2 = AMP_OUT_ZERO;
11555 else if (hp_nid == 0x15)
11556 dac_vol1 = AMP_OUT_ZERO;
11557 if (line_nid != 0x16 || hp_nid != 0x16 ||
11558 spec->autocfg.line_out_pins[1] != 0x16 ||
11559 spec->autocfg.line_out_pins[2] != 0x16)
11560 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11562 snd_hda_codec_write(codec, 0x02, 0,
11563 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11564 snd_hda_codec_write(codec, 0x03, 0,
11565 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11568 /* pcm configuration: identiacal with ALC880 */
11569 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11570 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11571 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11572 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11575 * BIOS auto configuration
11577 static int alc268_parse_auto_config(struct hda_codec *codec)
11579 struct alc_spec *spec = codec->spec;
11581 static hda_nid_t alc268_ignore[] = { 0 };
11583 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11587 if (!spec->autocfg.line_outs)
11588 return 0; /* can't find valid BIOS pin config */
11590 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11593 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11597 spec->multiout.max_channels = 2;
11599 /* digital only support output */
11600 if (spec->autocfg.dig_out_pin)
11601 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11603 if (spec->kctls.list)
11604 add_mixer(spec, spec->kctls.list);
11606 if (spec->autocfg.speaker_pins[0] != 0x1d)
11607 add_mixer(spec, alc268_beep_mixer);
11609 add_verb(spec, alc268_volume_init_verbs);
11610 spec->num_mux_defs = 1;
11611 spec->input_mux = &spec->private_imux;
11613 err = alc_auto_add_mic_boost(codec);
11617 store_pin_configs(codec);
11621 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11622 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11623 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11625 /* init callback for auto-configuration model -- overriding the default init */
11626 static void alc268_auto_init(struct hda_codec *codec)
11628 struct alc_spec *spec = codec->spec;
11629 alc268_auto_init_multi_out(codec);
11630 alc268_auto_init_hp_out(codec);
11631 alc268_auto_init_mono_speaker_out(codec);
11632 alc268_auto_init_analog_input(codec);
11633 if (spec->unsol_event)
11634 alc_inithook(codec);
11638 * configuration and preset
11640 static const char *alc268_models[ALC268_MODEL_LAST] = {
11641 [ALC267_QUANTA_IL1] = "quanta-il1",
11642 [ALC268_3ST] = "3stack",
11643 [ALC268_TOSHIBA] = "toshiba",
11644 [ALC268_ACER] = "acer",
11645 [ALC268_ACER_DMIC] = "acer-dmic",
11646 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11647 [ALC268_DELL] = "dell",
11648 [ALC268_ZEPTO] = "zepto",
11649 #ifdef CONFIG_SND_DEBUG
11650 [ALC268_TEST] = "test",
11652 [ALC268_AUTO] = "auto",
11655 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11656 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11657 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11658 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11659 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11660 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11661 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11662 ALC268_ACER_ASPIRE_ONE),
11663 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11664 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11665 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11666 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11667 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11668 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11669 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11670 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11671 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11672 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11676 static struct alc_config_preset alc268_presets[] = {
11677 [ALC267_QUANTA_IL1] = {
11678 .mixers = { alc267_quanta_il1_mixer },
11679 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11680 alc267_quanta_il1_verbs },
11681 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11682 .dac_nids = alc268_dac_nids,
11683 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11684 .adc_nids = alc268_adc_nids_alt,
11686 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11687 .channel_mode = alc268_modes,
11688 .input_mux = &alc268_capture_source,
11689 .unsol_event = alc267_quanta_il1_unsol_event,
11690 .init_hook = alc267_quanta_il1_automute,
11693 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11694 alc268_beep_mixer },
11695 .init_verbs = { alc268_base_init_verbs },
11696 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11697 .dac_nids = alc268_dac_nids,
11698 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11699 .adc_nids = alc268_adc_nids_alt,
11700 .capsrc_nids = alc268_capsrc_nids,
11702 .dig_out_nid = ALC268_DIGOUT_NID,
11703 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11704 .channel_mode = alc268_modes,
11705 .input_mux = &alc268_capture_source,
11707 [ALC268_TOSHIBA] = {
11708 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11709 alc268_beep_mixer },
11710 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11711 alc268_toshiba_verbs },
11712 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11713 .dac_nids = alc268_dac_nids,
11714 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11715 .adc_nids = alc268_adc_nids_alt,
11716 .capsrc_nids = alc268_capsrc_nids,
11718 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11719 .channel_mode = alc268_modes,
11720 .input_mux = &alc268_capture_source,
11721 .unsol_event = alc268_toshiba_unsol_event,
11722 .init_hook = alc268_toshiba_automute,
11725 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11726 alc268_beep_mixer },
11727 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11728 alc268_acer_verbs },
11729 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11730 .dac_nids = alc268_dac_nids,
11731 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11732 .adc_nids = alc268_adc_nids_alt,
11733 .capsrc_nids = alc268_capsrc_nids,
11735 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11736 .channel_mode = alc268_modes,
11737 .input_mux = &alc268_acer_capture_source,
11738 .unsol_event = alc268_acer_unsol_event,
11739 .init_hook = alc268_acer_init_hook,
11741 [ALC268_ACER_DMIC] = {
11742 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11743 alc268_beep_mixer },
11744 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11745 alc268_acer_verbs },
11746 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11747 .dac_nids = alc268_dac_nids,
11748 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11749 .adc_nids = alc268_adc_nids_alt,
11750 .capsrc_nids = alc268_capsrc_nids,
11752 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11753 .channel_mode = alc268_modes,
11754 .input_mux = &alc268_acer_dmic_capture_source,
11755 .unsol_event = alc268_acer_unsol_event,
11756 .init_hook = alc268_acer_init_hook,
11758 [ALC268_ACER_ASPIRE_ONE] = {
11759 .mixers = { alc268_acer_aspire_one_mixer,
11760 alc268_capture_alt_mixer },
11761 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11762 alc268_acer_aspire_one_verbs },
11763 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11764 .dac_nids = alc268_dac_nids,
11765 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11766 .adc_nids = alc268_adc_nids_alt,
11767 .capsrc_nids = alc268_capsrc_nids,
11769 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11770 .channel_mode = alc268_modes,
11771 .input_mux = &alc268_acer_lc_capture_source,
11772 .unsol_event = alc268_acer_lc_unsol_event,
11773 .init_hook = alc268_acer_lc_init_hook,
11776 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11777 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11778 alc268_dell_verbs },
11779 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11780 .dac_nids = alc268_dac_nids,
11782 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11783 .channel_mode = alc268_modes,
11784 .unsol_event = alc268_dell_unsol_event,
11785 .init_hook = alc268_dell_init_hook,
11786 .input_mux = &alc268_capture_source,
11789 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11790 alc268_beep_mixer },
11791 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11792 alc268_toshiba_verbs },
11793 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11794 .dac_nids = alc268_dac_nids,
11795 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11796 .adc_nids = alc268_adc_nids_alt,
11797 .capsrc_nids = alc268_capsrc_nids,
11799 .dig_out_nid = ALC268_DIGOUT_NID,
11800 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11801 .channel_mode = alc268_modes,
11802 .input_mux = &alc268_capture_source,
11803 .unsol_event = alc268_toshiba_unsol_event,
11804 .init_hook = alc268_toshiba_automute
11806 #ifdef CONFIG_SND_DEBUG
11808 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11809 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11810 alc268_volume_init_verbs },
11811 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11812 .dac_nids = alc268_dac_nids,
11813 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11814 .adc_nids = alc268_adc_nids_alt,
11815 .capsrc_nids = alc268_capsrc_nids,
11817 .dig_out_nid = ALC268_DIGOUT_NID,
11818 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11819 .channel_mode = alc268_modes,
11820 .input_mux = &alc268_capture_source,
11825 static int patch_alc268(struct hda_codec *codec)
11827 struct alc_spec *spec;
11831 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11835 codec->spec = spec;
11837 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11841 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11842 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11843 "trying auto-probe from BIOS...\n");
11844 board_config = ALC268_AUTO;
11847 if (board_config == ALC268_AUTO) {
11848 /* automatic parse from the BIOS config */
11849 err = alc268_parse_auto_config(codec);
11855 "hda_codec: Cannot set up configuration "
11856 "from BIOS. Using base mode...\n");
11857 board_config = ALC268_3ST;
11861 if (board_config != ALC268_AUTO)
11862 setup_preset(spec, &alc268_presets[board_config]);
11864 if (codec->vendor_id == 0x10ec0267) {
11865 spec->stream_name_analog = "ALC267 Analog";
11866 spec->stream_name_digital = "ALC267 Digital";
11868 spec->stream_name_analog = "ALC268 Analog";
11869 spec->stream_name_digital = "ALC268 Digital";
11872 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11873 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11874 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11876 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11878 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11879 /* override the amp caps for beep generator */
11880 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11881 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11882 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11883 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11884 (0 << AC_AMPCAP_MUTE_SHIFT));
11886 if (!spec->adc_nids && spec->input_mux) {
11887 /* check whether NID 0x07 is valid */
11888 unsigned int wcap = get_wcaps(codec, 0x07);
11892 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11893 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11894 spec->adc_nids = alc268_adc_nids_alt;
11895 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11896 add_mixer(spec, alc268_capture_alt_mixer);
11898 spec->adc_nids = alc268_adc_nids;
11899 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11900 add_mixer(spec, alc268_capture_mixer);
11902 spec->capsrc_nids = alc268_capsrc_nids;
11903 /* set default input source */
11904 for (i = 0; i < spec->num_adc_nids; i++)
11905 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11906 0, AC_VERB_SET_CONNECT_SEL,
11907 spec->input_mux->items[0].index);
11910 spec->vmaster_nid = 0x02;
11912 codec->patch_ops = alc_patch_ops;
11913 if (board_config == ALC268_AUTO)
11914 spec->init_hook = alc268_auto_init;
11920 * ALC269 channel source setting (2 channel)
11922 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11924 #define alc269_dac_nids alc260_dac_nids
11926 static hda_nid_t alc269_adc_nids[1] = {
11931 static hda_nid_t alc269_capsrc_nids[1] = {
11935 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11939 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11947 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11955 #define alc269_modes alc260_modes
11956 #define alc269_capture_source alc880_lg_lw_capture_source
11958 static struct snd_kcontrol_new alc269_base_mixer[] = {
11959 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11960 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11961 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11962 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11964 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11965 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11966 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11967 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11968 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11969 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11970 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11971 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11972 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11976 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11977 /* output mixer control */
11978 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11980 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11981 .name = "Master Playback Switch",
11982 .info = snd_hda_mixer_amp_switch_info,
11983 .get = snd_hda_mixer_amp_switch_get,
11984 .put = alc268_acer_master_sw_put,
11985 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11989 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11990 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11991 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11992 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11993 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11994 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11998 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
11999 /* output mixer control */
12000 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12002 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12003 .name = "Master Playback Switch",
12004 .info = snd_hda_mixer_amp_switch_info,
12005 .get = snd_hda_mixer_amp_switch_get,
12006 .put = alc268_acer_master_sw_put,
12007 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12012 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12013 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12014 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12015 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12016 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12017 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12018 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12019 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12023 /* bind volumes of both NID 0x0c and 0x0d */
12024 static struct hda_bind_ctls alc269_epc_bind_vol = {
12025 .ops = &snd_hda_bind_vol,
12027 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12028 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12033 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12034 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12035 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12036 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12040 /* capture mixer elements */
12041 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12042 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12043 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12044 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12049 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12050 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12051 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12052 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12057 static struct snd_kcontrol_new alc269_beep_mixer[] = {
12058 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12059 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12063 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12064 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12065 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12067 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12068 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12069 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12073 static struct hda_verb alc269_lifebook_verbs[] = {
12074 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12075 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12076 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12077 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12078 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12080 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12081 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12082 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12083 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12087 /* toggle speaker-output according to the hp-jack state */
12088 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12090 unsigned int present;
12091 unsigned char bits;
12093 present = snd_hda_codec_read(codec, 0x15, 0,
12094 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12095 bits = present ? AMP_IN_MUTE(0) : 0;
12096 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12097 AMP_IN_MUTE(0), bits);
12098 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12099 AMP_IN_MUTE(0), bits);
12101 snd_hda_codec_write(codec, 0x20, 0,
12102 AC_VERB_SET_COEF_INDEX, 0x0c);
12103 snd_hda_codec_write(codec, 0x20, 0,
12104 AC_VERB_SET_PROC_COEF, 0x680);
12106 snd_hda_codec_write(codec, 0x20, 0,
12107 AC_VERB_SET_COEF_INDEX, 0x0c);
12108 snd_hda_codec_write(codec, 0x20, 0,
12109 AC_VERB_SET_PROC_COEF, 0x480);
12112 /* toggle speaker-output according to the hp-jacks state */
12113 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12115 unsigned int present;
12116 unsigned char bits;
12118 /* Check laptop headphone socket */
12119 present = snd_hda_codec_read(codec, 0x15, 0,
12120 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12122 /* Check port replicator headphone socket */
12123 present |= snd_hda_codec_read(codec, 0x1a, 0,
12124 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12126 bits = present ? AMP_IN_MUTE(0) : 0;
12127 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12128 AMP_IN_MUTE(0), bits);
12129 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12130 AMP_IN_MUTE(0), bits);
12132 snd_hda_codec_write(codec, 0x20, 0,
12133 AC_VERB_SET_COEF_INDEX, 0x0c);
12134 snd_hda_codec_write(codec, 0x20, 0,
12135 AC_VERB_SET_PROC_COEF, 0x680);
12137 snd_hda_codec_write(codec, 0x20, 0,
12138 AC_VERB_SET_COEF_INDEX, 0x0c);
12139 snd_hda_codec_write(codec, 0x20, 0,
12140 AC_VERB_SET_PROC_COEF, 0x480);
12143 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12145 unsigned int present;
12147 present = snd_hda_codec_read(codec, 0x18, 0,
12148 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12149 snd_hda_codec_write(codec, 0x23, 0,
12150 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12153 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12155 unsigned int present_laptop;
12156 unsigned int present_dock;
12158 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12159 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12161 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12162 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12164 /* Laptop mic port overrides dock mic port, design decision */
12166 snd_hda_codec_write(codec, 0x23, 0,
12167 AC_VERB_SET_CONNECT_SEL, 0x3);
12168 if (present_laptop)
12169 snd_hda_codec_write(codec, 0x23, 0,
12170 AC_VERB_SET_CONNECT_SEL, 0x0);
12171 if (!present_dock && !present_laptop)
12172 snd_hda_codec_write(codec, 0x23, 0,
12173 AC_VERB_SET_CONNECT_SEL, 0x1);
12176 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12179 if ((res >> 26) == ALC880_HP_EVENT)
12180 alc269_quanta_fl1_speaker_automute(codec);
12181 if ((res >> 26) == ALC880_MIC_EVENT)
12182 alc269_quanta_fl1_mic_automute(codec);
12185 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12188 if ((res >> 26) == ALC880_HP_EVENT)
12189 alc269_lifebook_speaker_automute(codec);
12190 if ((res >> 26) == ALC880_MIC_EVENT)
12191 alc269_lifebook_mic_autoswitch(codec);
12194 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12196 alc269_quanta_fl1_speaker_automute(codec);
12197 alc269_quanta_fl1_mic_automute(codec);
12200 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12202 alc269_lifebook_speaker_automute(codec);
12203 alc269_lifebook_mic_autoswitch(codec);
12206 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12207 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12208 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12209 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12210 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12211 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12212 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12213 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12217 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12218 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12219 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12220 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12221 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12222 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12223 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12227 /* toggle speaker-output according to the hp-jack state */
12228 static void alc269_speaker_automute(struct hda_codec *codec)
12230 unsigned int present;
12231 unsigned char bits;
12233 present = snd_hda_codec_read(codec, 0x15, 0,
12234 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12235 bits = present ? AMP_IN_MUTE(0) : 0;
12236 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12237 AMP_IN_MUTE(0), bits);
12238 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12239 AMP_IN_MUTE(0), bits);
12242 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12244 unsigned int present;
12246 present = snd_hda_codec_read(codec, 0x18, 0,
12247 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12248 snd_hda_codec_write(codec, 0x23, 0,
12249 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12252 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12254 unsigned int present;
12256 present = snd_hda_codec_read(codec, 0x18, 0,
12257 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12258 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12259 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12260 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12261 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12264 /* unsolicited event for HP jack sensing */
12265 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12268 if ((res >> 26) == ALC880_HP_EVENT)
12269 alc269_speaker_automute(codec);
12271 if ((res >> 26) == ALC880_MIC_EVENT)
12272 alc269_eeepc_dmic_automute(codec);
12275 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12277 alc269_speaker_automute(codec);
12278 alc269_eeepc_dmic_automute(codec);
12281 /* unsolicited event for HP jack sensing */
12282 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12285 if ((res >> 26) == ALC880_HP_EVENT)
12286 alc269_speaker_automute(codec);
12288 if ((res >> 26) == ALC880_MIC_EVENT)
12289 alc269_eeepc_amic_automute(codec);
12292 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12294 alc269_speaker_automute(codec);
12295 alc269_eeepc_amic_automute(codec);
12299 * generic initialization of ADC, input mixers and output mixers
12301 static struct hda_verb alc269_init_verbs[] = {
12303 * Unmute ADC0 and set the default input to mic-in
12305 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12307 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12308 * analog-loopback mixer widget
12309 * Note: PASD motherboards uses the Line In 2 as the input for
12310 * front panel mic (mic 2)
12312 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12320 * Set up output mixers (0x0c - 0x0e)
12322 /* set vol=0 to output mixers */
12323 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12324 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12326 /* set up input amps for analog loopback */
12327 /* Amp Indices: DAC = 0, mixer = 1 */
12328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12330 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12332 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12337 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12338 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12341 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12343 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12344 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12345 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12346 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12347 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12348 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12349 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12351 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12352 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12354 /* FIXME: use matrix-type input source selection */
12355 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12356 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12357 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12358 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12363 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12364 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12368 /* add playback controls from the parsed DAC table */
12369 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12370 const struct auto_pin_cfg *cfg)
12375 spec->multiout.num_dacs = 1; /* only use one dac */
12376 spec->multiout.dac_nids = spec->private_dac_nids;
12377 spec->multiout.dac_nids[0] = 2;
12379 nid = cfg->line_out_pins[0];
12381 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12382 "Front Playback Volume",
12383 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12386 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12387 "Front Playback Switch",
12388 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12393 nid = cfg->speaker_pins[0];
12395 if (!cfg->line_out_pins[0]) {
12396 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12397 "Speaker Playback Volume",
12398 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12404 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12405 "Speaker Playback Switch",
12406 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12411 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12412 "Speaker Playback Switch",
12413 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12419 nid = cfg->hp_pins[0];
12421 /* spec->multiout.hp_nid = 2; */
12422 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12423 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12424 "Headphone Playback Volume",
12425 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12431 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12432 "Headphone Playback Switch",
12433 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12438 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12439 "Headphone Playback Switch",
12440 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12449 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12450 const struct auto_pin_cfg *cfg)
12454 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12457 /* digital-mic input pin is excluded in alc880_auto_create..()
12458 * because it's under 0x18
12460 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12461 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12462 struct hda_input_mux *imux = &spec->private_imux;
12463 imux->items[imux->num_items].label = "Int Mic";
12464 imux->items[imux->num_items].index = 0x05;
12470 #ifdef CONFIG_SND_HDA_POWER_SAVE
12471 #define alc269_loopbacks alc880_loopbacks
12474 /* pcm configuration: identiacal with ALC880 */
12475 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12476 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12477 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12478 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12481 * BIOS auto configuration
12483 static int alc269_parse_auto_config(struct hda_codec *codec)
12485 struct alc_spec *spec = codec->spec;
12487 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12489 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12494 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12497 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12501 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12503 if (spec->autocfg.dig_out_pin)
12504 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12506 if (spec->kctls.list)
12507 add_mixer(spec, spec->kctls.list);
12509 /* create a beep mixer control if the pin 0x1d isn't assigned */
12510 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12511 if (spec->autocfg.input_pins[i] == 0x1d)
12513 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12514 add_mixer(spec, alc269_beep_mixer);
12516 add_verb(spec, alc269_init_verbs);
12517 spec->num_mux_defs = 1;
12518 spec->input_mux = &spec->private_imux;
12519 /* set default input source */
12520 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12521 0, AC_VERB_SET_CONNECT_SEL,
12522 spec->input_mux->items[0].index);
12524 err = alc_auto_add_mic_boost(codec);
12528 if (!spec->cap_mixer)
12529 set_capture_mixer(spec);
12531 store_pin_configs(codec);
12535 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12536 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12537 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12540 /* init callback for auto-configuration model -- overriding the default init */
12541 static void alc269_auto_init(struct hda_codec *codec)
12543 struct alc_spec *spec = codec->spec;
12544 alc269_auto_init_multi_out(codec);
12545 alc269_auto_init_hp_out(codec);
12546 alc269_auto_init_analog_input(codec);
12547 if (spec->unsol_event)
12548 alc_inithook(codec);
12552 * configuration and preset
12554 static const char *alc269_models[ALC269_MODEL_LAST] = {
12555 [ALC269_BASIC] = "basic",
12556 [ALC269_QUANTA_FL1] = "quanta",
12557 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12558 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12559 [ALC269_FUJITSU] = "fujitsu",
12560 [ALC269_LIFEBOOK] = "lifebook"
12563 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12564 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12565 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12566 ALC269_ASUS_EEEPC_P703),
12567 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12568 ALC269_ASUS_EEEPC_P901),
12569 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12570 ALC269_ASUS_EEEPC_P901),
12571 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12572 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12576 static struct alc_config_preset alc269_presets[] = {
12578 .mixers = { alc269_base_mixer },
12579 .init_verbs = { alc269_init_verbs },
12580 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12581 .dac_nids = alc269_dac_nids,
12583 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12584 .channel_mode = alc269_modes,
12585 .input_mux = &alc269_capture_source,
12587 [ALC269_QUANTA_FL1] = {
12588 .mixers = { alc269_quanta_fl1_mixer },
12589 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12590 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12591 .dac_nids = alc269_dac_nids,
12593 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12594 .channel_mode = alc269_modes,
12595 .input_mux = &alc269_capture_source,
12596 .unsol_event = alc269_quanta_fl1_unsol_event,
12597 .init_hook = alc269_quanta_fl1_init_hook,
12599 [ALC269_ASUS_EEEPC_P703] = {
12600 .mixers = { alc269_eeepc_mixer },
12601 .cap_mixer = alc269_epc_capture_mixer,
12602 .init_verbs = { alc269_init_verbs,
12603 alc269_eeepc_amic_init_verbs },
12604 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12605 .dac_nids = alc269_dac_nids,
12607 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12608 .channel_mode = alc269_modes,
12609 .input_mux = &alc269_eeepc_amic_capture_source,
12610 .unsol_event = alc269_eeepc_amic_unsol_event,
12611 .init_hook = alc269_eeepc_amic_inithook,
12613 [ALC269_ASUS_EEEPC_P901] = {
12614 .mixers = { alc269_eeepc_mixer },
12615 .cap_mixer = alc269_epc_capture_mixer,
12616 .init_verbs = { alc269_init_verbs,
12617 alc269_eeepc_dmic_init_verbs },
12618 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12619 .dac_nids = alc269_dac_nids,
12621 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12622 .channel_mode = alc269_modes,
12623 .input_mux = &alc269_eeepc_dmic_capture_source,
12624 .unsol_event = alc269_eeepc_dmic_unsol_event,
12625 .init_hook = alc269_eeepc_dmic_inithook,
12627 [ALC269_FUJITSU] = {
12628 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12629 .cap_mixer = alc269_epc_capture_mixer,
12630 .init_verbs = { alc269_init_verbs,
12631 alc269_eeepc_dmic_init_verbs },
12632 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12633 .dac_nids = alc269_dac_nids,
12635 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12636 .channel_mode = alc269_modes,
12637 .input_mux = &alc269_eeepc_dmic_capture_source,
12638 .unsol_event = alc269_eeepc_dmic_unsol_event,
12639 .init_hook = alc269_eeepc_dmic_inithook,
12641 [ALC269_LIFEBOOK] = {
12642 .mixers = { alc269_lifebook_mixer },
12643 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12644 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12645 .dac_nids = alc269_dac_nids,
12647 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12648 .channel_mode = alc269_modes,
12649 .input_mux = &alc269_capture_source,
12650 .unsol_event = alc269_lifebook_unsol_event,
12651 .init_hook = alc269_lifebook_init_hook,
12655 static int patch_alc269(struct hda_codec *codec)
12657 struct alc_spec *spec;
12661 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12665 codec->spec = spec;
12667 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12669 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12673 if (board_config < 0) {
12674 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12675 "trying auto-probe from BIOS...\n");
12676 board_config = ALC269_AUTO;
12679 if (board_config == ALC269_AUTO) {
12680 /* automatic parse from the BIOS config */
12681 err = alc269_parse_auto_config(codec);
12687 "hda_codec: Cannot set up configuration "
12688 "from BIOS. Using base mode...\n");
12689 board_config = ALC269_BASIC;
12693 if (board_config != ALC269_AUTO)
12694 setup_preset(spec, &alc269_presets[board_config]);
12696 spec->stream_name_analog = "ALC269 Analog";
12697 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12698 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12700 spec->stream_name_digital = "ALC269 Digital";
12701 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12702 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12704 spec->adc_nids = alc269_adc_nids;
12705 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12706 spec->capsrc_nids = alc269_capsrc_nids;
12707 if (!spec->cap_mixer)
12708 set_capture_mixer(spec);
12710 codec->patch_ops = alc_patch_ops;
12711 if (board_config == ALC269_AUTO)
12712 spec->init_hook = alc269_auto_init;
12713 #ifdef CONFIG_SND_HDA_POWER_SAVE
12714 if (!spec->loopback.amplist)
12715 spec->loopback.amplist = alc269_loopbacks;
12722 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12726 * set the path ways for 2 channel output
12727 * need to set the codec line out and mic 1 pin widgets to inputs
12729 static struct hda_verb alc861_threestack_ch2_init[] = {
12730 /* set pin widget 1Ah (line in) for input */
12731 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12732 /* set pin widget 18h (mic1/2) for input, for mic also enable
12735 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12737 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12739 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12740 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12746 * need to set the codec line out and mic 1 pin widgets to outputs
12748 static struct hda_verb alc861_threestack_ch6_init[] = {
12749 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12750 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12751 /* set pin widget 18h (mic1) for output (CLFE)*/
12752 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12754 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12755 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12757 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12759 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12760 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12765 static struct hda_channel_mode alc861_threestack_modes[2] = {
12766 { 2, alc861_threestack_ch2_init },
12767 { 6, alc861_threestack_ch6_init },
12769 /* Set mic1 as input and unmute the mixer */
12770 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12771 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12772 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12775 /* Set mic1 as output and mute mixer */
12776 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12777 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12778 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12782 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12783 { 2, alc861_uniwill_m31_ch2_init },
12784 { 4, alc861_uniwill_m31_ch4_init },
12787 /* Set mic1 and line-in as input and unmute the mixer */
12788 static struct hda_verb alc861_asus_ch2_init[] = {
12789 /* set pin widget 1Ah (line in) for input */
12790 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12791 /* set pin widget 18h (mic1/2) for input, for mic also enable
12794 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12796 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12798 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12799 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12803 /* Set mic1 nad line-in as output and mute mixer */
12804 static struct hda_verb alc861_asus_ch6_init[] = {
12805 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12806 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12807 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12808 /* set pin widget 18h (mic1) for output (CLFE)*/
12809 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12810 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12811 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12812 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12814 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12816 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12817 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12822 static struct hda_channel_mode alc861_asus_modes[2] = {
12823 { 2, alc861_asus_ch2_init },
12824 { 6, alc861_asus_ch6_init },
12829 static struct snd_kcontrol_new alc861_base_mixer[] = {
12830 /* output mixer control */
12831 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12832 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12833 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12834 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12835 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12837 /*Input mixer control */
12838 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12839 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12840 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12841 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12842 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12843 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12844 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12845 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12846 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12847 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12852 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12853 /* output mixer control */
12854 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12855 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12856 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12857 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12858 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12860 /* Input mixer control */
12861 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12862 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12863 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12864 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12865 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12866 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12868 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12869 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12870 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12873 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12874 .name = "Channel Mode",
12875 .info = alc_ch_mode_info,
12876 .get = alc_ch_mode_get,
12877 .put = alc_ch_mode_put,
12878 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12883 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12884 /* output mixer control */
12885 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12886 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12887 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12892 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12893 /* output mixer control */
12894 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12895 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12896 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12897 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12898 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12900 /* Input mixer control */
12901 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12902 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12903 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12904 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12905 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12906 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12908 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12910 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12913 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12914 .name = "Channel Mode",
12915 .info = alc_ch_mode_info,
12916 .get = alc_ch_mode_get,
12917 .put = alc_ch_mode_put,
12918 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12923 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12924 /* output mixer control */
12925 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12926 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12927 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12928 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12929 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12931 /* Input mixer control */
12932 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12933 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12934 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12935 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12936 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12937 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12939 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12941 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12944 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12945 .name = "Channel Mode",
12946 .info = alc_ch_mode_info,
12947 .get = alc_ch_mode_get,
12948 .put = alc_ch_mode_put,
12949 .private_value = ARRAY_SIZE(alc861_asus_modes),
12954 /* additional mixer */
12955 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12956 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12957 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12958 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12959 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12964 * generic initialization of ADC, input mixers and output mixers
12966 static struct hda_verb alc861_base_init_verbs[] = {
12968 * Unmute ADC0 and set the default input to mic-in
12970 /* port-A for surround (rear panel) */
12971 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12972 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
12973 /* port-B for mic-in (rear panel) with vref */
12974 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12975 /* port-C for line-in (rear panel) */
12976 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12977 /* port-D for Front */
12978 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12979 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12980 /* port-E for HP out (front panel) */
12981 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12982 /* route front PCM to HP */
12983 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12984 /* port-F for mic-in (front panel) with vref */
12985 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12986 /* port-G for CLFE (rear panel) */
12987 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12988 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12989 /* port-H for side (rear panel) */
12990 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12991 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
12993 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12994 /* route front mic to ADC1*/
12995 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12996 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12998 /* Unmute DAC0~3 & spdif out*/
12999 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13000 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13001 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13002 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13005 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13006 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13007 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13008 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13009 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13011 /* Unmute Stereo Mixer 15 */
13012 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13014 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13017 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13018 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13019 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13020 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13021 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13022 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13023 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13024 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13025 /* hp used DAC 3 (Front) */
13026 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13027 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13032 static struct hda_verb alc861_threestack_init_verbs[] = {
13034 * Unmute ADC0 and set the default input to mic-in
13036 /* port-A for surround (rear panel) */
13037 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13038 /* port-B for mic-in (rear panel) with vref */
13039 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13040 /* port-C for line-in (rear panel) */
13041 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13042 /* port-D for Front */
13043 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13044 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13045 /* port-E for HP out (front panel) */
13046 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13047 /* route front PCM to HP */
13048 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13049 /* port-F for mic-in (front panel) with vref */
13050 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13051 /* port-G for CLFE (rear panel) */
13052 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13053 /* port-H for side (rear panel) */
13054 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13056 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13057 /* route front mic to ADC1*/
13058 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13059 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13060 /* Unmute DAC0~3 & spdif out*/
13061 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13062 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13063 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13064 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13067 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13068 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13069 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13070 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13071 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13073 /* Unmute Stereo Mixer 15 */
13074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13079 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13080 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13081 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13082 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13083 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13084 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13085 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13086 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13087 /* hp used DAC 3 (Front) */
13088 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13089 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13093 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13095 * Unmute ADC0 and set the default input to mic-in
13097 /* port-A for surround (rear panel) */
13098 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13099 /* port-B for mic-in (rear panel) with vref */
13100 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13101 /* port-C for line-in (rear panel) */
13102 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13103 /* port-D for Front */
13104 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13105 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13106 /* port-E for HP out (front panel) */
13107 /* this has to be set to VREF80 */
13108 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13109 /* route front PCM to HP */
13110 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13111 /* port-F for mic-in (front panel) with vref */
13112 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13113 /* port-G for CLFE (rear panel) */
13114 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13115 /* port-H for side (rear panel) */
13116 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13118 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13119 /* route front mic to ADC1*/
13120 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13122 /* Unmute DAC0~3 & spdif out*/
13123 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13124 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13125 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13126 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13129 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13130 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13131 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13132 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13133 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13135 /* Unmute Stereo Mixer 15 */
13136 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13137 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13139 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13141 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13142 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13143 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13144 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13146 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13147 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13148 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13149 /* hp used DAC 3 (Front) */
13150 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13151 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13155 static struct hda_verb alc861_asus_init_verbs[] = {
13157 * Unmute ADC0 and set the default input to mic-in
13159 /* port-A for surround (rear panel)
13160 * according to codec#0 this is the HP jack
13162 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13163 /* route front PCM to HP */
13164 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13165 /* port-B for mic-in (rear panel) with vref */
13166 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13167 /* port-C for line-in (rear panel) */
13168 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13169 /* port-D for Front */
13170 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13171 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13172 /* port-E for HP out (front panel) */
13173 /* this has to be set to VREF80 */
13174 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13175 /* route front PCM to HP */
13176 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13177 /* port-F for mic-in (front panel) with vref */
13178 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13179 /* port-G for CLFE (rear panel) */
13180 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13181 /* port-H for side (rear panel) */
13182 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13184 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13185 /* route front mic to ADC1*/
13186 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13187 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13188 /* Unmute DAC0~3 & spdif out*/
13189 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13190 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13191 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13192 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13193 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13194 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13195 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13196 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13197 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13198 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13200 /* Unmute Stereo Mixer 15 */
13201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13204 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13206 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13207 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13208 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13209 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13211 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13212 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13213 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13214 /* hp used DAC 3 (Front) */
13215 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13216 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13220 /* additional init verbs for ASUS laptops */
13221 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13222 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13223 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13228 * generic initialization of ADC, input mixers and output mixers
13230 static struct hda_verb alc861_auto_init_verbs[] = {
13232 * Unmute ADC0 and set the default input to mic-in
13234 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13237 /* Unmute DAC0~3 & spdif out*/
13238 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13239 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13240 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13241 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13242 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13244 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13245 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13246 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13247 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13248 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13250 /* Unmute Stereo Mixer 15 */
13251 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13254 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13256 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13257 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13258 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13259 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13260 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13261 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13262 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13263 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13265 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13266 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13269 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13270 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13271 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13274 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13279 static struct hda_verb alc861_toshiba_init_verbs[] = {
13280 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13285 /* toggle speaker-output according to the hp-jack state */
13286 static void alc861_toshiba_automute(struct hda_codec *codec)
13288 unsigned int present;
13290 present = snd_hda_codec_read(codec, 0x0f, 0,
13291 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13292 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13293 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13294 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13295 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13298 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13301 if ((res >> 26) == ALC880_HP_EVENT)
13302 alc861_toshiba_automute(codec);
13305 /* pcm configuration: identiacal with ALC880 */
13306 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13307 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13308 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13309 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13312 #define ALC861_DIGOUT_NID 0x07
13314 static struct hda_channel_mode alc861_8ch_modes[1] = {
13318 static hda_nid_t alc861_dac_nids[4] = {
13319 /* front, surround, clfe, side */
13320 0x03, 0x06, 0x05, 0x04
13323 static hda_nid_t alc660_dac_nids[3] = {
13324 /* front, clfe, surround */
13328 static hda_nid_t alc861_adc_nids[1] = {
13333 static struct hda_input_mux alc861_capture_source = {
13337 { "Front Mic", 0x3 },
13344 /* fill in the dac_nids table from the parsed pin configuration */
13345 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13346 const struct auto_pin_cfg *cfg)
13351 spec->multiout.dac_nids = spec->private_dac_nids;
13352 for (i = 0; i < cfg->line_outs; i++) {
13353 nid = cfg->line_out_pins[i];
13355 if (i >= ARRAY_SIZE(alc861_dac_nids))
13357 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13360 spec->multiout.num_dacs = cfg->line_outs;
13364 /* add playback controls from the parsed DAC table */
13365 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13366 const struct auto_pin_cfg *cfg)
13369 static const char *chname[4] = {
13370 "Front", "Surround", NULL /*CLFE*/, "Side"
13375 for (i = 0; i < cfg->line_outs; i++) {
13376 nid = spec->multiout.dac_nids[i];
13381 err = add_control(spec, ALC_CTL_BIND_MUTE,
13382 "Center Playback Switch",
13383 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13387 err = add_control(spec, ALC_CTL_BIND_MUTE,
13388 "LFE Playback Switch",
13389 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13394 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13396 if (nid == alc861_dac_nids[idx])
13398 sprintf(name, "%s Playback Switch", chname[idx]);
13399 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13400 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13409 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13417 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13419 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13420 "Headphone Playback Switch",
13421 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13424 spec->multiout.hp_nid = nid;
13429 /* create playback/capture controls for input pins */
13430 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13431 const struct auto_pin_cfg *cfg)
13433 struct hda_input_mux *imux = &spec->private_imux;
13434 int i, err, idx, idx1;
13436 for (i = 0; i < AUTO_PIN_LAST; i++) {
13437 switch (cfg->input_pins[i]) {
13440 idx = 2; /* Line In */
13444 idx = 2; /* Line In */
13448 idx = 1; /* Mic In */
13452 idx = 1; /* Mic In */
13462 err = new_analog_input(spec, cfg->input_pins[i],
13463 auto_pin_cfg_labels[i], idx, 0x15);
13467 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13468 imux->items[imux->num_items].index = idx1;
13474 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13476 int pin_type, int dac_idx)
13478 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13480 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13484 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13486 struct alc_spec *spec = codec->spec;
13489 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13490 for (i = 0; i < spec->autocfg.line_outs; i++) {
13491 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13492 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13494 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13495 spec->multiout.dac_nids[i]);
13499 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13501 struct alc_spec *spec = codec->spec;
13504 pin = spec->autocfg.hp_pins[0];
13505 if (pin) /* connect to front */
13506 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13507 spec->multiout.dac_nids[0]);
13508 pin = spec->autocfg.speaker_pins[0];
13510 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13513 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13515 struct alc_spec *spec = codec->spec;
13518 for (i = 0; i < AUTO_PIN_LAST; i++) {
13519 hda_nid_t nid = spec->autocfg.input_pins[i];
13520 if (nid >= 0x0c && nid <= 0x11) {
13521 snd_hda_codec_write(codec, nid, 0,
13522 AC_VERB_SET_PIN_WIDGET_CONTROL,
13523 i <= AUTO_PIN_FRONT_MIC ?
13524 PIN_VREF80 : PIN_IN);
13529 /* parse the BIOS configuration and set up the alc_spec */
13530 /* return 1 if successful, 0 if the proper config is not found,
13531 * or a negative error code
13533 static int alc861_parse_auto_config(struct hda_codec *codec)
13535 struct alc_spec *spec = codec->spec;
13537 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13539 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13543 if (!spec->autocfg.line_outs)
13544 return 0; /* can't find valid BIOS pin config */
13546 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13549 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13552 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13555 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13559 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13561 if (spec->autocfg.dig_out_pin)
13562 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13564 if (spec->kctls.list)
13565 add_mixer(spec, spec->kctls.list);
13567 add_verb(spec, alc861_auto_init_verbs);
13569 spec->num_mux_defs = 1;
13570 spec->input_mux = &spec->private_imux;
13572 spec->adc_nids = alc861_adc_nids;
13573 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13574 set_capture_mixer(spec);
13576 store_pin_configs(codec);
13580 /* additional initialization for auto-configuration model */
13581 static void alc861_auto_init(struct hda_codec *codec)
13583 struct alc_spec *spec = codec->spec;
13584 alc861_auto_init_multi_out(codec);
13585 alc861_auto_init_hp_out(codec);
13586 alc861_auto_init_analog_input(codec);
13587 if (spec->unsol_event)
13588 alc_inithook(codec);
13591 #ifdef CONFIG_SND_HDA_POWER_SAVE
13592 static struct hda_amp_list alc861_loopbacks[] = {
13593 { 0x15, HDA_INPUT, 0 },
13594 { 0x15, HDA_INPUT, 1 },
13595 { 0x15, HDA_INPUT, 2 },
13596 { 0x15, HDA_INPUT, 3 },
13603 * configuration and preset
13605 static const char *alc861_models[ALC861_MODEL_LAST] = {
13606 [ALC861_3ST] = "3stack",
13607 [ALC660_3ST] = "3stack-660",
13608 [ALC861_3ST_DIG] = "3stack-dig",
13609 [ALC861_6ST_DIG] = "6stack-dig",
13610 [ALC861_UNIWILL_M31] = "uniwill-m31",
13611 [ALC861_TOSHIBA] = "toshiba",
13612 [ALC861_ASUS] = "asus",
13613 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13614 [ALC861_AUTO] = "auto",
13617 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13618 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13619 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13620 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13621 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13622 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13623 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13624 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13625 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13626 * Any other models that need this preset?
13628 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13629 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13630 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13631 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13632 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13633 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13634 /* FIXME: the below seems conflict */
13635 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13636 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13637 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13641 static struct alc_config_preset alc861_presets[] = {
13643 .mixers = { alc861_3ST_mixer },
13644 .init_verbs = { alc861_threestack_init_verbs },
13645 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13646 .dac_nids = alc861_dac_nids,
13647 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13648 .channel_mode = alc861_threestack_modes,
13650 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13651 .adc_nids = alc861_adc_nids,
13652 .input_mux = &alc861_capture_source,
13654 [ALC861_3ST_DIG] = {
13655 .mixers = { alc861_base_mixer },
13656 .init_verbs = { alc861_threestack_init_verbs },
13657 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13658 .dac_nids = alc861_dac_nids,
13659 .dig_out_nid = ALC861_DIGOUT_NID,
13660 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13661 .channel_mode = alc861_threestack_modes,
13663 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13664 .adc_nids = alc861_adc_nids,
13665 .input_mux = &alc861_capture_source,
13667 [ALC861_6ST_DIG] = {
13668 .mixers = { alc861_base_mixer },
13669 .init_verbs = { alc861_base_init_verbs },
13670 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13671 .dac_nids = alc861_dac_nids,
13672 .dig_out_nid = ALC861_DIGOUT_NID,
13673 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13674 .channel_mode = alc861_8ch_modes,
13675 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13676 .adc_nids = alc861_adc_nids,
13677 .input_mux = &alc861_capture_source,
13680 .mixers = { alc861_3ST_mixer },
13681 .init_verbs = { alc861_threestack_init_verbs },
13682 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13683 .dac_nids = alc660_dac_nids,
13684 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13685 .channel_mode = alc861_threestack_modes,
13687 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13688 .adc_nids = alc861_adc_nids,
13689 .input_mux = &alc861_capture_source,
13691 [ALC861_UNIWILL_M31] = {
13692 .mixers = { alc861_uniwill_m31_mixer },
13693 .init_verbs = { alc861_uniwill_m31_init_verbs },
13694 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13695 .dac_nids = alc861_dac_nids,
13696 .dig_out_nid = ALC861_DIGOUT_NID,
13697 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13698 .channel_mode = alc861_uniwill_m31_modes,
13700 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13701 .adc_nids = alc861_adc_nids,
13702 .input_mux = &alc861_capture_source,
13704 [ALC861_TOSHIBA] = {
13705 .mixers = { alc861_toshiba_mixer },
13706 .init_verbs = { alc861_base_init_verbs,
13707 alc861_toshiba_init_verbs },
13708 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13709 .dac_nids = alc861_dac_nids,
13710 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13711 .channel_mode = alc883_3ST_2ch_modes,
13712 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13713 .adc_nids = alc861_adc_nids,
13714 .input_mux = &alc861_capture_source,
13715 .unsol_event = alc861_toshiba_unsol_event,
13716 .init_hook = alc861_toshiba_automute,
13719 .mixers = { alc861_asus_mixer },
13720 .init_verbs = { alc861_asus_init_verbs },
13721 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13722 .dac_nids = alc861_dac_nids,
13723 .dig_out_nid = ALC861_DIGOUT_NID,
13724 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13725 .channel_mode = alc861_asus_modes,
13728 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13729 .adc_nids = alc861_adc_nids,
13730 .input_mux = &alc861_capture_source,
13732 [ALC861_ASUS_LAPTOP] = {
13733 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13734 .init_verbs = { alc861_asus_init_verbs,
13735 alc861_asus_laptop_init_verbs },
13736 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13737 .dac_nids = alc861_dac_nids,
13738 .dig_out_nid = ALC861_DIGOUT_NID,
13739 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13740 .channel_mode = alc883_3ST_2ch_modes,
13742 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13743 .adc_nids = alc861_adc_nids,
13744 .input_mux = &alc861_capture_source,
13749 static int patch_alc861(struct hda_codec *codec)
13751 struct alc_spec *spec;
13755 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13759 codec->spec = spec;
13761 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13765 if (board_config < 0) {
13766 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13767 "trying auto-probe from BIOS...\n");
13768 board_config = ALC861_AUTO;
13771 if (board_config == ALC861_AUTO) {
13772 /* automatic parse from the BIOS config */
13773 err = alc861_parse_auto_config(codec);
13779 "hda_codec: Cannot set up configuration "
13780 "from BIOS. Using base mode...\n");
13781 board_config = ALC861_3ST_DIG;
13785 if (board_config != ALC861_AUTO)
13786 setup_preset(spec, &alc861_presets[board_config]);
13788 spec->stream_name_analog = "ALC861 Analog";
13789 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13790 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13792 spec->stream_name_digital = "ALC861 Digital";
13793 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13794 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13796 spec->vmaster_nid = 0x03;
13798 codec->patch_ops = alc_patch_ops;
13799 if (board_config == ALC861_AUTO)
13800 spec->init_hook = alc861_auto_init;
13801 #ifdef CONFIG_SND_HDA_POWER_SAVE
13802 if (!spec->loopback.amplist)
13803 spec->loopback.amplist = alc861_loopbacks;
13810 * ALC861-VD support
13814 * In addition, an independent DAC
13816 #define ALC861VD_DIGOUT_NID 0x06
13818 static hda_nid_t alc861vd_dac_nids[4] = {
13819 /* front, surr, clfe, side surr */
13820 0x02, 0x03, 0x04, 0x05
13823 /* dac_nids for ALC660vd are in a different order - according to
13824 * Realtek's driver.
13825 * This should probably tesult in a different mixer for 6stack models
13826 * of ALC660vd codecs, but for now there is only 3stack mixer
13827 * - and it is the same as in 861vd.
13828 * adc_nids in ALC660vd are (is) the same as in 861vd
13830 static hda_nid_t alc660vd_dac_nids[3] = {
13831 /* front, rear, clfe, rear_surr */
13835 static hda_nid_t alc861vd_adc_nids[1] = {
13840 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13843 /* FIXME: should be a matrix-type input source selection */
13844 static struct hda_input_mux alc861vd_capture_source = {
13848 { "Front Mic", 0x1 },
13854 static struct hda_input_mux alc861vd_dallas_capture_source = {
13857 { "Ext Mic", 0x0 },
13858 { "Int Mic", 0x1 },
13862 static struct hda_input_mux alc861vd_hp_capture_source = {
13865 { "Front Mic", 0x0 },
13866 { "ATAPI Mic", 0x1 },
13873 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13880 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13881 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13882 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13883 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13884 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13891 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13892 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13893 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13894 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13895 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13899 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13900 { 6, alc861vd_6stack_ch6_init },
13901 { 8, alc861vd_6stack_ch8_init },
13904 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13906 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13907 .name = "Channel Mode",
13908 .info = alc_ch_mode_info,
13909 .get = alc_ch_mode_get,
13910 .put = alc_ch_mode_put,
13915 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13916 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13918 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13919 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13920 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13922 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13923 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13925 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13927 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13929 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13930 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13932 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13933 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13935 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13937 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13941 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13942 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13943 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13948 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13949 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13951 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13952 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13957 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13958 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13959 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13963 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13965 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13967 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13968 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13969 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13971 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13972 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13974 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13975 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13977 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13978 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13983 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
13984 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13985 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13986 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13990 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13992 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13994 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13998 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13999 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14004 /* Pin assignment: Speaker=0x14, HP = 0x15,
14005 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14007 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14008 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14009 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14010 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14011 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14012 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14013 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14014 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14015 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14016 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14017 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14018 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
14019 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
14023 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14024 * Front Mic=0x18, ATAPI Mic = 0x19,
14026 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14027 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14028 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14029 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14030 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14031 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14032 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14033 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14034 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14040 * generic initialization of ADC, input mixers and output mixers
14042 static struct hda_verb alc861vd_volume_init_verbs[] = {
14044 * Unmute ADC0 and set the default input to mic-in
14046 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14049 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14050 * the analog-loopback mixer widget
14052 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14053 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14054 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14055 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14057 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14059 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14066 * Set up output mixers (0x02 - 0x05)
14068 /* set vol=0 to output mixers */
14069 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14070 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14071 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14072 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14074 /* set up input amps for analog loopback */
14075 /* Amp Indices: DAC = 0, mixer = 1 */
14076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14089 * 3-stack pin configuration:
14090 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14092 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14094 * Set pin mode and muting
14096 /* set front pin widgets 0x14 for output */
14097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14098 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14099 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14101 /* Mic (rear) pin: input vref at 80% */
14102 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14103 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14104 /* Front Mic pin: input vref at 80% */
14105 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14106 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14107 /* Line In pin: input */
14108 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14109 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14110 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14111 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14112 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14113 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14114 /* CD pin widget for input */
14115 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14121 * 6-stack pin configuration:
14123 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14125 * Set pin mode and muting
14127 /* set front pin widgets 0x14 for output */
14128 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14129 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14130 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14132 /* Rear Pin: output 1 (0x0d) */
14133 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14134 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14135 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14136 /* CLFE Pin: output 2 (0x0e) */
14137 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14138 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14139 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14140 /* Side Pin: output 3 (0x0f) */
14141 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14142 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14143 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14145 /* Mic (rear) pin: input vref at 80% */
14146 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14147 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14148 /* Front Mic pin: input vref at 80% */
14149 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14150 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14151 /* Line In pin: input */
14152 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14153 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14154 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14155 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14156 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14157 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14158 /* CD pin widget for input */
14159 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14164 static struct hda_verb alc861vd_eapd_verbs[] = {
14165 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14169 static struct hda_verb alc660vd_eapd_verbs[] = {
14170 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14171 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14175 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14177 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14179 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14180 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14184 /* toggle speaker-output according to the hp-jack state */
14185 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14187 unsigned int present;
14188 unsigned char bits;
14190 present = snd_hda_codec_read(codec, 0x1b, 0,
14191 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14192 bits = present ? HDA_AMP_MUTE : 0;
14193 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14194 HDA_AMP_MUTE, bits);
14197 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14199 unsigned int present;
14200 unsigned char bits;
14202 present = snd_hda_codec_read(codec, 0x18, 0,
14203 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14204 bits = present ? HDA_AMP_MUTE : 0;
14205 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14206 HDA_AMP_MUTE, bits);
14209 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14211 alc861vd_lenovo_hp_automute(codec);
14212 alc861vd_lenovo_mic_automute(codec);
14215 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14218 switch (res >> 26) {
14219 case ALC880_HP_EVENT:
14220 alc861vd_lenovo_hp_automute(codec);
14222 case ALC880_MIC_EVENT:
14223 alc861vd_lenovo_mic_automute(codec);
14228 static struct hda_verb alc861vd_dallas_verbs[] = {
14229 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14230 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14231 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14232 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14236 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14238 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14239 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14240 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14241 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14243 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14244 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14245 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14247 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14248 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14249 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14250 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14252 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14253 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14254 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14255 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14256 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14257 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14258 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14259 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14266 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14267 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14268 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14273 /* toggle speaker-output according to the hp-jack state */
14274 static void alc861vd_dallas_automute(struct hda_codec *codec)
14276 unsigned int present;
14278 present = snd_hda_codec_read(codec, 0x15, 0,
14279 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14280 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14281 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14284 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14286 if ((res >> 26) == ALC880_HP_EVENT)
14287 alc861vd_dallas_automute(codec);
14290 #ifdef CONFIG_SND_HDA_POWER_SAVE
14291 #define alc861vd_loopbacks alc880_loopbacks
14294 /* pcm configuration: identiacal with ALC880 */
14295 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14296 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14297 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14298 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14301 * configuration and preset
14303 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14304 [ALC660VD_3ST] = "3stack-660",
14305 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14306 [ALC660VD_ASUS_V1S] = "asus-v1s",
14307 [ALC861VD_3ST] = "3stack",
14308 [ALC861VD_3ST_DIG] = "3stack-digout",
14309 [ALC861VD_6ST_DIG] = "6stack-digout",
14310 [ALC861VD_LENOVO] = "lenovo",
14311 [ALC861VD_DALLAS] = "dallas",
14312 [ALC861VD_HP] = "hp",
14313 [ALC861VD_AUTO] = "auto",
14316 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14317 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14318 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14319 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14320 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14321 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14322 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14323 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14324 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14325 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14326 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14327 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14328 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14329 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14330 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14331 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14332 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14333 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14337 static struct alc_config_preset alc861vd_presets[] = {
14339 .mixers = { alc861vd_3st_mixer },
14340 .init_verbs = { alc861vd_volume_init_verbs,
14341 alc861vd_3stack_init_verbs },
14342 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14343 .dac_nids = alc660vd_dac_nids,
14344 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14345 .channel_mode = alc861vd_3stack_2ch_modes,
14346 .input_mux = &alc861vd_capture_source,
14348 [ALC660VD_3ST_DIG] = {
14349 .mixers = { alc861vd_3st_mixer },
14350 .init_verbs = { alc861vd_volume_init_verbs,
14351 alc861vd_3stack_init_verbs },
14352 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14353 .dac_nids = alc660vd_dac_nids,
14354 .dig_out_nid = ALC861VD_DIGOUT_NID,
14355 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14356 .channel_mode = alc861vd_3stack_2ch_modes,
14357 .input_mux = &alc861vd_capture_source,
14360 .mixers = { alc861vd_3st_mixer },
14361 .init_verbs = { alc861vd_volume_init_verbs,
14362 alc861vd_3stack_init_verbs },
14363 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14364 .dac_nids = alc861vd_dac_nids,
14365 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14366 .channel_mode = alc861vd_3stack_2ch_modes,
14367 .input_mux = &alc861vd_capture_source,
14369 [ALC861VD_3ST_DIG] = {
14370 .mixers = { alc861vd_3st_mixer },
14371 .init_verbs = { alc861vd_volume_init_verbs,
14372 alc861vd_3stack_init_verbs },
14373 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14374 .dac_nids = alc861vd_dac_nids,
14375 .dig_out_nid = ALC861VD_DIGOUT_NID,
14376 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14377 .channel_mode = alc861vd_3stack_2ch_modes,
14378 .input_mux = &alc861vd_capture_source,
14380 [ALC861VD_6ST_DIG] = {
14381 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14382 .init_verbs = { alc861vd_volume_init_verbs,
14383 alc861vd_6stack_init_verbs },
14384 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14385 .dac_nids = alc861vd_dac_nids,
14386 .dig_out_nid = ALC861VD_DIGOUT_NID,
14387 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14388 .channel_mode = alc861vd_6stack_modes,
14389 .input_mux = &alc861vd_capture_source,
14391 [ALC861VD_LENOVO] = {
14392 .mixers = { alc861vd_lenovo_mixer },
14393 .init_verbs = { alc861vd_volume_init_verbs,
14394 alc861vd_3stack_init_verbs,
14395 alc861vd_eapd_verbs,
14396 alc861vd_lenovo_unsol_verbs },
14397 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14398 .dac_nids = alc660vd_dac_nids,
14399 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14400 .channel_mode = alc861vd_3stack_2ch_modes,
14401 .input_mux = &alc861vd_capture_source,
14402 .unsol_event = alc861vd_lenovo_unsol_event,
14403 .init_hook = alc861vd_lenovo_automute,
14405 [ALC861VD_DALLAS] = {
14406 .mixers = { alc861vd_dallas_mixer },
14407 .init_verbs = { alc861vd_dallas_verbs },
14408 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14409 .dac_nids = alc861vd_dac_nids,
14410 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14411 .channel_mode = alc861vd_3stack_2ch_modes,
14412 .input_mux = &alc861vd_dallas_capture_source,
14413 .unsol_event = alc861vd_dallas_unsol_event,
14414 .init_hook = alc861vd_dallas_automute,
14417 .mixers = { alc861vd_hp_mixer },
14418 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14419 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14420 .dac_nids = alc861vd_dac_nids,
14421 .dig_out_nid = ALC861VD_DIGOUT_NID,
14422 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14423 .channel_mode = alc861vd_3stack_2ch_modes,
14424 .input_mux = &alc861vd_hp_capture_source,
14425 .unsol_event = alc861vd_dallas_unsol_event,
14426 .init_hook = alc861vd_dallas_automute,
14428 [ALC660VD_ASUS_V1S] = {
14429 .mixers = { alc861vd_lenovo_mixer },
14430 .init_verbs = { alc861vd_volume_init_verbs,
14431 alc861vd_3stack_init_verbs,
14432 alc861vd_eapd_verbs,
14433 alc861vd_lenovo_unsol_verbs },
14434 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14435 .dac_nids = alc660vd_dac_nids,
14436 .dig_out_nid = ALC861VD_DIGOUT_NID,
14437 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14438 .channel_mode = alc861vd_3stack_2ch_modes,
14439 .input_mux = &alc861vd_capture_source,
14440 .unsol_event = alc861vd_lenovo_unsol_event,
14441 .init_hook = alc861vd_lenovo_automute,
14446 * BIOS auto configuration
14448 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14449 hda_nid_t nid, int pin_type, int dac_idx)
14451 alc_set_pin_output(codec, nid, pin_type);
14454 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14456 struct alc_spec *spec = codec->spec;
14459 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14460 for (i = 0; i <= HDA_SIDE; i++) {
14461 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14462 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14464 alc861vd_auto_set_output_and_unmute(codec, nid,
14470 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14472 struct alc_spec *spec = codec->spec;
14475 pin = spec->autocfg.hp_pins[0];
14476 if (pin) /* connect to front and use dac 0 */
14477 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14478 pin = spec->autocfg.speaker_pins[0];
14480 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14483 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14484 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14486 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14488 struct alc_spec *spec = codec->spec;
14491 for (i = 0; i < AUTO_PIN_LAST; i++) {
14492 hda_nid_t nid = spec->autocfg.input_pins[i];
14493 if (alc861vd_is_input_pin(nid)) {
14494 snd_hda_codec_write(codec, nid, 0,
14495 AC_VERB_SET_PIN_WIDGET_CONTROL,
14496 i <= AUTO_PIN_FRONT_MIC ?
14497 PIN_VREF80 : PIN_IN);
14498 if (nid != ALC861VD_PIN_CD_NID)
14499 snd_hda_codec_write(codec, nid, 0,
14500 AC_VERB_SET_AMP_GAIN_MUTE,
14506 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14508 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14509 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14511 /* add playback controls from the parsed DAC table */
14512 /* Based on ALC880 version. But ALC861VD has separate,
14513 * different NIDs for mute/unmute switch and volume control */
14514 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14515 const struct auto_pin_cfg *cfg)
14518 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14519 hda_nid_t nid_v, nid_s;
14522 for (i = 0; i < cfg->line_outs; i++) {
14523 if (!spec->multiout.dac_nids[i])
14525 nid_v = alc861vd_idx_to_mixer_vol(
14527 spec->multiout.dac_nids[i]));
14528 nid_s = alc861vd_idx_to_mixer_switch(
14530 spec->multiout.dac_nids[i]));
14534 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14535 "Center Playback Volume",
14536 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14540 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14541 "LFE Playback Volume",
14542 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14546 err = add_control(spec, ALC_CTL_BIND_MUTE,
14547 "Center Playback Switch",
14548 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14552 err = add_control(spec, ALC_CTL_BIND_MUTE,
14553 "LFE Playback Switch",
14554 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14559 sprintf(name, "%s Playback Volume", chname[i]);
14560 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14561 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14565 sprintf(name, "%s Playback Switch", chname[i]);
14566 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14567 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14576 /* add playback controls for speaker and HP outputs */
14577 /* Based on ALC880 version. But ALC861VD has separate,
14578 * different NIDs for mute/unmute switch and volume control */
14579 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14580 hda_nid_t pin, const char *pfx)
14582 hda_nid_t nid_v, nid_s;
14589 if (alc880_is_fixed_pin(pin)) {
14590 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14591 /* specify the DAC as the extra output */
14592 if (!spec->multiout.hp_nid)
14593 spec->multiout.hp_nid = nid_v;
14595 spec->multiout.extra_out_nid[0] = nid_v;
14596 /* control HP volume/switch on the output mixer amp */
14597 nid_v = alc861vd_idx_to_mixer_vol(
14598 alc880_fixed_pin_idx(pin));
14599 nid_s = alc861vd_idx_to_mixer_switch(
14600 alc880_fixed_pin_idx(pin));
14602 sprintf(name, "%s Playback Volume", pfx);
14603 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14604 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14607 sprintf(name, "%s Playback Switch", pfx);
14608 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14609 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14612 } else if (alc880_is_multi_pin(pin)) {
14613 /* set manual connection */
14614 /* we have only a switch on HP-out PIN */
14615 sprintf(name, "%s Playback Switch", pfx);
14616 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14617 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14624 /* parse the BIOS configuration and set up the alc_spec
14625 * return 1 if successful, 0 if the proper config is not found,
14626 * or a negative error code
14627 * Based on ALC880 version - had to change it to override
14628 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14629 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14631 struct alc_spec *spec = codec->spec;
14633 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14635 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14639 if (!spec->autocfg.line_outs)
14640 return 0; /* can't find valid BIOS pin config */
14642 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14645 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14648 err = alc861vd_auto_create_extra_out(spec,
14649 spec->autocfg.speaker_pins[0],
14653 err = alc861vd_auto_create_extra_out(spec,
14654 spec->autocfg.hp_pins[0],
14658 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14662 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14664 if (spec->autocfg.dig_out_pin)
14665 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14667 if (spec->kctls.list)
14668 add_mixer(spec, spec->kctls.list);
14670 add_verb(spec, alc861vd_volume_init_verbs);
14672 spec->num_mux_defs = 1;
14673 spec->input_mux = &spec->private_imux;
14675 err = alc_auto_add_mic_boost(codec);
14679 store_pin_configs(codec);
14683 /* additional initialization for auto-configuration model */
14684 static void alc861vd_auto_init(struct hda_codec *codec)
14686 struct alc_spec *spec = codec->spec;
14687 alc861vd_auto_init_multi_out(codec);
14688 alc861vd_auto_init_hp_out(codec);
14689 alc861vd_auto_init_analog_input(codec);
14690 alc861vd_auto_init_input_src(codec);
14691 if (spec->unsol_event)
14692 alc_inithook(codec);
14695 static int patch_alc861vd(struct hda_codec *codec)
14697 struct alc_spec *spec;
14698 int err, board_config;
14700 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14704 codec->spec = spec;
14706 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14710 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14711 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14712 "ALC861VD, trying auto-probe from BIOS...\n");
14713 board_config = ALC861VD_AUTO;
14716 if (board_config == ALC861VD_AUTO) {
14717 /* automatic parse from the BIOS config */
14718 err = alc861vd_parse_auto_config(codec);
14724 "hda_codec: Cannot set up configuration "
14725 "from BIOS. Using base mode...\n");
14726 board_config = ALC861VD_3ST;
14730 if (board_config != ALC861VD_AUTO)
14731 setup_preset(spec, &alc861vd_presets[board_config]);
14733 if (codec->vendor_id == 0x10ec0660) {
14734 spec->stream_name_analog = "ALC660-VD Analog";
14735 spec->stream_name_digital = "ALC660-VD Digital";
14736 /* always turn on EAPD */
14737 add_verb(spec, alc660vd_eapd_verbs);
14739 spec->stream_name_analog = "ALC861VD Analog";
14740 spec->stream_name_digital = "ALC861VD Digital";
14743 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14744 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14746 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14747 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14749 spec->adc_nids = alc861vd_adc_nids;
14750 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14751 spec->capsrc_nids = alc861vd_capsrc_nids;
14752 spec->is_mix_capture = 1;
14754 set_capture_mixer(spec);
14756 spec->vmaster_nid = 0x02;
14758 codec->patch_ops = alc_patch_ops;
14760 if (board_config == ALC861VD_AUTO)
14761 spec->init_hook = alc861vd_auto_init;
14762 #ifdef CONFIG_SND_HDA_POWER_SAVE
14763 if (!spec->loopback.amplist)
14764 spec->loopback.amplist = alc861vd_loopbacks;
14773 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14774 * configuration. Each pin widget can choose any input DACs and a mixer.
14775 * Each ADC is connected from a mixer of all inputs. This makes possible
14776 * 6-channel independent captures.
14778 * In addition, an independent DAC for the multi-playback (not used in this
14781 #define ALC662_DIGOUT_NID 0x06
14782 #define ALC662_DIGIN_NID 0x0a
14784 static hda_nid_t alc662_dac_nids[4] = {
14785 /* front, rear, clfe, rear_surr */
14789 static hda_nid_t alc662_adc_nids[1] = {
14794 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14797 /* FIXME: should be a matrix-type input source selection */
14798 static struct hda_input_mux alc662_capture_source = {
14802 { "Front Mic", 0x1 },
14808 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14816 static struct hda_input_mux alc662_eeepc_capture_source = {
14824 static struct hda_input_mux alc663_capture_source = {
14828 { "Front Mic", 0x1 },
14833 static struct hda_input_mux alc663_m51va_capture_source = {
14836 { "Ext-Mic", 0x0 },
14844 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14851 static struct hda_verb alc662_3ST_ch2_init[] = {
14852 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14853 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14854 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14855 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14862 static struct hda_verb alc662_3ST_ch6_init[] = {
14863 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14864 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14865 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14866 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14867 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14868 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14872 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14873 { 2, alc662_3ST_ch2_init },
14874 { 6, alc662_3ST_ch6_init },
14880 static struct hda_verb alc662_sixstack_ch6_init[] = {
14881 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14882 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14883 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14890 static struct hda_verb alc662_sixstack_ch8_init[] = {
14891 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14892 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14893 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14897 static struct hda_channel_mode alc662_5stack_modes[2] = {
14898 { 2, alc662_sixstack_ch6_init },
14899 { 6, alc662_sixstack_ch8_init },
14902 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14903 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14906 static struct snd_kcontrol_new alc662_base_mixer[] = {
14907 /* output mixer control */
14908 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14909 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14910 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14911 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14912 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14913 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14914 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14915 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14916 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14918 /*Input mixer control */
14919 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14920 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14921 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14922 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14923 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14924 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14925 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14926 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14930 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14931 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14932 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14933 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14934 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14935 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14936 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14937 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14940 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14941 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14942 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14943 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14947 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14948 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14949 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14950 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14951 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14952 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14953 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14954 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14955 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14956 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14957 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14958 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14959 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14960 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14961 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14962 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14963 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14964 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14965 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14966 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14970 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
14971 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14972 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
14973 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14974 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
14975 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14976 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14977 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14979 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14983 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
14984 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14986 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14987 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14989 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
14990 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14991 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14993 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
14994 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14995 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14999 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15000 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15001 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15002 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15003 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15004 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15005 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15006 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15007 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15008 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15009 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15017 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15018 .ops = &snd_hda_bind_vol,
15020 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15021 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15026 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15027 .ops = &snd_hda_bind_sw,
15029 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15030 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15035 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15036 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15037 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15038 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15039 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15043 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15044 .ops = &snd_hda_bind_sw,
15046 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15047 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15048 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15053 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15054 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15055 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15057 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15058 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15059 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15064 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15065 .ops = &snd_hda_bind_sw,
15067 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15068 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15069 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15074 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15075 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15076 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15077 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15078 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15079 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15080 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15084 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15085 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15086 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15089 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15090 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15091 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15095 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15096 .ops = &snd_hda_bind_vol,
15098 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15099 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15104 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15105 .ops = &snd_hda_bind_sw,
15107 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15108 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15113 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15114 HDA_BIND_VOL("Master Playback Volume",
15115 &alc663_asus_two_bind_master_vol),
15116 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15117 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15124 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15125 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15126 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15127 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15134 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15135 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15136 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15137 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15138 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15143 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15144 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15148 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15149 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15150 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15155 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15156 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15157 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15158 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15162 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15164 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15165 .name = "Channel Mode",
15166 .info = alc_ch_mode_info,
15167 .get = alc_ch_mode_get,
15168 .put = alc_ch_mode_put,
15173 static struct hda_verb alc662_init_verbs[] = {
15174 /* ADC: mute amp left and right */
15175 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15176 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15177 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15187 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15188 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15189 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15190 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15192 /* Front Pin: output 0 (0x0c) */
15193 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15194 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15196 /* Rear Pin: output 1 (0x0d) */
15197 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15198 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15200 /* CLFE Pin: output 2 (0x0e) */
15201 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15202 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15204 /* Mic (rear) pin: input vref at 80% */
15205 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15207 /* Front Mic pin: input vref at 80% */
15208 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15209 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15210 /* Line In pin: input */
15211 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15213 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15215 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15216 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15217 /* CD pin widget for input */
15218 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15220 /* FIXME: use matrix-type input source selection */
15221 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15225 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15226 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15228 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15229 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15230 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15231 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15233 /* always trun on EAPD */
15234 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15235 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15240 static struct hda_verb alc662_sue_init_verbs[] = {
15241 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15242 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15246 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15247 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15248 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15252 /* Set Unsolicited Event*/
15253 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15254 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15255 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15260 * generic initialization of ADC, input mixers and output mixers
15262 static struct hda_verb alc662_auto_init_verbs[] = {
15264 * Unmute ADC and set the default input to mic-in
15266 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15267 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15269 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15271 * Note: PASD motherboards uses the Line In 2 as the input for front
15272 * panel mic (mic 2)
15274 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15277 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15278 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15282 * Set up output mixers (0x0c - 0x0f)
15284 /* set vol=0 to output mixers */
15285 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15286 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15287 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15289 /* set up input amps for analog loopback */
15290 /* Amp Indices: DAC = 0, mixer = 1 */
15291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15299 /* FIXME: use matrix-type input source selection */
15300 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15307 /* additional verbs for ALC663 */
15308 static struct hda_verb alc663_auto_init_verbs[] = {
15309 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15310 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15314 static struct hda_verb alc663_m51va_init_verbs[] = {
15315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15317 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15318 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15319 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15322 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15323 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15327 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15328 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15329 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15330 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15333 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15334 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15338 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15339 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15340 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15341 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15342 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15345 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15346 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15350 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15352 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15353 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15355 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15356 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15357 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15361 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15362 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15363 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15364 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15365 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15368 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15371 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15372 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15373 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15377 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15378 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15379 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15380 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15381 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15387 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15388 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15389 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15393 static struct hda_verb alc663_g71v_init_verbs[] = {
15394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15395 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15396 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15398 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15399 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15400 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15402 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15403 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15404 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15408 static struct hda_verb alc663_g50v_init_verbs[] = {
15409 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15410 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15411 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15413 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15414 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15418 static struct hda_verb alc662_ecs_init_verbs[] = {
15419 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15421 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15422 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15426 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15427 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15428 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15432 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15434 unsigned int present;
15435 unsigned char bits;
15437 present = snd_hda_codec_read(codec, 0x14, 0,
15438 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15439 bits = present ? HDA_AMP_MUTE : 0;
15440 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15441 HDA_AMP_MUTE, bits);
15444 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15446 unsigned int present;
15447 unsigned char bits;
15449 present = snd_hda_codec_read(codec, 0x1b, 0,
15450 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15451 bits = present ? HDA_AMP_MUTE : 0;
15452 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15453 HDA_AMP_MUTE, bits);
15454 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15455 HDA_AMP_MUTE, bits);
15458 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15461 if ((res >> 26) == ALC880_HP_EVENT)
15462 alc662_lenovo_101e_all_automute(codec);
15463 if ((res >> 26) == ALC880_FRONT_EVENT)
15464 alc662_lenovo_101e_ispeaker_automute(codec);
15467 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15469 unsigned int present;
15471 present = snd_hda_codec_read(codec, 0x18, 0,
15472 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15473 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15474 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15475 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15476 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15477 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15478 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15479 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15480 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15483 /* unsolicited event for HP jack sensing */
15484 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15487 if ((res >> 26) == ALC880_HP_EVENT)
15488 alc262_hippo1_automute( codec );
15490 if ((res >> 26) == ALC880_MIC_EVENT)
15491 alc662_eeepc_mic_automute(codec);
15494 static void alc662_eeepc_inithook(struct hda_codec *codec)
15496 alc262_hippo1_automute( codec );
15497 alc662_eeepc_mic_automute(codec);
15500 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15503 unsigned int present;
15505 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15506 present = snd_hda_codec_read(codec, 0x14, 0,
15507 AC_VERB_GET_PIN_SENSE, 0);
15508 present = (present & 0x80000000) != 0;
15510 /* mute internal speaker */
15511 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15512 HDA_AMP_MUTE, HDA_AMP_MUTE);
15514 /* unmute internal speaker if necessary */
15515 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15516 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15517 HDA_AMP_MUTE, mute);
15521 /* unsolicited event for HP jack sensing */
15522 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15525 if ((res >> 26) == ALC880_HP_EVENT)
15526 alc662_eeepc_ep20_automute(codec);
15529 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15531 alc662_eeepc_ep20_automute(codec);
15534 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15536 unsigned int present;
15537 unsigned char bits;
15539 present = snd_hda_codec_read(codec, 0x21, 0,
15540 AC_VERB_GET_PIN_SENSE, 0)
15541 & AC_PINSENSE_PRESENCE;
15542 bits = present ? HDA_AMP_MUTE : 0;
15543 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15544 AMP_IN_MUTE(0), bits);
15545 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15546 AMP_IN_MUTE(0), bits);
15549 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15551 unsigned int present;
15552 unsigned char bits;
15554 present = snd_hda_codec_read(codec, 0x21, 0,
15555 AC_VERB_GET_PIN_SENSE, 0)
15556 & AC_PINSENSE_PRESENCE;
15557 bits = present ? HDA_AMP_MUTE : 0;
15558 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15559 AMP_IN_MUTE(0), bits);
15560 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15561 AMP_IN_MUTE(0), bits);
15562 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15563 AMP_IN_MUTE(0), bits);
15564 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15565 AMP_IN_MUTE(0), bits);
15568 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15570 unsigned int present;
15571 unsigned char bits;
15573 present = snd_hda_codec_read(codec, 0x15, 0,
15574 AC_VERB_GET_PIN_SENSE, 0)
15575 & AC_PINSENSE_PRESENCE;
15576 bits = present ? HDA_AMP_MUTE : 0;
15577 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15578 AMP_IN_MUTE(0), bits);
15579 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15580 AMP_IN_MUTE(0), bits);
15581 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15582 AMP_IN_MUTE(0), bits);
15583 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15584 AMP_IN_MUTE(0), bits);
15587 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15589 unsigned int present;
15590 unsigned char bits;
15592 present = snd_hda_codec_read(codec, 0x1b, 0,
15593 AC_VERB_GET_PIN_SENSE, 0)
15594 & AC_PINSENSE_PRESENCE;
15595 bits = present ? 0 : PIN_OUT;
15596 snd_hda_codec_write(codec, 0x14, 0,
15597 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15600 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15602 unsigned int present1, present2;
15604 present1 = snd_hda_codec_read(codec, 0x21, 0,
15605 AC_VERB_GET_PIN_SENSE, 0)
15606 & AC_PINSENSE_PRESENCE;
15607 present2 = snd_hda_codec_read(codec, 0x15, 0,
15608 AC_VERB_GET_PIN_SENSE, 0)
15609 & AC_PINSENSE_PRESENCE;
15611 if (present1 || present2) {
15612 snd_hda_codec_write_cache(codec, 0x14, 0,
15613 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15615 snd_hda_codec_write_cache(codec, 0x14, 0,
15616 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15620 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15622 unsigned int present1, present2;
15624 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15625 AC_VERB_GET_PIN_SENSE, 0)
15626 & AC_PINSENSE_PRESENCE;
15627 present2 = snd_hda_codec_read(codec, 0x15, 0,
15628 AC_VERB_GET_PIN_SENSE, 0)
15629 & AC_PINSENSE_PRESENCE;
15631 if (present1 || present2) {
15632 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15633 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15634 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15635 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15637 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15638 AMP_IN_MUTE(0), 0);
15639 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15640 AMP_IN_MUTE(0), 0);
15644 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15646 unsigned int present;
15648 present = snd_hda_codec_read(codec, 0x18, 0,
15649 AC_VERB_GET_PIN_SENSE, 0)
15650 & AC_PINSENSE_PRESENCE;
15651 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15652 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15653 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15654 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15655 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15656 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15657 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15658 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15661 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15664 switch (res >> 26) {
15665 case ALC880_HP_EVENT:
15666 alc663_m51va_speaker_automute(codec);
15668 case ALC880_MIC_EVENT:
15669 alc663_m51va_mic_automute(codec);
15674 static void alc663_m51va_inithook(struct hda_codec *codec)
15676 alc663_m51va_speaker_automute(codec);
15677 alc663_m51va_mic_automute(codec);
15680 /* ***************** Mode1 ******************************/
15681 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15684 switch (res >> 26) {
15685 case ALC880_HP_EVENT:
15686 alc663_m51va_speaker_automute(codec);
15688 case ALC880_MIC_EVENT:
15689 alc662_eeepc_mic_automute(codec);
15694 static void alc663_mode1_inithook(struct hda_codec *codec)
15696 alc663_m51va_speaker_automute(codec);
15697 alc662_eeepc_mic_automute(codec);
15699 /* ***************** Mode2 ******************************/
15700 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15703 switch (res >> 26) {
15704 case ALC880_HP_EVENT:
15705 alc662_f5z_speaker_automute(codec);
15707 case ALC880_MIC_EVENT:
15708 alc662_eeepc_mic_automute(codec);
15713 static void alc662_mode2_inithook(struct hda_codec *codec)
15715 alc662_f5z_speaker_automute(codec);
15716 alc662_eeepc_mic_automute(codec);
15718 /* ***************** Mode3 ******************************/
15719 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15722 switch (res >> 26) {
15723 case ALC880_HP_EVENT:
15724 alc663_two_hp_m1_speaker_automute(codec);
15726 case ALC880_MIC_EVENT:
15727 alc662_eeepc_mic_automute(codec);
15732 static void alc663_mode3_inithook(struct hda_codec *codec)
15734 alc663_two_hp_m1_speaker_automute(codec);
15735 alc662_eeepc_mic_automute(codec);
15737 /* ***************** Mode4 ******************************/
15738 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15741 switch (res >> 26) {
15742 case ALC880_HP_EVENT:
15743 alc663_21jd_two_speaker_automute(codec);
15745 case ALC880_MIC_EVENT:
15746 alc662_eeepc_mic_automute(codec);
15751 static void alc663_mode4_inithook(struct hda_codec *codec)
15753 alc663_21jd_two_speaker_automute(codec);
15754 alc662_eeepc_mic_automute(codec);
15756 /* ***************** Mode5 ******************************/
15757 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15760 switch (res >> 26) {
15761 case ALC880_HP_EVENT:
15762 alc663_15jd_two_speaker_automute(codec);
15764 case ALC880_MIC_EVENT:
15765 alc662_eeepc_mic_automute(codec);
15770 static void alc663_mode5_inithook(struct hda_codec *codec)
15772 alc663_15jd_two_speaker_automute(codec);
15773 alc662_eeepc_mic_automute(codec);
15775 /* ***************** Mode6 ******************************/
15776 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15779 switch (res >> 26) {
15780 case ALC880_HP_EVENT:
15781 alc663_two_hp_m2_speaker_automute(codec);
15783 case ALC880_MIC_EVENT:
15784 alc662_eeepc_mic_automute(codec);
15789 static void alc663_mode6_inithook(struct hda_codec *codec)
15791 alc663_two_hp_m2_speaker_automute(codec);
15792 alc662_eeepc_mic_automute(codec);
15795 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15797 unsigned int present;
15798 unsigned char bits;
15800 present = snd_hda_codec_read(codec, 0x21, 0,
15801 AC_VERB_GET_PIN_SENSE, 0)
15802 & AC_PINSENSE_PRESENCE;
15803 bits = present ? HDA_AMP_MUTE : 0;
15804 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15805 HDA_AMP_MUTE, bits);
15806 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15807 HDA_AMP_MUTE, bits);
15810 static void alc663_g71v_front_automute(struct hda_codec *codec)
15812 unsigned int present;
15813 unsigned char bits;
15815 present = snd_hda_codec_read(codec, 0x15, 0,
15816 AC_VERB_GET_PIN_SENSE, 0)
15817 & AC_PINSENSE_PRESENCE;
15818 bits = present ? HDA_AMP_MUTE : 0;
15819 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15820 HDA_AMP_MUTE, bits);
15823 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15826 switch (res >> 26) {
15827 case ALC880_HP_EVENT:
15828 alc663_g71v_hp_automute(codec);
15830 case ALC880_FRONT_EVENT:
15831 alc663_g71v_front_automute(codec);
15833 case ALC880_MIC_EVENT:
15834 alc662_eeepc_mic_automute(codec);
15839 static void alc663_g71v_inithook(struct hda_codec *codec)
15841 alc663_g71v_front_automute(codec);
15842 alc663_g71v_hp_automute(codec);
15843 alc662_eeepc_mic_automute(codec);
15846 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15849 switch (res >> 26) {
15850 case ALC880_HP_EVENT:
15851 alc663_m51va_speaker_automute(codec);
15853 case ALC880_MIC_EVENT:
15854 alc662_eeepc_mic_automute(codec);
15859 static void alc663_g50v_inithook(struct hda_codec *codec)
15861 alc663_m51va_speaker_automute(codec);
15862 alc662_eeepc_mic_automute(codec);
15865 /* bind hp and internal speaker mute (with plug check) */
15866 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15867 struct snd_ctl_elem_value *ucontrol)
15869 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15870 long *valp = ucontrol->value.integer.value;
15873 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15875 valp[0] ? 0 : HDA_AMP_MUTE);
15876 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15878 valp[1] ? 0 : HDA_AMP_MUTE);
15880 alc262_hippo1_automute(codec);
15884 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15885 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15887 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15888 .name = "Master Playback Switch",
15889 .info = snd_hda_mixer_amp_switch_info,
15890 .get = snd_hda_mixer_amp_switch_get,
15891 .put = alc662_ecs_master_sw_put,
15892 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15895 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15896 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15897 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15899 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15900 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15901 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15905 #ifdef CONFIG_SND_HDA_POWER_SAVE
15906 #define alc662_loopbacks alc880_loopbacks
15910 /* pcm configuration: identiacal with ALC880 */
15911 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15912 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15913 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15914 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15917 * configuration and preset
15919 static const char *alc662_models[ALC662_MODEL_LAST] = {
15920 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15921 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15922 [ALC662_3ST_6ch] = "3stack-6ch",
15923 [ALC662_5ST_DIG] = "6stack-dig",
15924 [ALC662_LENOVO_101E] = "lenovo-101e",
15925 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15926 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15927 [ALC662_ECS] = "ecs",
15928 [ALC663_ASUS_M51VA] = "m51va",
15929 [ALC663_ASUS_G71V] = "g71v",
15930 [ALC663_ASUS_H13] = "h13",
15931 [ALC663_ASUS_G50V] = "g50v",
15932 [ALC663_ASUS_MODE1] = "asus-mode1",
15933 [ALC662_ASUS_MODE2] = "asus-mode2",
15934 [ALC663_ASUS_MODE3] = "asus-mode3",
15935 [ALC663_ASUS_MODE4] = "asus-mode4",
15936 [ALC663_ASUS_MODE5] = "asus-mode5",
15937 [ALC663_ASUS_MODE6] = "asus-mode6",
15938 [ALC662_AUTO] = "auto",
15941 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15942 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15943 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15944 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15945 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15946 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15947 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15948 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15949 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15950 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15951 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15952 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15953 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15954 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15955 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15956 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15957 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15958 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15959 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15960 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15961 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15962 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15963 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15964 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15965 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15966 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15967 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15968 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15969 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15970 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15971 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15972 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15973 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15974 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15975 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15976 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15977 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15978 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15979 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15980 ALC662_3ST_6ch_DIG),
15981 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15982 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15983 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15984 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15985 ALC662_3ST_6ch_DIG),
15986 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15987 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15988 ALC662_3ST_6ch_DIG),
15989 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15990 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15991 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
15995 static struct alc_config_preset alc662_presets[] = {
15996 [ALC662_3ST_2ch_DIG] = {
15997 .mixers = { alc662_3ST_2ch_mixer },
15998 .init_verbs = { alc662_init_verbs },
15999 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16000 .dac_nids = alc662_dac_nids,
16001 .dig_out_nid = ALC662_DIGOUT_NID,
16002 .dig_in_nid = ALC662_DIGIN_NID,
16003 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16004 .channel_mode = alc662_3ST_2ch_modes,
16005 .input_mux = &alc662_capture_source,
16007 [ALC662_3ST_6ch_DIG] = {
16008 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16009 .init_verbs = { alc662_init_verbs },
16010 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16011 .dac_nids = alc662_dac_nids,
16012 .dig_out_nid = ALC662_DIGOUT_NID,
16013 .dig_in_nid = ALC662_DIGIN_NID,
16014 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16015 .channel_mode = alc662_3ST_6ch_modes,
16017 .input_mux = &alc662_capture_source,
16019 [ALC662_3ST_6ch] = {
16020 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16021 .init_verbs = { alc662_init_verbs },
16022 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16023 .dac_nids = alc662_dac_nids,
16024 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16025 .channel_mode = alc662_3ST_6ch_modes,
16027 .input_mux = &alc662_capture_source,
16029 [ALC662_5ST_DIG] = {
16030 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16031 .init_verbs = { alc662_init_verbs },
16032 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16033 .dac_nids = alc662_dac_nids,
16034 .dig_out_nid = ALC662_DIGOUT_NID,
16035 .dig_in_nid = ALC662_DIGIN_NID,
16036 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16037 .channel_mode = alc662_5stack_modes,
16038 .input_mux = &alc662_capture_source,
16040 [ALC662_LENOVO_101E] = {
16041 .mixers = { alc662_lenovo_101e_mixer },
16042 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16043 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16044 .dac_nids = alc662_dac_nids,
16045 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16046 .channel_mode = alc662_3ST_2ch_modes,
16047 .input_mux = &alc662_lenovo_101e_capture_source,
16048 .unsol_event = alc662_lenovo_101e_unsol_event,
16049 .init_hook = alc662_lenovo_101e_all_automute,
16051 [ALC662_ASUS_EEEPC_P701] = {
16052 .mixers = { alc662_eeepc_p701_mixer },
16053 .init_verbs = { alc662_init_verbs,
16054 alc662_eeepc_sue_init_verbs },
16055 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16056 .dac_nids = alc662_dac_nids,
16057 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16058 .channel_mode = alc662_3ST_2ch_modes,
16059 .input_mux = &alc662_eeepc_capture_source,
16060 .unsol_event = alc662_eeepc_unsol_event,
16061 .init_hook = alc662_eeepc_inithook,
16063 [ALC662_ASUS_EEEPC_EP20] = {
16064 .mixers = { alc662_eeepc_ep20_mixer,
16065 alc662_chmode_mixer },
16066 .init_verbs = { alc662_init_verbs,
16067 alc662_eeepc_ep20_sue_init_verbs },
16068 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16069 .dac_nids = alc662_dac_nids,
16070 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16071 .channel_mode = alc662_3ST_6ch_modes,
16072 .input_mux = &alc662_lenovo_101e_capture_source,
16073 .unsol_event = alc662_eeepc_ep20_unsol_event,
16074 .init_hook = alc662_eeepc_ep20_inithook,
16077 .mixers = { alc662_ecs_mixer },
16078 .init_verbs = { alc662_init_verbs,
16079 alc662_ecs_init_verbs },
16080 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16081 .dac_nids = alc662_dac_nids,
16082 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16083 .channel_mode = alc662_3ST_2ch_modes,
16084 .input_mux = &alc662_eeepc_capture_source,
16085 .unsol_event = alc662_eeepc_unsol_event,
16086 .init_hook = alc662_eeepc_inithook,
16088 [ALC663_ASUS_M51VA] = {
16089 .mixers = { alc663_m51va_mixer },
16090 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16091 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16092 .dac_nids = alc662_dac_nids,
16093 .dig_out_nid = ALC662_DIGOUT_NID,
16094 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16095 .channel_mode = alc662_3ST_2ch_modes,
16096 .input_mux = &alc663_m51va_capture_source,
16097 .unsol_event = alc663_m51va_unsol_event,
16098 .init_hook = alc663_m51va_inithook,
16100 [ALC663_ASUS_G71V] = {
16101 .mixers = { alc663_g71v_mixer },
16102 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16103 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16104 .dac_nids = alc662_dac_nids,
16105 .dig_out_nid = ALC662_DIGOUT_NID,
16106 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16107 .channel_mode = alc662_3ST_2ch_modes,
16108 .input_mux = &alc662_eeepc_capture_source,
16109 .unsol_event = alc663_g71v_unsol_event,
16110 .init_hook = alc663_g71v_inithook,
16112 [ALC663_ASUS_H13] = {
16113 .mixers = { alc663_m51va_mixer },
16114 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16115 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16116 .dac_nids = alc662_dac_nids,
16117 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16118 .channel_mode = alc662_3ST_2ch_modes,
16119 .input_mux = &alc663_m51va_capture_source,
16120 .unsol_event = alc663_m51va_unsol_event,
16121 .init_hook = alc663_m51va_inithook,
16123 [ALC663_ASUS_G50V] = {
16124 .mixers = { alc663_g50v_mixer },
16125 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16126 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16127 .dac_nids = alc662_dac_nids,
16128 .dig_out_nid = ALC662_DIGOUT_NID,
16129 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16130 .channel_mode = alc662_3ST_6ch_modes,
16131 .input_mux = &alc663_capture_source,
16132 .unsol_event = alc663_g50v_unsol_event,
16133 .init_hook = alc663_g50v_inithook,
16135 [ALC663_ASUS_MODE1] = {
16136 .mixers = { alc663_m51va_mixer },
16137 .cap_mixer = alc662_auto_capture_mixer,
16138 .init_verbs = { alc662_init_verbs,
16139 alc663_21jd_amic_init_verbs },
16140 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16142 .dac_nids = alc662_dac_nids,
16143 .dig_out_nid = ALC662_DIGOUT_NID,
16144 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16145 .channel_mode = alc662_3ST_2ch_modes,
16146 .input_mux = &alc662_eeepc_capture_source,
16147 .unsol_event = alc663_mode1_unsol_event,
16148 .init_hook = alc663_mode1_inithook,
16150 [ALC662_ASUS_MODE2] = {
16151 .mixers = { alc662_1bjd_mixer },
16152 .cap_mixer = alc662_auto_capture_mixer,
16153 .init_verbs = { alc662_init_verbs,
16154 alc662_1bjd_amic_init_verbs },
16155 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16156 .dac_nids = alc662_dac_nids,
16157 .dig_out_nid = ALC662_DIGOUT_NID,
16158 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16159 .channel_mode = alc662_3ST_2ch_modes,
16160 .input_mux = &alc662_eeepc_capture_source,
16161 .unsol_event = alc662_mode2_unsol_event,
16162 .init_hook = alc662_mode2_inithook,
16164 [ALC663_ASUS_MODE3] = {
16165 .mixers = { alc663_two_hp_m1_mixer },
16166 .cap_mixer = alc662_auto_capture_mixer,
16167 .init_verbs = { alc662_init_verbs,
16168 alc663_two_hp_amic_m1_init_verbs },
16169 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16171 .dac_nids = alc662_dac_nids,
16172 .dig_out_nid = ALC662_DIGOUT_NID,
16173 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16174 .channel_mode = alc662_3ST_2ch_modes,
16175 .input_mux = &alc662_eeepc_capture_source,
16176 .unsol_event = alc663_mode3_unsol_event,
16177 .init_hook = alc663_mode3_inithook,
16179 [ALC663_ASUS_MODE4] = {
16180 .mixers = { alc663_asus_21jd_clfe_mixer },
16181 .cap_mixer = alc662_auto_capture_mixer,
16182 .init_verbs = { alc662_init_verbs,
16183 alc663_21jd_amic_init_verbs},
16184 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16186 .dac_nids = alc662_dac_nids,
16187 .dig_out_nid = ALC662_DIGOUT_NID,
16188 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16189 .channel_mode = alc662_3ST_2ch_modes,
16190 .input_mux = &alc662_eeepc_capture_source,
16191 .unsol_event = alc663_mode4_unsol_event,
16192 .init_hook = alc663_mode4_inithook,
16194 [ALC663_ASUS_MODE5] = {
16195 .mixers = { alc663_asus_15jd_clfe_mixer },
16196 .cap_mixer = alc662_auto_capture_mixer,
16197 .init_verbs = { alc662_init_verbs,
16198 alc663_15jd_amic_init_verbs },
16199 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16201 .dac_nids = alc662_dac_nids,
16202 .dig_out_nid = ALC662_DIGOUT_NID,
16203 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16204 .channel_mode = alc662_3ST_2ch_modes,
16205 .input_mux = &alc662_eeepc_capture_source,
16206 .unsol_event = alc663_mode5_unsol_event,
16207 .init_hook = alc663_mode5_inithook,
16209 [ALC663_ASUS_MODE6] = {
16210 .mixers = { alc663_two_hp_m2_mixer },
16211 .cap_mixer = alc662_auto_capture_mixer,
16212 .init_verbs = { alc662_init_verbs,
16213 alc663_two_hp_amic_m2_init_verbs },
16214 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16216 .dac_nids = alc662_dac_nids,
16217 .dig_out_nid = ALC662_DIGOUT_NID,
16218 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16219 .channel_mode = alc662_3ST_2ch_modes,
16220 .input_mux = &alc662_eeepc_capture_source,
16221 .unsol_event = alc663_mode6_unsol_event,
16222 .init_hook = alc663_mode6_inithook,
16228 * BIOS auto configuration
16231 /* add playback controls from the parsed DAC table */
16232 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16233 const struct auto_pin_cfg *cfg)
16236 static const char *chname[4] = {
16237 "Front", "Surround", NULL /*CLFE*/, "Side"
16242 for (i = 0; i < cfg->line_outs; i++) {
16243 if (!spec->multiout.dac_nids[i])
16245 nid = alc880_idx_to_dac(i);
16248 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16249 "Center Playback Volume",
16250 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16254 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16255 "LFE Playback Volume",
16256 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16260 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16261 "Center Playback Switch",
16262 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16266 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16267 "LFE Playback Switch",
16268 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16273 sprintf(name, "%s Playback Volume", chname[i]);
16274 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16275 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16279 sprintf(name, "%s Playback Switch", chname[i]);
16280 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16281 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16290 /* add playback controls for speaker and HP outputs */
16291 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16302 /* ALC663 has a mono output pin on 0x17 */
16303 sprintf(name, "%s Playback Switch", pfx);
16304 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16305 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16309 if (alc880_is_fixed_pin(pin)) {
16310 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16311 /* printk("DAC nid=%x\n",nid); */
16312 /* specify the DAC as the extra output */
16313 if (!spec->multiout.hp_nid)
16314 spec->multiout.hp_nid = nid;
16316 spec->multiout.extra_out_nid[0] = nid;
16317 /* control HP volume/switch on the output mixer amp */
16318 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16319 sprintf(name, "%s Playback Volume", pfx);
16320 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16321 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16324 sprintf(name, "%s Playback Switch", pfx);
16325 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16326 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16329 } else if (alc880_is_multi_pin(pin)) {
16330 /* set manual connection */
16331 /* we have only a switch on HP-out PIN */
16332 sprintf(name, "%s Playback Switch", pfx);
16333 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16334 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16341 /* create playback/capture controls for input pins */
16342 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16343 const struct auto_pin_cfg *cfg)
16345 struct hda_input_mux *imux = &spec->private_imux;
16348 for (i = 0; i < AUTO_PIN_LAST; i++) {
16349 if (alc880_is_input_pin(cfg->input_pins[i])) {
16350 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16351 err = new_analog_input(spec, cfg->input_pins[i],
16352 auto_pin_cfg_labels[i],
16356 imux->items[imux->num_items].label =
16357 auto_pin_cfg_labels[i];
16358 imux->items[imux->num_items].index =
16359 alc880_input_pin_idx(cfg->input_pins[i]);
16366 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16367 hda_nid_t nid, int pin_type,
16370 alc_set_pin_output(codec, nid, pin_type);
16371 /* need the manual connection? */
16372 if (alc880_is_multi_pin(nid)) {
16373 struct alc_spec *spec = codec->spec;
16374 int idx = alc880_multi_pin_idx(nid);
16375 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16376 AC_VERB_SET_CONNECT_SEL,
16377 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16381 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16383 struct alc_spec *spec = codec->spec;
16386 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16387 for (i = 0; i <= HDA_SIDE; i++) {
16388 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16389 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16391 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16396 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16398 struct alc_spec *spec = codec->spec;
16401 pin = spec->autocfg.hp_pins[0];
16402 if (pin) /* connect to front */
16404 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16405 pin = spec->autocfg.speaker_pins[0];
16407 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16410 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16411 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16413 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16415 struct alc_spec *spec = codec->spec;
16418 for (i = 0; i < AUTO_PIN_LAST; i++) {
16419 hda_nid_t nid = spec->autocfg.input_pins[i];
16420 if (alc662_is_input_pin(nid)) {
16421 snd_hda_codec_write(codec, nid, 0,
16422 AC_VERB_SET_PIN_WIDGET_CONTROL,
16423 (i <= AUTO_PIN_FRONT_MIC ?
16424 PIN_VREF80 : PIN_IN));
16425 if (nid != ALC662_PIN_CD_NID)
16426 snd_hda_codec_write(codec, nid, 0,
16427 AC_VERB_SET_AMP_GAIN_MUTE,
16433 #define alc662_auto_init_input_src alc882_auto_init_input_src
16435 static int alc662_parse_auto_config(struct hda_codec *codec)
16437 struct alc_spec *spec = codec->spec;
16439 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16441 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16445 if (!spec->autocfg.line_outs)
16446 return 0; /* can't find valid BIOS pin config */
16448 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16451 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16454 err = alc662_auto_create_extra_out(spec,
16455 spec->autocfg.speaker_pins[0],
16459 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16463 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16467 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16469 if (spec->autocfg.dig_out_pin)
16470 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16472 if (spec->kctls.list)
16473 add_mixer(spec, spec->kctls.list);
16475 spec->num_mux_defs = 1;
16476 spec->input_mux = &spec->private_imux;
16478 add_verb(spec, alc662_auto_init_verbs);
16479 if (codec->vendor_id == 0x10ec0663)
16480 add_verb(spec, alc663_auto_init_verbs);
16482 err = alc_auto_add_mic_boost(codec);
16486 store_pin_configs(codec);
16490 /* additional initialization for auto-configuration model */
16491 static void alc662_auto_init(struct hda_codec *codec)
16493 struct alc_spec *spec = codec->spec;
16494 alc662_auto_init_multi_out(codec);
16495 alc662_auto_init_hp_out(codec);
16496 alc662_auto_init_analog_input(codec);
16497 alc662_auto_init_input_src(codec);
16498 if (spec->unsol_event)
16499 alc_inithook(codec);
16502 static int patch_alc662(struct hda_codec *codec)
16504 struct alc_spec *spec;
16505 int err, board_config;
16507 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16511 codec->spec = spec;
16513 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16515 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16518 if (board_config < 0) {
16519 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16520 "trying auto-probe from BIOS...\n");
16521 board_config = ALC662_AUTO;
16524 if (board_config == ALC662_AUTO) {
16525 /* automatic parse from the BIOS config */
16526 err = alc662_parse_auto_config(codec);
16532 "hda_codec: Cannot set up configuration "
16533 "from BIOS. Using base mode...\n");
16534 board_config = ALC662_3ST_2ch_DIG;
16538 if (board_config != ALC662_AUTO)
16539 setup_preset(spec, &alc662_presets[board_config]);
16541 if (codec->vendor_id == 0x10ec0663) {
16542 spec->stream_name_analog = "ALC663 Analog";
16543 spec->stream_name_digital = "ALC663 Digital";
16544 } else if (codec->vendor_id == 0x10ec0272) {
16545 spec->stream_name_analog = "ALC272 Analog";
16546 spec->stream_name_digital = "ALC272 Digital";
16548 spec->stream_name_analog = "ALC662 Analog";
16549 spec->stream_name_digital = "ALC662 Digital";
16552 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16553 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16555 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16556 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16558 spec->adc_nids = alc662_adc_nids;
16559 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16560 spec->capsrc_nids = alc662_capsrc_nids;
16561 spec->is_mix_capture = 1;
16563 if (!spec->cap_mixer)
16564 set_capture_mixer(spec);
16566 spec->vmaster_nid = 0x02;
16568 codec->patch_ops = alc_patch_ops;
16569 if (board_config == ALC662_AUTO)
16570 spec->init_hook = alc662_auto_init;
16571 #ifdef CONFIG_SND_HDA_POWER_SAVE
16572 if (!spec->loopback.amplist)
16573 spec->loopback.amplist = alc662_loopbacks;
16582 struct hda_codec_preset snd_hda_preset_realtek[] = {
16583 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16584 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16585 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16586 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16587 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16588 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16589 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16590 .patch = patch_alc861 },
16591 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16592 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16593 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16594 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16595 .patch = patch_alc883 },
16596 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16597 .patch = patch_alc662 },
16598 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16599 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16600 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16601 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16602 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16603 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16604 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16605 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16606 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16607 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16608 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16609 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16610 .patch = patch_alc883 },
16611 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16612 {} /* terminator */