2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
34 #define ALC880_FRONT_EVENT 0x01
35 #define ALC880_DCVOL_EVENT 0x02
36 #define ALC880_HP_EVENT 0x04
37 #define ALC880_MIC_EVENT 0x08
39 /* ALC880 board config type */
63 #ifdef CONFIG_SND_DEBUG
67 ALC880_MODEL_LAST /* last tag */
80 #ifdef CONFIG_SND_DEBUG
84 ALC260_MODEL_LAST /* last tag */
94 ALC262_HP_BPC_D7000_WL,
95 ALC262_HP_BPC_D7000_WF,
107 ALC262_MODEL_LAST /* last tag */
117 ALC268_ACER_ASPIRE_ONE,
120 #ifdef CONFIG_SND_DEBUG
124 ALC268_MODEL_LAST /* last tag */
131 ALC269_ASUS_EEEPC_P703,
132 ALC269_ASUS_EEEPC_P901,
136 ALC269_MODEL_LAST /* last tag */
153 /* ALC861-VD models */
175 ALC662_ASUS_EEEPC_P701,
176 ALC662_ASUS_EEEPC_EP20,
215 ALC883_TARGA_2ch_DIG,
218 ALC888_ACER_ASPIRE_4930G,
222 ALC883_LENOVO_101E_2ch,
223 ALC883_LENOVO_NB0763,
224 ALC888_LENOVO_MS7195_DIG,
231 ALC883_FUJITSU_PI2515,
232 ALC888_FUJITSU_XA3530,
233 ALC883_3ST_6ch_INTEL,
242 #define GPIO_MASK 0x03
245 /* codec parameterization */
246 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
247 unsigned int num_mixers;
248 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
250 const struct hda_verb *init_verbs[5]; /* initialization verbs
254 unsigned int num_init_verbs;
256 char *stream_name_analog; /* analog PCM stream */
257 struct hda_pcm_stream *stream_analog_playback;
258 struct hda_pcm_stream *stream_analog_capture;
259 struct hda_pcm_stream *stream_analog_alt_playback;
260 struct hda_pcm_stream *stream_analog_alt_capture;
262 char *stream_name_digital; /* digital PCM stream */
263 struct hda_pcm_stream *stream_digital_playback;
264 struct hda_pcm_stream *stream_digital_capture;
267 struct hda_multi_out multiout; /* playback set-up
268 * max_channels, dacs must be set
269 * dig_out_nid and hp_nid are optional
271 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;
310 unsigned int no_analog :1; /* digital I/O only */
312 /* for virtual master */
313 hda_nid_t vmaster_nid;
314 #ifdef CONFIG_SND_HDA_POWER_SAVE
315 struct hda_loopback_check loopback;
320 unsigned int pll_coef_idx, pll_coef_bit;
322 #ifdef SND_HDA_NEEDS_RESUME
323 #define ALC_MAX_PINS 16
324 unsigned int num_pins;
325 hda_nid_t pin_nids[ALC_MAX_PINS];
326 unsigned int pin_cfgs[ALC_MAX_PINS];
331 * configuration template - to be copied to the spec instance
333 struct alc_config_preset {
334 struct snd_kcontrol_new *mixers[5]; /* should be identical size
337 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
338 const struct hda_verb *init_verbs[5];
339 unsigned int num_dacs;
341 hda_nid_t dig_out_nid; /* optional */
342 hda_nid_t hp_nid; /* optional */
343 unsigned int num_adc_nids;
345 hda_nid_t *capsrc_nids;
346 hda_nid_t dig_in_nid;
347 unsigned int num_channel_mode;
348 const struct hda_channel_mode *channel_mode;
350 unsigned int num_mux_defs;
351 const struct hda_input_mux *input_mux;
352 void (*unsol_event)(struct hda_codec *, unsigned int);
353 void (*init_hook)(struct hda_codec *);
354 #ifdef CONFIG_SND_HDA_POWER_SAVE
355 struct hda_amp_list *loopbacks;
363 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
364 struct snd_ctl_elem_info *uinfo)
366 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
367 struct alc_spec *spec = codec->spec;
368 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
369 if (mux_idx >= spec->num_mux_defs)
371 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
374 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
375 struct snd_ctl_elem_value *ucontrol)
377 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
378 struct alc_spec *spec = codec->spec;
379 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
381 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
385 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
386 struct snd_ctl_elem_value *ucontrol)
388 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
389 struct alc_spec *spec = codec->spec;
390 const struct hda_input_mux *imux;
391 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
392 unsigned int mux_idx;
393 hda_nid_t nid = spec->capsrc_nids ?
394 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
396 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
397 imux = &spec->input_mux[mux_idx];
399 if (spec->is_mix_capture) {
400 /* Matrix-mixer style (e.g. ALC882) */
401 unsigned int *cur_val = &spec->cur_mux[adc_idx];
404 idx = ucontrol->value.enumerated.item[0];
405 if (idx >= imux->num_items)
406 idx = imux->num_items - 1;
409 for (i = 0; i < imux->num_items; i++) {
410 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
411 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
412 imux->items[i].index,
418 /* MUX style (e.g. ALC880) */
419 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
420 &spec->cur_mux[adc_idx]);
425 * channel mode setting
427 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
428 struct snd_ctl_elem_info *uinfo)
430 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
431 struct alc_spec *spec = codec->spec;
432 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
433 spec->num_channel_mode);
436 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
437 struct snd_ctl_elem_value *ucontrol)
439 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
440 struct alc_spec *spec = codec->spec;
441 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
442 spec->num_channel_mode,
443 spec->multiout.max_channels);
446 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
447 struct snd_ctl_elem_value *ucontrol)
449 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
450 struct alc_spec *spec = codec->spec;
451 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
452 spec->num_channel_mode,
453 &spec->multiout.max_channels);
454 if (err >= 0 && spec->need_dac_fix)
455 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
460 * Control the mode of pin widget settings via the mixer. "pc" is used
461 * instead of "%" to avoid consequences of accidently treating the % as
462 * being part of a format specifier. Maximum allowed length of a value is
463 * 63 characters plus NULL terminator.
465 * Note: some retasking pin complexes seem to ignore requests for input
466 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
467 * are requested. Therefore order this list so that this behaviour will not
468 * cause problems when mixer clients move through the enum sequentially.
469 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
472 static char *alc_pin_mode_names[] = {
473 "Mic 50pc bias", "Mic 80pc bias",
474 "Line in", "Line out", "Headphone out",
476 static unsigned char alc_pin_mode_values[] = {
477 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
479 /* The control can present all 5 options, or it can limit the options based
480 * in the pin being assumed to be exclusively an input or an output pin. In
481 * addition, "input" pins may or may not process the mic bias option
482 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
483 * accept requests for bias as of chip versions up to March 2006) and/or
484 * wiring in the computer.
486 #define ALC_PIN_DIR_IN 0x00
487 #define ALC_PIN_DIR_OUT 0x01
488 #define ALC_PIN_DIR_INOUT 0x02
489 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
490 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
492 /* Info about the pin modes supported by the different pin direction modes.
493 * For each direction the minimum and maximum values are given.
495 static signed char alc_pin_mode_dir_info[5][2] = {
496 { 0, 2 }, /* ALC_PIN_DIR_IN */
497 { 3, 4 }, /* ALC_PIN_DIR_OUT */
498 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
499 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
500 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
502 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
503 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
504 #define alc_pin_mode_n_items(_dir) \
505 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
507 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
508 struct snd_ctl_elem_info *uinfo)
510 unsigned int item_num = uinfo->value.enumerated.item;
511 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
513 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
515 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
517 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
518 item_num = alc_pin_mode_min(dir);
519 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
523 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
524 struct snd_ctl_elem_value *ucontrol)
527 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
528 hda_nid_t nid = kcontrol->private_value & 0xffff;
529 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
530 long *valp = ucontrol->value.integer.value;
531 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
532 AC_VERB_GET_PIN_WIDGET_CONTROL,
535 /* Find enumerated value for current pinctl setting */
536 i = alc_pin_mode_min(dir);
537 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
539 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
543 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_value *ucontrol)
547 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
548 hda_nid_t nid = kcontrol->private_value & 0xffff;
549 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
550 long val = *ucontrol->value.integer.value;
551 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
552 AC_VERB_GET_PIN_WIDGET_CONTROL,
555 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
556 val = alc_pin_mode_min(dir);
558 change = pinctl != alc_pin_mode_values[val];
560 /* Set pin mode to that requested */
561 snd_hda_codec_write_cache(codec, nid, 0,
562 AC_VERB_SET_PIN_WIDGET_CONTROL,
563 alc_pin_mode_values[val]);
565 /* Also enable the retasking pin's input/output as required
566 * for the requested pin mode. Enum values of 2 or less are
569 * Dynamically switching the input/output buffers probably
570 * reduces noise slightly (particularly on input) so we'll
571 * do it. However, having both input and output buffers
572 * enabled simultaneously doesn't seem to be problematic if
573 * this turns out to be necessary in the future.
576 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
577 HDA_AMP_MUTE, HDA_AMP_MUTE);
578 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
581 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
582 HDA_AMP_MUTE, HDA_AMP_MUTE);
583 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
590 #define ALC_PIN_MODE(xname, nid, dir) \
591 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
592 .info = alc_pin_mode_info, \
593 .get = alc_pin_mode_get, \
594 .put = alc_pin_mode_put, \
595 .private_value = nid | (dir<<16) }
597 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
598 * together using a mask with more than one bit set. This control is
599 * currently used only by the ALC260 test model. At this stage they are not
600 * needed for any "production" models.
602 #ifdef CONFIG_SND_DEBUG
603 #define alc_gpio_data_info snd_ctl_boolean_mono_info
605 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
606 struct snd_ctl_elem_value *ucontrol)
608 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
609 hda_nid_t nid = kcontrol->private_value & 0xffff;
610 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
611 long *valp = ucontrol->value.integer.value;
612 unsigned int val = snd_hda_codec_read(codec, nid, 0,
613 AC_VERB_GET_GPIO_DATA, 0x00);
615 *valp = (val & mask) != 0;
618 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
619 struct snd_ctl_elem_value *ucontrol)
622 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
623 hda_nid_t nid = kcontrol->private_value & 0xffff;
624 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
625 long val = *ucontrol->value.integer.value;
626 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
627 AC_VERB_GET_GPIO_DATA,
630 /* Set/unset the masked GPIO bit(s) as needed */
631 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
636 snd_hda_codec_write_cache(codec, nid, 0,
637 AC_VERB_SET_GPIO_DATA, gpio_data);
641 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
642 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
643 .info = alc_gpio_data_info, \
644 .get = alc_gpio_data_get, \
645 .put = alc_gpio_data_put, \
646 .private_value = nid | (mask<<16) }
647 #endif /* CONFIG_SND_DEBUG */
649 /* A switch control to allow the enabling of the digital IO pins on the
650 * ALC260. This is incredibly simplistic; the intention of this control is
651 * to provide something in the test model allowing digital outputs to be
652 * identified if present. If models are found which can utilise these
653 * outputs a more complete mixer control can be devised for those models if
656 #ifdef CONFIG_SND_DEBUG
657 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
659 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
660 struct snd_ctl_elem_value *ucontrol)
662 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
663 hda_nid_t nid = kcontrol->private_value & 0xffff;
664 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
665 long *valp = ucontrol->value.integer.value;
666 unsigned int val = snd_hda_codec_read(codec, nid, 0,
667 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
669 *valp = (val & mask) != 0;
672 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
673 struct snd_ctl_elem_value *ucontrol)
676 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
677 hda_nid_t nid = kcontrol->private_value & 0xffff;
678 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
679 long val = *ucontrol->value.integer.value;
680 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
681 AC_VERB_GET_DIGI_CONVERT_1,
684 /* Set/unset the masked control bit(s) as needed */
685 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
690 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
695 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
696 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
697 .info = alc_spdif_ctrl_info, \
698 .get = alc_spdif_ctrl_get, \
699 .put = alc_spdif_ctrl_put, \
700 .private_value = nid | (mask<<16) }
701 #endif /* CONFIG_SND_DEBUG */
703 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
704 * Again, this is only used in the ALC26x test models to help identify when
705 * the EAPD line must be asserted for features to work.
707 #ifdef CONFIG_SND_DEBUG
708 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
710 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
711 struct snd_ctl_elem_value *ucontrol)
713 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
714 hda_nid_t nid = kcontrol->private_value & 0xffff;
715 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
716 long *valp = ucontrol->value.integer.value;
717 unsigned int val = snd_hda_codec_read(codec, nid, 0,
718 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
720 *valp = (val & mask) != 0;
724 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
725 struct snd_ctl_elem_value *ucontrol)
728 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
729 hda_nid_t nid = kcontrol->private_value & 0xffff;
730 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
731 long val = *ucontrol->value.integer.value;
732 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
733 AC_VERB_GET_EAPD_BTLENABLE,
736 /* Set/unset the masked control bit(s) as needed */
737 change = (!val ? 0 : mask) != (ctrl_data & mask);
742 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
748 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
749 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
750 .info = alc_eapd_ctrl_info, \
751 .get = alc_eapd_ctrl_get, \
752 .put = alc_eapd_ctrl_put, \
753 .private_value = nid | (mask<<16) }
754 #endif /* CONFIG_SND_DEBUG */
758 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
760 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
762 spec->mixers[spec->num_mixers++] = mix;
765 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
767 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
769 spec->init_verbs[spec->num_init_verbs++] = verb;
772 #ifdef CONFIG_PROC_FS
776 static void print_realtek_coef(struct snd_info_buffer *buffer,
777 struct hda_codec *codec, hda_nid_t nid)
783 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
784 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
785 coeff = snd_hda_codec_read(codec, nid, 0,
786 AC_VERB_GET_COEF_INDEX, 0);
787 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
790 #define print_realtek_coef NULL
794 * set up from the preset table
796 static void setup_preset(struct alc_spec *spec,
797 const struct alc_config_preset *preset)
801 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
802 add_mixer(spec, preset->mixers[i]);
803 spec->cap_mixer = preset->cap_mixer;
804 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
806 add_verb(spec, preset->init_verbs[i]);
808 spec->channel_mode = preset->channel_mode;
809 spec->num_channel_mode = preset->num_channel_mode;
810 spec->need_dac_fix = preset->need_dac_fix;
812 spec->multiout.max_channels = spec->channel_mode[0].channels;
814 spec->multiout.num_dacs = preset->num_dacs;
815 spec->multiout.dac_nids = preset->dac_nids;
816 spec->multiout.dig_out_nid = preset->dig_out_nid;
817 spec->multiout.hp_nid = preset->hp_nid;
819 spec->num_mux_defs = preset->num_mux_defs;
820 if (!spec->num_mux_defs)
821 spec->num_mux_defs = 1;
822 spec->input_mux = preset->input_mux;
824 spec->num_adc_nids = preset->num_adc_nids;
825 spec->adc_nids = preset->adc_nids;
826 spec->capsrc_nids = preset->capsrc_nids;
827 spec->dig_in_nid = preset->dig_in_nid;
829 spec->unsol_event = preset->unsol_event;
830 spec->init_hook = preset->init_hook;
831 #ifdef CONFIG_SND_HDA_POWER_SAVE
832 spec->loopback.amplist = preset->loopbacks;
836 /* Enable GPIO mask and set output */
837 static struct hda_verb alc_gpio1_init_verbs[] = {
838 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
839 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
840 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
844 static struct hda_verb alc_gpio2_init_verbs[] = {
845 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
846 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
847 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
851 static struct hda_verb alc_gpio3_init_verbs[] = {
852 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
853 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
854 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
859 * Fix hardware PLL issue
860 * On some codecs, the analog PLL gating control must be off while
861 * the default value is 1.
863 static void alc_fix_pll(struct hda_codec *codec)
865 struct alc_spec *spec = codec->spec;
870 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
872 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
873 AC_VERB_GET_PROC_COEF, 0);
874 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
876 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
877 val & ~(1 << spec->pll_coef_bit));
880 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
881 unsigned int coef_idx, unsigned int coef_bit)
883 struct alc_spec *spec = codec->spec;
885 spec->pll_coef_idx = coef_idx;
886 spec->pll_coef_bit = coef_bit;
890 static void alc_sku_automute(struct hda_codec *codec)
892 struct alc_spec *spec = codec->spec;
893 unsigned int present;
894 unsigned int hp_nid = spec->autocfg.hp_pins[0];
895 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
897 /* need to execute and sync at first */
898 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
899 present = snd_hda_codec_read(codec, hp_nid, 0,
900 AC_VERB_GET_PIN_SENSE, 0);
901 spec->jack_present = (present & 0x80000000) != 0;
902 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
903 spec->jack_present ? 0 : PIN_OUT);
906 #if 0 /* it's broken in some acses -- temporarily disabled */
907 static void alc_mic_automute(struct hda_codec *codec)
909 struct alc_spec *spec = codec->spec;
910 unsigned int present;
911 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
912 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
913 unsigned int mix_nid = spec->capsrc_nids[0];
914 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
916 capsrc_idx_mic = mic_nid - 0x18;
917 capsrc_idx_fmic = fmic_nid - 0x18;
918 present = snd_hda_codec_read(codec, mic_nid, 0,
919 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
920 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
921 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
922 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
923 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
924 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
925 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
928 #define alc_mic_automute(codec) /* NOP */
929 #endif /* disabled */
931 /* unsolicited event for HP jack sensing */
932 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
934 if (codec->vendor_id == 0x10ec0880)
938 if (res == ALC880_HP_EVENT)
939 alc_sku_automute(codec);
941 if (res == ALC880_MIC_EVENT)
942 alc_mic_automute(codec);
945 static void alc_inithook(struct hda_codec *codec)
947 alc_sku_automute(codec);
948 alc_mic_automute(codec);
951 /* additional initialization for ALC888 variants */
952 static void alc888_coef_init(struct hda_codec *codec)
956 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
957 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
958 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
959 if ((tmp & 0xf0) == 2)
961 snd_hda_codec_read(codec, 0x20, 0,
962 AC_VERB_SET_PROC_COEF, 0x830);
965 snd_hda_codec_read(codec, 0x20, 0,
966 AC_VERB_SET_PROC_COEF, 0x3030);
969 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
970 * 31 ~ 16 : Manufacture ID
972 * 7 ~ 0 : Assembly ID
973 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
975 static void alc_subsystem_id(struct hda_codec *codec,
976 unsigned int porta, unsigned int porte,
979 unsigned int ass, tmp, i;
981 struct alc_spec *spec = codec->spec;
983 ass = codec->subsystem_id & 0xffff;
984 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
988 * 31~30 : port conetcivity
991 * 19~16 : Check sum (15:1)
996 if (codec->vendor_id == 0x10ec0260)
998 ass = snd_hda_codec_read(codec, nid, 0,
999 AC_VERB_GET_CONFIG_DEFAULT, 0);
1000 if (!(ass & 1) && !(ass & 0x100000))
1002 if ((ass >> 30) != 1) /* no physical connection */
1007 for (i = 1; i < 16; i++) {
1011 if (((ass >> 16) & 0xf) != tmp)
1017 * 2 : 0 --> Desktop, 1 --> Laptop
1018 * 3~5 : External Amplifier control
1021 tmp = (ass & 0x38) >> 3; /* external Amp control */
1024 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1027 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1030 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1032 case 5: /* set EAPD output high */
1033 switch (codec->vendor_id) {
1035 snd_hda_codec_write(codec, 0x0f, 0,
1036 AC_VERB_SET_EAPD_BTLENABLE, 2);
1037 snd_hda_codec_write(codec, 0x10, 0,
1038 AC_VERB_SET_EAPD_BTLENABLE, 2);
1049 snd_hda_codec_write(codec, 0x14, 0,
1050 AC_VERB_SET_EAPD_BTLENABLE, 2);
1051 snd_hda_codec_write(codec, 0x15, 0,
1052 AC_VERB_SET_EAPD_BTLENABLE, 2);
1055 switch (codec->vendor_id) {
1057 snd_hda_codec_write(codec, 0x1a, 0,
1058 AC_VERB_SET_COEF_INDEX, 7);
1059 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1060 AC_VERB_GET_PROC_COEF, 0);
1061 snd_hda_codec_write(codec, 0x1a, 0,
1062 AC_VERB_SET_COEF_INDEX, 7);
1063 snd_hda_codec_write(codec, 0x1a, 0,
1064 AC_VERB_SET_PROC_COEF,
1073 snd_hda_codec_write(codec, 0x20, 0,
1074 AC_VERB_SET_COEF_INDEX, 7);
1075 tmp = snd_hda_codec_read(codec, 0x20, 0,
1076 AC_VERB_GET_PROC_COEF, 0);
1077 snd_hda_codec_write(codec, 0x20, 0,
1078 AC_VERB_SET_COEF_INDEX, 7);
1079 snd_hda_codec_write(codec, 0x20, 0,
1080 AC_VERB_SET_PROC_COEF,
1084 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1088 snd_hda_codec_write(codec, 0x20, 0,
1089 AC_VERB_SET_COEF_INDEX, 7);
1090 tmp = snd_hda_codec_read(codec, 0x20, 0,
1091 AC_VERB_GET_PROC_COEF, 0);
1092 snd_hda_codec_write(codec, 0x20, 0,
1093 AC_VERB_SET_COEF_INDEX, 7);
1094 snd_hda_codec_write(codec, 0x20, 0,
1095 AC_VERB_SET_PROC_COEF,
1103 /* is laptop or Desktop and enable the function "Mute internal speaker
1104 * when the external headphone out jack is plugged"
1106 if (!(ass & 0x8000))
1109 * 10~8 : Jack location
1110 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1112 * 15 : 1 --> enable the function "Mute internal speaker
1113 * when the external headphone out jack is plugged"
1115 if (!spec->autocfg.speaker_pins[0]) {
1116 if (spec->autocfg.line_out_pins[0])
1117 spec->autocfg.speaker_pins[0] =
1118 spec->autocfg.line_out_pins[0];
1123 if (!spec->autocfg.hp_pins[0]) {
1124 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1126 spec->autocfg.hp_pins[0] = porta;
1128 spec->autocfg.hp_pins[0] = porte;
1130 spec->autocfg.hp_pins[0] = portd;
1134 if (spec->autocfg.hp_pins[0])
1135 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1136 AC_VERB_SET_UNSOLICITED_ENABLE,
1137 AC_USRSP_EN | ALC880_HP_EVENT);
1139 #if 0 /* it's broken in some acses -- temporarily disabled */
1140 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1141 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1142 snd_hda_codec_write(codec,
1143 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1144 AC_VERB_SET_UNSOLICITED_ENABLE,
1145 AC_USRSP_EN | ALC880_MIC_EVENT);
1146 #endif /* disabled */
1148 spec->unsol_event = alc_sku_unsol_event;
1152 * Fix-up pin default configurations
1160 static void alc_fix_pincfg(struct hda_codec *codec,
1161 const struct snd_pci_quirk *quirk,
1162 const struct alc_pincfg **pinfix)
1164 const struct alc_pincfg *cfg;
1166 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1170 cfg = pinfix[quirk->value];
1171 for (; cfg->nid; cfg++) {
1174 for (i = 0; i < 4; i++) {
1175 snd_hda_codec_write(codec, cfg->nid, 0,
1176 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1190 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1191 /* Mic-in jack as mic in */
1192 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1193 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1194 /* Line-in jack as Line in */
1195 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1196 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1197 /* Line-Out as Front */
1198 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1205 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1206 /* Mic-in jack as mic in */
1207 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1208 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1209 /* Line-in jack as Surround */
1210 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1211 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1212 /* Line-Out as Front */
1213 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1220 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1221 /* Mic-in jack as CLFE */
1222 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1223 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1224 /* Line-in jack as Surround */
1225 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1226 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1227 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1228 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1235 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1236 /* Mic-in jack as CLFE */
1237 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1238 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1239 /* Line-in jack as Surround */
1240 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1241 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1242 /* Line-Out as Side */
1243 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1247 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1248 { 2, alc888_4ST_ch2_intel_init },
1249 { 4, alc888_4ST_ch4_intel_init },
1250 { 6, alc888_4ST_ch6_intel_init },
1251 { 8, alc888_4ST_ch8_intel_init },
1255 * ALC888 Fujitsu Siemens Amillo xa3530
1258 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1259 /* Front Mic: set to PIN_IN (empty by default) */
1260 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1261 /* Connect Internal HP to Front */
1262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1263 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1264 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1265 /* Connect Bass HP to Front */
1266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1268 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1269 /* Connect Line-Out side jack (SPDIF) to Side */
1270 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1271 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1272 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1273 /* Connect Mic jack to CLFE */
1274 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1276 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1277 /* Connect Line-in jack to Surround */
1278 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1279 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1280 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1281 /* Connect HP out jack to Front */
1282 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1283 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1284 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1285 /* Enable unsolicited event for HP jack and Line-out jack */
1286 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1287 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1291 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1293 unsigned int present;
1295 /* Line out presence */
1296 present = snd_hda_codec_read(codec, 0x17, 0,
1297 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1298 /* HP out presence */
1299 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1300 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1301 bits = present ? HDA_AMP_MUTE : 0;
1302 /* Toggle internal speakers muting */
1303 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1304 HDA_AMP_MUTE, bits);
1305 /* Toggle internal bass muting */
1306 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1307 HDA_AMP_MUTE, bits);
1310 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1313 if (res >> 26 == ALC880_HP_EVENT)
1314 alc888_fujitsu_xa3530_automute(codec);
1319 * ALC888 Acer Aspire 4930G model
1322 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1323 /* Front Mic: set to PIN_IN (empty by default) */
1324 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1325 /* Unselect Front Mic by default in input mixer 3 */
1326 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1327 /* Enable unsolicited event for HP jack */
1328 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1329 /* Connect Internal HP to front */
1330 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1331 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1332 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1333 /* Connect HP out to front */
1334 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1335 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1340 static struct hda_input_mux alc888_2_capture_sources[2] = {
1341 /* Front mic only available on one ADC */
1348 { "Front Mic", 0xb },
1361 static struct snd_kcontrol_new alc888_base_mixer[] = {
1362 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1363 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1364 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1365 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1366 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1368 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1369 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1370 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1371 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1372 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1373 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1374 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1375 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1376 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1380 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1381 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1385 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1387 unsigned int present;
1389 present = snd_hda_codec_read(codec, 0x15, 0,
1390 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1391 bits = present ? HDA_AMP_MUTE : 0;
1392 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1393 HDA_AMP_MUTE, bits);
1396 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1399 if (res >> 26 == ALC880_HP_EVENT)
1400 alc888_acer_aspire_4930g_automute(codec);
1404 * ALC880 3-stack model
1406 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1407 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1408 * F-Mic = 0x1b, HP = 0x19
1411 static hda_nid_t alc880_dac_nids[4] = {
1412 /* front, rear, clfe, rear_surr */
1413 0x02, 0x05, 0x04, 0x03
1416 static hda_nid_t alc880_adc_nids[3] = {
1421 /* The datasheet says the node 0x07 is connected from inputs,
1422 * but it shows zero connection in the real implementation on some devices.
1423 * Note: this is a 915GAV bug, fixed on 915GLV
1425 static hda_nid_t alc880_adc_nids_alt[2] = {
1430 #define ALC880_DIGOUT_NID 0x06
1431 #define ALC880_DIGIN_NID 0x0a
1433 static struct hda_input_mux alc880_capture_source = {
1437 { "Front Mic", 0x3 },
1443 /* channel source setting (2/6 channel selection for 3-stack) */
1445 static struct hda_verb alc880_threestack_ch2_init[] = {
1446 /* set line-in to input, mute it */
1447 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1448 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1449 /* set mic-in to input vref 80%, mute it */
1450 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1451 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1456 static struct hda_verb alc880_threestack_ch6_init[] = {
1457 /* set line-in to output, unmute it */
1458 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1459 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1460 /* set mic-in to output, unmute it */
1461 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1462 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1466 static struct hda_channel_mode alc880_threestack_modes[2] = {
1467 { 2, alc880_threestack_ch2_init },
1468 { 6, alc880_threestack_ch6_init },
1471 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1472 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1473 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1474 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1475 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1476 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1477 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1478 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1479 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1480 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1481 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1482 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1483 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1486 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1487 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1488 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1489 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1490 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1493 .name = "Channel Mode",
1494 .info = alc_ch_mode_info,
1495 .get = alc_ch_mode_get,
1496 .put = alc_ch_mode_put,
1501 /* capture mixer elements */
1502 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1503 struct snd_ctl_elem_info *uinfo)
1505 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1506 struct alc_spec *spec = codec->spec;
1509 mutex_lock(&codec->control_mutex);
1510 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1512 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1513 mutex_unlock(&codec->control_mutex);
1517 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1518 unsigned int size, unsigned int __user *tlv)
1520 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1521 struct alc_spec *spec = codec->spec;
1524 mutex_lock(&codec->control_mutex);
1525 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1527 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1528 mutex_unlock(&codec->control_mutex);
1532 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1533 struct snd_ctl_elem_value *ucontrol);
1535 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1536 struct snd_ctl_elem_value *ucontrol,
1539 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1540 struct alc_spec *spec = codec->spec;
1541 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1544 mutex_lock(&codec->control_mutex);
1545 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1547 err = func(kcontrol, ucontrol);
1548 mutex_unlock(&codec->control_mutex);
1552 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1553 struct snd_ctl_elem_value *ucontrol)
1555 return alc_cap_getput_caller(kcontrol, ucontrol,
1556 snd_hda_mixer_amp_volume_get);
1559 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1560 struct snd_ctl_elem_value *ucontrol)
1562 return alc_cap_getput_caller(kcontrol, ucontrol,
1563 snd_hda_mixer_amp_volume_put);
1566 /* capture mixer elements */
1567 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1569 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1570 struct snd_ctl_elem_value *ucontrol)
1572 return alc_cap_getput_caller(kcontrol, ucontrol,
1573 snd_hda_mixer_amp_switch_get);
1576 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1577 struct snd_ctl_elem_value *ucontrol)
1579 return alc_cap_getput_caller(kcontrol, ucontrol,
1580 snd_hda_mixer_amp_switch_put);
1583 #define DEFINE_CAPMIX(num) \
1584 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1586 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1587 .name = "Capture Switch", \
1588 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1590 .info = alc_cap_sw_info, \
1591 .get = alc_cap_sw_get, \
1592 .put = alc_cap_sw_put, \
1595 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1596 .name = "Capture Volume", \
1597 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1598 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1599 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1601 .info = alc_cap_vol_info, \
1602 .get = alc_cap_vol_get, \
1603 .put = alc_cap_vol_put, \
1604 .tlv = { .c = alc_cap_vol_tlv }, \
1607 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1608 /* .name = "Capture Source", */ \
1609 .name = "Input Source", \
1611 .info = alc_mux_enum_info, \
1612 .get = alc_mux_enum_get, \
1613 .put = alc_mux_enum_put, \
1618 /* up to three ADCs */
1625 * ALC880 5-stack model
1627 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1629 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1630 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1633 /* additional mixers to alc880_three_stack_mixer */
1634 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1635 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1636 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1640 /* channel source setting (6/8 channel selection for 5-stack) */
1642 static struct hda_verb alc880_fivestack_ch6_init[] = {
1643 /* set line-in to input, mute it */
1644 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1645 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1650 static struct hda_verb alc880_fivestack_ch8_init[] = {
1651 /* set line-in to output, unmute it */
1652 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1653 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1657 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1658 { 6, alc880_fivestack_ch6_init },
1659 { 8, alc880_fivestack_ch8_init },
1664 * ALC880 6-stack model
1666 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1667 * Side = 0x05 (0x0f)
1668 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1669 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1672 static hda_nid_t alc880_6st_dac_nids[4] = {
1673 /* front, rear, clfe, rear_surr */
1674 0x02, 0x03, 0x04, 0x05
1677 static struct hda_input_mux alc880_6stack_capture_source = {
1681 { "Front Mic", 0x1 },
1687 /* fixed 8-channels */
1688 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1692 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1693 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1694 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1695 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1696 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1697 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1698 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1699 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1700 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1701 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1702 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1703 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1704 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1709 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1711 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1712 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1715 .name = "Channel Mode",
1716 .info = alc_ch_mode_info,
1717 .get = alc_ch_mode_get,
1718 .put = alc_ch_mode_put,
1727 * W810 has rear IO for:
1730 * Center/LFE (DAC 04)
1733 * The system also has a pair of internal speakers, and a headphone jack.
1734 * These are both connected to Line2 on the codec, hence to DAC 02.
1736 * There is a variable resistor to control the speaker or headphone
1737 * volume. This is a hardware-only device without a software API.
1739 * Plugging headphones in will disable the internal speakers. This is
1740 * implemented in hardware, not via the driver using jack sense. In
1741 * a similar fashion, plugging into the rear socket marked "front" will
1742 * disable both the speakers and headphones.
1744 * For input, there's a microphone jack, and an "audio in" jack.
1745 * These may not do anything useful with this driver yet, because I
1746 * haven't setup any initialization verbs for these yet...
1749 static hda_nid_t alc880_w810_dac_nids[3] = {
1750 /* front, rear/surround, clfe */
1754 /* fixed 6 channels */
1755 static struct hda_channel_mode alc880_w810_modes[1] = {
1759 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1760 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1761 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1762 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1763 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1764 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1765 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1766 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1767 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1768 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1769 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1777 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1778 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1782 static hda_nid_t alc880_z71v_dac_nids[1] = {
1785 #define ALC880_Z71V_HP_DAC 0x03
1787 /* fixed 2 channels */
1788 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1792 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1793 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1794 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1796 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1797 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1798 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1806 * ALC880 F1734 model
1808 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1809 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1812 static hda_nid_t alc880_f1734_dac_nids[1] = {
1815 #define ALC880_F1734_HP_DAC 0x02
1817 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1818 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1819 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1820 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1821 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1822 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1823 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1829 static struct hda_input_mux alc880_f1734_capture_source = {
1841 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1842 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1843 * Mic = 0x18, Line = 0x1a
1846 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1847 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1849 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1850 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1851 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1852 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1853 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1854 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1855 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1856 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1857 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1858 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1859 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1860 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1861 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1862 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1863 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1865 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1866 .name = "Channel Mode",
1867 .info = alc_ch_mode_info,
1868 .get = alc_ch_mode_get,
1869 .put = alc_ch_mode_put,
1875 * ALC880 ASUS W1V model
1877 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1878 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1879 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1882 /* additional mixers to alc880_asus_mixer */
1883 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1884 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1885 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1889 /* additional mixers to alc880_asus_mixer */
1890 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1891 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1892 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1897 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1898 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1899 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1901 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1902 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1904 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1905 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1906 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1911 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1912 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1913 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1914 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1915 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1916 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1917 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1918 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1919 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1920 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1921 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1922 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1923 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1926 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1927 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1928 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1929 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1932 .name = "Channel Mode",
1933 .info = alc_ch_mode_info,
1934 .get = alc_ch_mode_get,
1935 .put = alc_ch_mode_put,
1940 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1941 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1942 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1943 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1944 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1945 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1946 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1947 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1948 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1949 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1950 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1954 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1955 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1956 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1957 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1958 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1965 * virtual master controls
1969 * slave controls for virtual master
1971 static const char *alc_slave_vols[] = {
1972 "Front Playback Volume",
1973 "Surround Playback Volume",
1974 "Center Playback Volume",
1975 "LFE Playback Volume",
1976 "Side Playback Volume",
1977 "Headphone Playback Volume",
1978 "Speaker Playback Volume",
1979 "Mono Playback Volume",
1980 "Line-Out Playback Volume",
1981 "PCM Playback Volume",
1985 static const char *alc_slave_sws[] = {
1986 "Front Playback Switch",
1987 "Surround Playback Switch",
1988 "Center Playback Switch",
1989 "LFE Playback Switch",
1990 "Side Playback Switch",
1991 "Headphone Playback Switch",
1992 "Speaker Playback Switch",
1993 "Mono Playback Switch",
1994 "IEC958 Playback Switch",
1999 * build control elements
2002 static void alc_free_kctls(struct hda_codec *codec);
2004 static int alc_build_controls(struct hda_codec *codec)
2006 struct alc_spec *spec = codec->spec;
2010 for (i = 0; i < spec->num_mixers; i++) {
2011 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2015 if (spec->cap_mixer) {
2016 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2020 if (spec->multiout.dig_out_nid) {
2021 err = snd_hda_create_spdif_out_ctls(codec,
2022 spec->multiout.dig_out_nid);
2025 if (!spec->no_analog) {
2026 err = snd_hda_create_spdif_share_sw(codec,
2030 spec->multiout.share_spdif = 1;
2033 if (spec->dig_in_nid) {
2034 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2039 /* if we have no master control, let's create it */
2040 if (!spec->no_analog &&
2041 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2042 unsigned int vmaster_tlv[4];
2043 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2044 HDA_OUTPUT, vmaster_tlv);
2045 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2046 vmaster_tlv, alc_slave_vols);
2050 if (!spec->no_analog &&
2051 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2052 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2053 NULL, alc_slave_sws);
2058 alc_free_kctls(codec); /* no longer needed */
2064 * initialize the codec volumes, etc
2068 * generic initialization of ADC, input mixers and output mixers
2070 static struct hda_verb alc880_volume_init_verbs[] = {
2072 * Unmute ADC0-2 and set the default input to mic-in
2074 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2075 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2076 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2078 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2081 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2083 * Note: PASD motherboards uses the Line In 2 as the input for front
2086 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2092 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2093 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2096 * Set up output mixers (0x0c - 0x0f)
2098 /* set vol=0 to output mixers */
2099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2102 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2103 /* set up input amps for analog loopback */
2104 /* Amp Indices: DAC = 0, mixer = 1 */
2105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2106 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2107 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2108 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2109 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2111 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2112 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2118 * 3-stack pin configuration:
2119 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2121 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2123 * preset connection lists of input pins
2124 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2126 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2127 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2128 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2131 * Set pin mode and muting
2133 /* set front pin widgets 0x14 for output */
2134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2135 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2136 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2137 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2138 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2139 /* Mic2 (as headphone out) for HP output */
2140 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2142 /* Line In pin widget for input */
2143 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2144 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2145 /* Line2 (as front mic) pin widget for input and vref at 80% */
2146 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2147 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2148 /* CD pin widget for input */
2149 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2155 * 5-stack pin configuration:
2156 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2157 * line-in/side = 0x1a, f-mic = 0x1b
2159 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2161 * preset connection lists of input pins
2162 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2164 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2165 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2168 * Set pin mode and muting
2170 /* set pin widgets 0x14-0x17 for output */
2171 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2172 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2173 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2174 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2175 /* unmute pins for output (no gain on this amp) */
2176 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2178 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2179 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2181 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2182 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2183 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2184 /* Mic2 (as headphone out) for HP output */
2185 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2187 /* Line In pin widget for input */
2188 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2189 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2190 /* Line2 (as front mic) pin widget for input and vref at 80% */
2191 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2192 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2193 /* CD pin widget for input */
2194 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2200 * W810 pin configuration:
2201 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2203 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2204 /* hphone/speaker input selector: front DAC */
2205 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2208 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2211 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2212 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2215 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2221 * Z71V pin configuration:
2222 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2224 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2225 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2226 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2230 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2231 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2232 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2233 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2239 * 6-stack pin configuration:
2240 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2241 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2243 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2244 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2246 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2247 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2248 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2250 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2252 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2253 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2255 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2256 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2257 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2258 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2259 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2260 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2261 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2262 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2263 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2269 * Uniwill pin configuration:
2270 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2273 static struct hda_verb alc880_uniwill_init_verbs[] = {
2274 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2276 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2277 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2278 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2279 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2280 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2281 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2282 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2283 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2285 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2286 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2291 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2293 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2295 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2296 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2297 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2298 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2299 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2301 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2302 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2309 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2311 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2312 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2314 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2315 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2316 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2317 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2318 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2319 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2322 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2323 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2324 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2325 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2329 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2330 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2334 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2335 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2340 static struct hda_verb alc880_beep_init_verbs[] = {
2341 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2345 /* toggle speaker-output according to the hp-jack state */
2346 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2348 unsigned int present;
2351 present = snd_hda_codec_read(codec, 0x14, 0,
2352 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2353 bits = present ? HDA_AMP_MUTE : 0;
2354 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2355 HDA_AMP_MUTE, bits);
2356 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2357 HDA_AMP_MUTE, bits);
2360 /* auto-toggle front mic */
2361 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2363 unsigned int present;
2366 present = snd_hda_codec_read(codec, 0x18, 0,
2367 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2368 bits = present ? HDA_AMP_MUTE : 0;
2369 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2372 static void alc880_uniwill_automute(struct hda_codec *codec)
2374 alc880_uniwill_hp_automute(codec);
2375 alc880_uniwill_mic_automute(codec);
2378 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2381 /* Looks like the unsol event is incompatible with the standard
2382 * definition. 4bit tag is placed at 28 bit!
2384 switch (res >> 28) {
2385 case ALC880_HP_EVENT:
2386 alc880_uniwill_hp_automute(codec);
2388 case ALC880_MIC_EVENT:
2389 alc880_uniwill_mic_automute(codec);
2394 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2396 unsigned int present;
2399 present = snd_hda_codec_read(codec, 0x14, 0,
2400 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2401 bits = present ? HDA_AMP_MUTE : 0;
2402 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2405 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2407 unsigned int present;
2409 present = snd_hda_codec_read(codec, 0x21, 0,
2410 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2411 present &= HDA_AMP_VOLMASK;
2412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2413 HDA_AMP_VOLMASK, present);
2414 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2415 HDA_AMP_VOLMASK, present);
2418 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2421 /* Looks like the unsol event is incompatible with the standard
2422 * definition. 4bit tag is placed at 28 bit!
2424 if ((res >> 28) == ALC880_HP_EVENT)
2425 alc880_uniwill_p53_hp_automute(codec);
2426 if ((res >> 28) == ALC880_DCVOL_EVENT)
2427 alc880_uniwill_p53_dcvol_automute(codec);
2431 * F1734 pin configuration:
2432 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2434 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2435 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2436 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2437 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2438 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2439 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2442 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2444 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2446 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2448 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2450 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2451 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2452 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2453 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2454 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2456 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2457 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2463 * ASUS pin configuration:
2464 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2466 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2467 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2468 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2469 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2470 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2478 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2481 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2482 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2488 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2489 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2494 /* Enable GPIO mask and set output */
2495 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2496 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2498 /* Clevo m520g init */
2499 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2500 /* headphone output */
2501 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2503 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2509 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2510 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2511 /* Mic1 (rear panel) */
2512 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2513 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2514 /* Mic2 (front panel) */
2515 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2516 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2518 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2519 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2520 /* change to EAPD mode */
2521 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2522 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2527 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2528 /* change to EAPD mode */
2529 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2530 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2532 /* Headphone output */
2533 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2535 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2536 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2538 /* Line In pin widget for input */
2539 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2540 /* CD pin widget for input */
2541 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2542 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2545 /* change to EAPD mode */
2546 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2547 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2553 * LG m1 express dual
2556 * Rear Line-In/Out (blue): 0x14
2557 * Build-in Mic-In: 0x15
2559 * HP-Out (green): 0x1b
2560 * Mic-In/Out (red): 0x19
2564 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2565 static hda_nid_t alc880_lg_dac_nids[3] = {
2569 /* seems analog CD is not working */
2570 static struct hda_input_mux alc880_lg_capture_source = {
2575 { "Internal Mic", 0x6 },
2579 /* 2,4,6 channel modes */
2580 static struct hda_verb alc880_lg_ch2_init[] = {
2581 /* set line-in and mic-in to input */
2582 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2583 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2587 static struct hda_verb alc880_lg_ch4_init[] = {
2588 /* set line-in to out and mic-in to input */
2589 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2590 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2594 static struct hda_verb alc880_lg_ch6_init[] = {
2595 /* set line-in and mic-in to output */
2596 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2597 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2601 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2602 { 2, alc880_lg_ch2_init },
2603 { 4, alc880_lg_ch4_init },
2604 { 6, alc880_lg_ch6_init },
2607 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2608 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2609 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2610 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2611 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2612 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2613 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2614 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2615 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2618 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2619 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2620 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2621 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2623 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2624 .name = "Channel Mode",
2625 .info = alc_ch_mode_info,
2626 .get = alc_ch_mode_get,
2627 .put = alc_ch_mode_put,
2632 static struct hda_verb alc880_lg_init_verbs[] = {
2633 /* set capture source to mic-in */
2634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2635 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2637 /* mute all amp mixer inputs */
2638 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2641 /* line-in to input */
2642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2643 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2648 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2649 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2650 /* mic-in to input */
2651 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2652 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2655 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2656 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2657 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2659 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2663 /* toggle speaker-output according to the hp-jack state */
2664 static void alc880_lg_automute(struct hda_codec *codec)
2666 unsigned int present;
2669 present = snd_hda_codec_read(codec, 0x1b, 0,
2670 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2671 bits = present ? HDA_AMP_MUTE : 0;
2672 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2673 HDA_AMP_MUTE, bits);
2676 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2678 /* Looks like the unsol event is incompatible with the standard
2679 * definition. 4bit tag is placed at 28 bit!
2681 if ((res >> 28) == 0x01)
2682 alc880_lg_automute(codec);
2691 * Built-in Mic-In: 0x19
2697 static struct hda_input_mux alc880_lg_lw_capture_source = {
2701 { "Internal Mic", 0x1 },
2706 #define alc880_lg_lw_modes alc880_threestack_modes
2708 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2709 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2710 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2711 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2712 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2713 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2714 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2715 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2716 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2717 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2718 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2721 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2722 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2725 .name = "Channel Mode",
2726 .info = alc_ch_mode_info,
2727 .get = alc_ch_mode_get,
2728 .put = alc_ch_mode_put,
2733 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2734 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2735 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2736 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2738 /* set capture source to mic-in */
2739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2740 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2748 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 /* mic-in to input */
2750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2753 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2754 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2756 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2760 /* toggle speaker-output according to the hp-jack state */
2761 static void alc880_lg_lw_automute(struct hda_codec *codec)
2763 unsigned int present;
2766 present = snd_hda_codec_read(codec, 0x1b, 0,
2767 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2768 bits = present ? HDA_AMP_MUTE : 0;
2769 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2770 HDA_AMP_MUTE, bits);
2773 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2775 /* Looks like the unsol event is incompatible with the standard
2776 * definition. 4bit tag is placed at 28 bit!
2778 if ((res >> 28) == 0x01)
2779 alc880_lg_lw_automute(codec);
2782 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2783 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2784 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2787 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2788 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2792 static struct hda_input_mux alc880_medion_rim_capture_source = {
2796 { "Internal Mic", 0x1 },
2800 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2801 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2803 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2804 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2806 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2807 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2808 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2809 /* Mic2 (as headphone out) for HP output */
2810 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2812 /* Internal Speaker */
2813 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2814 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2816 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2817 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2819 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2823 /* toggle speaker-output according to the hp-jack state */
2824 static void alc880_medion_rim_automute(struct hda_codec *codec)
2826 unsigned int present;
2829 present = snd_hda_codec_read(codec, 0x14, 0,
2830 AC_VERB_GET_PIN_SENSE, 0)
2831 & AC_PINSENSE_PRESENCE;
2832 bits = present ? HDA_AMP_MUTE : 0;
2833 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2834 HDA_AMP_MUTE, bits);
2836 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2838 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2841 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2844 /* Looks like the unsol event is incompatible with the standard
2845 * definition. 4bit tag is placed at 28 bit!
2847 if ((res >> 28) == ALC880_HP_EVENT)
2848 alc880_medion_rim_automute(codec);
2851 #ifdef CONFIG_SND_HDA_POWER_SAVE
2852 static struct hda_amp_list alc880_loopbacks[] = {
2853 { 0x0b, HDA_INPUT, 0 },
2854 { 0x0b, HDA_INPUT, 1 },
2855 { 0x0b, HDA_INPUT, 2 },
2856 { 0x0b, HDA_INPUT, 3 },
2857 { 0x0b, HDA_INPUT, 4 },
2861 static struct hda_amp_list alc880_lg_loopbacks[] = {
2862 { 0x0b, HDA_INPUT, 1 },
2863 { 0x0b, HDA_INPUT, 6 },
2864 { 0x0b, HDA_INPUT, 7 },
2873 static int alc_init(struct hda_codec *codec)
2875 struct alc_spec *spec = codec->spec;
2879 if (codec->vendor_id == 0x10ec0888)
2880 alc888_coef_init(codec);
2882 for (i = 0; i < spec->num_init_verbs; i++)
2883 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2885 if (spec->init_hook)
2886 spec->init_hook(codec);
2891 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2893 struct alc_spec *spec = codec->spec;
2895 if (spec->unsol_event)
2896 spec->unsol_event(codec, res);
2899 #ifdef CONFIG_SND_HDA_POWER_SAVE
2900 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2902 struct alc_spec *spec = codec->spec;
2903 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2908 * Analog playback callbacks
2910 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2911 struct hda_codec *codec,
2912 struct snd_pcm_substream *substream)
2914 struct alc_spec *spec = codec->spec;
2915 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2919 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2920 struct hda_codec *codec,
2921 unsigned int stream_tag,
2922 unsigned int format,
2923 struct snd_pcm_substream *substream)
2925 struct alc_spec *spec = codec->spec;
2926 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2927 stream_tag, format, substream);
2930 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2931 struct hda_codec *codec,
2932 struct snd_pcm_substream *substream)
2934 struct alc_spec *spec = codec->spec;
2935 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2941 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2942 struct hda_codec *codec,
2943 struct snd_pcm_substream *substream)
2945 struct alc_spec *spec = codec->spec;
2946 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2949 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2950 struct hda_codec *codec,
2951 unsigned int stream_tag,
2952 unsigned int format,
2953 struct snd_pcm_substream *substream)
2955 struct alc_spec *spec = codec->spec;
2956 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2957 stream_tag, format, substream);
2960 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2961 struct hda_codec *codec,
2962 struct snd_pcm_substream *substream)
2964 struct alc_spec *spec = codec->spec;
2965 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2971 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2972 struct hda_codec *codec,
2973 unsigned int stream_tag,
2974 unsigned int format,
2975 struct snd_pcm_substream *substream)
2977 struct alc_spec *spec = codec->spec;
2979 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2980 stream_tag, 0, format);
2984 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2985 struct hda_codec *codec,
2986 struct snd_pcm_substream *substream)
2988 struct alc_spec *spec = codec->spec;
2990 snd_hda_codec_cleanup_stream(codec,
2991 spec->adc_nids[substream->number + 1]);
2998 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3002 /* NID is set in alc_build_pcms */
3004 .open = alc880_playback_pcm_open,
3005 .prepare = alc880_playback_pcm_prepare,
3006 .cleanup = alc880_playback_pcm_cleanup
3010 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3014 /* NID is set in alc_build_pcms */
3017 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3021 /* NID is set in alc_build_pcms */
3024 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3025 .substreams = 2, /* can be overridden */
3028 /* NID is set in alc_build_pcms */
3030 .prepare = alc880_alt_capture_pcm_prepare,
3031 .cleanup = alc880_alt_capture_pcm_cleanup
3035 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3039 /* NID is set in alc_build_pcms */
3041 .open = alc880_dig_playback_pcm_open,
3042 .close = alc880_dig_playback_pcm_close,
3043 .prepare = alc880_dig_playback_pcm_prepare
3047 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3051 /* NID is set in alc_build_pcms */
3054 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3055 static struct hda_pcm_stream alc_pcm_null_stream = {
3061 static int alc_build_pcms(struct hda_codec *codec)
3063 struct alc_spec *spec = codec->spec;
3064 struct hda_pcm *info = spec->pcm_rec;
3067 codec->num_pcms = 1;
3068 codec->pcm_info = info;
3070 if (spec->no_analog)
3073 info->name = spec->stream_name_analog;
3074 if (spec->stream_analog_playback) {
3075 if (snd_BUG_ON(!spec->multiout.dac_nids))
3077 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3078 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3080 if (spec->stream_analog_capture) {
3081 if (snd_BUG_ON(!spec->adc_nids))
3083 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3084 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3087 if (spec->channel_mode) {
3088 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3089 for (i = 0; i < spec->num_channel_mode; i++) {
3090 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3091 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3097 /* SPDIF for stream index #1 */
3098 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3099 codec->num_pcms = 2;
3100 info = spec->pcm_rec + 1;
3101 info->name = spec->stream_name_digital;
3102 if (spec->dig_out_type)
3103 info->pcm_type = spec->dig_out_type;
3105 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3106 if (spec->multiout.dig_out_nid &&
3107 spec->stream_digital_playback) {
3108 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3109 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3111 if (spec->dig_in_nid &&
3112 spec->stream_digital_capture) {
3113 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3114 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3116 /* FIXME: do we need this for all Realtek codec models? */
3117 codec->spdif_status_reset = 1;
3120 if (spec->no_analog)
3123 /* If the use of more than one ADC is requested for the current
3124 * model, configure a second analog capture-only PCM.
3126 /* Additional Analaog capture for index #2 */
3127 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3128 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3129 codec->num_pcms = 3;
3130 info = spec->pcm_rec + 2;
3131 info->name = spec->stream_name_analog;
3132 if (spec->alt_dac_nid) {
3133 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3134 *spec->stream_analog_alt_playback;
3135 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3138 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3139 alc_pcm_null_stream;
3140 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3142 if (spec->num_adc_nids > 1) {
3143 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3144 *spec->stream_analog_alt_capture;
3145 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3147 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3148 spec->num_adc_nids - 1;
3150 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3151 alc_pcm_null_stream;
3152 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3159 static void alc_free_kctls(struct hda_codec *codec)
3161 struct alc_spec *spec = codec->spec;
3163 if (spec->kctls.list) {
3164 struct snd_kcontrol_new *kctl = spec->kctls.list;
3166 for (i = 0; i < spec->kctls.used; i++)
3167 kfree(kctl[i].name);
3169 snd_array_free(&spec->kctls);
3172 static void alc_free(struct hda_codec *codec)
3174 struct alc_spec *spec = codec->spec;
3179 alc_free_kctls(codec);
3181 codec->spec = NULL; /* to be sure */
3184 #ifdef SND_HDA_NEEDS_RESUME
3185 static void store_pin_configs(struct hda_codec *codec)
3187 struct alc_spec *spec = codec->spec;
3188 hda_nid_t nid, end_nid;
3190 end_nid = codec->start_nid + codec->num_nodes;
3191 for (nid = codec->start_nid; nid < end_nid; nid++) {
3192 unsigned int wid_caps = get_wcaps(codec, nid);
3193 unsigned int wid_type =
3194 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3195 if (wid_type != AC_WID_PIN)
3197 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3199 spec->pin_nids[spec->num_pins] = nid;
3200 spec->pin_cfgs[spec->num_pins] =
3201 snd_hda_codec_read(codec, nid, 0,
3202 AC_VERB_GET_CONFIG_DEFAULT, 0);
3207 static void resume_pin_configs(struct hda_codec *codec)
3209 struct alc_spec *spec = codec->spec;
3212 for (i = 0; i < spec->num_pins; i++) {
3213 hda_nid_t pin_nid = spec->pin_nids[i];
3214 unsigned int pin_config = spec->pin_cfgs[i];
3215 snd_hda_codec_write(codec, pin_nid, 0,
3216 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3217 pin_config & 0x000000ff);
3218 snd_hda_codec_write(codec, pin_nid, 0,
3219 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3220 (pin_config & 0x0000ff00) >> 8);
3221 snd_hda_codec_write(codec, pin_nid, 0,
3222 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3223 (pin_config & 0x00ff0000) >> 16);
3224 snd_hda_codec_write(codec, pin_nid, 0,
3225 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3230 static int alc_resume(struct hda_codec *codec)
3232 resume_pin_configs(codec);
3233 codec->patch_ops.init(codec);
3234 snd_hda_codec_resume_amp(codec);
3235 snd_hda_codec_resume_cache(codec);
3239 #define store_pin_configs(codec)
3244 static struct hda_codec_ops alc_patch_ops = {
3245 .build_controls = alc_build_controls,
3246 .build_pcms = alc_build_pcms,
3249 .unsol_event = alc_unsol_event,
3250 #ifdef SND_HDA_NEEDS_RESUME
3251 .resume = alc_resume,
3253 #ifdef CONFIG_SND_HDA_POWER_SAVE
3254 .check_power_status = alc_check_power_status,
3260 * Test configuration for debugging
3262 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3265 #ifdef CONFIG_SND_DEBUG
3266 static hda_nid_t alc880_test_dac_nids[4] = {
3267 0x02, 0x03, 0x04, 0x05
3270 static struct hda_input_mux alc880_test_capture_source = {
3279 { "Surround", 0x6 },
3283 static struct hda_channel_mode alc880_test_modes[4] = {
3290 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3291 struct snd_ctl_elem_info *uinfo)
3293 static char *texts[] = {
3294 "N/A", "Line Out", "HP Out",
3295 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3297 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3299 uinfo->value.enumerated.items = 8;
3300 if (uinfo->value.enumerated.item >= 8)
3301 uinfo->value.enumerated.item = 7;
3302 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3306 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3307 struct snd_ctl_elem_value *ucontrol)
3309 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3310 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3311 unsigned int pin_ctl, item = 0;
3313 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3314 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3315 if (pin_ctl & AC_PINCTL_OUT_EN) {
3316 if (pin_ctl & AC_PINCTL_HP_EN)
3320 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3321 switch (pin_ctl & AC_PINCTL_VREFEN) {
3322 case AC_PINCTL_VREF_HIZ: item = 3; break;
3323 case AC_PINCTL_VREF_50: item = 4; break;
3324 case AC_PINCTL_VREF_GRD: item = 5; break;
3325 case AC_PINCTL_VREF_80: item = 6; break;
3326 case AC_PINCTL_VREF_100: item = 7; break;
3329 ucontrol->value.enumerated.item[0] = item;
3333 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3334 struct snd_ctl_elem_value *ucontrol)
3336 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3337 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3338 static unsigned int ctls[] = {
3339 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3340 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3341 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3342 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3343 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3344 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3346 unsigned int old_ctl, new_ctl;
3348 old_ctl = snd_hda_codec_read(codec, nid, 0,
3349 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3350 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3351 if (old_ctl != new_ctl) {
3353 snd_hda_codec_write_cache(codec, nid, 0,
3354 AC_VERB_SET_PIN_WIDGET_CONTROL,
3356 val = ucontrol->value.enumerated.item[0] >= 3 ?
3358 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3365 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3366 struct snd_ctl_elem_info *uinfo)
3368 static char *texts[] = {
3369 "Front", "Surround", "CLFE", "Side"
3371 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3373 uinfo->value.enumerated.items = 4;
3374 if (uinfo->value.enumerated.item >= 4)
3375 uinfo->value.enumerated.item = 3;
3376 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3380 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3381 struct snd_ctl_elem_value *ucontrol)
3383 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3384 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3387 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3388 ucontrol->value.enumerated.item[0] = sel & 3;
3392 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3393 struct snd_ctl_elem_value *ucontrol)
3395 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3396 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3399 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3400 if (ucontrol->value.enumerated.item[0] != sel) {
3401 sel = ucontrol->value.enumerated.item[0] & 3;
3402 snd_hda_codec_write_cache(codec, nid, 0,
3403 AC_VERB_SET_CONNECT_SEL, sel);
3409 #define PIN_CTL_TEST(xname,nid) { \
3410 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3412 .info = alc_test_pin_ctl_info, \
3413 .get = alc_test_pin_ctl_get, \
3414 .put = alc_test_pin_ctl_put, \
3415 .private_value = nid \
3418 #define PIN_SRC_TEST(xname,nid) { \
3419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3421 .info = alc_test_pin_src_info, \
3422 .get = alc_test_pin_src_get, \
3423 .put = alc_test_pin_src_put, \
3424 .private_value = nid \
3427 static struct snd_kcontrol_new alc880_test_mixer[] = {
3428 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3429 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3430 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3431 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3432 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3433 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3434 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3435 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3436 PIN_CTL_TEST("Front Pin Mode", 0x14),
3437 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3438 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3439 PIN_CTL_TEST("Side Pin Mode", 0x17),
3440 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3441 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3442 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3443 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3444 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3445 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3446 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3447 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3448 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3449 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3450 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3451 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3452 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3453 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3454 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3455 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3456 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3457 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3459 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3460 .name = "Channel Mode",
3461 .info = alc_ch_mode_info,
3462 .get = alc_ch_mode_get,
3463 .put = alc_ch_mode_put,
3468 static struct hda_verb alc880_test_init_verbs[] = {
3469 /* Unmute inputs of 0x0c - 0x0f */
3470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3473 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3476 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3477 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3478 /* Vol output for 0x0c-0x0f */
3479 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3482 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3483 /* Set output pins 0x14-0x17 */
3484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3486 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3487 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3488 /* Unmute output pins 0x14-0x17 */
3489 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3491 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3492 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3493 /* Set input pins 0x18-0x1c */
3494 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3495 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3496 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3497 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3498 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3499 /* Mute input pins 0x18-0x1b */
3500 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3501 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3503 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3505 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3506 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3508 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3509 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3510 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3511 /* Analog input/passthru */
3512 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3524 static const char *alc880_models[ALC880_MODEL_LAST] = {
3525 [ALC880_3ST] = "3stack",
3526 [ALC880_TCL_S700] = "tcl",
3527 [ALC880_3ST_DIG] = "3stack-digout",
3528 [ALC880_CLEVO] = "clevo",
3529 [ALC880_5ST] = "5stack",
3530 [ALC880_5ST_DIG] = "5stack-digout",
3531 [ALC880_W810] = "w810",
3532 [ALC880_Z71V] = "z71v",
3533 [ALC880_6ST] = "6stack",
3534 [ALC880_6ST_DIG] = "6stack-digout",
3535 [ALC880_ASUS] = "asus",
3536 [ALC880_ASUS_W1V] = "asus-w1v",
3537 [ALC880_ASUS_DIG] = "asus-dig",
3538 [ALC880_ASUS_DIG2] = "asus-dig2",
3539 [ALC880_UNIWILL_DIG] = "uniwill",
3540 [ALC880_UNIWILL_P53] = "uniwill-p53",
3541 [ALC880_FUJITSU] = "fujitsu",
3542 [ALC880_F1734] = "F1734",
3544 [ALC880_LG_LW] = "lg-lw",
3545 [ALC880_MEDION_RIM] = "medion",
3546 #ifdef CONFIG_SND_DEBUG
3547 [ALC880_TEST] = "test",
3549 [ALC880_AUTO] = "auto",
3552 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3553 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3554 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3555 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3556 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3557 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3558 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3559 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3560 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3561 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3562 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3563 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3564 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3565 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3566 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3567 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3568 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3569 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3570 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3571 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3572 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3573 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3574 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3575 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3576 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3577 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3578 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3579 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3580 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3581 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3582 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3583 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3584 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3585 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3586 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3587 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3588 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3589 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3590 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3591 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3592 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3593 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3594 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3595 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3596 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3597 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3598 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3599 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3600 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3601 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3602 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3603 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3604 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3605 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3606 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3607 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3608 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3609 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3610 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3611 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3612 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3613 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3614 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3615 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3616 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3617 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3618 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3619 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3620 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3621 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3622 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3623 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3628 * ALC880 codec presets
3630 static struct alc_config_preset alc880_presets[] = {
3632 .mixers = { alc880_three_stack_mixer },
3633 .init_verbs = { alc880_volume_init_verbs,
3634 alc880_pin_3stack_init_verbs },
3635 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3636 .dac_nids = alc880_dac_nids,
3637 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3638 .channel_mode = alc880_threestack_modes,
3640 .input_mux = &alc880_capture_source,
3642 [ALC880_3ST_DIG] = {
3643 .mixers = { alc880_three_stack_mixer },
3644 .init_verbs = { alc880_volume_init_verbs,
3645 alc880_pin_3stack_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_threestack_modes),
3650 .channel_mode = alc880_threestack_modes,
3652 .input_mux = &alc880_capture_source,
3654 [ALC880_TCL_S700] = {
3655 .mixers = { alc880_tcl_s700_mixer },
3656 .init_verbs = { alc880_volume_init_verbs,
3657 alc880_pin_tcl_S700_init_verbs,
3658 alc880_gpio2_init_verbs },
3659 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3660 .dac_nids = alc880_dac_nids,
3661 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3662 .num_adc_nids = 1, /* single ADC */
3664 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3665 .channel_mode = alc880_2_jack_modes,
3666 .input_mux = &alc880_capture_source,
3669 .mixers = { alc880_three_stack_mixer,
3670 alc880_five_stack_mixer},
3671 .init_verbs = { alc880_volume_init_verbs,
3672 alc880_pin_5stack_init_verbs },
3673 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3674 .dac_nids = alc880_dac_nids,
3675 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3676 .channel_mode = alc880_fivestack_modes,
3677 .input_mux = &alc880_capture_source,
3679 [ALC880_5ST_DIG] = {
3680 .mixers = { alc880_three_stack_mixer,
3681 alc880_five_stack_mixer },
3682 .init_verbs = { alc880_volume_init_verbs,
3683 alc880_pin_5stack_init_verbs },
3684 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3685 .dac_nids = alc880_dac_nids,
3686 .dig_out_nid = ALC880_DIGOUT_NID,
3687 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3688 .channel_mode = alc880_fivestack_modes,
3689 .input_mux = &alc880_capture_source,
3692 .mixers = { alc880_six_stack_mixer },
3693 .init_verbs = { alc880_volume_init_verbs,
3694 alc880_pin_6stack_init_verbs },
3695 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3696 .dac_nids = alc880_6st_dac_nids,
3697 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3698 .channel_mode = alc880_sixstack_modes,
3699 .input_mux = &alc880_6stack_capture_source,
3701 [ALC880_6ST_DIG] = {
3702 .mixers = { alc880_six_stack_mixer },
3703 .init_verbs = { alc880_volume_init_verbs,
3704 alc880_pin_6stack_init_verbs },
3705 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3706 .dac_nids = alc880_6st_dac_nids,
3707 .dig_out_nid = ALC880_DIGOUT_NID,
3708 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3709 .channel_mode = alc880_sixstack_modes,
3710 .input_mux = &alc880_6stack_capture_source,
3713 .mixers = { alc880_w810_base_mixer },
3714 .init_verbs = { alc880_volume_init_verbs,
3715 alc880_pin_w810_init_verbs,
3716 alc880_gpio2_init_verbs },
3717 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3718 .dac_nids = alc880_w810_dac_nids,
3719 .dig_out_nid = ALC880_DIGOUT_NID,
3720 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3721 .channel_mode = alc880_w810_modes,
3722 .input_mux = &alc880_capture_source,
3725 .mixers = { alc880_z71v_mixer },
3726 .init_verbs = { alc880_volume_init_verbs,
3727 alc880_pin_z71v_init_verbs },
3728 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3729 .dac_nids = alc880_z71v_dac_nids,
3730 .dig_out_nid = ALC880_DIGOUT_NID,
3732 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3733 .channel_mode = alc880_2_jack_modes,
3734 .input_mux = &alc880_capture_source,
3737 .mixers = { alc880_f1734_mixer },
3738 .init_verbs = { alc880_volume_init_verbs,
3739 alc880_pin_f1734_init_verbs },
3740 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3741 .dac_nids = alc880_f1734_dac_nids,
3743 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3744 .channel_mode = alc880_2_jack_modes,
3745 .input_mux = &alc880_f1734_capture_source,
3746 .unsol_event = alc880_uniwill_p53_unsol_event,
3747 .init_hook = alc880_uniwill_p53_hp_automute,
3750 .mixers = { alc880_asus_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 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3757 .channel_mode = alc880_asus_modes,
3759 .input_mux = &alc880_capture_source,
3761 [ALC880_ASUS_DIG] = {
3762 .mixers = { alc880_asus_mixer },
3763 .init_verbs = { alc880_volume_init_verbs,
3764 alc880_pin_asus_init_verbs,
3765 alc880_gpio1_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_ASUS_DIG2] = {
3775 .mixers = { alc880_asus_mixer },
3776 .init_verbs = { alc880_volume_init_verbs,
3777 alc880_pin_asus_init_verbs,
3778 alc880_gpio2_init_verbs }, /* use GPIO2 */
3779 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3780 .dac_nids = alc880_asus_dac_nids,
3781 .dig_out_nid = ALC880_DIGOUT_NID,
3782 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3783 .channel_mode = alc880_asus_modes,
3785 .input_mux = &alc880_capture_source,
3787 [ALC880_ASUS_W1V] = {
3788 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3789 .init_verbs = { alc880_volume_init_verbs,
3790 alc880_pin_asus_init_verbs,
3791 alc880_gpio1_init_verbs },
3792 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3793 .dac_nids = alc880_asus_dac_nids,
3794 .dig_out_nid = ALC880_DIGOUT_NID,
3795 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3796 .channel_mode = alc880_asus_modes,
3798 .input_mux = &alc880_capture_source,
3800 [ALC880_UNIWILL_DIG] = {
3801 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3802 .init_verbs = { alc880_volume_init_verbs,
3803 alc880_pin_asus_init_verbs },
3804 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3805 .dac_nids = alc880_asus_dac_nids,
3806 .dig_out_nid = ALC880_DIGOUT_NID,
3807 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3808 .channel_mode = alc880_asus_modes,
3810 .input_mux = &alc880_capture_source,
3812 [ALC880_UNIWILL] = {
3813 .mixers = { alc880_uniwill_mixer },
3814 .init_verbs = { alc880_volume_init_verbs,
3815 alc880_uniwill_init_verbs },
3816 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3817 .dac_nids = alc880_asus_dac_nids,
3818 .dig_out_nid = ALC880_DIGOUT_NID,
3819 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3820 .channel_mode = alc880_threestack_modes,
3822 .input_mux = &alc880_capture_source,
3823 .unsol_event = alc880_uniwill_unsol_event,
3824 .init_hook = alc880_uniwill_automute,
3826 [ALC880_UNIWILL_P53] = {
3827 .mixers = { alc880_uniwill_p53_mixer },
3828 .init_verbs = { alc880_volume_init_verbs,
3829 alc880_uniwill_p53_init_verbs },
3830 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3831 .dac_nids = alc880_asus_dac_nids,
3832 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3833 .channel_mode = alc880_threestack_modes,
3834 .input_mux = &alc880_capture_source,
3835 .unsol_event = alc880_uniwill_p53_unsol_event,
3836 .init_hook = alc880_uniwill_p53_hp_automute,
3838 [ALC880_FUJITSU] = {
3839 .mixers = { alc880_fujitsu_mixer,
3840 alc880_pcbeep_mixer, },
3841 .init_verbs = { alc880_volume_init_verbs,
3842 alc880_uniwill_p53_init_verbs,
3843 alc880_beep_init_verbs },
3844 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3845 .dac_nids = alc880_dac_nids,
3846 .dig_out_nid = ALC880_DIGOUT_NID,
3847 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3848 .channel_mode = alc880_2_jack_modes,
3849 .input_mux = &alc880_capture_source,
3850 .unsol_event = alc880_uniwill_p53_unsol_event,
3851 .init_hook = alc880_uniwill_p53_hp_automute,
3854 .mixers = { alc880_three_stack_mixer },
3855 .init_verbs = { alc880_volume_init_verbs,
3856 alc880_pin_clevo_init_verbs },
3857 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3858 .dac_nids = alc880_dac_nids,
3860 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3861 .channel_mode = alc880_threestack_modes,
3863 .input_mux = &alc880_capture_source,
3866 .mixers = { alc880_lg_mixer },
3867 .init_verbs = { alc880_volume_init_verbs,
3868 alc880_lg_init_verbs },
3869 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3870 .dac_nids = alc880_lg_dac_nids,
3871 .dig_out_nid = ALC880_DIGOUT_NID,
3872 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3873 .channel_mode = alc880_lg_ch_modes,
3875 .input_mux = &alc880_lg_capture_source,
3876 .unsol_event = alc880_lg_unsol_event,
3877 .init_hook = alc880_lg_automute,
3878 #ifdef CONFIG_SND_HDA_POWER_SAVE
3879 .loopbacks = alc880_lg_loopbacks,
3883 .mixers = { alc880_lg_lw_mixer },
3884 .init_verbs = { alc880_volume_init_verbs,
3885 alc880_lg_lw_init_verbs },
3886 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3887 .dac_nids = alc880_dac_nids,
3888 .dig_out_nid = ALC880_DIGOUT_NID,
3889 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3890 .channel_mode = alc880_lg_lw_modes,
3891 .input_mux = &alc880_lg_lw_capture_source,
3892 .unsol_event = alc880_lg_lw_unsol_event,
3893 .init_hook = alc880_lg_lw_automute,
3895 [ALC880_MEDION_RIM] = {
3896 .mixers = { alc880_medion_rim_mixer },
3897 .init_verbs = { alc880_volume_init_verbs,
3898 alc880_medion_rim_init_verbs,
3899 alc_gpio2_init_verbs },
3900 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3901 .dac_nids = alc880_dac_nids,
3902 .dig_out_nid = ALC880_DIGOUT_NID,
3903 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3904 .channel_mode = alc880_2_jack_modes,
3905 .input_mux = &alc880_medion_rim_capture_source,
3906 .unsol_event = alc880_medion_rim_unsol_event,
3907 .init_hook = alc880_medion_rim_automute,
3909 #ifdef CONFIG_SND_DEBUG
3911 .mixers = { alc880_test_mixer },
3912 .init_verbs = { alc880_test_init_verbs },
3913 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3914 .dac_nids = alc880_test_dac_nids,
3915 .dig_out_nid = ALC880_DIGOUT_NID,
3916 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3917 .channel_mode = alc880_test_modes,
3918 .input_mux = &alc880_test_capture_source,
3924 * Automatic parse of I/O pins from the BIOS configuration
3929 ALC_CTL_WIDGET_MUTE,
3932 static struct snd_kcontrol_new alc880_control_templates[] = {
3933 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3934 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3935 HDA_BIND_MUTE(NULL, 0, 0, 0),
3938 /* add dynamic controls */
3939 static int add_control(struct alc_spec *spec, int type, const char *name,
3942 struct snd_kcontrol_new *knew;
3944 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3945 knew = snd_array_new(&spec->kctls);
3948 *knew = alc880_control_templates[type];
3949 knew->name = kstrdup(name, GFP_KERNEL);
3952 knew->private_value = val;
3956 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3957 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3958 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3959 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3960 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3961 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3962 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3963 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3964 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3965 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3966 #define ALC880_PIN_CD_NID 0x1c
3968 /* fill in the dac_nids table from the parsed pin configuration */
3969 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3970 const struct auto_pin_cfg *cfg)
3976 memset(assigned, 0, sizeof(assigned));
3977 spec->multiout.dac_nids = spec->private_dac_nids;
3979 /* check the pins hardwired to audio widget */
3980 for (i = 0; i < cfg->line_outs; i++) {
3981 nid = cfg->line_out_pins[i];
3982 if (alc880_is_fixed_pin(nid)) {
3983 int idx = alc880_fixed_pin_idx(nid);
3984 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3988 /* left pins can be connect to any audio widget */
3989 for (i = 0; i < cfg->line_outs; i++) {
3990 nid = cfg->line_out_pins[i];
3991 if (alc880_is_fixed_pin(nid))
3993 /* search for an empty channel */
3994 for (j = 0; j < cfg->line_outs; j++) {
3996 spec->multiout.dac_nids[i] =
3997 alc880_idx_to_dac(j);
4003 spec->multiout.num_dacs = cfg->line_outs;
4007 /* add playback controls from the parsed DAC table */
4008 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4009 const struct auto_pin_cfg *cfg)
4012 static const char *chname[4] = {
4013 "Front", "Surround", NULL /*CLFE*/, "Side"
4018 for (i = 0; i < cfg->line_outs; i++) {
4019 if (!spec->multiout.dac_nids[i])
4021 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4024 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4025 "Center Playback Volume",
4026 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4030 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4031 "LFE Playback Volume",
4032 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4036 err = add_control(spec, ALC_CTL_BIND_MUTE,
4037 "Center Playback Switch",
4038 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4042 err = add_control(spec, ALC_CTL_BIND_MUTE,
4043 "LFE Playback Switch",
4044 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4049 sprintf(name, "%s Playback Volume", chname[i]);
4050 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4051 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4055 sprintf(name, "%s Playback Switch", chname[i]);
4056 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4057 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4066 /* add playback controls for speaker and HP outputs */
4067 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4077 if (alc880_is_fixed_pin(pin)) {
4078 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4079 /* specify the DAC as the extra output */
4080 if (!spec->multiout.hp_nid)
4081 spec->multiout.hp_nid = nid;
4083 spec->multiout.extra_out_nid[0] = nid;
4084 /* control HP volume/switch on the output mixer amp */
4085 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4086 sprintf(name, "%s Playback Volume", pfx);
4087 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4088 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4091 sprintf(name, "%s Playback Switch", pfx);
4092 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4093 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4096 } else if (alc880_is_multi_pin(pin)) {
4097 /* set manual connection */
4098 /* we have only a switch on HP-out PIN */
4099 sprintf(name, "%s Playback Switch", pfx);
4100 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4101 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4108 /* create input playback/capture controls for the given pin */
4109 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4110 const char *ctlname,
4111 int idx, hda_nid_t mix_nid)
4116 sprintf(name, "%s Playback Volume", ctlname);
4117 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4118 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4121 sprintf(name, "%s Playback Switch", ctlname);
4122 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4123 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4129 /* create playback/capture controls for input pins */
4130 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4131 const struct auto_pin_cfg *cfg)
4133 struct hda_input_mux *imux = &spec->private_imux;
4136 for (i = 0; i < AUTO_PIN_LAST; i++) {
4137 if (alc880_is_input_pin(cfg->input_pins[i])) {
4138 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4139 err = new_analog_input(spec, cfg->input_pins[i],
4140 auto_pin_cfg_labels[i],
4144 imux->items[imux->num_items].label =
4145 auto_pin_cfg_labels[i];
4146 imux->items[imux->num_items].index =
4147 alc880_input_pin_idx(cfg->input_pins[i]);
4154 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4155 unsigned int pin_type)
4157 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4160 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4164 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4165 hda_nid_t nid, int pin_type,
4168 alc_set_pin_output(codec, nid, pin_type);
4169 /* need the manual connection? */
4170 if (alc880_is_multi_pin(nid)) {
4171 struct alc_spec *spec = codec->spec;
4172 int idx = alc880_multi_pin_idx(nid);
4173 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4174 AC_VERB_SET_CONNECT_SEL,
4175 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4179 static int get_pin_type(int line_out_type)
4181 if (line_out_type == AUTO_PIN_HP_OUT)
4187 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4189 struct alc_spec *spec = codec->spec;
4192 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4193 for (i = 0; i < spec->autocfg.line_outs; i++) {
4194 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4195 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4196 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4200 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4202 struct alc_spec *spec = codec->spec;
4205 pin = spec->autocfg.speaker_pins[0];
4206 if (pin) /* connect to front */
4207 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4208 pin = spec->autocfg.hp_pins[0];
4209 if (pin) /* connect to front */
4210 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4213 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4215 struct alc_spec *spec = codec->spec;
4218 for (i = 0; i < AUTO_PIN_LAST; i++) {
4219 hda_nid_t nid = spec->autocfg.input_pins[i];
4220 if (alc880_is_input_pin(nid)) {
4221 snd_hda_codec_write(codec, nid, 0,
4222 AC_VERB_SET_PIN_WIDGET_CONTROL,
4223 i <= AUTO_PIN_FRONT_MIC ?
4224 PIN_VREF80 : PIN_IN);
4225 if (nid != ALC880_PIN_CD_NID)
4226 snd_hda_codec_write(codec, nid, 0,
4227 AC_VERB_SET_AMP_GAIN_MUTE,
4233 /* parse the BIOS configuration and set up the alc_spec */
4234 /* return 1 if successful, 0 if the proper config is not found,
4235 * or a negative error code
4237 static int alc880_parse_auto_config(struct hda_codec *codec)
4239 struct alc_spec *spec = codec->spec;
4241 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4243 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4247 if (!spec->autocfg.line_outs)
4248 return 0; /* can't find valid BIOS pin config */
4250 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4253 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4256 err = alc880_auto_create_extra_out(spec,
4257 spec->autocfg.speaker_pins[0],
4261 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4265 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4269 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4271 if (spec->autocfg.dig_out_pin)
4272 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4273 if (spec->autocfg.dig_in_pin)
4274 spec->dig_in_nid = ALC880_DIGIN_NID;
4276 if (spec->kctls.list)
4277 add_mixer(spec, spec->kctls.list);
4279 add_verb(spec, alc880_volume_init_verbs);
4281 spec->num_mux_defs = 1;
4282 spec->input_mux = &spec->private_imux;
4284 store_pin_configs(codec);
4288 /* additional initialization for auto-configuration model */
4289 static void alc880_auto_init(struct hda_codec *codec)
4291 struct alc_spec *spec = codec->spec;
4292 alc880_auto_init_multi_out(codec);
4293 alc880_auto_init_extra_out(codec);
4294 alc880_auto_init_analog_input(codec);
4295 if (spec->unsol_event)
4296 alc_inithook(codec);
4300 * OK, here we have finally the patch for ALC880
4303 static void set_capture_mixer(struct alc_spec *spec)
4305 static struct snd_kcontrol_new *caps[3] = {
4310 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4311 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4314 static int patch_alc880(struct hda_codec *codec)
4316 struct alc_spec *spec;
4320 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4326 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4329 if (board_config < 0) {
4330 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4331 "trying auto-probe from BIOS...\n");
4332 board_config = ALC880_AUTO;
4335 if (board_config == ALC880_AUTO) {
4336 /* automatic parse from the BIOS config */
4337 err = alc880_parse_auto_config(codec);
4343 "hda_codec: Cannot set up configuration "
4344 "from BIOS. Using 3-stack mode...\n");
4345 board_config = ALC880_3ST;
4349 if (board_config != ALC880_AUTO)
4350 setup_preset(spec, &alc880_presets[board_config]);
4352 spec->stream_name_analog = "ALC880 Analog";
4353 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4354 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4355 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4357 spec->stream_name_digital = "ALC880 Digital";
4358 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4359 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4361 if (!spec->adc_nids && spec->input_mux) {
4362 /* check whether NID 0x07 is valid */
4363 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4365 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4366 if (wcap != AC_WID_AUD_IN) {
4367 spec->adc_nids = alc880_adc_nids_alt;
4368 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4370 spec->adc_nids = alc880_adc_nids;
4371 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4374 set_capture_mixer(spec);
4376 spec->vmaster_nid = 0x0c;
4378 codec->patch_ops = alc_patch_ops;
4379 if (board_config == ALC880_AUTO)
4380 spec->init_hook = alc880_auto_init;
4381 #ifdef CONFIG_SND_HDA_POWER_SAVE
4382 if (!spec->loopback.amplist)
4383 spec->loopback.amplist = alc880_loopbacks;
4385 codec->proc_widget_hook = print_realtek_coef;
4395 static hda_nid_t alc260_dac_nids[1] = {
4400 static hda_nid_t alc260_adc_nids[1] = {
4405 static hda_nid_t alc260_adc_nids_alt[1] = {
4410 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4411 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4413 static hda_nid_t alc260_dual_adc_nids[2] = {
4418 #define ALC260_DIGOUT_NID 0x03
4419 #define ALC260_DIGIN_NID 0x06
4421 static struct hda_input_mux alc260_capture_source = {
4425 { "Front Mic", 0x1 },
4431 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4432 * headphone jack and the internal CD lines since these are the only pins at
4433 * which audio can appear. For flexibility, also allow the option of
4434 * recording the mixer output on the second ADC (ADC0 doesn't have a
4435 * connection to the mixer output).
4437 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4441 { "Mic/Line", 0x0 },
4443 { "Headphone", 0x2 },
4449 { "Mic/Line", 0x0 },
4451 { "Headphone", 0x2 },
4458 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4459 * the Fujitsu S702x, but jacks are marked differently.
4461 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4468 { "Headphone", 0x5 },
4477 { "Headphone", 0x6 },
4483 * This is just place-holder, so there's something for alc_build_pcms to look
4484 * at when it calculates the maximum number of channels. ALC260 has no mixer
4485 * element which allows changing the channel mode, so the verb list is
4488 static struct hda_channel_mode alc260_modes[1] = {
4493 /* Mixer combinations
4495 * basic: base_output + input + pc_beep + capture
4496 * HP: base_output + input + capture_alt
4497 * HP_3013: hp_3013 + input + capture
4498 * fujitsu: fujitsu + capture
4499 * acer: acer + capture
4502 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4503 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4504 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4505 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4506 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4507 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4508 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4512 static struct snd_kcontrol_new alc260_input_mixer[] = {
4513 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4514 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4515 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4516 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4518 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4519 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4520 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4524 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4525 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4526 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4530 /* update HP, line and mono out pins according to the master switch */
4531 static void alc260_hp_master_update(struct hda_codec *codec,
4532 hda_nid_t hp, hda_nid_t line,
4535 struct alc_spec *spec = codec->spec;
4536 unsigned int val = spec->master_sw ? PIN_HP : 0;
4537 /* change HP and line-out pins */
4538 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4540 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4542 /* mono (speaker) depending on the HP jack sense */
4543 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4544 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4548 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4549 struct snd_ctl_elem_value *ucontrol)
4551 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4552 struct alc_spec *spec = codec->spec;
4553 *ucontrol->value.integer.value = spec->master_sw;
4557 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4558 struct snd_ctl_elem_value *ucontrol)
4560 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4561 struct alc_spec *spec = codec->spec;
4562 int val = !!*ucontrol->value.integer.value;
4563 hda_nid_t hp, line, mono;
4565 if (val == spec->master_sw)
4567 spec->master_sw = val;
4568 hp = (kcontrol->private_value >> 16) & 0xff;
4569 line = (kcontrol->private_value >> 8) & 0xff;
4570 mono = kcontrol->private_value & 0xff;
4571 alc260_hp_master_update(codec, hp, line, mono);
4575 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4577 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4578 .name = "Master Playback Switch",
4579 .info = snd_ctl_boolean_mono_info,
4580 .get = alc260_hp_master_sw_get,
4581 .put = alc260_hp_master_sw_put,
4582 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4584 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4585 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4586 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4587 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4588 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4590 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4594 static struct hda_verb alc260_hp_unsol_verbs[] = {
4595 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4599 static void alc260_hp_automute(struct hda_codec *codec)
4601 struct alc_spec *spec = codec->spec;
4602 unsigned int present;
4604 present = snd_hda_codec_read(codec, 0x10, 0,
4605 AC_VERB_GET_PIN_SENSE, 0);
4606 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4607 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4610 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4612 if ((res >> 26) == ALC880_HP_EVENT)
4613 alc260_hp_automute(codec);
4616 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4619 .name = "Master Playback Switch",
4620 .info = snd_ctl_boolean_mono_info,
4621 .get = alc260_hp_master_sw_get,
4622 .put = alc260_hp_master_sw_put,
4623 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4625 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4626 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4627 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4628 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4629 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4630 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4631 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4632 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4636 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4637 .ops = &snd_hda_bind_vol,
4639 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4640 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4641 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4646 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4647 .ops = &snd_hda_bind_sw,
4649 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4650 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4655 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4656 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4657 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4658 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4663 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4664 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4668 static void alc260_hp_3013_automute(struct hda_codec *codec)
4670 struct alc_spec *spec = codec->spec;
4671 unsigned int present;
4673 present = snd_hda_codec_read(codec, 0x15, 0,
4674 AC_VERB_GET_PIN_SENSE, 0);
4675 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4676 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4679 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4682 if ((res >> 26) == ALC880_HP_EVENT)
4683 alc260_hp_3013_automute(codec);
4686 static void alc260_hp_3012_automute(struct hda_codec *codec)
4688 unsigned int present, bits;
4690 present = snd_hda_codec_read(codec, 0x10, 0,
4691 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4693 bits = present ? 0 : PIN_OUT;
4694 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4696 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4698 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4702 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4705 if ((res >> 26) == ALC880_HP_EVENT)
4706 alc260_hp_3012_automute(codec);
4709 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4710 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4712 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4713 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4714 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4715 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4716 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4717 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4718 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4719 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4720 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4721 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4722 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4723 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4724 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4728 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4729 * versions of the ALC260 don't act on requests to enable mic bias from NID
4730 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4731 * datasheet doesn't mention this restriction. At this stage it's not clear
4732 * whether this behaviour is intentional or is a hardware bug in chip
4733 * revisions available in early 2006. Therefore for now allow the
4734 * "Headphone Jack Mode" control to span all choices, but if it turns out
4735 * that the lack of mic bias for this NID is intentional we could change the
4736 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4738 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4739 * don't appear to make the mic bias available from the "line" jack, even
4740 * though the NID used for this jack (0x14) can supply it. The theory is
4741 * that perhaps Acer have included blocking capacitors between the ALC260
4742 * and the output jack. If this turns out to be the case for all such
4743 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4744 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4746 * The C20x Tablet series have a mono internal speaker which is controlled
4747 * via the chip's Mono sum widget and pin complex, so include the necessary
4748 * controls for such models. On models without a "mono speaker" the control
4749 * won't do anything.
4751 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4752 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4753 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4754 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4755 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4757 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4759 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4760 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4762 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4763 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4764 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4765 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4766 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4767 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4768 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4772 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4773 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4775 static struct snd_kcontrol_new alc260_will_mixer[] = {
4776 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4777 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4779 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4780 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4781 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4782 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4783 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4784 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4785 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4786 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4787 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4791 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4792 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4794 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4795 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4796 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4798 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4799 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4800 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4801 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4802 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4803 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4804 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4809 * initialization verbs
4811 static struct hda_verb alc260_init_verbs[] = {
4812 /* Line In pin widget for input */
4813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4814 /* CD pin widget for input */
4815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4816 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4817 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4818 /* Mic2 (front panel) pin widget for input and vref at 80% */
4819 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4820 /* LINE-2 is used for line-out in rear */
4821 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4822 /* select line-out */
4823 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4825 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4827 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4829 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4830 /* mute capture amp left and right */
4831 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4832 /* set connection select to line in (default select for this ADC) */
4833 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4834 /* mute capture amp left and right */
4835 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4836 /* set connection select to line in (default select for this ADC) */
4837 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4838 /* set vol=0 Line-Out mixer amp left and right */
4839 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4840 /* unmute pin widget amp left and right (no gain on this amp) */
4841 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4842 /* set vol=0 HP mixer amp left and right */
4843 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4844 /* unmute pin widget amp left and right (no gain on this amp) */
4845 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4846 /* set vol=0 Mono mixer amp left and right */
4847 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4848 /* unmute pin widget amp left and right (no gain on this amp) */
4849 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4850 /* unmute LINE-2 out pin */
4851 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4852 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4855 /* mute analog inputs */
4856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4861 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4862 /* mute Front out path */
4863 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4864 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4865 /* mute Headphone out path */
4866 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4867 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4868 /* mute Mono out path */
4869 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4870 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4874 #if 0 /* should be identical with alc260_init_verbs? */
4875 static struct hda_verb alc260_hp_init_verbs[] = {
4876 /* Headphone and output */
4877 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4879 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4880 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4881 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4882 /* Mic2 (front panel) pin widget for input and vref at 80% */
4883 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4884 /* Line In pin widget for input */
4885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4886 /* Line-2 pin widget for output */
4887 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4888 /* CD pin widget for input */
4889 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4890 /* unmute amp left and right */
4891 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4892 /* set connection select to line in (default select for this ADC) */
4893 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4894 /* unmute Line-Out mixer amp left and right (volume = 0) */
4895 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4896 /* mute pin widget amp left and right (no gain on this amp) */
4897 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4898 /* unmute HP mixer amp left and right (volume = 0) */
4899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4900 /* mute pin widget amp left and right (no gain on this amp) */
4901 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4902 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4905 /* mute analog inputs */
4906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4911 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4912 /* Unmute Front out path */
4913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4914 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4915 /* Unmute Headphone out path */
4916 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4917 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4918 /* Unmute Mono out path */
4919 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4920 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4925 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4926 /* Line out and output */
4927 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4929 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4930 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4931 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4932 /* Mic2 (front panel) pin widget for input and vref at 80% */
4933 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4934 /* Line In pin widget for input */
4935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4936 /* Headphone pin widget for output */
4937 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4938 /* CD pin widget for input */
4939 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4940 /* unmute amp left and right */
4941 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4942 /* set connection select to line in (default select for this ADC) */
4943 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4944 /* unmute Line-Out mixer amp left and right (volume = 0) */
4945 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4946 /* mute pin widget amp left and right (no gain on this amp) */
4947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4948 /* unmute HP mixer amp left and right (volume = 0) */
4949 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4950 /* mute pin widget amp left and right (no gain on this amp) */
4951 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4952 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4955 /* mute analog inputs */
4956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4958 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4959 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4960 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4961 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4962 /* Unmute Front out path */
4963 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4964 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4965 /* Unmute Headphone out path */
4966 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4967 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4968 /* Unmute Mono out path */
4969 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4970 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4974 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4975 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4976 * audio = 0x16, internal speaker = 0x10.
4978 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4979 /* Disable all GPIOs */
4980 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4981 /* Internal speaker is connected to headphone pin */
4982 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4983 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4985 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4986 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4987 /* Ensure all other unused pins are disabled and muted. */
4988 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4989 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4990 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4991 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4992 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4993 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4997 /* Disable digital (SPDIF) pins */
4998 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4999 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5001 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5002 * when acting as an output.
5004 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5006 /* Start with output sum widgets muted and their output gains at min */
5007 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5009 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5010 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5012 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5013 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5014 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5015 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5017 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5018 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5019 /* Unmute Line1 pin widget output buffer since it starts as an output.
5020 * If the pin mode is changed by the user the pin mode control will
5021 * take care of enabling the pin's input/output buffers as needed.
5022 * Therefore there's no need to enable the input buffer at this
5025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5026 /* Unmute input buffer of pin widget used for Line-in (no equiv
5029 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5031 /* Mute capture amp left and right */
5032 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5033 /* Set ADC connection select to match default mixer setting - line
5036 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5038 /* Do the same for the second ADC: mute capture input amp and
5039 * set ADC connection to line in (on mic1 pin)
5041 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5042 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5044 /* Mute all inputs to mixer widget (even unconnected ones) */
5045 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5046 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5047 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5048 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5049 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5051 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5057 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5058 * similar laptops (adapted from Fujitsu init verbs).
5060 static struct hda_verb alc260_acer_init_verbs[] = {
5061 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5062 * the headphone jack. Turn this on and rely on the standard mute
5063 * methods whenever the user wants to turn these outputs off.
5065 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5066 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5067 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5068 /* Internal speaker/Headphone jack is connected to Line-out pin */
5069 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5070 /* Internal microphone/Mic jack is connected to Mic1 pin */
5071 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5072 /* Line In jack is connected to Line1 pin */
5073 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5074 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5075 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5076 /* Ensure all other unused pins are disabled and muted. */
5077 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5078 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5079 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5080 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5082 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5083 /* Disable digital (SPDIF) pins */
5084 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5085 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5087 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5088 * bus when acting as outputs.
5090 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5091 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5093 /* Start with output sum widgets muted and their output gains at min */
5094 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5095 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5096 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5097 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5098 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5099 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5100 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5101 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5102 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5104 /* Unmute Line-out pin widget amp left and right
5105 * (no equiv mixer ctrl)
5107 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5108 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5109 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5110 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5111 * inputs. If the pin mode is changed by the user the pin mode control
5112 * will take care of enabling the pin's input/output buffers as needed.
5113 * Therefore there's no need to enable the input buffer at this
5116 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5117 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5119 /* Mute capture amp left and right */
5120 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5121 /* Set ADC connection select to match default mixer setting - mic
5124 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5126 /* Do similar with the second ADC: mute capture input amp and
5127 * set ADC connection to mic to match ALSA's default state.
5129 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5130 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5132 /* Mute all inputs to mixer widget (even unconnected ones) */
5133 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5134 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5135 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5136 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5138 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5139 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5140 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5145 static struct hda_verb alc260_will_verbs[] = {
5146 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5147 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5148 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5149 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5150 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5151 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5155 static struct hda_verb alc260_replacer_672v_verbs[] = {
5156 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5157 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5158 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5160 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5161 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5162 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5164 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5168 /* toggle speaker-output according to the hp-jack state */
5169 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5171 unsigned int present;
5173 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5174 present = snd_hda_codec_read(codec, 0x0f, 0,
5175 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5177 snd_hda_codec_write_cache(codec, 0x01, 0,
5178 AC_VERB_SET_GPIO_DATA, 1);
5179 snd_hda_codec_write_cache(codec, 0x0f, 0,
5180 AC_VERB_SET_PIN_WIDGET_CONTROL,
5183 snd_hda_codec_write_cache(codec, 0x01, 0,
5184 AC_VERB_SET_GPIO_DATA, 0);
5185 snd_hda_codec_write_cache(codec, 0x0f, 0,
5186 AC_VERB_SET_PIN_WIDGET_CONTROL,
5191 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5194 if ((res >> 26) == ALC880_HP_EVENT)
5195 alc260_replacer_672v_automute(codec);
5198 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5199 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5200 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5201 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5202 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5203 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5204 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5205 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5206 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5207 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5208 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5212 /* Test configuration for debugging, modelled after the ALC880 test
5215 #ifdef CONFIG_SND_DEBUG
5216 static hda_nid_t alc260_test_dac_nids[1] = {
5219 static hda_nid_t alc260_test_adc_nids[2] = {
5222 /* For testing the ALC260, each input MUX needs its own definition since
5223 * the signal assignments are different. This assumes that the first ADC
5226 static struct hda_input_mux alc260_test_capture_sources[2] = {
5230 { "MIC1 pin", 0x0 },
5231 { "MIC2 pin", 0x1 },
5232 { "LINE1 pin", 0x2 },
5233 { "LINE2 pin", 0x3 },
5235 { "LINE-OUT pin", 0x5 },
5236 { "HP-OUT pin", 0x6 },
5242 { "MIC1 pin", 0x0 },
5243 { "MIC2 pin", 0x1 },
5244 { "LINE1 pin", 0x2 },
5245 { "LINE2 pin", 0x3 },
5248 { "LINE-OUT pin", 0x6 },
5249 { "HP-OUT pin", 0x7 },
5253 static struct snd_kcontrol_new alc260_test_mixer[] = {
5254 /* Output driver widgets */
5255 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5256 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5257 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5258 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5259 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5260 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5262 /* Modes for retasking pin widgets
5263 * Note: the ALC260 doesn't seem to act on requests to enable mic
5264 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5265 * mention this restriction. At this stage it's not clear whether
5266 * this behaviour is intentional or is a hardware bug in chip
5267 * revisions available at least up until early 2006. Therefore for
5268 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5269 * choices, but if it turns out that the lack of mic bias for these
5270 * NIDs is intentional we could change their modes from
5271 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5273 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5274 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5275 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5276 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5277 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5278 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5280 /* Loopback mixer controls */
5281 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5282 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5283 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5284 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5285 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5286 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5287 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5288 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5289 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5290 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5291 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5292 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5293 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5294 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5295 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5296 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5298 /* Controls for GPIO pins, assuming they are configured as outputs */
5299 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5300 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5301 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5302 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5304 /* Switches to allow the digital IO pins to be enabled. The datasheet
5305 * is ambigious as to which NID is which; testing on laptops which
5306 * make this output available should provide clarification.
5308 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5309 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5311 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5312 * this output to turn on an external amplifier.
5314 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5315 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5319 static struct hda_verb alc260_test_init_verbs[] = {
5320 /* Enable all GPIOs as outputs with an initial value of 0 */
5321 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5322 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5323 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5325 /* Enable retasking pins as output, initially without power amp */
5326 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5327 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5329 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5330 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5331 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5333 /* Disable digital (SPDIF) pins initially, but users can enable
5334 * them via a mixer switch. In the case of SPDIF-out, this initverb
5335 * payload also sets the generation to 0, output to be in "consumer"
5336 * PCM format, copyright asserted, no pre-emphasis and no validity
5339 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5340 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5342 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5343 * OUT1 sum bus when acting as an output.
5345 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5346 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5347 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5348 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5350 /* Start with output sum widgets muted and their output gains at min */
5351 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5353 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5354 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5355 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5356 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5357 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5358 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5359 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5361 /* Unmute retasking pin widget output buffers since the default
5362 * state appears to be output. As the pin mode is changed by the
5363 * user the pin mode control will take care of enabling the pin's
5364 * input/output buffers as needed.
5366 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5367 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5369 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5370 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5371 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5372 /* Also unmute the mono-out pin widget */
5373 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5375 /* Mute capture amp left and right */
5376 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5377 /* Set ADC connection select to match default mixer setting (mic1
5380 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5382 /* Do the same for the second ADC: mute capture input amp and
5383 * set ADC connection to mic1 pin
5385 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5386 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5388 /* Mute all inputs to mixer widget (even unconnected ones) */
5389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5390 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5392 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5394 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5395 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5396 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5402 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5403 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5405 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5406 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5409 * for BIOS auto-configuration
5412 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5413 const char *pfx, int *vol_bits)
5416 unsigned long vol_val, sw_val;
5420 if (nid >= 0x0f && nid < 0x11) {
5421 nid_vol = nid - 0x7;
5422 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5423 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5424 } else if (nid == 0x11) {
5425 nid_vol = nid - 0x7;
5426 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5427 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5428 } else if (nid >= 0x12 && nid <= 0x15) {
5430 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5431 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5435 if (!(*vol_bits & (1 << nid_vol))) {
5436 /* first control for the volume widget */
5437 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5438 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5441 *vol_bits |= (1 << nid_vol);
5443 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5444 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5450 /* add playback controls from the parsed DAC table */
5451 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5452 const struct auto_pin_cfg *cfg)
5458 spec->multiout.num_dacs = 1;
5459 spec->multiout.dac_nids = spec->private_dac_nids;
5460 spec->multiout.dac_nids[0] = 0x02;
5462 nid = cfg->line_out_pins[0];
5464 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5469 nid = cfg->speaker_pins[0];
5471 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5476 nid = cfg->hp_pins[0];
5478 err = alc260_add_playback_controls(spec, nid, "Headphone",
5486 /* create playback/capture controls for input pins */
5487 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5488 const struct auto_pin_cfg *cfg)
5490 struct hda_input_mux *imux = &spec->private_imux;
5493 for (i = 0; i < AUTO_PIN_LAST; i++) {
5494 if (cfg->input_pins[i] >= 0x12) {
5495 idx = cfg->input_pins[i] - 0x12;
5496 err = new_analog_input(spec, cfg->input_pins[i],
5497 auto_pin_cfg_labels[i], idx,
5501 imux->items[imux->num_items].label =
5502 auto_pin_cfg_labels[i];
5503 imux->items[imux->num_items].index = idx;
5506 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5507 idx = cfg->input_pins[i] - 0x09;
5508 err = new_analog_input(spec, cfg->input_pins[i],
5509 auto_pin_cfg_labels[i], idx,
5513 imux->items[imux->num_items].label =
5514 auto_pin_cfg_labels[i];
5515 imux->items[imux->num_items].index = idx;
5522 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5523 hda_nid_t nid, int pin_type,
5526 alc_set_pin_output(codec, nid, pin_type);
5527 /* need the manual connection? */
5529 int idx = nid - 0x12;
5530 snd_hda_codec_write(codec, idx + 0x0b, 0,
5531 AC_VERB_SET_CONNECT_SEL, sel_idx);
5535 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5537 struct alc_spec *spec = codec->spec;
5540 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5541 nid = spec->autocfg.line_out_pins[0];
5543 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5544 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5547 nid = spec->autocfg.speaker_pins[0];
5549 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5551 nid = spec->autocfg.hp_pins[0];
5553 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5556 #define ALC260_PIN_CD_NID 0x16
5557 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5559 struct alc_spec *spec = codec->spec;
5562 for (i = 0; i < AUTO_PIN_LAST; i++) {
5563 hda_nid_t nid = spec->autocfg.input_pins[i];
5565 snd_hda_codec_write(codec, nid, 0,
5566 AC_VERB_SET_PIN_WIDGET_CONTROL,
5567 i <= AUTO_PIN_FRONT_MIC ?
5568 PIN_VREF80 : PIN_IN);
5569 if (nid != ALC260_PIN_CD_NID)
5570 snd_hda_codec_write(codec, nid, 0,
5571 AC_VERB_SET_AMP_GAIN_MUTE,
5578 * generic initialization of ADC, input mixers and output mixers
5580 static struct hda_verb alc260_volume_init_verbs[] = {
5582 * Unmute ADC0-1 and set the default input to mic-in
5584 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5585 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5586 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5587 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5589 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5591 * Note: PASD motherboards uses the Line In 2 as the input for
5592 * front panel mic (mic 2)
5594 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5595 /* mute analog inputs */
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5603 * Set up output mixers (0x08 - 0x0a)
5605 /* set vol=0 to output mixers */
5606 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5608 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5609 /* set up input amps for analog loopback */
5610 /* Amp Indices: DAC = 0, mixer = 1 */
5611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5612 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5613 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5615 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5616 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5621 static int alc260_parse_auto_config(struct hda_codec *codec)
5623 struct alc_spec *spec = codec->spec;
5625 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5627 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5631 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5634 if (!spec->kctls.list)
5635 return 0; /* can't find valid BIOS pin config */
5636 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5640 spec->multiout.max_channels = 2;
5642 if (spec->autocfg.dig_out_pin)
5643 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5644 if (spec->kctls.list)
5645 add_mixer(spec, spec->kctls.list);
5647 add_verb(spec, alc260_volume_init_verbs);
5649 spec->num_mux_defs = 1;
5650 spec->input_mux = &spec->private_imux;
5652 store_pin_configs(codec);
5656 /* additional initialization for auto-configuration model */
5657 static void alc260_auto_init(struct hda_codec *codec)
5659 struct alc_spec *spec = codec->spec;
5660 alc260_auto_init_multi_out(codec);
5661 alc260_auto_init_analog_input(codec);
5662 if (spec->unsol_event)
5663 alc_inithook(codec);
5666 #ifdef CONFIG_SND_HDA_POWER_SAVE
5667 static struct hda_amp_list alc260_loopbacks[] = {
5668 { 0x07, HDA_INPUT, 0 },
5669 { 0x07, HDA_INPUT, 1 },
5670 { 0x07, HDA_INPUT, 2 },
5671 { 0x07, HDA_INPUT, 3 },
5672 { 0x07, HDA_INPUT, 4 },
5678 * ALC260 configurations
5680 static const char *alc260_models[ALC260_MODEL_LAST] = {
5681 [ALC260_BASIC] = "basic",
5683 [ALC260_HP_3013] = "hp-3013",
5684 [ALC260_HP_DC7600] = "hp-dc7600",
5685 [ALC260_FUJITSU_S702X] = "fujitsu",
5686 [ALC260_ACER] = "acer",
5687 [ALC260_WILL] = "will",
5688 [ALC260_REPLACER_672V] = "replacer",
5689 #ifdef CONFIG_SND_DEBUG
5690 [ALC260_TEST] = "test",
5692 [ALC260_AUTO] = "auto",
5695 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5696 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5697 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5698 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5699 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5700 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5701 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5702 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5703 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5704 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5705 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5706 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5707 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5708 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5709 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5710 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5711 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5712 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5713 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5717 static struct alc_config_preset alc260_presets[] = {
5719 .mixers = { alc260_base_output_mixer,
5721 alc260_pc_beep_mixer },
5722 .init_verbs = { alc260_init_verbs },
5723 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5724 .dac_nids = alc260_dac_nids,
5725 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5726 .adc_nids = alc260_adc_nids,
5727 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5728 .channel_mode = alc260_modes,
5729 .input_mux = &alc260_capture_source,
5732 .mixers = { alc260_hp_output_mixer,
5733 alc260_input_mixer },
5734 .init_verbs = { alc260_init_verbs,
5735 alc260_hp_unsol_verbs },
5736 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5737 .dac_nids = alc260_dac_nids,
5738 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5739 .adc_nids = alc260_adc_nids_alt,
5740 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5741 .channel_mode = alc260_modes,
5742 .input_mux = &alc260_capture_source,
5743 .unsol_event = alc260_hp_unsol_event,
5744 .init_hook = alc260_hp_automute,
5746 [ALC260_HP_DC7600] = {
5747 .mixers = { alc260_hp_dc7600_mixer,
5748 alc260_input_mixer },
5749 .init_verbs = { alc260_init_verbs,
5750 alc260_hp_dc7600_verbs },
5751 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5752 .dac_nids = alc260_dac_nids,
5753 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5754 .adc_nids = alc260_adc_nids_alt,
5755 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5756 .channel_mode = alc260_modes,
5757 .input_mux = &alc260_capture_source,
5758 .unsol_event = alc260_hp_3012_unsol_event,
5759 .init_hook = alc260_hp_3012_automute,
5761 [ALC260_HP_3013] = {
5762 .mixers = { alc260_hp_3013_mixer,
5763 alc260_input_mixer },
5764 .init_verbs = { alc260_hp_3013_init_verbs,
5765 alc260_hp_3013_unsol_verbs },
5766 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5767 .dac_nids = alc260_dac_nids,
5768 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5769 .adc_nids = alc260_adc_nids_alt,
5770 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5771 .channel_mode = alc260_modes,
5772 .input_mux = &alc260_capture_source,
5773 .unsol_event = alc260_hp_3013_unsol_event,
5774 .init_hook = alc260_hp_3013_automute,
5776 [ALC260_FUJITSU_S702X] = {
5777 .mixers = { alc260_fujitsu_mixer },
5778 .init_verbs = { alc260_fujitsu_init_verbs },
5779 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5780 .dac_nids = alc260_dac_nids,
5781 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5782 .adc_nids = alc260_dual_adc_nids,
5783 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5784 .channel_mode = alc260_modes,
5785 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5786 .input_mux = alc260_fujitsu_capture_sources,
5789 .mixers = { alc260_acer_mixer },
5790 .init_verbs = { alc260_acer_init_verbs },
5791 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5792 .dac_nids = alc260_dac_nids,
5793 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5794 .adc_nids = alc260_dual_adc_nids,
5795 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5796 .channel_mode = alc260_modes,
5797 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5798 .input_mux = alc260_acer_capture_sources,
5801 .mixers = { alc260_will_mixer },
5802 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5803 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5804 .dac_nids = alc260_dac_nids,
5805 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5806 .adc_nids = alc260_adc_nids,
5807 .dig_out_nid = ALC260_DIGOUT_NID,
5808 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5809 .channel_mode = alc260_modes,
5810 .input_mux = &alc260_capture_source,
5812 [ALC260_REPLACER_672V] = {
5813 .mixers = { alc260_replacer_672v_mixer },
5814 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5815 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5816 .dac_nids = alc260_dac_nids,
5817 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5818 .adc_nids = alc260_adc_nids,
5819 .dig_out_nid = ALC260_DIGOUT_NID,
5820 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5821 .channel_mode = alc260_modes,
5822 .input_mux = &alc260_capture_source,
5823 .unsol_event = alc260_replacer_672v_unsol_event,
5824 .init_hook = alc260_replacer_672v_automute,
5826 #ifdef CONFIG_SND_DEBUG
5828 .mixers = { alc260_test_mixer },
5829 .init_verbs = { alc260_test_init_verbs },
5830 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5831 .dac_nids = alc260_test_dac_nids,
5832 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5833 .adc_nids = alc260_test_adc_nids,
5834 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5835 .channel_mode = alc260_modes,
5836 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5837 .input_mux = alc260_test_capture_sources,
5842 static int patch_alc260(struct hda_codec *codec)
5844 struct alc_spec *spec;
5845 int err, board_config;
5847 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5853 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5856 if (board_config < 0) {
5857 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5858 "trying auto-probe from BIOS...\n");
5859 board_config = ALC260_AUTO;
5862 if (board_config == ALC260_AUTO) {
5863 /* automatic parse from the BIOS config */
5864 err = alc260_parse_auto_config(codec);
5870 "hda_codec: Cannot set up configuration "
5871 "from BIOS. Using base mode...\n");
5872 board_config = ALC260_BASIC;
5876 if (board_config != ALC260_AUTO)
5877 setup_preset(spec, &alc260_presets[board_config]);
5879 spec->stream_name_analog = "ALC260 Analog";
5880 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5881 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5883 spec->stream_name_digital = "ALC260 Digital";
5884 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5885 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5887 if (!spec->adc_nids && spec->input_mux) {
5888 /* check whether NID 0x04 is valid */
5889 unsigned int wcap = get_wcaps(codec, 0x04);
5890 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5892 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5893 spec->adc_nids = alc260_adc_nids_alt;
5894 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5896 spec->adc_nids = alc260_adc_nids;
5897 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5900 set_capture_mixer(spec);
5902 spec->vmaster_nid = 0x08;
5904 codec->patch_ops = alc_patch_ops;
5905 if (board_config == ALC260_AUTO)
5906 spec->init_hook = alc260_auto_init;
5907 #ifdef CONFIG_SND_HDA_POWER_SAVE
5908 if (!spec->loopback.amplist)
5909 spec->loopback.amplist = alc260_loopbacks;
5911 codec->proc_widget_hook = print_realtek_coef;
5920 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5921 * configuration. Each pin widget can choose any input DACs and a mixer.
5922 * Each ADC is connected from a mixer of all inputs. This makes possible
5923 * 6-channel independent captures.
5925 * In addition, an independent DAC for the multi-playback (not used in this
5928 #define ALC882_DIGOUT_NID 0x06
5929 #define ALC882_DIGIN_NID 0x0a
5931 static struct hda_channel_mode alc882_ch_modes[1] = {
5935 static hda_nid_t alc882_dac_nids[4] = {
5936 /* front, rear, clfe, rear_surr */
5937 0x02, 0x03, 0x04, 0x05
5940 /* identical with ALC880 */
5941 #define alc882_adc_nids alc880_adc_nids
5942 #define alc882_adc_nids_alt alc880_adc_nids_alt
5944 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5945 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5948 /* FIXME: should be a matrix-type input source selection */
5950 static struct hda_input_mux alc882_capture_source = {
5954 { "Front Mic", 0x1 },
5962 static struct hda_verb alc882_3ST_ch2_init[] = {
5963 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5964 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5965 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5966 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5973 static struct hda_verb alc882_3ST_ch6_init[] = {
5974 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5975 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5976 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5977 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5978 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5979 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5983 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5984 { 2, alc882_3ST_ch2_init },
5985 { 6, alc882_3ST_ch6_init },
5991 static struct hda_verb alc882_sixstack_ch6_init[] = {
5992 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5993 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5994 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5995 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6002 static struct hda_verb alc882_sixstack_ch8_init[] = {
6003 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6004 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6005 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6006 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6010 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6011 { 6, alc882_sixstack_ch6_init },
6012 { 8, alc882_sixstack_ch8_init },
6016 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6022 static struct hda_verb alc885_mbp_ch2_init[] = {
6023 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6024 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6025 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6032 static struct hda_verb alc885_mbp_ch6_init[] = {
6033 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6034 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6035 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6036 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6037 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6041 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6042 { 2, alc885_mbp_ch2_init },
6043 { 6, alc885_mbp_ch6_init },
6047 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6048 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6050 static struct snd_kcontrol_new alc882_base_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("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6054 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6055 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6056 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6057 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6058 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6059 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6060 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6062 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6063 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6064 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6065 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6069 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6070 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6071 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6072 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6073 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6077 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6078 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6079 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6080 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6081 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6082 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6083 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6085 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6086 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6087 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6090 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6092 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6093 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6094 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6100 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6101 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6105 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6106 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6107 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6108 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6115 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6116 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6117 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6118 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6122 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6123 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6125 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6127 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6129 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6134 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6135 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6137 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6138 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6142 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6143 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6144 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6145 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6146 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6147 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6149 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6151 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6153 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6154 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6158 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6160 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6161 .name = "Channel Mode",
6162 .info = alc_ch_mode_info,
6163 .get = alc_ch_mode_get,
6164 .put = alc_ch_mode_put,
6169 static struct hda_verb alc882_init_verbs[] = {
6170 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6171 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6172 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6175 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6176 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6177 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6179 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6180 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6181 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6183 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6184 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6185 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6187 /* Front Pin: output 0 (0x0c) */
6188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6189 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6190 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6191 /* Rear Pin: output 1 (0x0d) */
6192 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6193 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6194 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6195 /* CLFE Pin: output 2 (0x0e) */
6196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6197 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6198 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6199 /* Side Pin: output 3 (0x0f) */
6200 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6201 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6202 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6203 /* Mic (rear) pin: input vref at 80% */
6204 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6206 /* Front Mic pin: input vref at 80% */
6207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6209 /* Line In pin: input */
6210 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6211 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6212 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6214 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6215 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6216 /* CD pin widget for input */
6217 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6219 /* FIXME: use matrix-type input source selection */
6220 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6221 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6223 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6224 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6225 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6227 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6228 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6229 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6230 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6232 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6233 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6236 /* ADC1: mute amp left and right */
6237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6238 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6239 /* ADC2: mute amp left and right */
6240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6241 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6242 /* ADC3: mute amp left and right */
6243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6244 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6249 static struct hda_verb alc882_eapd_verbs[] = {
6250 /* change to EAPD mode */
6251 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6252 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6257 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6261 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6262 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6263 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6264 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6268 static struct hda_verb alc882_macpro_init_verbs[] = {
6269 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6271 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6272 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6273 /* Front Pin: output 0 (0x0c) */
6274 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6275 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6276 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6277 /* Front Mic pin: input vref at 80% */
6278 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6279 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6280 /* Speaker: output */
6281 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6282 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6283 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6284 /* Headphone output (output 0 - 0x0c) */
6285 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6286 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6287 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6289 /* FIXME: use matrix-type input source selection */
6290 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6291 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6292 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6294 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6306 /* ADC1: mute amp left and right */
6307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6308 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6309 /* ADC2: mute amp left and right */
6310 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6311 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6312 /* ADC3: mute amp left and right */
6313 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6314 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6319 /* Macbook Pro rev3 */
6320 static struct hda_verb alc885_mbp3_init_verbs[] = {
6321 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6322 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6326 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6329 /* Front Pin: output 0 (0x0c) */
6330 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6331 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6332 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6333 /* HP Pin: output 0 (0x0d) */
6334 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6335 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6337 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6338 /* Mic (rear) pin: input vref at 80% */
6339 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6340 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6341 /* Front Mic pin: input vref at 80% */
6342 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6343 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6344 /* Line In pin: use output 1 when in LineOut mode */
6345 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6346 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6347 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6349 /* FIXME: use matrix-type input source selection */
6350 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6351 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6355 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6357 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6366 /* ADC1: mute amp left and right */
6367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6368 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6369 /* ADC2: mute amp left and right */
6370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6371 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6372 /* ADC3: mute amp left and right */
6373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6374 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6379 /* iMac 24 mixer. */
6380 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6381 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6382 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6386 /* iMac 24 init verbs. */
6387 static struct hda_verb alc885_imac24_init_verbs[] = {
6388 /* Internal speakers: output 0 (0x0c) */
6389 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6390 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6391 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6392 /* Internal speakers: output 0 (0x0c) */
6393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6394 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6395 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6396 /* Headphone: output 0 (0x0c) */
6397 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6398 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6399 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6400 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6401 /* Front Mic: input vref at 80% */
6402 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6407 /* Toggle speaker-output according to the hp-jack state */
6408 static void alc885_imac24_automute(struct hda_codec *codec)
6410 unsigned int present;
6412 present = snd_hda_codec_read(codec, 0x14, 0,
6413 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6414 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6415 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6416 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6417 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6420 /* Processes unsolicited events. */
6421 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6424 /* Headphone insertion or removal. */
6425 if ((res >> 26) == ALC880_HP_EVENT)
6426 alc885_imac24_automute(codec);
6429 static void alc885_mbp3_automute(struct hda_codec *codec)
6431 unsigned int present;
6433 present = snd_hda_codec_read(codec, 0x15, 0,
6434 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6435 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6436 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6437 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6438 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6441 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6444 /* Headphone insertion or removal. */
6445 if ((res >> 26) == ALC880_HP_EVENT)
6446 alc885_mbp3_automute(codec);
6450 static struct hda_verb alc882_targa_verbs[] = {
6451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6454 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6455 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6457 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6458 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6459 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6461 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6462 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6463 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6464 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6468 /* toggle speaker-output according to the hp-jack state */
6469 static void alc882_targa_automute(struct hda_codec *codec)
6471 unsigned int present;
6473 present = snd_hda_codec_read(codec, 0x14, 0,
6474 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6475 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6476 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6477 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6481 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6483 /* Looks like the unsol event is incompatible with the standard
6484 * definition. 4bit tag is placed at 26 bit!
6486 if (((res >> 26) == ALC880_HP_EVENT)) {
6487 alc882_targa_automute(codec);
6491 static struct hda_verb alc882_asus_a7j_verbs[] = {
6492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6497 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6499 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6500 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6501 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6503 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6504 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6505 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6509 static struct hda_verb alc882_asus_a7m_verbs[] = {
6510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6515 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6517 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6519 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6521 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6522 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6523 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6527 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6529 unsigned int gpiostate, gpiomask, gpiodir;
6531 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6532 AC_VERB_GET_GPIO_DATA, 0);
6535 gpiostate |= (1 << pin);
6537 gpiostate &= ~(1 << pin);
6539 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6540 AC_VERB_GET_GPIO_MASK, 0);
6541 gpiomask |= (1 << pin);
6543 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6544 AC_VERB_GET_GPIO_DIRECTION, 0);
6545 gpiodir |= (1 << pin);
6548 snd_hda_codec_write(codec, codec->afg, 0,
6549 AC_VERB_SET_GPIO_MASK, gpiomask);
6550 snd_hda_codec_write(codec, codec->afg, 0,
6551 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6555 snd_hda_codec_write(codec, codec->afg, 0,
6556 AC_VERB_SET_GPIO_DATA, gpiostate);
6559 /* set up GPIO at initialization */
6560 static void alc885_macpro_init_hook(struct hda_codec *codec)
6562 alc882_gpio_mute(codec, 0, 0);
6563 alc882_gpio_mute(codec, 1, 0);
6566 /* set up GPIO and update auto-muting at initialization */
6567 static void alc885_imac24_init_hook(struct hda_codec *codec)
6569 alc885_macpro_init_hook(codec);
6570 alc885_imac24_automute(codec);
6574 * generic initialization of ADC, input mixers and output mixers
6576 static struct hda_verb alc882_auto_init_verbs[] = {
6578 * Unmute ADC0-2 and set the default input to mic-in
6580 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6582 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6583 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6584 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6585 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6587 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6589 * Note: PASD motherboards uses the Line In 2 as the input for
6590 * front panel mic (mic 2)
6592 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6593 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6594 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6596 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6597 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6600 * Set up output mixers (0x0c - 0x0f)
6602 /* set vol=0 to output mixers */
6603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6604 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6606 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6607 /* set up input amps for analog loopback */
6608 /* Amp Indices: DAC = 0, mixer = 1 */
6609 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6610 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6611 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6612 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6613 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6614 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6615 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6616 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6617 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6618 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6620 /* FIXME: use matrix-type input source selection */
6621 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6622 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6623 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6624 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6625 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6626 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6628 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6629 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6630 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6631 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6633 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6634 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6635 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6636 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6641 #ifdef CONFIG_SND_HDA_POWER_SAVE
6642 #define alc882_loopbacks alc880_loopbacks
6645 /* pcm configuration: identiacal with ALC880 */
6646 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6647 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6648 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6649 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6652 * configuration and preset
6654 static const char *alc882_models[ALC882_MODEL_LAST] = {
6655 [ALC882_3ST_DIG] = "3stack-dig",
6656 [ALC882_6ST_DIG] = "6stack-dig",
6657 [ALC882_ARIMA] = "arima",
6658 [ALC882_W2JC] = "w2jc",
6659 [ALC882_TARGA] = "targa",
6660 [ALC882_ASUS_A7J] = "asus-a7j",
6661 [ALC882_ASUS_A7M] = "asus-a7m",
6662 [ALC885_MACPRO] = "macpro",
6663 [ALC885_MBP3] = "mbp3",
6664 [ALC885_IMAC24] = "imac24",
6665 [ALC882_AUTO] = "auto",
6668 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6669 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6670 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6671 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6672 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6673 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6674 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6675 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6676 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6677 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6678 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6679 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6680 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6684 static struct alc_config_preset alc882_presets[] = {
6685 [ALC882_3ST_DIG] = {
6686 .mixers = { alc882_base_mixer },
6687 .init_verbs = { alc882_init_verbs },
6688 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6689 .dac_nids = alc882_dac_nids,
6690 .dig_out_nid = ALC882_DIGOUT_NID,
6691 .dig_in_nid = ALC882_DIGIN_NID,
6692 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6693 .channel_mode = alc882_ch_modes,
6695 .input_mux = &alc882_capture_source,
6697 [ALC882_6ST_DIG] = {
6698 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6699 .init_verbs = { alc882_init_verbs },
6700 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6701 .dac_nids = alc882_dac_nids,
6702 .dig_out_nid = ALC882_DIGOUT_NID,
6703 .dig_in_nid = ALC882_DIGIN_NID,
6704 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6705 .channel_mode = alc882_sixstack_modes,
6706 .input_mux = &alc882_capture_source,
6709 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6710 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6711 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6712 .dac_nids = alc882_dac_nids,
6713 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6714 .channel_mode = alc882_sixstack_modes,
6715 .input_mux = &alc882_capture_source,
6718 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6719 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6720 alc880_gpio1_init_verbs },
6721 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6722 .dac_nids = alc882_dac_nids,
6723 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6724 .channel_mode = alc880_threestack_modes,
6726 .input_mux = &alc882_capture_source,
6727 .dig_out_nid = ALC882_DIGOUT_NID,
6730 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6731 .init_verbs = { alc885_mbp3_init_verbs,
6732 alc880_gpio1_init_verbs },
6733 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6734 .dac_nids = alc882_dac_nids,
6735 .channel_mode = alc885_mbp_6ch_modes,
6736 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6737 .input_mux = &alc882_capture_source,
6738 .dig_out_nid = ALC882_DIGOUT_NID,
6739 .dig_in_nid = ALC882_DIGIN_NID,
6740 .unsol_event = alc885_mbp3_unsol_event,
6741 .init_hook = alc885_mbp3_automute,
6744 .mixers = { alc882_macpro_mixer },
6745 .init_verbs = { alc882_macpro_init_verbs },
6746 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6747 .dac_nids = alc882_dac_nids,
6748 .dig_out_nid = ALC882_DIGOUT_NID,
6749 .dig_in_nid = ALC882_DIGIN_NID,
6750 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6751 .channel_mode = alc882_ch_modes,
6752 .input_mux = &alc882_capture_source,
6753 .init_hook = alc885_macpro_init_hook,
6756 .mixers = { alc885_imac24_mixer },
6757 .init_verbs = { alc885_imac24_init_verbs },
6758 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6759 .dac_nids = alc882_dac_nids,
6760 .dig_out_nid = ALC882_DIGOUT_NID,
6761 .dig_in_nid = ALC882_DIGIN_NID,
6762 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6763 .channel_mode = alc882_ch_modes,
6764 .input_mux = &alc882_capture_source,
6765 .unsol_event = alc885_imac24_unsol_event,
6766 .init_hook = alc885_imac24_init_hook,
6769 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6770 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6771 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6772 .dac_nids = alc882_dac_nids,
6773 .dig_out_nid = ALC882_DIGOUT_NID,
6774 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6775 .adc_nids = alc882_adc_nids,
6776 .capsrc_nids = alc882_capsrc_nids,
6777 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6778 .channel_mode = alc882_3ST_6ch_modes,
6780 .input_mux = &alc882_capture_source,
6781 .unsol_event = alc882_targa_unsol_event,
6782 .init_hook = alc882_targa_automute,
6784 [ALC882_ASUS_A7J] = {
6785 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6786 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6787 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6788 .dac_nids = alc882_dac_nids,
6789 .dig_out_nid = ALC882_DIGOUT_NID,
6790 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6791 .adc_nids = alc882_adc_nids,
6792 .capsrc_nids = alc882_capsrc_nids,
6793 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6794 .channel_mode = alc882_3ST_6ch_modes,
6796 .input_mux = &alc882_capture_source,
6798 [ALC882_ASUS_A7M] = {
6799 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6800 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6801 alc880_gpio1_init_verbs,
6802 alc882_asus_a7m_verbs },
6803 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6804 .dac_nids = alc882_dac_nids,
6805 .dig_out_nid = ALC882_DIGOUT_NID,
6806 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6807 .channel_mode = alc880_threestack_modes,
6809 .input_mux = &alc882_capture_source,
6818 PINFIX_ABIT_AW9D_MAX
6821 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6822 { 0x15, 0x01080104 }, /* side */
6823 { 0x16, 0x01011012 }, /* rear */
6824 { 0x17, 0x01016011 }, /* clfe */
6828 static const struct alc_pincfg *alc882_pin_fixes[] = {
6829 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6832 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6833 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6838 * BIOS auto configuration
6840 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6841 hda_nid_t nid, int pin_type,
6845 struct alc_spec *spec = codec->spec;
6848 alc_set_pin_output(codec, nid, pin_type);
6849 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6852 idx = spec->multiout.dac_nids[dac_idx] - 2;
6853 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6857 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6859 struct alc_spec *spec = codec->spec;
6862 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6863 for (i = 0; i <= HDA_SIDE; i++) {
6864 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6865 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6867 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6872 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6874 struct alc_spec *spec = codec->spec;
6877 pin = spec->autocfg.hp_pins[0];
6878 if (pin) /* connect to front */
6880 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6881 pin = spec->autocfg.speaker_pins[0];
6883 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6886 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6887 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6889 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6891 struct alc_spec *spec = codec->spec;
6894 for (i = 0; i < AUTO_PIN_LAST; i++) {
6895 hda_nid_t nid = spec->autocfg.input_pins[i];
6900 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6901 unsigned int pincap;
6902 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6903 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6907 snd_hda_codec_write(codec, nid, 0,
6908 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6909 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6910 snd_hda_codec_write(codec, nid, 0,
6911 AC_VERB_SET_AMP_GAIN_MUTE,
6916 static void alc882_auto_init_input_src(struct hda_codec *codec)
6918 struct alc_spec *spec = codec->spec;
6919 const struct hda_input_mux *imux = spec->input_mux;
6922 for (c = 0; c < spec->num_adc_nids; c++) {
6923 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6924 hda_nid_t nid = spec->capsrc_nids[c];
6925 int conns, mute, idx, item;
6927 conns = snd_hda_get_connections(codec, nid, conn_list,
6928 ARRAY_SIZE(conn_list));
6931 for (idx = 0; idx < conns; idx++) {
6932 /* if the current connection is the selected one,
6933 * unmute it as default - otherwise mute it
6935 mute = AMP_IN_MUTE(idx);
6936 for (item = 0; item < imux->num_items; item++) {
6937 if (imux->items[item].index == idx) {
6938 if (spec->cur_mux[c] == item)
6939 mute = AMP_IN_UNMUTE(idx);
6943 snd_hda_codec_write(codec, nid, 0,
6944 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6949 /* add mic boosts if needed */
6950 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6952 struct alc_spec *spec = codec->spec;
6956 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6957 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6958 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6960 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6964 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6965 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6966 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6968 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6975 /* almost identical with ALC880 parser... */
6976 static int alc882_parse_auto_config(struct hda_codec *codec)
6978 struct alc_spec *spec = codec->spec;
6979 int err = alc880_parse_auto_config(codec);
6984 return 0; /* no config found */
6986 err = alc_auto_add_mic_boost(codec);
6990 /* hack - override the init verbs */
6991 spec->init_verbs[0] = alc882_auto_init_verbs;
6993 return 1; /* config found */
6996 /* additional initialization for auto-configuration model */
6997 static void alc882_auto_init(struct hda_codec *codec)
6999 struct alc_spec *spec = codec->spec;
7000 alc882_auto_init_multi_out(codec);
7001 alc882_auto_init_hp_out(codec);
7002 alc882_auto_init_analog_input(codec);
7003 alc882_auto_init_input_src(codec);
7004 if (spec->unsol_event)
7005 alc_inithook(codec);
7008 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7010 static int patch_alc882(struct hda_codec *codec)
7012 struct alc_spec *spec;
7013 int err, board_config;
7015 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7021 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7025 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7026 /* Pick up systems that don't supply PCI SSID */
7027 switch (codec->subsystem_id) {
7028 case 0x106b0c00: /* Mac Pro */
7029 board_config = ALC885_MACPRO;
7031 case 0x106b1000: /* iMac 24 */
7032 case 0x106b2800: /* AppleTV */
7033 board_config = ALC885_IMAC24;
7035 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7036 case 0x106b00a4: /* MacbookPro4,1 */
7037 case 0x106b2c00: /* Macbook Pro rev3 */
7038 case 0x106b3600: /* Macbook 3.1 */
7039 board_config = ALC885_MBP3;
7042 /* ALC889A is handled better as ALC888-compatible */
7043 if (codec->revision_id == 0x100101 ||
7044 codec->revision_id == 0x100103) {
7046 return patch_alc883(codec);
7048 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7049 "trying auto-probe from BIOS...\n");
7050 board_config = ALC882_AUTO;
7054 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7056 if (board_config == ALC882_AUTO) {
7057 /* automatic parse from the BIOS config */
7058 err = alc882_parse_auto_config(codec);
7064 "hda_codec: Cannot set up configuration "
7065 "from BIOS. Using base mode...\n");
7066 board_config = ALC882_3ST_DIG;
7070 if (board_config != ALC882_AUTO)
7071 setup_preset(spec, &alc882_presets[board_config]);
7073 if (codec->vendor_id == 0x10ec0885) {
7074 spec->stream_name_analog = "ALC885 Analog";
7075 spec->stream_name_digital = "ALC885 Digital";
7077 spec->stream_name_analog = "ALC882 Analog";
7078 spec->stream_name_digital = "ALC882 Digital";
7081 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7082 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7083 /* FIXME: setup DAC5 */
7084 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7085 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7087 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7088 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7090 spec->is_mix_capture = 1; /* matrix-style capture */
7091 if (!spec->adc_nids && spec->input_mux) {
7092 /* check whether NID 0x07 is valid */
7093 unsigned int wcap = get_wcaps(codec, 0x07);
7095 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7096 if (wcap != AC_WID_AUD_IN) {
7097 spec->adc_nids = alc882_adc_nids_alt;
7098 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7099 spec->capsrc_nids = alc882_capsrc_nids_alt;
7101 spec->adc_nids = alc882_adc_nids;
7102 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7103 spec->capsrc_nids = alc882_capsrc_nids;
7106 set_capture_mixer(spec);
7108 spec->vmaster_nid = 0x0c;
7110 codec->patch_ops = alc_patch_ops;
7111 if (board_config == ALC882_AUTO)
7112 spec->init_hook = alc882_auto_init;
7113 #ifdef CONFIG_SND_HDA_POWER_SAVE
7114 if (!spec->loopback.amplist)
7115 spec->loopback.amplist = alc882_loopbacks;
7117 codec->proc_widget_hook = print_realtek_coef;
7125 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7126 * configuration. Each pin widget can choose any input DACs and a mixer.
7127 * Each ADC is connected from a mixer of all inputs. This makes possible
7128 * 6-channel independent captures.
7130 * In addition, an independent DAC for the multi-playback (not used in this
7133 #define ALC883_DIGOUT_NID 0x06
7134 #define ALC883_DIGIN_NID 0x0a
7136 #define ALC1200_DIGOUT_NID 0x10
7138 static hda_nid_t alc883_dac_nids[4] = {
7139 /* front, rear, clfe, rear_surr */
7140 0x02, 0x03, 0x04, 0x05
7143 static hda_nid_t alc883_adc_nids[2] = {
7148 static hda_nid_t alc883_adc_nids_alt[1] = {
7153 static hda_nid_t alc883_adc_nids_rev[2] = {
7158 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7160 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7163 /* FIXME: should be a matrix-type input source selection */
7165 static struct hda_input_mux alc883_capture_source = {
7169 { "Front Mic", 0x1 },
7175 static struct hda_input_mux alc883_3stack_6ch_intel = {
7179 { "Front Mic", 0x0 },
7185 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7193 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7203 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7211 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7215 { "Front Mic", 0x1 },
7220 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7231 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7238 static struct hda_verb alc883_3ST_ch2_init[] = {
7239 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7240 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7241 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7242 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7249 static struct hda_verb alc883_3ST_ch4_init[] = {
7250 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7251 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7252 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7253 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7254 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7261 static struct hda_verb alc883_3ST_ch6_init[] = {
7262 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7263 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7264 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7265 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7266 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7267 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7271 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7272 { 2, alc883_3ST_ch2_init },
7273 { 4, alc883_3ST_ch4_init },
7274 { 6, alc883_3ST_ch6_init },
7280 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7281 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7282 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7283 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7284 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7291 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7292 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7293 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7294 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7295 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7296 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7303 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7304 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7305 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7306 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7307 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7308 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7309 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7313 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7314 { 2, alc883_3ST_ch2_intel_init },
7315 { 4, alc883_3ST_ch4_intel_init },
7316 { 6, alc883_3ST_ch6_intel_init },
7322 static struct hda_verb alc883_sixstack_ch6_init[] = {
7323 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7324 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7325 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7326 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7333 static struct hda_verb alc883_sixstack_ch8_init[] = {
7334 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7335 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7336 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7337 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7341 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7342 { 6, alc883_sixstack_ch6_init },
7343 { 8, alc883_sixstack_ch8_init },
7346 static struct hda_verb alc883_medion_eapd_verbs[] = {
7347 /* eanable EAPD on medion laptop */
7348 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7349 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7353 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7354 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7357 static struct snd_kcontrol_new alc883_base_mixer[] = {
7358 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7359 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7360 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7361 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7362 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7363 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7364 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7365 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7366 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7367 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7368 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7369 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7370 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7372 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7374 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7376 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7377 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7378 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7379 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7380 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7384 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7385 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7386 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7387 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7388 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7389 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7390 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7391 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7393 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7394 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7395 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7396 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7397 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7401 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7402 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7403 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7404 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7405 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7406 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7407 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7408 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7409 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7410 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7411 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7415 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7416 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7417 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7418 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7419 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7425 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7429 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7430 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7431 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7433 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7434 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7435 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7436 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7438 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7439 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7440 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7441 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7442 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7443 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7444 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7448 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7449 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7450 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7452 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7453 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7454 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7455 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7456 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7457 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7458 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7459 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7460 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7461 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7463 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7465 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7466 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7468 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7469 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7473 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7474 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7475 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7477 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7478 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7480 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7481 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7482 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7483 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7484 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7485 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7486 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7487 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7488 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7489 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7490 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7491 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7492 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7493 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7494 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7495 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7499 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7500 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7501 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7502 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7503 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7504 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7505 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7506 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7507 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7509 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7510 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7511 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7512 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7514 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7516 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7517 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7518 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7519 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7520 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7524 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7525 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7526 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7527 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7528 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7529 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7530 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7531 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7532 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7533 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7534 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7535 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7537 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7539 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7544 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7545 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7547 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7548 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7549 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7551 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7553 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7554 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7555 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7559 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7560 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7561 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7562 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7563 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7564 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7565 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7566 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7571 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7573 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7575 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7576 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7578 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7579 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7580 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7584 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7585 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7586 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7587 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7588 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7589 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7590 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7591 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7592 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7593 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7597 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7598 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7599 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7600 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7604 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7605 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7609 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7610 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7611 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7612 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7613 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7614 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7615 0x0d, 1, 0x0, HDA_OUTPUT),
7616 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7617 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7618 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7619 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7620 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7622 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7623 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7624 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7625 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7626 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7627 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7628 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7631 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7632 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7636 static struct hda_bind_ctls alc883_bind_cap_vol = {
7637 .ops = &snd_hda_bind_vol,
7639 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7640 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7645 static struct hda_bind_ctls alc883_bind_cap_switch = {
7646 .ops = &snd_hda_bind_sw,
7648 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7649 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7654 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7655 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7656 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7658 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7659 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7660 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7661 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7662 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7666 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7667 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7668 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7670 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7671 /* .name = "Capture Source", */
7672 .name = "Input Source",
7674 .info = alc_mux_enum_info,
7675 .get = alc_mux_enum_get,
7676 .put = alc_mux_enum_put,
7681 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7683 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7684 .name = "Channel Mode",
7685 .info = alc_ch_mode_info,
7686 .get = alc_ch_mode_get,
7687 .put = alc_ch_mode_put,
7692 static struct hda_verb alc883_init_verbs[] = {
7693 /* ADC1: mute amp left and right */
7694 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7695 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7696 /* ADC2: mute amp left and right */
7697 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7698 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7699 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7700 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7705 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7706 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7708 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7709 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7710 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7712 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7713 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7714 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7716 /* mute analog input loopbacks */
7717 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7718 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7719 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7720 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7723 /* Front Pin: output 0 (0x0c) */
7724 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7725 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7726 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7727 /* Rear Pin: output 1 (0x0d) */
7728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7730 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7731 /* CLFE Pin: output 2 (0x0e) */
7732 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7734 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7735 /* Side Pin: output 3 (0x0f) */
7736 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7737 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7738 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7739 /* Mic (rear) pin: input vref at 80% */
7740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7741 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7742 /* Front Mic pin: input vref at 80% */
7743 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7744 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7745 /* Line In pin: input */
7746 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7747 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7748 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7749 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7750 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7751 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7752 /* CD pin widget for input */
7753 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7755 /* FIXME: use matrix-type input source selection */
7756 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7758 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7759 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7760 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7761 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7766 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7770 /* toggle speaker-output according to the hp-jack state */
7771 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7773 unsigned int present;
7775 present = snd_hda_codec_read(codec, 0x15, 0,
7776 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7777 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7778 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7779 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7780 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7783 /* auto-toggle front mic */
7785 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7787 unsigned int present;
7790 present = snd_hda_codec_read(codec, 0x18, 0,
7791 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7792 bits = present ? HDA_AMP_MUTE : 0;
7793 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7797 static void alc883_mitac_automute(struct hda_codec *codec)
7799 alc883_mitac_hp_automute(codec);
7800 /* alc883_mitac_mic_automute(codec); */
7803 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7806 switch (res >> 26) {
7807 case ALC880_HP_EVENT:
7808 alc883_mitac_hp_automute(codec);
7810 case ALC880_MIC_EVENT:
7811 /* alc883_mitac_mic_automute(codec); */
7816 static struct hda_verb alc883_mitac_verbs[] = {
7818 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7821 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7822 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7824 /* enable unsolicited event */
7825 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7826 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7831 static struct hda_verb alc883_clevo_m720_verbs[] = {
7833 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7836 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7837 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7839 /* enable unsolicited event */
7840 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7841 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7846 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7848 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7854 /* enable unsolicited event */
7855 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7860 static struct hda_verb alc883_tagra_verbs[] = {
7861 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7864 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7867 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7868 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7869 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7871 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7872 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7873 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7874 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7879 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7880 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7881 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7882 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7886 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7887 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7888 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7889 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7890 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7894 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7896 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7897 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7899 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7903 static struct hda_verb alc883_haier_w66_verbs[] = {
7904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7905 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7909 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7910 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7911 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7912 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7916 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7920 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7921 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7922 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7923 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7924 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7928 static struct hda_verb alc888_3st_hp_verbs[] = {
7929 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7930 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7931 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7935 static struct hda_verb alc888_6st_dell_verbs[] = {
7936 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7940 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7941 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7942 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7943 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7944 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7948 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7949 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7950 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7951 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7952 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7956 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7957 { 2, alc888_3st_hp_2ch_init },
7958 { 6, alc888_3st_hp_6ch_init },
7961 /* toggle front-jack and RCA according to the hp-jack state */
7962 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7964 unsigned int present;
7966 present = snd_hda_codec_read(codec, 0x1b, 0,
7967 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7968 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7969 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7970 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7971 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7974 /* toggle RCA according to the front-jack state */
7975 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7977 unsigned int present;
7979 present = snd_hda_codec_read(codec, 0x14, 0,
7980 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7981 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7982 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7985 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7988 if ((res >> 26) == ALC880_HP_EVENT)
7989 alc888_lenovo_ms7195_front_automute(codec);
7990 if ((res >> 26) == ALC880_FRONT_EVENT)
7991 alc888_lenovo_ms7195_rca_automute(codec);
7994 static struct hda_verb alc883_medion_md2_verbs[] = {
7995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7998 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8000 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8004 /* toggle speaker-output according to the hp-jack state */
8005 static void alc883_medion_md2_automute(struct hda_codec *codec)
8007 unsigned int present;
8009 present = snd_hda_codec_read(codec, 0x14, 0,
8010 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8011 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8012 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8015 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8018 if ((res >> 26) == ALC880_HP_EVENT)
8019 alc883_medion_md2_automute(codec);
8022 /* toggle speaker-output according to the hp-jack state */
8023 static void alc883_tagra_automute(struct hda_codec *codec)
8025 unsigned int present;
8028 present = snd_hda_codec_read(codec, 0x14, 0,
8029 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8030 bits = present ? HDA_AMP_MUTE : 0;
8031 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8032 HDA_AMP_MUTE, bits);
8033 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8037 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8039 if ((res >> 26) == ALC880_HP_EVENT)
8040 alc883_tagra_automute(codec);
8043 /* toggle speaker-output according to the hp-jack state */
8044 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8046 unsigned int present;
8049 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8050 & AC_PINSENSE_PRESENCE;
8051 bits = present ? HDA_AMP_MUTE : 0;
8052 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8053 HDA_AMP_MUTE, bits);
8056 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8058 unsigned int present;
8060 present = snd_hda_codec_read(codec, 0x18, 0,
8061 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8062 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8063 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8066 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8068 alc883_clevo_m720_hp_automute(codec);
8069 alc883_clevo_m720_mic_automute(codec);
8072 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8075 switch (res >> 26) {
8076 case ALC880_HP_EVENT:
8077 alc883_clevo_m720_hp_automute(codec);
8079 case ALC880_MIC_EVENT:
8080 alc883_clevo_m720_mic_automute(codec);
8085 /* toggle speaker-output according to the hp-jack state */
8086 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8088 unsigned int present;
8091 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8092 & AC_PINSENSE_PRESENCE;
8093 bits = present ? HDA_AMP_MUTE : 0;
8094 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8095 HDA_AMP_MUTE, bits);
8098 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8101 if ((res >> 26) == ALC880_HP_EVENT)
8102 alc883_2ch_fujitsu_pi2515_automute(codec);
8105 static void alc883_haier_w66_automute(struct hda_codec *codec)
8107 unsigned int present;
8110 present = snd_hda_codec_read(codec, 0x1b, 0,
8111 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8112 bits = present ? 0x80 : 0;
8113 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8117 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8120 if ((res >> 26) == ALC880_HP_EVENT)
8121 alc883_haier_w66_automute(codec);
8124 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8126 unsigned int present;
8129 present = snd_hda_codec_read(codec, 0x14, 0,
8130 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8131 bits = present ? HDA_AMP_MUTE : 0;
8132 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8133 HDA_AMP_MUTE, bits);
8136 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8138 unsigned int present;
8141 present = snd_hda_codec_read(codec, 0x1b, 0,
8142 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8143 bits = present ? HDA_AMP_MUTE : 0;
8144 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8145 HDA_AMP_MUTE, bits);
8146 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8147 HDA_AMP_MUTE, bits);
8150 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8153 if ((res >> 26) == ALC880_HP_EVENT)
8154 alc883_lenovo_101e_all_automute(codec);
8155 if ((res >> 26) == ALC880_FRONT_EVENT)
8156 alc883_lenovo_101e_ispeaker_automute(codec);
8159 /* toggle speaker-output according to the hp-jack state */
8160 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8162 unsigned int present;
8164 present = snd_hda_codec_read(codec, 0x14, 0,
8165 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8166 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8167 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8168 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8169 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8172 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8175 if ((res >> 26) == ALC880_HP_EVENT)
8176 alc883_acer_aspire_automute(codec);
8179 static struct hda_verb alc883_acer_eapd_verbs[] = {
8180 /* HP Pin: output 0 (0x0c) */
8181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8182 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8183 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8184 /* Front Pin: output 0 (0x0c) */
8185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8186 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8187 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8188 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8189 /* eanable EAPD on medion laptop */
8190 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8191 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8192 /* enable unsolicited event */
8193 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8197 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8199 unsigned int present;
8201 present = snd_hda_codec_read(codec, 0x1b, 0,
8202 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8203 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8204 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8205 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8206 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8207 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8208 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8209 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8210 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8213 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8216 switch (res >> 26) {
8217 case ALC880_HP_EVENT:
8218 printk("hp_event\n");
8219 alc888_6st_dell_front_automute(codec);
8224 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8227 unsigned int present;
8229 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8230 present = snd_hda_codec_read(codec, 0x1b, 0,
8231 AC_VERB_GET_PIN_SENSE, 0);
8232 present = (present & 0x80000000) != 0;
8234 /* mute internal speaker */
8235 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8236 HDA_AMP_MUTE, HDA_AMP_MUTE);
8237 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8238 HDA_AMP_MUTE, HDA_AMP_MUTE);
8239 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8240 HDA_AMP_MUTE, HDA_AMP_MUTE);
8241 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8242 HDA_AMP_MUTE, HDA_AMP_MUTE);
8243 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8244 HDA_AMP_MUTE, HDA_AMP_MUTE);
8246 /* unmute internal speaker if necessary */
8247 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8248 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8249 HDA_AMP_MUTE, mute);
8250 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8251 HDA_AMP_MUTE, mute);
8252 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8253 HDA_AMP_MUTE, mute);
8254 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8255 HDA_AMP_MUTE, mute);
8256 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8257 HDA_AMP_MUTE, mute);
8261 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8264 if ((res >> 26) == ALC880_HP_EVENT)
8265 alc888_lenovo_sky_front_automute(codec);
8269 * generic initialization of ADC, input mixers and output mixers
8271 static struct hda_verb alc883_auto_init_verbs[] = {
8273 * Unmute ADC0-2 and set the default input to mic-in
8275 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8276 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8277 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8278 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8280 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8282 * Note: PASD motherboards uses the Line In 2 as the input for
8283 * front panel mic (mic 2)
8285 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8293 * Set up output mixers (0x0c - 0x0f)
8295 /* set vol=0 to output mixers */
8296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8299 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8300 /* set up input amps for analog loopback */
8301 /* Amp Indices: DAC = 0, mixer = 1 */
8302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8304 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8306 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8308 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8309 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8310 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8311 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8313 /* FIXME: use matrix-type input source selection */
8314 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8319 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8320 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8325 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8326 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8331 static struct hda_verb alc888_asus_m90v_verbs[] = {
8332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8335 /* enable unsolicited event */
8336 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8337 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8341 static void alc883_nb_mic_automute(struct hda_codec *codec)
8343 unsigned int present;
8345 present = snd_hda_codec_read(codec, 0x18, 0,
8346 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8347 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8348 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8349 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8350 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8353 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8355 unsigned int present;
8358 present = snd_hda_codec_read(codec, 0x1b, 0,
8359 AC_VERB_GET_PIN_SENSE, 0)
8360 & AC_PINSENSE_PRESENCE;
8361 bits = present ? 0 : PIN_OUT;
8362 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8364 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8366 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8370 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8373 switch (res >> 26) {
8374 case ALC880_HP_EVENT:
8375 alc883_M90V_speaker_automute(codec);
8377 case ALC880_MIC_EVENT:
8378 alc883_nb_mic_automute(codec);
8383 static void alc883_mode2_inithook(struct hda_codec *codec)
8385 alc883_M90V_speaker_automute(codec);
8386 alc883_nb_mic_automute(codec);
8389 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8391 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8392 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8395 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8396 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8397 /* enable unsolicited event */
8398 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8402 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8404 unsigned int present;
8407 present = snd_hda_codec_read(codec, 0x14, 0,
8408 AC_VERB_GET_PIN_SENSE, 0)
8409 & AC_PINSENSE_PRESENCE;
8410 bits = present ? 0 : PIN_OUT;
8411 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8415 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8418 switch (res >> 26) {
8419 case ALC880_HP_EVENT:
8420 alc883_eee1601_speaker_automute(codec);
8425 static void alc883_eee1601_inithook(struct hda_codec *codec)
8427 alc883_eee1601_speaker_automute(codec);
8430 #ifdef CONFIG_SND_HDA_POWER_SAVE
8431 #define alc883_loopbacks alc880_loopbacks
8434 /* pcm configuration: identiacal with ALC880 */
8435 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8436 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8437 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8438 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8439 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8442 * configuration and preset
8444 static const char *alc883_models[ALC883_MODEL_LAST] = {
8445 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8446 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8447 [ALC883_3ST_6ch] = "3stack-6ch",
8448 [ALC883_6ST_DIG] = "6stack-dig",
8449 [ALC883_TARGA_DIG] = "targa-dig",
8450 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8451 [ALC883_ACER] = "acer",
8452 [ALC883_ACER_ASPIRE] = "acer-aspire",
8453 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8454 [ALC883_MEDION] = "medion",
8455 [ALC883_MEDION_MD2] = "medion-md2",
8456 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8457 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8458 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8459 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8460 [ALC888_LENOVO_SKY] = "lenovo-sky",
8461 [ALC883_HAIER_W66] = "haier-w66",
8462 [ALC888_3ST_HP] = "3stack-hp",
8463 [ALC888_6ST_DELL] = "6stack-dell",
8464 [ALC883_MITAC] = "mitac",
8465 [ALC883_CLEVO_M720] = "clevo-m720",
8466 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8467 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8468 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8469 [ALC1200_ASUS_P5Q] = "asus-p5q",
8470 [ALC883_AUTO] = "auto",
8473 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8474 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8475 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8476 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8477 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8478 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8479 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8480 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8481 ALC888_ACER_ASPIRE_4930G),
8482 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8483 ALC888_ACER_ASPIRE_4930G),
8484 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8485 ALC888_ACER_ASPIRE_4930G),
8486 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8487 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8488 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8489 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8490 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8491 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8492 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8493 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8494 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8495 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8496 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8497 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8498 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8499 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8500 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8501 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8502 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8503 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8504 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8505 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8506 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8507 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8508 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8509 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8510 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8511 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8512 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8513 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8514 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8515 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8516 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8517 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8518 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8519 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8520 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8521 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8522 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8523 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8524 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8525 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8526 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8527 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8528 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8529 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8530 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8531 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8532 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8533 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8534 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8535 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8536 ALC888_FUJITSU_XA3530),
8537 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8538 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8539 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8540 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8541 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8542 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8543 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8544 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8545 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8546 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8547 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8548 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8549 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8550 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8554 static struct alc_config_preset alc883_presets[] = {
8555 [ALC883_3ST_2ch_DIG] = {
8556 .mixers = { alc883_3ST_2ch_mixer },
8557 .init_verbs = { alc883_init_verbs },
8558 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8559 .dac_nids = alc883_dac_nids,
8560 .dig_out_nid = ALC883_DIGOUT_NID,
8561 .dig_in_nid = ALC883_DIGIN_NID,
8562 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8563 .channel_mode = alc883_3ST_2ch_modes,
8564 .input_mux = &alc883_capture_source,
8566 [ALC883_3ST_6ch_DIG] = {
8567 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8568 .init_verbs = { alc883_init_verbs },
8569 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8570 .dac_nids = alc883_dac_nids,
8571 .dig_out_nid = ALC883_DIGOUT_NID,
8572 .dig_in_nid = ALC883_DIGIN_NID,
8573 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8574 .channel_mode = alc883_3ST_6ch_modes,
8576 .input_mux = &alc883_capture_source,
8578 [ALC883_3ST_6ch] = {
8579 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8580 .init_verbs = { alc883_init_verbs },
8581 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8582 .dac_nids = alc883_dac_nids,
8583 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8584 .channel_mode = alc883_3ST_6ch_modes,
8586 .input_mux = &alc883_capture_source,
8588 [ALC883_3ST_6ch_INTEL] = {
8589 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8590 .init_verbs = { alc883_init_verbs },
8591 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8592 .dac_nids = alc883_dac_nids,
8593 .dig_out_nid = ALC883_DIGOUT_NID,
8594 .dig_in_nid = ALC883_DIGIN_NID,
8595 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8596 .channel_mode = alc883_3ST_6ch_intel_modes,
8598 .input_mux = &alc883_3stack_6ch_intel,
8600 [ALC883_6ST_DIG] = {
8601 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8602 .init_verbs = { alc883_init_verbs },
8603 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8604 .dac_nids = alc883_dac_nids,
8605 .dig_out_nid = ALC883_DIGOUT_NID,
8606 .dig_in_nid = ALC883_DIGIN_NID,
8607 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8608 .channel_mode = alc883_sixstack_modes,
8609 .input_mux = &alc883_capture_source,
8611 [ALC883_TARGA_DIG] = {
8612 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8613 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8614 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8615 .dac_nids = alc883_dac_nids,
8616 .dig_out_nid = ALC883_DIGOUT_NID,
8617 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8618 .channel_mode = alc883_3ST_6ch_modes,
8620 .input_mux = &alc883_capture_source,
8621 .unsol_event = alc883_tagra_unsol_event,
8622 .init_hook = alc883_tagra_automute,
8624 [ALC883_TARGA_2ch_DIG] = {
8625 .mixers = { alc883_tagra_2ch_mixer},
8626 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8628 .dac_nids = alc883_dac_nids,
8629 .adc_nids = alc883_adc_nids_alt,
8630 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8631 .dig_out_nid = ALC883_DIGOUT_NID,
8632 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8633 .channel_mode = alc883_3ST_2ch_modes,
8634 .input_mux = &alc883_capture_source,
8635 .unsol_event = alc883_tagra_unsol_event,
8636 .init_hook = alc883_tagra_automute,
8639 .mixers = { alc883_base_mixer },
8640 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8641 * and the headphone jack. Turn this on and rely on the
8642 * standard mute methods whenever the user wants to turn
8643 * these outputs off.
8645 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8646 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8647 .dac_nids = alc883_dac_nids,
8648 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8649 .channel_mode = alc883_3ST_2ch_modes,
8650 .input_mux = &alc883_capture_source,
8652 [ALC883_ACER_ASPIRE] = {
8653 .mixers = { alc883_acer_aspire_mixer },
8654 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8655 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8656 .dac_nids = alc883_dac_nids,
8657 .dig_out_nid = ALC883_DIGOUT_NID,
8658 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8659 .channel_mode = alc883_3ST_2ch_modes,
8660 .input_mux = &alc883_capture_source,
8661 .unsol_event = alc883_acer_aspire_unsol_event,
8662 .init_hook = alc883_acer_aspire_automute,
8664 [ALC888_ACER_ASPIRE_4930G] = {
8665 .mixers = { alc888_base_mixer,
8666 alc883_chmode_mixer },
8667 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8668 alc888_acer_aspire_4930g_verbs },
8669 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8670 .dac_nids = alc883_dac_nids,
8671 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8672 .adc_nids = alc883_adc_nids_rev,
8673 .capsrc_nids = alc883_capsrc_nids_rev,
8674 .dig_out_nid = ALC883_DIGOUT_NID,
8675 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8676 .channel_mode = alc883_3ST_6ch_modes,
8679 ARRAY_SIZE(alc888_2_capture_sources),
8680 .input_mux = alc888_2_capture_sources,
8681 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8682 .init_hook = alc888_acer_aspire_4930g_automute,
8685 .mixers = { alc883_fivestack_mixer,
8686 alc883_chmode_mixer },
8687 .init_verbs = { alc883_init_verbs,
8688 alc883_medion_eapd_verbs },
8689 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8690 .dac_nids = alc883_dac_nids,
8691 .adc_nids = alc883_adc_nids_alt,
8692 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8693 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8694 .channel_mode = alc883_sixstack_modes,
8695 .input_mux = &alc883_capture_source,
8697 [ALC883_MEDION_MD2] = {
8698 .mixers = { alc883_medion_md2_mixer},
8699 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8700 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8701 .dac_nids = alc883_dac_nids,
8702 .dig_out_nid = ALC883_DIGOUT_NID,
8703 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8704 .channel_mode = alc883_3ST_2ch_modes,
8705 .input_mux = &alc883_capture_source,
8706 .unsol_event = alc883_medion_md2_unsol_event,
8707 .init_hook = alc883_medion_md2_automute,
8709 [ALC883_LAPTOP_EAPD] = {
8710 .mixers = { alc883_base_mixer },
8711 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8712 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8713 .dac_nids = alc883_dac_nids,
8714 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8715 .channel_mode = alc883_3ST_2ch_modes,
8716 .input_mux = &alc883_capture_source,
8718 [ALC883_CLEVO_M720] = {
8719 .mixers = { alc883_clevo_m720_mixer },
8720 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8721 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8722 .dac_nids = alc883_dac_nids,
8723 .dig_out_nid = ALC883_DIGOUT_NID,
8724 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8725 .channel_mode = alc883_3ST_2ch_modes,
8726 .input_mux = &alc883_capture_source,
8727 .unsol_event = alc883_clevo_m720_unsol_event,
8728 .init_hook = alc883_clevo_m720_automute,
8730 [ALC883_LENOVO_101E_2ch] = {
8731 .mixers = { alc883_lenovo_101e_2ch_mixer},
8732 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8733 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8734 .dac_nids = alc883_dac_nids,
8735 .adc_nids = alc883_adc_nids_alt,
8736 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8737 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8738 .channel_mode = alc883_3ST_2ch_modes,
8739 .input_mux = &alc883_lenovo_101e_capture_source,
8740 .unsol_event = alc883_lenovo_101e_unsol_event,
8741 .init_hook = alc883_lenovo_101e_all_automute,
8743 [ALC883_LENOVO_NB0763] = {
8744 .mixers = { alc883_lenovo_nb0763_mixer },
8745 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8746 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8747 .dac_nids = alc883_dac_nids,
8748 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8749 .channel_mode = alc883_3ST_2ch_modes,
8751 .input_mux = &alc883_lenovo_nb0763_capture_source,
8752 .unsol_event = alc883_medion_md2_unsol_event,
8753 .init_hook = alc883_medion_md2_automute,
8755 [ALC888_LENOVO_MS7195_DIG] = {
8756 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8757 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8759 .dac_nids = alc883_dac_nids,
8760 .dig_out_nid = ALC883_DIGOUT_NID,
8761 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8762 .channel_mode = alc883_3ST_6ch_modes,
8764 .input_mux = &alc883_capture_source,
8765 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8766 .init_hook = alc888_lenovo_ms7195_front_automute,
8768 [ALC883_HAIER_W66] = {
8769 .mixers = { alc883_tagra_2ch_mixer},
8770 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8771 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8772 .dac_nids = alc883_dac_nids,
8773 .dig_out_nid = ALC883_DIGOUT_NID,
8774 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8775 .channel_mode = alc883_3ST_2ch_modes,
8776 .input_mux = &alc883_capture_source,
8777 .unsol_event = alc883_haier_w66_unsol_event,
8778 .init_hook = alc883_haier_w66_automute,
8781 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8782 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8783 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8784 .dac_nids = alc883_dac_nids,
8785 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8786 .channel_mode = alc888_3st_hp_modes,
8788 .input_mux = &alc883_capture_source,
8790 [ALC888_6ST_DELL] = {
8791 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8792 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8793 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8794 .dac_nids = alc883_dac_nids,
8795 .dig_out_nid = ALC883_DIGOUT_NID,
8796 .dig_in_nid = ALC883_DIGIN_NID,
8797 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8798 .channel_mode = alc883_sixstack_modes,
8799 .input_mux = &alc883_capture_source,
8800 .unsol_event = alc888_6st_dell_unsol_event,
8801 .init_hook = alc888_6st_dell_front_automute,
8804 .mixers = { alc883_mitac_mixer },
8805 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8807 .dac_nids = alc883_dac_nids,
8808 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8809 .channel_mode = alc883_3ST_2ch_modes,
8810 .input_mux = &alc883_capture_source,
8811 .unsol_event = alc883_mitac_unsol_event,
8812 .init_hook = alc883_mitac_automute,
8814 [ALC883_FUJITSU_PI2515] = {
8815 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8816 .init_verbs = { alc883_init_verbs,
8817 alc883_2ch_fujitsu_pi2515_verbs},
8818 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8819 .dac_nids = alc883_dac_nids,
8820 .dig_out_nid = ALC883_DIGOUT_NID,
8821 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8822 .channel_mode = alc883_3ST_2ch_modes,
8823 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8824 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8825 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8827 [ALC888_FUJITSU_XA3530] = {
8828 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8829 .init_verbs = { alc883_init_verbs,
8830 alc888_fujitsu_xa3530_verbs },
8831 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8832 .dac_nids = alc883_dac_nids,
8833 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8834 .adc_nids = alc883_adc_nids_rev,
8835 .capsrc_nids = alc883_capsrc_nids_rev,
8836 .dig_out_nid = ALC883_DIGOUT_NID,
8837 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8838 .channel_mode = alc888_4ST_8ch_intel_modes,
8840 ARRAY_SIZE(alc888_2_capture_sources),
8841 .input_mux = alc888_2_capture_sources,
8842 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8843 .init_hook = alc888_fujitsu_xa3530_automute,
8845 [ALC888_LENOVO_SKY] = {
8846 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8847 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8848 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8849 .dac_nids = alc883_dac_nids,
8850 .dig_out_nid = ALC883_DIGOUT_NID,
8851 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8852 .channel_mode = alc883_sixstack_modes,
8854 .input_mux = &alc883_lenovo_sky_capture_source,
8855 .unsol_event = alc883_lenovo_sky_unsol_event,
8856 .init_hook = alc888_lenovo_sky_front_automute,
8858 [ALC888_ASUS_M90V] = {
8859 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8860 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8861 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8862 .dac_nids = alc883_dac_nids,
8863 .dig_out_nid = ALC883_DIGOUT_NID,
8864 .dig_in_nid = ALC883_DIGIN_NID,
8865 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8866 .channel_mode = alc883_3ST_6ch_modes,
8868 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8869 .unsol_event = alc883_mode2_unsol_event,
8870 .init_hook = alc883_mode2_inithook,
8872 [ALC888_ASUS_EEE1601] = {
8873 .mixers = { alc883_asus_eee1601_mixer },
8874 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8875 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8876 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8877 .dac_nids = alc883_dac_nids,
8878 .dig_out_nid = ALC883_DIGOUT_NID,
8879 .dig_in_nid = ALC883_DIGIN_NID,
8880 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8881 .channel_mode = alc883_3ST_2ch_modes,
8883 .input_mux = &alc883_asus_eee1601_capture_source,
8884 .unsol_event = alc883_eee1601_unsol_event,
8885 .init_hook = alc883_eee1601_inithook,
8887 [ALC1200_ASUS_P5Q] = {
8888 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8889 .init_verbs = { alc883_init_verbs },
8890 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8891 .dac_nids = alc883_dac_nids,
8892 .dig_out_nid = ALC1200_DIGOUT_NID,
8893 .dig_in_nid = ALC883_DIGIN_NID,
8894 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8895 .channel_mode = alc883_sixstack_modes,
8896 .input_mux = &alc883_capture_source,
8902 * BIOS auto configuration
8904 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8905 hda_nid_t nid, int pin_type,
8909 struct alc_spec *spec = codec->spec;
8912 alc_set_pin_output(codec, nid, pin_type);
8913 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8916 idx = spec->multiout.dac_nids[dac_idx] - 2;
8917 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8921 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8923 struct alc_spec *spec = codec->spec;
8926 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8927 for (i = 0; i <= HDA_SIDE; i++) {
8928 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8929 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8931 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8936 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8938 struct alc_spec *spec = codec->spec;
8941 pin = spec->autocfg.hp_pins[0];
8942 if (pin) /* connect to front */
8944 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8945 pin = spec->autocfg.speaker_pins[0];
8947 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8950 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8951 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8953 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8955 struct alc_spec *spec = codec->spec;
8958 for (i = 0; i < AUTO_PIN_LAST; i++) {
8959 hda_nid_t nid = spec->autocfg.input_pins[i];
8960 if (alc883_is_input_pin(nid)) {
8961 snd_hda_codec_write(codec, nid, 0,
8962 AC_VERB_SET_PIN_WIDGET_CONTROL,
8963 (i <= AUTO_PIN_FRONT_MIC ?
8964 PIN_VREF80 : PIN_IN));
8965 if (nid != ALC883_PIN_CD_NID)
8966 snd_hda_codec_write(codec, nid, 0,
8967 AC_VERB_SET_AMP_GAIN_MUTE,
8973 #define alc883_auto_init_input_src alc882_auto_init_input_src
8975 /* almost identical with ALC880 parser... */
8976 static int alc883_parse_auto_config(struct hda_codec *codec)
8978 struct alc_spec *spec = codec->spec;
8979 int err = alc880_parse_auto_config(codec);
8984 return 0; /* no config found */
8986 err = alc_auto_add_mic_boost(codec);
8990 /* hack - override the init verbs */
8991 spec->init_verbs[0] = alc883_auto_init_verbs;
8993 return 1; /* config found */
8996 /* additional initialization for auto-configuration model */
8997 static void alc883_auto_init(struct hda_codec *codec)
8999 struct alc_spec *spec = codec->spec;
9000 alc883_auto_init_multi_out(codec);
9001 alc883_auto_init_hp_out(codec);
9002 alc883_auto_init_analog_input(codec);
9003 alc883_auto_init_input_src(codec);
9004 if (spec->unsol_event)
9005 alc_inithook(codec);
9008 static int patch_alc883(struct hda_codec *codec)
9010 struct alc_spec *spec;
9011 int err, board_config;
9013 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9019 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9021 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9024 if (board_config < 0) {
9025 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9026 "trying auto-probe from BIOS...\n");
9027 board_config = ALC883_AUTO;
9030 if (board_config == ALC883_AUTO) {
9031 /* automatic parse from the BIOS config */
9032 err = alc883_parse_auto_config(codec);
9038 "hda_codec: Cannot set up configuration "
9039 "from BIOS. Using base mode...\n");
9040 board_config = ALC883_3ST_2ch_DIG;
9044 if (board_config != ALC883_AUTO)
9045 setup_preset(spec, &alc883_presets[board_config]);
9047 switch (codec->vendor_id) {
9049 if (codec->revision_id == 0x100101) {
9050 spec->stream_name_analog = "ALC1200 Analog";
9051 spec->stream_name_digital = "ALC1200 Digital";
9053 spec->stream_name_analog = "ALC888 Analog";
9054 spec->stream_name_digital = "ALC888 Digital";
9058 spec->stream_name_analog = "ALC889 Analog";
9059 spec->stream_name_digital = "ALC889 Digital";
9062 spec->stream_name_analog = "ALC883 Analog";
9063 spec->stream_name_digital = "ALC883 Digital";
9067 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9068 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9069 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9071 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9072 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9074 if (!spec->num_adc_nids) {
9075 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9076 spec->adc_nids = alc883_adc_nids;
9078 if (!spec->capsrc_nids)
9079 spec->capsrc_nids = alc883_capsrc_nids;
9080 spec->is_mix_capture = 1; /* matrix-style capture */
9081 if (!spec->cap_mixer)
9082 set_capture_mixer(spec);
9084 spec->vmaster_nid = 0x0c;
9086 codec->patch_ops = alc_patch_ops;
9087 if (board_config == ALC883_AUTO)
9088 spec->init_hook = alc883_auto_init;
9090 #ifdef CONFIG_SND_HDA_POWER_SAVE
9091 if (!spec->loopback.amplist)
9092 spec->loopback.amplist = alc883_loopbacks;
9094 codec->proc_widget_hook = print_realtek_coef;
9103 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9104 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9106 #define alc262_dac_nids alc260_dac_nids
9107 #define alc262_adc_nids alc882_adc_nids
9108 #define alc262_adc_nids_alt alc882_adc_nids_alt
9109 #define alc262_capsrc_nids alc882_capsrc_nids
9110 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9112 #define alc262_modes alc260_modes
9113 #define alc262_capture_source alc882_capture_source
9115 static hda_nid_t alc262_dmic_adc_nids[1] = {
9120 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9122 static struct snd_kcontrol_new alc262_base_mixer[] = {
9123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9124 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9132 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9133 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9134 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9135 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9136 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9137 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9139 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9140 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9144 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9145 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9146 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9147 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9148 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9149 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9150 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9153 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9154 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9155 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9156 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9157 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9158 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9159 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9164 /* update HP, line and mono-out pins according to the master switch */
9165 static void alc262_hp_master_update(struct hda_codec *codec)
9167 struct alc_spec *spec = codec->spec;
9168 int val = spec->master_sw;
9171 snd_hda_codec_write_cache(codec, 0x1b, 0,
9172 AC_VERB_SET_PIN_WIDGET_CONTROL,
9174 snd_hda_codec_write_cache(codec, 0x15, 0,
9175 AC_VERB_SET_PIN_WIDGET_CONTROL,
9177 /* mono (speaker) depending on the HP jack sense */
9178 val = val && !spec->jack_present;
9179 snd_hda_codec_write_cache(codec, 0x16, 0,
9180 AC_VERB_SET_PIN_WIDGET_CONTROL,
9184 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9186 struct alc_spec *spec = codec->spec;
9187 unsigned int presence;
9188 presence = snd_hda_codec_read(codec, 0x1b, 0,
9189 AC_VERB_GET_PIN_SENSE, 0);
9190 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9191 alc262_hp_master_update(codec);
9194 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9196 if ((res >> 26) != ALC880_HP_EVENT)
9198 alc262_hp_bpc_automute(codec);
9201 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9203 struct alc_spec *spec = codec->spec;
9204 unsigned int presence;
9205 presence = snd_hda_codec_read(codec, 0x15, 0,
9206 AC_VERB_GET_PIN_SENSE, 0);
9207 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9208 alc262_hp_master_update(codec);
9211 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9214 if ((res >> 26) != ALC880_HP_EVENT)
9216 alc262_hp_wildwest_automute(codec);
9219 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9220 struct snd_ctl_elem_value *ucontrol)
9222 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9223 struct alc_spec *spec = codec->spec;
9224 *ucontrol->value.integer.value = spec->master_sw;
9228 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9229 struct snd_ctl_elem_value *ucontrol)
9231 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9232 struct alc_spec *spec = codec->spec;
9233 int val = !!*ucontrol->value.integer.value;
9235 if (val == spec->master_sw)
9237 spec->master_sw = val;
9238 alc262_hp_master_update(codec);
9242 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9244 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9245 .name = "Master Playback Switch",
9246 .info = snd_ctl_boolean_mono_info,
9247 .get = alc262_hp_master_sw_get,
9248 .put = alc262_hp_master_sw_put,
9250 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9251 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9253 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9255 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9257 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9258 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9259 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9260 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9261 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9262 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9264 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9265 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9266 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9267 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9268 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9269 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9270 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9274 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9277 .name = "Master Playback Switch",
9278 .info = snd_ctl_boolean_mono_info,
9279 .get = alc262_hp_master_sw_get,
9280 .put = alc262_hp_master_sw_put,
9282 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9283 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9284 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9286 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9288 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9290 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9291 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9292 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9293 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9294 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9296 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9297 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9298 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9302 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9303 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9304 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9305 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9309 /* mute/unmute internal speaker according to the hp jack and mute state */
9310 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9312 struct alc_spec *spec = codec->spec;
9314 if (force || !spec->sense_updated) {
9315 unsigned int present;
9316 present = snd_hda_codec_read(codec, 0x15, 0,
9317 AC_VERB_GET_PIN_SENSE, 0);
9318 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9319 spec->sense_updated = 1;
9321 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9322 spec->jack_present ? HDA_AMP_MUTE : 0);
9325 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9328 if ((res >> 26) != ALC880_HP_EVENT)
9330 alc262_hp_t5735_automute(codec, 1);
9333 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9335 alc262_hp_t5735_automute(codec, 1);
9338 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9339 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9340 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9341 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9343 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9344 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9345 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9349 static struct hda_verb alc262_hp_t5735_verbs[] = {
9350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9353 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9357 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9358 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9359 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9360 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9361 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9362 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9363 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9367 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9368 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9369 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9370 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9371 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9372 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9373 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9377 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9381 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9388 /* bind hp and internal speaker mute (with plug check) */
9389 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9390 struct snd_ctl_elem_value *ucontrol)
9392 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9393 long *valp = ucontrol->value.integer.value;
9396 /* change hp mute */
9397 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9399 valp[0] ? 0 : HDA_AMP_MUTE);
9400 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9402 valp[1] ? 0 : HDA_AMP_MUTE);
9404 /* change speaker according to HP jack state */
9405 struct alc_spec *spec = codec->spec;
9407 if (spec->jack_present)
9408 mute = HDA_AMP_MUTE;
9410 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9412 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9413 HDA_AMP_MUTE, mute);
9418 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9419 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9422 .name = "Master Playback Switch",
9423 .info = snd_hda_mixer_amp_switch_info,
9424 .get = snd_hda_mixer_amp_switch_get,
9425 .put = alc262_sony_master_sw_put,
9426 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9430 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9431 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9435 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9436 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9437 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9438 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9441 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9442 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9446 #define alc262_capture_mixer alc882_capture_mixer
9447 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9450 * generic initialization of ADC, input mixers and output mixers
9452 static struct hda_verb alc262_init_verbs[] = {
9454 * Unmute ADC0-2 and set the default input to mic-in
9456 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9458 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9459 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9460 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9461 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9463 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9465 * Note: PASD motherboards uses the Line In 2 as the input for
9466 * front panel mic (mic 2)
9468 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9469 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9470 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9471 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9472 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9473 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9476 * Set up output mixers (0x0c - 0x0e)
9478 /* set vol=0 to output mixers */
9479 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9482 /* set up input amps for analog loopback */
9483 /* Amp Indices: DAC = 0, mixer = 1 */
9484 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9486 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9487 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9488 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9489 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9491 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9493 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9494 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9495 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9496 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9499 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9500 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9504 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9505 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9507 /* FIXME: use matrix-type input source selection */
9508 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9509 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9510 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9511 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9512 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9513 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9515 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9517 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9518 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9520 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9521 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9522 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9528 static struct hda_verb alc262_eapd_verbs[] = {
9529 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9530 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9534 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9535 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9536 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9540 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9541 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9542 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9543 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9545 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9550 static struct hda_verb alc262_sony_unsol_verbs[] = {
9551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9552 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9555 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9560 static struct hda_input_mux alc262_dmic_capture_source = {
9563 { "Int DMic", 0x9 },
9568 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9569 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9570 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9571 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9577 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9578 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9581 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9582 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9583 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9584 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9585 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9589 static void alc262_dmic_automute(struct hda_codec *codec)
9591 unsigned int present;
9593 present = snd_hda_codec_read(codec, 0x18, 0,
9594 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9595 snd_hda_codec_write(codec, 0x22, 0,
9596 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9599 /* toggle speaker-output according to the hp-jack state */
9600 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9602 unsigned int present;
9605 present = snd_hda_codec_read(codec, 0x15, 0,
9606 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9607 bits = present ? 0 : PIN_OUT;
9608 snd_hda_codec_write(codec, 0x14, 0,
9609 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9614 /* unsolicited event for HP jack sensing */
9615 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9618 if ((res >> 26) == ALC880_HP_EVENT)
9619 alc262_toshiba_s06_speaker_automute(codec);
9620 if ((res >> 26) == ALC880_MIC_EVENT)
9621 alc262_dmic_automute(codec);
9625 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9627 alc262_toshiba_s06_speaker_automute(codec);
9628 alc262_dmic_automute(codec);
9631 /* mute/unmute internal speaker according to the hp jack and mute state */
9632 static void alc262_hippo_automute(struct hda_codec *codec)
9634 struct alc_spec *spec = codec->spec;
9636 unsigned int present;
9638 /* need to execute and sync at first */
9639 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9640 present = snd_hda_codec_read(codec, 0x15, 0,
9641 AC_VERB_GET_PIN_SENSE, 0);
9642 spec->jack_present = (present & 0x80000000) != 0;
9643 if (spec->jack_present) {
9644 /* mute internal speaker */
9645 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9646 HDA_AMP_MUTE, HDA_AMP_MUTE);
9648 /* unmute internal speaker if necessary */
9649 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9650 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9651 HDA_AMP_MUTE, mute);
9655 /* unsolicited event for HP jack sensing */
9656 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9659 if ((res >> 26) != ALC880_HP_EVENT)
9661 alc262_hippo_automute(codec);
9664 static void alc262_hippo1_automute(struct hda_codec *codec)
9667 unsigned int present;
9669 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9670 present = snd_hda_codec_read(codec, 0x1b, 0,
9671 AC_VERB_GET_PIN_SENSE, 0);
9672 present = (present & 0x80000000) != 0;
9674 /* mute internal speaker */
9675 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9676 HDA_AMP_MUTE, HDA_AMP_MUTE);
9678 /* unmute internal speaker if necessary */
9679 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9680 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9681 HDA_AMP_MUTE, mute);
9685 /* unsolicited event for HP jack sensing */
9686 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9689 if ((res >> 26) != ALC880_HP_EVENT)
9691 alc262_hippo1_automute(codec);
9697 * 0x16 = internal speaker
9698 * 0x18 = external mic
9701 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9702 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9703 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9705 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9706 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9707 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9709 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9710 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9714 static struct hda_verb alc262_nec_verbs[] = {
9715 /* Unmute Speaker */
9716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9719 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9720 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9722 /* External mic to headphone */
9723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9724 /* External mic to speaker */
9725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9731 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9732 * 0x1b = port replicator headphone out
9735 #define ALC_HP_EVENT 0x37
9737 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9738 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9739 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9740 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9741 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9745 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9746 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9747 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9751 static struct hda_input_mux alc262_fujitsu_capture_source = {
9760 static struct hda_input_mux alc262_HP_capture_source = {
9764 { "Front Mic", 0x1 },
9771 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9775 { "Front Mic", 0x2 },
9781 /* mute/unmute internal speaker according to the hp jacks and mute state */
9782 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9784 struct alc_spec *spec = codec->spec;
9787 if (force || !spec->sense_updated) {
9788 unsigned int present;
9789 /* need to execute and sync at first */
9790 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9791 /* check laptop HP jack */
9792 present = snd_hda_codec_read(codec, 0x14, 0,
9793 AC_VERB_GET_PIN_SENSE, 0);
9794 /* need to execute and sync at first */
9795 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9796 /* check docking HP jack */
9797 present |= snd_hda_codec_read(codec, 0x1b, 0,
9798 AC_VERB_GET_PIN_SENSE, 0);
9799 if (present & AC_PINSENSE_PRESENCE)
9800 spec->jack_present = 1;
9802 spec->jack_present = 0;
9803 spec->sense_updated = 1;
9805 /* unmute internal speaker only if both HPs are unplugged and
9806 * master switch is on
9808 if (spec->jack_present)
9809 mute = HDA_AMP_MUTE;
9811 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9812 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9813 HDA_AMP_MUTE, mute);
9816 /* unsolicited event for HP jack sensing */
9817 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9820 if ((res >> 26) != ALC_HP_EVENT)
9822 alc262_fujitsu_automute(codec, 1);
9825 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9827 alc262_fujitsu_automute(codec, 1);
9830 /* bind volumes of both NID 0x0c and 0x0d */
9831 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9832 .ops = &snd_hda_bind_vol,
9834 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9835 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9840 /* mute/unmute internal speaker according to the hp jack and mute state */
9841 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9843 struct alc_spec *spec = codec->spec;
9846 if (force || !spec->sense_updated) {
9847 unsigned int present_int_hp;
9848 /* need to execute and sync at first */
9849 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9850 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9851 AC_VERB_GET_PIN_SENSE, 0);
9852 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9853 spec->sense_updated = 1;
9855 if (spec->jack_present) {
9856 /* mute internal speaker */
9857 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9858 HDA_AMP_MUTE, HDA_AMP_MUTE);
9859 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9860 HDA_AMP_MUTE, HDA_AMP_MUTE);
9862 /* unmute internal speaker if necessary */
9863 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9864 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9865 HDA_AMP_MUTE, mute);
9866 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9867 HDA_AMP_MUTE, mute);
9871 /* unsolicited event for HP jack sensing */
9872 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9875 if ((res >> 26) != ALC_HP_EVENT)
9877 alc262_lenovo_3000_automute(codec, 1);
9880 /* bind hp and internal speaker mute (with plug check) */
9881 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9882 struct snd_ctl_elem_value *ucontrol)
9884 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9885 long *valp = ucontrol->value.integer.value;
9888 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9890 valp ? 0 : HDA_AMP_MUTE);
9891 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9893 valp ? 0 : HDA_AMP_MUTE);
9896 alc262_fujitsu_automute(codec, 0);
9900 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9901 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9903 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9904 .name = "Master Playback Switch",
9905 .info = snd_hda_mixer_amp_switch_info,
9906 .get = snd_hda_mixer_amp_switch_get,
9907 .put = alc262_fujitsu_master_sw_put,
9908 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9910 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9911 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9912 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9913 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9914 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9915 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9916 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9917 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9918 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9919 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9923 /* bind hp and internal speaker mute (with plug check) */
9924 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9925 struct snd_ctl_elem_value *ucontrol)
9927 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9928 long *valp = ucontrol->value.integer.value;
9931 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9933 valp ? 0 : HDA_AMP_MUTE);
9936 alc262_lenovo_3000_automute(codec, 0);
9940 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9941 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9943 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9944 .name = "Master Playback Switch",
9945 .info = snd_hda_mixer_amp_switch_info,
9946 .get = snd_hda_mixer_amp_switch_get,
9947 .put = alc262_lenovo_3000_master_sw_put,
9948 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9950 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9951 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9952 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9955 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9956 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9957 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9961 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9962 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9964 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9965 .name = "Master Playback Switch",
9966 .info = snd_hda_mixer_amp_switch_info,
9967 .get = snd_hda_mixer_amp_switch_get,
9968 .put = alc262_sony_master_sw_put,
9969 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9973 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9974 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9975 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9976 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9980 /* additional init verbs for Benq laptops */
9981 static struct hda_verb alc262_EAPD_verbs[] = {
9982 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9983 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9987 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9988 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9989 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9991 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9992 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9996 /* Samsung Q1 Ultra Vista model setup */
9997 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9998 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9999 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10001 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10002 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10003 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10007 static struct hda_verb alc262_ultra_verbs[] = {
10009 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10010 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10011 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10013 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10014 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10015 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10016 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10018 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10019 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10020 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10021 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10022 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10026 /* ADC, choose mic */
10027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10033 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10034 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10035 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10036 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10040 /* mute/unmute internal speaker according to the hp jack and mute state */
10041 static void alc262_ultra_automute(struct hda_codec *codec)
10043 struct alc_spec *spec = codec->spec;
10047 /* auto-mute only when HP is used as HP */
10048 if (!spec->cur_mux[0]) {
10049 unsigned int present;
10050 /* need to execute and sync at first */
10051 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10052 present = snd_hda_codec_read(codec, 0x15, 0,
10053 AC_VERB_GET_PIN_SENSE, 0);
10054 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10055 if (spec->jack_present)
10056 mute = HDA_AMP_MUTE;
10058 /* mute/unmute internal speaker */
10059 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10060 HDA_AMP_MUTE, mute);
10061 /* mute/unmute HP */
10062 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10063 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10066 /* unsolicited event for HP jack sensing */
10067 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10070 if ((res >> 26) != ALC880_HP_EVENT)
10072 alc262_ultra_automute(codec);
10075 static struct hda_input_mux alc262_ultra_capture_source = {
10079 { "Headphone", 0x7 },
10083 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10084 struct snd_ctl_elem_value *ucontrol)
10086 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10087 struct alc_spec *spec = codec->spec;
10090 ret = alc_mux_enum_put(kcontrol, ucontrol);
10093 /* reprogram the HP pin as mic or HP according to the input source */
10094 snd_hda_codec_write_cache(codec, 0x15, 0,
10095 AC_VERB_SET_PIN_WIDGET_CONTROL,
10096 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10097 alc262_ultra_automute(codec); /* mute/unmute HP */
10101 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10102 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10103 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10106 .name = "Capture Source",
10107 .info = alc_mux_enum_info,
10108 .get = alc_mux_enum_get,
10109 .put = alc262_ultra_mux_enum_put,
10114 /* add playback controls from the parsed DAC table */
10115 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10116 const struct auto_pin_cfg *cfg)
10121 spec->multiout.num_dacs = 1; /* only use one dac */
10122 spec->multiout.dac_nids = spec->private_dac_nids;
10123 spec->multiout.dac_nids[0] = 2;
10125 nid = cfg->line_out_pins[0];
10127 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10128 "Front Playback Volume",
10129 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10132 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10133 "Front Playback Switch",
10134 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10139 nid = cfg->speaker_pins[0];
10142 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10143 "Speaker Playback Volume",
10144 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10148 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10149 "Speaker Playback Switch",
10150 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10155 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10156 "Speaker Playback Switch",
10157 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10163 nid = cfg->hp_pins[0];
10165 /* spec->multiout.hp_nid = 2; */
10167 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10168 "Headphone Playback Volume",
10169 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10173 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10174 "Headphone Playback Switch",
10175 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10180 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10181 "Headphone Playback Switch",
10182 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10191 /* identical with ALC880 */
10192 #define alc262_auto_create_analog_input_ctls \
10193 alc880_auto_create_analog_input_ctls
10196 * generic initialization of ADC, input mixers and output mixers
10198 static struct hda_verb alc262_volume_init_verbs[] = {
10200 * Unmute ADC0-2 and set the default input to mic-in
10202 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10203 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10204 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10205 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10206 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10207 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10209 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10211 * Note: PASD motherboards uses the Line In 2 as the input for
10212 * front panel mic (mic 2)
10214 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10218 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10219 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10222 * Set up output mixers (0x0c - 0x0f)
10224 /* set vol=0 to output mixers */
10225 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10226 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10227 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10229 /* set up input amps for analog loopback */
10230 /* Amp Indices: DAC = 0, mixer = 1 */
10231 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10232 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10233 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10234 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10235 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10236 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10238 /* FIXME: use matrix-type input source selection */
10239 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10240 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10242 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10249 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10259 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10261 * Unmute ADC0-2 and set the default input to mic-in
10263 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10265 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10266 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10267 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10270 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10272 * Note: PASD motherboards uses the Line In 2 as the input for
10273 * front panel mic (mic 2)
10275 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10277 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10278 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10280 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10285 * Set up output mixers (0x0c - 0x0e)
10287 /* set vol=0 to output mixers */
10288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10289 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10290 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10292 /* set up input amps for analog loopback */
10293 /* Amp Indices: DAC = 0, mixer = 1 */
10294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10301 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10302 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10303 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10305 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10308 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10309 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10312 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10313 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10314 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10315 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10317 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10318 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10319 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10321 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10322 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10325 /* FIXME: use matrix-type input source selection */
10326 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10327 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10328 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10330 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10335 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10336 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10340 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10341 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10343 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10348 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10350 * Unmute ADC0-2 and set the default input to mic-in
10352 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10354 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10356 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10357 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10359 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10361 * Note: PASD motherboards uses the Line In 2 as the input for front
10362 * panel mic (mic 2)
10364 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10374 * Set up output mixers (0x0c - 0x0e)
10376 /* set vol=0 to output mixers */
10377 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10378 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10379 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10381 /* set up input amps for analog loopback */
10382 /* Amp Indices: DAC = 0, mixer = 1 */
10383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10385 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10386 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10387 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10388 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10392 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10393 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10394 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10395 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10396 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10397 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10399 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10400 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10402 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10403 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10405 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10407 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10408 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10409 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10410 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10412 /* FIXME: use matrix-type input source selection */
10413 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10414 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10420 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10423 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10424 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10426 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10427 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10428 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10429 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10432 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10433 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10434 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10435 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10436 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10437 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10439 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10444 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10446 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10447 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10448 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10450 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10451 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10452 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10453 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10456 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10462 #ifdef CONFIG_SND_HDA_POWER_SAVE
10463 #define alc262_loopbacks alc880_loopbacks
10466 /* pcm configuration: identiacal with ALC880 */
10467 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10468 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10469 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10470 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10473 * BIOS auto configuration
10475 static int alc262_parse_auto_config(struct hda_codec *codec)
10477 struct alc_spec *spec = codec->spec;
10479 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10481 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10485 if (!spec->autocfg.line_outs) {
10486 if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) {
10487 spec->multiout.max_channels = 2;
10488 spec->no_analog = 1;
10491 return 0; /* can't find valid BIOS pin config */
10493 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10496 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10500 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10503 if (spec->autocfg.dig_out_pin) {
10504 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10505 spec->dig_out_type = spec->autocfg.dig_out_type;
10507 if (spec->autocfg.dig_in_pin)
10508 spec->dig_in_nid = ALC262_DIGIN_NID;
10510 if (spec->kctls.list)
10511 add_mixer(spec, spec->kctls.list);
10513 add_verb(spec, alc262_volume_init_verbs);
10514 spec->num_mux_defs = 1;
10515 spec->input_mux = &spec->private_imux;
10517 err = alc_auto_add_mic_boost(codec);
10521 store_pin_configs(codec);
10525 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10526 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10527 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10528 #define alc262_auto_init_input_src alc882_auto_init_input_src
10531 /* init callback for auto-configuration model -- overriding the default init */
10532 static void alc262_auto_init(struct hda_codec *codec)
10534 struct alc_spec *spec = codec->spec;
10535 alc262_auto_init_multi_out(codec);
10536 alc262_auto_init_hp_out(codec);
10537 alc262_auto_init_analog_input(codec);
10538 alc262_auto_init_input_src(codec);
10539 if (spec->unsol_event)
10540 alc_inithook(codec);
10544 * configuration and preset
10546 static const char *alc262_models[ALC262_MODEL_LAST] = {
10547 [ALC262_BASIC] = "basic",
10548 [ALC262_HIPPO] = "hippo",
10549 [ALC262_HIPPO_1] = "hippo_1",
10550 [ALC262_FUJITSU] = "fujitsu",
10551 [ALC262_HP_BPC] = "hp-bpc",
10552 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10553 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10554 [ALC262_HP_RP5700] = "hp-rp5700",
10555 [ALC262_BENQ_ED8] = "benq",
10556 [ALC262_BENQ_T31] = "benq-t31",
10557 [ALC262_SONY_ASSAMD] = "sony-assamd",
10558 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10559 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10560 [ALC262_ULTRA] = "ultra",
10561 [ALC262_LENOVO_3000] = "lenovo-3000",
10562 [ALC262_NEC] = "nec",
10563 [ALC262_AUTO] = "auto",
10566 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10567 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10568 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10569 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10570 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10571 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10572 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10573 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10574 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10575 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10576 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10577 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10578 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10579 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10580 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10581 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10582 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10583 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10584 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10585 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10586 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10587 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10588 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10589 ALC262_HP_TC_T5735),
10590 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10591 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10592 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10593 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10594 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10595 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10596 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",
10597 ALC262_SONY_ASSAMD),
10598 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10599 ALC262_TOSHIBA_RX1),
10600 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10601 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10602 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10603 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10604 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10605 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10606 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10607 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10608 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10609 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10613 static struct alc_config_preset alc262_presets[] = {
10615 .mixers = { alc262_base_mixer },
10616 .init_verbs = { alc262_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_capture_source,
10625 .mixers = { alc262_base_mixer },
10626 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10627 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10628 .dac_nids = alc262_dac_nids,
10630 .dig_out_nid = ALC262_DIGOUT_NID,
10631 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10632 .channel_mode = alc262_modes,
10633 .input_mux = &alc262_capture_source,
10634 .unsol_event = alc262_hippo_unsol_event,
10635 .init_hook = alc262_hippo_automute,
10637 [ALC262_HIPPO_1] = {
10638 .mixers = { alc262_hippo1_mixer },
10639 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10640 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10641 .dac_nids = alc262_dac_nids,
10643 .dig_out_nid = ALC262_DIGOUT_NID,
10644 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10645 .channel_mode = alc262_modes,
10646 .input_mux = &alc262_capture_source,
10647 .unsol_event = alc262_hippo1_unsol_event,
10648 .init_hook = alc262_hippo1_automute,
10650 [ALC262_FUJITSU] = {
10651 .mixers = { alc262_fujitsu_mixer },
10652 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10653 alc262_fujitsu_unsol_verbs },
10654 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10655 .dac_nids = alc262_dac_nids,
10657 .dig_out_nid = ALC262_DIGOUT_NID,
10658 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10659 .channel_mode = alc262_modes,
10660 .input_mux = &alc262_fujitsu_capture_source,
10661 .unsol_event = alc262_fujitsu_unsol_event,
10662 .init_hook = alc262_fujitsu_init_hook,
10664 [ALC262_HP_BPC] = {
10665 .mixers = { alc262_HP_BPC_mixer },
10666 .init_verbs = { alc262_HP_BPC_init_verbs },
10667 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10668 .dac_nids = alc262_dac_nids,
10670 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10671 .channel_mode = alc262_modes,
10672 .input_mux = &alc262_HP_capture_source,
10673 .unsol_event = alc262_hp_bpc_unsol_event,
10674 .init_hook = alc262_hp_bpc_automute,
10676 [ALC262_HP_BPC_D7000_WF] = {
10677 .mixers = { alc262_HP_BPC_WildWest_mixer },
10678 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10679 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10680 .dac_nids = alc262_dac_nids,
10682 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10683 .channel_mode = alc262_modes,
10684 .input_mux = &alc262_HP_D7000_capture_source,
10685 .unsol_event = alc262_hp_wildwest_unsol_event,
10686 .init_hook = alc262_hp_wildwest_automute,
10688 [ALC262_HP_BPC_D7000_WL] = {
10689 .mixers = { alc262_HP_BPC_WildWest_mixer,
10690 alc262_HP_BPC_WildWest_option_mixer },
10691 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10692 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10693 .dac_nids = alc262_dac_nids,
10695 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10696 .channel_mode = alc262_modes,
10697 .input_mux = &alc262_HP_D7000_capture_source,
10698 .unsol_event = alc262_hp_wildwest_unsol_event,
10699 .init_hook = alc262_hp_wildwest_automute,
10701 [ALC262_HP_TC_T5735] = {
10702 .mixers = { alc262_hp_t5735_mixer },
10703 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10704 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10705 .dac_nids = alc262_dac_nids,
10707 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10708 .channel_mode = alc262_modes,
10709 .input_mux = &alc262_capture_source,
10710 .unsol_event = alc262_hp_t5735_unsol_event,
10711 .init_hook = alc262_hp_t5735_init_hook,
10713 [ALC262_HP_RP5700] = {
10714 .mixers = { alc262_hp_rp5700_mixer },
10715 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10716 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10717 .dac_nids = alc262_dac_nids,
10718 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10719 .channel_mode = alc262_modes,
10720 .input_mux = &alc262_hp_rp5700_capture_source,
10722 [ALC262_BENQ_ED8] = {
10723 .mixers = { alc262_base_mixer },
10724 .init_verbs = { alc262_init_verbs, alc262_EAPD_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_SONY_ASSAMD] = {
10733 .mixers = { alc262_sony_mixer },
10734 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10735 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10736 .dac_nids = alc262_dac_nids,
10738 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10739 .channel_mode = alc262_modes,
10740 .input_mux = &alc262_capture_source,
10741 .unsol_event = alc262_hippo_unsol_event,
10742 .init_hook = alc262_hippo_automute,
10744 [ALC262_BENQ_T31] = {
10745 .mixers = { alc262_benq_t31_mixer },
10746 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10747 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10748 .dac_nids = alc262_dac_nids,
10750 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10751 .channel_mode = alc262_modes,
10752 .input_mux = &alc262_capture_source,
10753 .unsol_event = alc262_hippo_unsol_event,
10754 .init_hook = alc262_hippo_automute,
10757 .mixers = { alc262_ultra_mixer },
10758 .cap_mixer = alc262_ultra_capture_mixer,
10759 .init_verbs = { alc262_ultra_verbs },
10760 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10761 .dac_nids = alc262_dac_nids,
10762 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10763 .channel_mode = alc262_modes,
10764 .input_mux = &alc262_ultra_capture_source,
10765 .adc_nids = alc262_adc_nids, /* ADC0 */
10766 .capsrc_nids = alc262_capsrc_nids,
10767 .num_adc_nids = 1, /* single ADC */
10768 .unsol_event = alc262_ultra_unsol_event,
10769 .init_hook = alc262_ultra_automute,
10771 [ALC262_LENOVO_3000] = {
10772 .mixers = { alc262_lenovo_3000_mixer },
10773 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10774 alc262_lenovo_3000_unsol_verbs },
10775 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10776 .dac_nids = alc262_dac_nids,
10778 .dig_out_nid = ALC262_DIGOUT_NID,
10779 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10780 .channel_mode = alc262_modes,
10781 .input_mux = &alc262_fujitsu_capture_source,
10782 .unsol_event = alc262_lenovo_3000_unsol_event,
10785 .mixers = { alc262_nec_mixer },
10786 .init_verbs = { alc262_nec_verbs },
10787 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10788 .dac_nids = alc262_dac_nids,
10790 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10791 .channel_mode = alc262_modes,
10792 .input_mux = &alc262_capture_source,
10794 [ALC262_TOSHIBA_S06] = {
10795 .mixers = { alc262_toshiba_s06_mixer },
10796 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10797 alc262_eapd_verbs },
10798 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10799 .capsrc_nids = alc262_dmic_capsrc_nids,
10800 .dac_nids = alc262_dac_nids,
10801 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10802 .dig_out_nid = ALC262_DIGOUT_NID,
10803 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10804 .channel_mode = alc262_modes,
10805 .input_mux = &alc262_dmic_capture_source,
10806 .unsol_event = alc262_toshiba_s06_unsol_event,
10807 .init_hook = alc262_toshiba_s06_init_hook,
10809 [ALC262_TOSHIBA_RX1] = {
10810 .mixers = { alc262_toshiba_rx1_mixer },
10811 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10812 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10813 .dac_nids = alc262_dac_nids,
10815 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10816 .channel_mode = alc262_modes,
10817 .input_mux = &alc262_capture_source,
10818 .unsol_event = alc262_hippo_unsol_event,
10819 .init_hook = alc262_hippo_automute,
10823 static int patch_alc262(struct hda_codec *codec)
10825 struct alc_spec *spec;
10829 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10833 codec->spec = spec;
10835 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10840 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10841 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10842 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10843 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10847 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10849 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10853 if (board_config < 0) {
10854 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10855 "trying auto-probe from BIOS...\n");
10856 board_config = ALC262_AUTO;
10859 if (board_config == ALC262_AUTO) {
10860 /* automatic parse from the BIOS config */
10861 err = alc262_parse_auto_config(codec);
10867 "hda_codec: Cannot set up configuration "
10868 "from BIOS. Using base mode...\n");
10869 board_config = ALC262_BASIC;
10873 if (board_config != ALC262_AUTO)
10874 setup_preset(spec, &alc262_presets[board_config]);
10876 spec->stream_name_analog = "ALC262 Analog";
10877 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10878 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10880 spec->stream_name_digital = "ALC262 Digital";
10881 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10882 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10884 spec->is_mix_capture = 1;
10885 if (!spec->adc_nids && spec->input_mux) {
10886 /* check whether NID 0x07 is valid */
10887 unsigned int wcap = get_wcaps(codec, 0x07);
10890 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10891 if (wcap != AC_WID_AUD_IN) {
10892 spec->adc_nids = alc262_adc_nids_alt;
10893 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10894 spec->capsrc_nids = alc262_capsrc_nids_alt;
10896 spec->adc_nids = alc262_adc_nids;
10897 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10898 spec->capsrc_nids = alc262_capsrc_nids;
10901 if (!spec->cap_mixer && !spec->no_analog)
10902 set_capture_mixer(spec);
10904 spec->vmaster_nid = 0x0c;
10906 codec->patch_ops = alc_patch_ops;
10907 if (board_config == ALC262_AUTO)
10908 spec->init_hook = alc262_auto_init;
10909 #ifdef CONFIG_SND_HDA_POWER_SAVE
10910 if (!spec->loopback.amplist)
10911 spec->loopback.amplist = alc262_loopbacks;
10913 codec->proc_widget_hook = print_realtek_coef;
10919 * ALC268 channel source setting (2 channel)
10921 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10922 #define alc268_modes alc260_modes
10924 static hda_nid_t alc268_dac_nids[2] = {
10929 static hda_nid_t alc268_adc_nids[2] = {
10934 static hda_nid_t alc268_adc_nids_alt[1] = {
10939 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10941 static struct snd_kcontrol_new alc268_base_mixer[] = {
10942 /* output mixer control */
10943 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10944 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10945 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10947 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10948 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10949 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10953 /* bind Beep switches of both NID 0x0f and 0x10 */
10954 static struct hda_bind_ctls alc268_bind_beep_sw = {
10955 .ops = &snd_hda_bind_sw,
10957 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10958 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10963 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10964 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10965 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10969 static struct hda_verb alc268_eapd_verbs[] = {
10970 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10971 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10975 /* Toshiba specific */
10976 #define alc268_toshiba_automute alc262_hippo_automute
10978 static struct hda_verb alc268_toshiba_verbs[] = {
10979 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10983 static struct hda_input_mux alc268_acer_lc_capture_source = {
10991 /* Acer specific */
10992 /* bind volumes of both NID 0x02 and 0x03 */
10993 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10994 .ops = &snd_hda_bind_vol,
10996 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10997 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11002 /* mute/unmute internal speaker according to the hp jack and mute state */
11003 static void alc268_acer_automute(struct hda_codec *codec, int force)
11005 struct alc_spec *spec = codec->spec;
11008 if (force || !spec->sense_updated) {
11009 unsigned int present;
11010 present = snd_hda_codec_read(codec, 0x14, 0,
11011 AC_VERB_GET_PIN_SENSE, 0);
11012 spec->jack_present = (present & 0x80000000) != 0;
11013 spec->sense_updated = 1;
11015 if (spec->jack_present)
11016 mute = HDA_AMP_MUTE; /* mute internal speaker */
11017 else /* unmute internal speaker if necessary */
11018 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11019 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11020 HDA_AMP_MUTE, mute);
11024 /* bind hp and internal speaker mute (with plug check) */
11025 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11026 struct snd_ctl_elem_value *ucontrol)
11028 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11029 long *valp = ucontrol->value.integer.value;
11032 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11034 valp[0] ? 0 : HDA_AMP_MUTE);
11035 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11037 valp[1] ? 0 : HDA_AMP_MUTE);
11039 alc268_acer_automute(codec, 0);
11043 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11044 /* output mixer control */
11045 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11047 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11048 .name = "Master Playback Switch",
11049 .info = snd_hda_mixer_amp_switch_info,
11050 .get = snd_hda_mixer_amp_switch_get,
11051 .put = alc268_acer_master_sw_put,
11052 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11054 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11058 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11059 /* output mixer control */
11060 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11062 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11063 .name = "Master Playback Switch",
11064 .info = snd_hda_mixer_amp_switch_info,
11065 .get = snd_hda_mixer_amp_switch_get,
11066 .put = alc268_acer_master_sw_put,
11067 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11069 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11070 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11071 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11075 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11076 /* output mixer control */
11077 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11079 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11080 .name = "Master Playback Switch",
11081 .info = snd_hda_mixer_amp_switch_info,
11082 .get = snd_hda_mixer_amp_switch_get,
11083 .put = alc268_acer_master_sw_put,
11084 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11087 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11091 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11092 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11093 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11096 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11101 static struct hda_verb alc268_acer_verbs[] = {
11102 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11103 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11105 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11106 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11107 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11108 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11112 /* unsolicited event for HP jack sensing */
11113 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11116 if ((res >> 26) != ALC880_HP_EVENT)
11118 alc268_toshiba_automute(codec);
11121 static void alc268_acer_unsol_event(struct hda_codec *codec,
11124 if ((res >> 26) != ALC880_HP_EVENT)
11126 alc268_acer_automute(codec, 1);
11129 static void alc268_acer_init_hook(struct hda_codec *codec)
11131 alc268_acer_automute(codec, 1);
11134 /* toggle speaker-output according to the hp-jack state */
11135 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11137 unsigned int present;
11138 unsigned char bits;
11140 present = snd_hda_codec_read(codec, 0x15, 0,
11141 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11142 bits = present ? AMP_IN_MUTE(0) : 0;
11143 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11144 AMP_IN_MUTE(0), bits);
11145 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11146 AMP_IN_MUTE(0), bits);
11150 static void alc268_acer_mic_automute(struct hda_codec *codec)
11152 unsigned int present;
11154 present = snd_hda_codec_read(codec, 0x18, 0,
11155 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11156 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11157 present ? 0x0 : 0x6);
11160 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11163 if ((res >> 26) == ALC880_HP_EVENT)
11164 alc268_aspire_one_speaker_automute(codec);
11165 if ((res >> 26) == ALC880_MIC_EVENT)
11166 alc268_acer_mic_automute(codec);
11169 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11171 alc268_aspire_one_speaker_automute(codec);
11172 alc268_acer_mic_automute(codec);
11175 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11176 /* output mixer control */
11177 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11178 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11179 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11180 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11182 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11186 static struct hda_verb alc268_dell_verbs[] = {
11187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11189 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11193 /* mute/unmute internal speaker according to the hp jack and mute state */
11194 static void alc268_dell_automute(struct hda_codec *codec)
11196 unsigned int present;
11199 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11200 if (present & 0x80000000)
11201 mute = HDA_AMP_MUTE;
11203 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11204 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11205 HDA_AMP_MUTE, mute);
11208 static void alc268_dell_unsol_event(struct hda_codec *codec,
11211 if ((res >> 26) != ALC880_HP_EVENT)
11213 alc268_dell_automute(codec);
11216 #define alc268_dell_init_hook alc268_dell_automute
11218 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11219 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11220 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11221 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11222 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11223 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11224 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11225 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11226 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11230 static struct hda_verb alc267_quanta_il1_verbs[] = {
11231 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11232 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11236 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11238 unsigned int present;
11240 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11241 & AC_PINSENSE_PRESENCE;
11242 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11243 present ? 0 : PIN_OUT);
11246 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11248 unsigned int present;
11250 present = snd_hda_codec_read(codec, 0x18, 0,
11251 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11252 snd_hda_codec_write(codec, 0x23, 0,
11253 AC_VERB_SET_CONNECT_SEL,
11254 present ? 0x00 : 0x01);
11257 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11259 alc267_quanta_il1_hp_automute(codec);
11260 alc267_quanta_il1_mic_automute(codec);
11263 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11266 switch (res >> 26) {
11267 case ALC880_HP_EVENT:
11268 alc267_quanta_il1_hp_automute(codec);
11270 case ALC880_MIC_EVENT:
11271 alc267_quanta_il1_mic_automute(codec);
11277 * generic initialization of ADC, input mixers and output mixers
11279 static struct hda_verb alc268_base_init_verbs[] = {
11280 /* Unmute DAC0-1 and set vol = 0 */
11281 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11282 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11285 * Set up output mixers (0x0c - 0x0e)
11287 /* set vol=0 to output mixers */
11288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11289 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11291 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11292 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11296 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11298 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11299 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11300 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11301 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11305 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11307 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11309 /* set PCBEEP vol = 0, mute connections */
11310 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11311 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11312 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11314 /* Unmute Selector 23h,24h and set the default input to mic-in */
11316 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11318 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11325 * generic initialization of ADC, input mixers and output mixers
11327 static struct hda_verb alc268_volume_init_verbs[] = {
11328 /* set output DAC */
11329 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11330 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11332 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11333 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11334 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11335 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11336 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11339 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11340 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11342 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11343 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11345 /* set PCBEEP vol = 0, mute connections */
11346 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11348 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11353 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11354 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11355 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11358 /* The multiple "Capture Source" controls confuse alsamixer
11359 * So call somewhat different..
11361 /* .name = "Capture Source", */
11362 .name = "Input Source",
11364 .info = alc_mux_enum_info,
11365 .get = alc_mux_enum_get,
11366 .put = alc_mux_enum_put,
11371 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11372 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11373 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11374 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11375 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11377 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11378 /* The multiple "Capture Source" controls confuse alsamixer
11379 * So call somewhat different..
11381 /* .name = "Capture Source", */
11382 .name = "Input Source",
11384 .info = alc_mux_enum_info,
11385 .get = alc_mux_enum_get,
11386 .put = alc_mux_enum_put,
11391 static struct hda_input_mux alc268_capture_source = {
11395 { "Front Mic", 0x1 },
11401 static struct hda_input_mux alc268_acer_capture_source = {
11405 { "Internal Mic", 0x1 },
11410 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11414 { "Internal Mic", 0x6 },
11419 #ifdef CONFIG_SND_DEBUG
11420 static struct snd_kcontrol_new alc268_test_mixer[] = {
11421 /* Volume widgets */
11422 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11423 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11424 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11425 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11426 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11427 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11428 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11429 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11430 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11431 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11432 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11433 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11434 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11435 /* The below appears problematic on some hardwares */
11436 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11437 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11438 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11439 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11440 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11442 /* Modes for retasking pin widgets */
11443 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11444 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11445 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11446 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11448 /* Controls for GPIO pins, assuming they are configured as outputs */
11449 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11450 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11451 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11452 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11454 /* Switches to allow the digital SPDIF output pin to be enabled.
11455 * The ALC268 does not have an SPDIF input.
11457 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11459 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11460 * this output to turn on an external amplifier.
11462 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11463 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11469 /* create input playback/capture controls for the given pin */
11470 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11471 const char *ctlname, int idx)
11476 sprintf(name, "%s Playback Volume", ctlname);
11478 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11479 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11483 } else if (nid == 0x15) {
11484 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11485 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11491 sprintf(name, "%s Playback Switch", ctlname);
11492 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11493 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11499 /* add playback controls from the parsed DAC table */
11500 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11501 const struct auto_pin_cfg *cfg)
11506 spec->multiout.num_dacs = 2; /* only use one dac */
11507 spec->multiout.dac_nids = spec->private_dac_nids;
11508 spec->multiout.dac_nids[0] = 2;
11509 spec->multiout.dac_nids[1] = 3;
11511 nid = cfg->line_out_pins[0];
11513 alc268_new_analog_output(spec, nid, "Front", 0);
11515 nid = cfg->speaker_pins[0];
11517 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11518 "Speaker Playback Volume",
11519 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11523 nid = cfg->hp_pins[0];
11525 alc268_new_analog_output(spec, nid, "Headphone", 0);
11527 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11529 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11530 "Mono Playback Switch",
11531 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11538 /* create playback/capture controls for input pins */
11539 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11540 const struct auto_pin_cfg *cfg)
11542 struct hda_input_mux *imux = &spec->private_imux;
11545 for (i = 0; i < AUTO_PIN_LAST; i++) {
11546 switch(cfg->input_pins[i]) {
11548 idx1 = 0; /* Mic 1 */
11551 idx1 = 1; /* Mic 2 */
11554 idx1 = 2; /* Line In */
11561 idx1 = 6; /* digital mics */
11566 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11567 imux->items[imux->num_items].index = idx1;
11573 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11575 struct alc_spec *spec = codec->spec;
11576 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11577 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11578 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11579 unsigned int dac_vol1, dac_vol2;
11582 snd_hda_codec_write(codec, speaker_nid, 0,
11583 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11584 snd_hda_codec_write(codec, 0x0f, 0,
11585 AC_VERB_SET_AMP_GAIN_MUTE,
11587 snd_hda_codec_write(codec, 0x10, 0,
11588 AC_VERB_SET_AMP_GAIN_MUTE,
11591 snd_hda_codec_write(codec, 0x0f, 0,
11592 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11593 snd_hda_codec_write(codec, 0x10, 0,
11594 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11597 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11598 if (line_nid == 0x14)
11599 dac_vol2 = AMP_OUT_ZERO;
11600 else if (line_nid == 0x15)
11601 dac_vol1 = AMP_OUT_ZERO;
11602 if (hp_nid == 0x14)
11603 dac_vol2 = AMP_OUT_ZERO;
11604 else if (hp_nid == 0x15)
11605 dac_vol1 = AMP_OUT_ZERO;
11606 if (line_nid != 0x16 || hp_nid != 0x16 ||
11607 spec->autocfg.line_out_pins[1] != 0x16 ||
11608 spec->autocfg.line_out_pins[2] != 0x16)
11609 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11611 snd_hda_codec_write(codec, 0x02, 0,
11612 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11613 snd_hda_codec_write(codec, 0x03, 0,
11614 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11617 /* pcm configuration: identiacal with ALC880 */
11618 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11619 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11620 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11621 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11624 * BIOS auto configuration
11626 static int alc268_parse_auto_config(struct hda_codec *codec)
11628 struct alc_spec *spec = codec->spec;
11630 static hda_nid_t alc268_ignore[] = { 0 };
11632 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11636 if (!spec->autocfg.line_outs)
11637 return 0; /* can't find valid BIOS pin config */
11639 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11642 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11646 spec->multiout.max_channels = 2;
11648 /* digital only support output */
11649 if (spec->autocfg.dig_out_pin)
11650 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11652 if (spec->kctls.list)
11653 add_mixer(spec, spec->kctls.list);
11655 if (spec->autocfg.speaker_pins[0] != 0x1d)
11656 add_mixer(spec, alc268_beep_mixer);
11658 add_verb(spec, alc268_volume_init_verbs);
11659 spec->num_mux_defs = 1;
11660 spec->input_mux = &spec->private_imux;
11662 err = alc_auto_add_mic_boost(codec);
11666 store_pin_configs(codec);
11670 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11671 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11672 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11674 /* init callback for auto-configuration model -- overriding the default init */
11675 static void alc268_auto_init(struct hda_codec *codec)
11677 struct alc_spec *spec = codec->spec;
11678 alc268_auto_init_multi_out(codec);
11679 alc268_auto_init_hp_out(codec);
11680 alc268_auto_init_mono_speaker_out(codec);
11681 alc268_auto_init_analog_input(codec);
11682 if (spec->unsol_event)
11683 alc_inithook(codec);
11687 * configuration and preset
11689 static const char *alc268_models[ALC268_MODEL_LAST] = {
11690 [ALC267_QUANTA_IL1] = "quanta-il1",
11691 [ALC268_3ST] = "3stack",
11692 [ALC268_TOSHIBA] = "toshiba",
11693 [ALC268_ACER] = "acer",
11694 [ALC268_ACER_DMIC] = "acer-dmic",
11695 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11696 [ALC268_DELL] = "dell",
11697 [ALC268_ZEPTO] = "zepto",
11698 #ifdef CONFIG_SND_DEBUG
11699 [ALC268_TEST] = "test",
11701 [ALC268_AUTO] = "auto",
11704 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11705 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11706 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11707 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11708 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11709 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11710 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11711 ALC268_ACER_ASPIRE_ONE),
11712 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11713 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11714 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11715 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11716 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11717 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11718 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11719 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11720 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11721 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11722 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11726 static struct alc_config_preset alc268_presets[] = {
11727 [ALC267_QUANTA_IL1] = {
11728 .mixers = { alc267_quanta_il1_mixer },
11729 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11730 alc267_quanta_il1_verbs },
11731 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11732 .dac_nids = alc268_dac_nids,
11733 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11734 .adc_nids = alc268_adc_nids_alt,
11736 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11737 .channel_mode = alc268_modes,
11738 .input_mux = &alc268_capture_source,
11739 .unsol_event = alc267_quanta_il1_unsol_event,
11740 .init_hook = alc267_quanta_il1_automute,
11743 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11744 alc268_beep_mixer },
11745 .init_verbs = { alc268_base_init_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 .dig_out_nid = ALC268_DIGOUT_NID,
11753 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11754 .channel_mode = alc268_modes,
11755 .input_mux = &alc268_capture_source,
11757 [ALC268_TOSHIBA] = {
11758 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11759 alc268_beep_mixer },
11760 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11761 alc268_toshiba_verbs },
11762 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11763 .dac_nids = alc268_dac_nids,
11764 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11765 .adc_nids = alc268_adc_nids_alt,
11766 .capsrc_nids = alc268_capsrc_nids,
11768 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11769 .channel_mode = alc268_modes,
11770 .input_mux = &alc268_capture_source,
11771 .unsol_event = alc268_toshiba_unsol_event,
11772 .init_hook = alc268_toshiba_automute,
11775 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11776 alc268_beep_mixer },
11777 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11778 alc268_acer_verbs },
11779 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11780 .dac_nids = alc268_dac_nids,
11781 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11782 .adc_nids = alc268_adc_nids_alt,
11783 .capsrc_nids = alc268_capsrc_nids,
11785 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11786 .channel_mode = alc268_modes,
11787 .input_mux = &alc268_acer_capture_source,
11788 .unsol_event = alc268_acer_unsol_event,
11789 .init_hook = alc268_acer_init_hook,
11791 [ALC268_ACER_DMIC] = {
11792 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11793 alc268_beep_mixer },
11794 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11795 alc268_acer_verbs },
11796 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11797 .dac_nids = alc268_dac_nids,
11798 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11799 .adc_nids = alc268_adc_nids_alt,
11800 .capsrc_nids = alc268_capsrc_nids,
11802 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11803 .channel_mode = alc268_modes,
11804 .input_mux = &alc268_acer_dmic_capture_source,
11805 .unsol_event = alc268_acer_unsol_event,
11806 .init_hook = alc268_acer_init_hook,
11808 [ALC268_ACER_ASPIRE_ONE] = {
11809 .mixers = { alc268_acer_aspire_one_mixer,
11810 alc268_capture_alt_mixer },
11811 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11812 alc268_acer_aspire_one_verbs },
11813 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11814 .dac_nids = alc268_dac_nids,
11815 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11816 .adc_nids = alc268_adc_nids_alt,
11817 .capsrc_nids = alc268_capsrc_nids,
11819 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11820 .channel_mode = alc268_modes,
11821 .input_mux = &alc268_acer_lc_capture_source,
11822 .unsol_event = alc268_acer_lc_unsol_event,
11823 .init_hook = alc268_acer_lc_init_hook,
11826 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11827 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11828 alc268_dell_verbs },
11829 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11830 .dac_nids = alc268_dac_nids,
11832 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11833 .channel_mode = alc268_modes,
11834 .unsol_event = alc268_dell_unsol_event,
11835 .init_hook = alc268_dell_init_hook,
11836 .input_mux = &alc268_capture_source,
11839 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11840 alc268_beep_mixer },
11841 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11842 alc268_toshiba_verbs },
11843 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11844 .dac_nids = alc268_dac_nids,
11845 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11846 .adc_nids = alc268_adc_nids_alt,
11847 .capsrc_nids = alc268_capsrc_nids,
11849 .dig_out_nid = ALC268_DIGOUT_NID,
11850 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11851 .channel_mode = alc268_modes,
11852 .input_mux = &alc268_capture_source,
11853 .unsol_event = alc268_toshiba_unsol_event,
11854 .init_hook = alc268_toshiba_automute
11856 #ifdef CONFIG_SND_DEBUG
11858 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11859 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11860 alc268_volume_init_verbs },
11861 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11862 .dac_nids = alc268_dac_nids,
11863 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11864 .adc_nids = alc268_adc_nids_alt,
11865 .capsrc_nids = alc268_capsrc_nids,
11867 .dig_out_nid = ALC268_DIGOUT_NID,
11868 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11869 .channel_mode = alc268_modes,
11870 .input_mux = &alc268_capture_source,
11875 static int patch_alc268(struct hda_codec *codec)
11877 struct alc_spec *spec;
11881 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11885 codec->spec = spec;
11887 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11891 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11892 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11893 "trying auto-probe from BIOS...\n");
11894 board_config = ALC268_AUTO;
11897 if (board_config == ALC268_AUTO) {
11898 /* automatic parse from the BIOS config */
11899 err = alc268_parse_auto_config(codec);
11905 "hda_codec: Cannot set up configuration "
11906 "from BIOS. Using base mode...\n");
11907 board_config = ALC268_3ST;
11911 if (board_config != ALC268_AUTO)
11912 setup_preset(spec, &alc268_presets[board_config]);
11914 if (codec->vendor_id == 0x10ec0267) {
11915 spec->stream_name_analog = "ALC267 Analog";
11916 spec->stream_name_digital = "ALC267 Digital";
11918 spec->stream_name_analog = "ALC268 Analog";
11919 spec->stream_name_digital = "ALC268 Digital";
11922 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11923 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11924 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11926 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11928 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11929 /* override the amp caps for beep generator */
11930 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11931 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11932 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11933 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11934 (0 << AC_AMPCAP_MUTE_SHIFT));
11936 if (!spec->adc_nids && spec->input_mux) {
11937 /* check whether NID 0x07 is valid */
11938 unsigned int wcap = get_wcaps(codec, 0x07);
11942 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11943 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11944 spec->adc_nids = alc268_adc_nids_alt;
11945 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11946 add_mixer(spec, alc268_capture_alt_mixer);
11948 spec->adc_nids = alc268_adc_nids;
11949 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11950 add_mixer(spec, alc268_capture_mixer);
11952 spec->capsrc_nids = alc268_capsrc_nids;
11953 /* set default input source */
11954 for (i = 0; i < spec->num_adc_nids; i++)
11955 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11956 0, AC_VERB_SET_CONNECT_SEL,
11957 spec->input_mux->items[0].index);
11960 spec->vmaster_nid = 0x02;
11962 codec->patch_ops = alc_patch_ops;
11963 if (board_config == ALC268_AUTO)
11964 spec->init_hook = alc268_auto_init;
11966 codec->proc_widget_hook = print_realtek_coef;
11972 * ALC269 channel source setting (2 channel)
11974 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11976 #define alc269_dac_nids alc260_dac_nids
11978 static hda_nid_t alc269_adc_nids[1] = {
11983 static hda_nid_t alc269_capsrc_nids[1] = {
11987 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11991 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11999 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12007 #define alc269_modes alc260_modes
12008 #define alc269_capture_source alc880_lg_lw_capture_source
12010 static struct snd_kcontrol_new alc269_base_mixer[] = {
12011 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12012 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12013 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12014 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12017 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12018 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12019 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12020 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12021 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12022 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12024 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12028 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12029 /* output mixer control */
12030 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12032 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12033 .name = "Master Playback Switch",
12034 .info = snd_hda_mixer_amp_switch_info,
12035 .get = snd_hda_mixer_amp_switch_get,
12036 .put = alc268_acer_master_sw_put,
12037 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12040 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12041 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12042 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12043 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12044 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12045 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12046 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12050 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12051 /* output mixer control */
12052 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12054 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12055 .name = "Master Playback Switch",
12056 .info = snd_hda_mixer_amp_switch_info,
12057 .get = snd_hda_mixer_amp_switch_get,
12058 .put = alc268_acer_master_sw_put,
12059 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12064 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12065 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12066 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12067 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12068 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12069 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12070 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12071 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12075 /* bind volumes of both NID 0x0c and 0x0d */
12076 static struct hda_bind_ctls alc269_epc_bind_vol = {
12077 .ops = &snd_hda_bind_vol,
12079 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12080 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12085 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12086 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12087 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12088 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12092 /* capture mixer elements */
12093 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12094 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12095 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12101 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12102 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12104 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12109 static struct snd_kcontrol_new alc269_beep_mixer[] = {
12110 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12111 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12115 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12116 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12117 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12119 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12120 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12121 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12125 static struct hda_verb alc269_lifebook_verbs[] = {
12126 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12127 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12128 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12129 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12130 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12131 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12132 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12133 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12134 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12135 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12139 /* toggle speaker-output according to the hp-jack state */
12140 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12142 unsigned int present;
12143 unsigned char bits;
12145 present = snd_hda_codec_read(codec, 0x15, 0,
12146 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12147 bits = present ? AMP_IN_MUTE(0) : 0;
12148 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12149 AMP_IN_MUTE(0), bits);
12150 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12151 AMP_IN_MUTE(0), bits);
12153 snd_hda_codec_write(codec, 0x20, 0,
12154 AC_VERB_SET_COEF_INDEX, 0x0c);
12155 snd_hda_codec_write(codec, 0x20, 0,
12156 AC_VERB_SET_PROC_COEF, 0x680);
12158 snd_hda_codec_write(codec, 0x20, 0,
12159 AC_VERB_SET_COEF_INDEX, 0x0c);
12160 snd_hda_codec_write(codec, 0x20, 0,
12161 AC_VERB_SET_PROC_COEF, 0x480);
12164 /* toggle speaker-output according to the hp-jacks state */
12165 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12167 unsigned int present;
12168 unsigned char bits;
12170 /* Check laptop headphone socket */
12171 present = snd_hda_codec_read(codec, 0x15, 0,
12172 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12174 /* Check port replicator headphone socket */
12175 present |= snd_hda_codec_read(codec, 0x1a, 0,
12176 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12178 bits = present ? AMP_IN_MUTE(0) : 0;
12179 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12180 AMP_IN_MUTE(0), bits);
12181 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12182 AMP_IN_MUTE(0), bits);
12184 snd_hda_codec_write(codec, 0x20, 0,
12185 AC_VERB_SET_COEF_INDEX, 0x0c);
12186 snd_hda_codec_write(codec, 0x20, 0,
12187 AC_VERB_SET_PROC_COEF, 0x680);
12189 snd_hda_codec_write(codec, 0x20, 0,
12190 AC_VERB_SET_COEF_INDEX, 0x0c);
12191 snd_hda_codec_write(codec, 0x20, 0,
12192 AC_VERB_SET_PROC_COEF, 0x480);
12195 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12197 unsigned int present;
12199 present = snd_hda_codec_read(codec, 0x18, 0,
12200 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12201 snd_hda_codec_write(codec, 0x23, 0,
12202 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12205 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12207 unsigned int present_laptop;
12208 unsigned int present_dock;
12210 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12211 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12213 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12214 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12216 /* Laptop mic port overrides dock mic port, design decision */
12218 snd_hda_codec_write(codec, 0x23, 0,
12219 AC_VERB_SET_CONNECT_SEL, 0x3);
12220 if (present_laptop)
12221 snd_hda_codec_write(codec, 0x23, 0,
12222 AC_VERB_SET_CONNECT_SEL, 0x0);
12223 if (!present_dock && !present_laptop)
12224 snd_hda_codec_write(codec, 0x23, 0,
12225 AC_VERB_SET_CONNECT_SEL, 0x1);
12228 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12231 if ((res >> 26) == ALC880_HP_EVENT)
12232 alc269_quanta_fl1_speaker_automute(codec);
12233 if ((res >> 26) == ALC880_MIC_EVENT)
12234 alc269_quanta_fl1_mic_automute(codec);
12237 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12240 if ((res >> 26) == ALC880_HP_EVENT)
12241 alc269_lifebook_speaker_automute(codec);
12242 if ((res >> 26) == ALC880_MIC_EVENT)
12243 alc269_lifebook_mic_autoswitch(codec);
12246 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12248 alc269_quanta_fl1_speaker_automute(codec);
12249 alc269_quanta_fl1_mic_automute(codec);
12252 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12254 alc269_lifebook_speaker_automute(codec);
12255 alc269_lifebook_mic_autoswitch(codec);
12258 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12260 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12261 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12263 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12264 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12265 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12269 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12270 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12271 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12272 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12274 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12275 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12279 /* toggle speaker-output according to the hp-jack state */
12280 static void alc269_speaker_automute(struct hda_codec *codec)
12282 unsigned int present;
12283 unsigned char bits;
12285 present = snd_hda_codec_read(codec, 0x15, 0,
12286 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12287 bits = present ? AMP_IN_MUTE(0) : 0;
12288 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12289 AMP_IN_MUTE(0), bits);
12290 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12291 AMP_IN_MUTE(0), bits);
12294 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12296 unsigned int present;
12298 present = snd_hda_codec_read(codec, 0x18, 0,
12299 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12300 snd_hda_codec_write(codec, 0x23, 0,
12301 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12304 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12306 unsigned int present;
12308 present = snd_hda_codec_read(codec, 0x18, 0,
12309 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12310 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12311 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12312 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12313 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12316 /* unsolicited event for HP jack sensing */
12317 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12320 if ((res >> 26) == ALC880_HP_EVENT)
12321 alc269_speaker_automute(codec);
12323 if ((res >> 26) == ALC880_MIC_EVENT)
12324 alc269_eeepc_dmic_automute(codec);
12327 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12329 alc269_speaker_automute(codec);
12330 alc269_eeepc_dmic_automute(codec);
12333 /* unsolicited event for HP jack sensing */
12334 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12337 if ((res >> 26) == ALC880_HP_EVENT)
12338 alc269_speaker_automute(codec);
12340 if ((res >> 26) == ALC880_MIC_EVENT)
12341 alc269_eeepc_amic_automute(codec);
12344 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12346 alc269_speaker_automute(codec);
12347 alc269_eeepc_amic_automute(codec);
12351 * generic initialization of ADC, input mixers and output mixers
12353 static struct hda_verb alc269_init_verbs[] = {
12355 * Unmute ADC0 and set the default input to mic-in
12357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12359 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12360 * analog-loopback mixer widget
12361 * Note: PASD motherboards uses the Line In 2 as the input for
12362 * front panel mic (mic 2)
12364 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12372 * Set up output mixers (0x0c - 0x0e)
12374 /* set vol=0 to output mixers */
12375 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12376 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12378 /* set up input amps for analog loopback */
12379 /* Amp Indices: DAC = 0, mixer = 1 */
12380 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12382 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12383 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12384 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12387 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12388 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12389 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12390 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12391 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12392 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12393 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12395 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12397 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12398 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12399 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12400 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12401 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12403 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12404 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12406 /* FIXME: use matrix-type input source selection */
12407 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12408 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12409 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12410 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12411 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12412 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12415 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12416 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12420 /* add playback controls from the parsed DAC table */
12421 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12422 const struct auto_pin_cfg *cfg)
12427 spec->multiout.num_dacs = 1; /* only use one dac */
12428 spec->multiout.dac_nids = spec->private_dac_nids;
12429 spec->multiout.dac_nids[0] = 2;
12431 nid = cfg->line_out_pins[0];
12433 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12434 "Front Playback Volume",
12435 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12438 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12439 "Front Playback Switch",
12440 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12445 nid = cfg->speaker_pins[0];
12447 if (!cfg->line_out_pins[0]) {
12448 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12449 "Speaker Playback Volume",
12450 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12456 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12457 "Speaker Playback Switch",
12458 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12463 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12464 "Speaker Playback Switch",
12465 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12471 nid = cfg->hp_pins[0];
12473 /* spec->multiout.hp_nid = 2; */
12474 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12475 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12476 "Headphone Playback Volume",
12477 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12483 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12484 "Headphone Playback Switch",
12485 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12490 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12491 "Headphone Playback Switch",
12492 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12501 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12502 const struct auto_pin_cfg *cfg)
12506 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12509 /* digital-mic input pin is excluded in alc880_auto_create..()
12510 * because it's under 0x18
12512 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12513 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12514 struct hda_input_mux *imux = &spec->private_imux;
12515 imux->items[imux->num_items].label = "Int Mic";
12516 imux->items[imux->num_items].index = 0x05;
12522 #ifdef CONFIG_SND_HDA_POWER_SAVE
12523 #define alc269_loopbacks alc880_loopbacks
12526 /* pcm configuration: identiacal with ALC880 */
12527 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12528 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12529 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12530 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12533 * BIOS auto configuration
12535 static int alc269_parse_auto_config(struct hda_codec *codec)
12537 struct alc_spec *spec = codec->spec;
12539 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12541 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12546 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12549 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12553 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12555 if (spec->autocfg.dig_out_pin)
12556 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12558 if (spec->kctls.list)
12559 add_mixer(spec, spec->kctls.list);
12561 /* create a beep mixer control if the pin 0x1d isn't assigned */
12562 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12563 if (spec->autocfg.input_pins[i] == 0x1d)
12565 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12566 add_mixer(spec, alc269_beep_mixer);
12568 add_verb(spec, alc269_init_verbs);
12569 spec->num_mux_defs = 1;
12570 spec->input_mux = &spec->private_imux;
12571 /* set default input source */
12572 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12573 0, AC_VERB_SET_CONNECT_SEL,
12574 spec->input_mux->items[0].index);
12576 err = alc_auto_add_mic_boost(codec);
12580 if (!spec->cap_mixer)
12581 set_capture_mixer(spec);
12583 store_pin_configs(codec);
12587 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12588 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12589 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12592 /* init callback for auto-configuration model -- overriding the default init */
12593 static void alc269_auto_init(struct hda_codec *codec)
12595 struct alc_spec *spec = codec->spec;
12596 alc269_auto_init_multi_out(codec);
12597 alc269_auto_init_hp_out(codec);
12598 alc269_auto_init_analog_input(codec);
12599 if (spec->unsol_event)
12600 alc_inithook(codec);
12604 * configuration and preset
12606 static const char *alc269_models[ALC269_MODEL_LAST] = {
12607 [ALC269_BASIC] = "basic",
12608 [ALC269_QUANTA_FL1] = "quanta",
12609 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12610 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12611 [ALC269_FUJITSU] = "fujitsu",
12612 [ALC269_LIFEBOOK] = "lifebook"
12615 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12616 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12617 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12618 ALC269_ASUS_EEEPC_P703),
12619 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12620 ALC269_ASUS_EEEPC_P901),
12621 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12622 ALC269_ASUS_EEEPC_P901),
12623 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12624 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12628 static struct alc_config_preset alc269_presets[] = {
12630 .mixers = { alc269_base_mixer },
12631 .init_verbs = { alc269_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_capture_source,
12639 [ALC269_QUANTA_FL1] = {
12640 .mixers = { alc269_quanta_fl1_mixer },
12641 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12642 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12643 .dac_nids = alc269_dac_nids,
12645 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12646 .channel_mode = alc269_modes,
12647 .input_mux = &alc269_capture_source,
12648 .unsol_event = alc269_quanta_fl1_unsol_event,
12649 .init_hook = alc269_quanta_fl1_init_hook,
12651 [ALC269_ASUS_EEEPC_P703] = {
12652 .mixers = { alc269_eeepc_mixer },
12653 .cap_mixer = alc269_epc_capture_mixer,
12654 .init_verbs = { alc269_init_verbs,
12655 alc269_eeepc_amic_init_verbs },
12656 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12657 .dac_nids = alc269_dac_nids,
12659 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12660 .channel_mode = alc269_modes,
12661 .input_mux = &alc269_eeepc_amic_capture_source,
12662 .unsol_event = alc269_eeepc_amic_unsol_event,
12663 .init_hook = alc269_eeepc_amic_inithook,
12665 [ALC269_ASUS_EEEPC_P901] = {
12666 .mixers = { alc269_eeepc_mixer },
12667 .cap_mixer = alc269_epc_capture_mixer,
12668 .init_verbs = { alc269_init_verbs,
12669 alc269_eeepc_dmic_init_verbs },
12670 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12671 .dac_nids = alc269_dac_nids,
12673 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12674 .channel_mode = alc269_modes,
12675 .input_mux = &alc269_eeepc_dmic_capture_source,
12676 .unsol_event = alc269_eeepc_dmic_unsol_event,
12677 .init_hook = alc269_eeepc_dmic_inithook,
12679 [ALC269_FUJITSU] = {
12680 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12681 .cap_mixer = alc269_epc_capture_mixer,
12682 .init_verbs = { alc269_init_verbs,
12683 alc269_eeepc_dmic_init_verbs },
12684 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12685 .dac_nids = alc269_dac_nids,
12687 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12688 .channel_mode = alc269_modes,
12689 .input_mux = &alc269_eeepc_dmic_capture_source,
12690 .unsol_event = alc269_eeepc_dmic_unsol_event,
12691 .init_hook = alc269_eeepc_dmic_inithook,
12693 [ALC269_LIFEBOOK] = {
12694 .mixers = { alc269_lifebook_mixer },
12695 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12696 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12697 .dac_nids = alc269_dac_nids,
12699 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12700 .channel_mode = alc269_modes,
12701 .input_mux = &alc269_capture_source,
12702 .unsol_event = alc269_lifebook_unsol_event,
12703 .init_hook = alc269_lifebook_init_hook,
12707 static int patch_alc269(struct hda_codec *codec)
12709 struct alc_spec *spec;
12713 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12717 codec->spec = spec;
12719 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12721 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12725 if (board_config < 0) {
12726 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12727 "trying auto-probe from BIOS...\n");
12728 board_config = ALC269_AUTO;
12731 if (board_config == ALC269_AUTO) {
12732 /* automatic parse from the BIOS config */
12733 err = alc269_parse_auto_config(codec);
12739 "hda_codec: Cannot set up configuration "
12740 "from BIOS. Using base mode...\n");
12741 board_config = ALC269_BASIC;
12745 if (board_config != ALC269_AUTO)
12746 setup_preset(spec, &alc269_presets[board_config]);
12748 spec->stream_name_analog = "ALC269 Analog";
12749 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12750 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12752 spec->stream_name_digital = "ALC269 Digital";
12753 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12754 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12756 spec->adc_nids = alc269_adc_nids;
12757 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12758 spec->capsrc_nids = alc269_capsrc_nids;
12759 if (!spec->cap_mixer)
12760 set_capture_mixer(spec);
12762 codec->patch_ops = alc_patch_ops;
12763 if (board_config == ALC269_AUTO)
12764 spec->init_hook = alc269_auto_init;
12765 #ifdef CONFIG_SND_HDA_POWER_SAVE
12766 if (!spec->loopback.amplist)
12767 spec->loopback.amplist = alc269_loopbacks;
12769 codec->proc_widget_hook = print_realtek_coef;
12775 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12779 * set the path ways for 2 channel output
12780 * need to set the codec line out and mic 1 pin widgets to inputs
12782 static struct hda_verb alc861_threestack_ch2_init[] = {
12783 /* set pin widget 1Ah (line in) for input */
12784 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12785 /* set pin widget 18h (mic1/2) for input, for mic also enable
12788 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12790 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12792 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12793 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12799 * need to set the codec line out and mic 1 pin widgets to outputs
12801 static struct hda_verb alc861_threestack_ch6_init[] = {
12802 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12803 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12804 /* set pin widget 18h (mic1) for output (CLFE)*/
12805 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12807 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12808 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12810 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12812 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12813 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12818 static struct hda_channel_mode alc861_threestack_modes[2] = {
12819 { 2, alc861_threestack_ch2_init },
12820 { 6, alc861_threestack_ch6_init },
12822 /* Set mic1 as input and unmute the mixer */
12823 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12824 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12825 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12828 /* Set mic1 as output and mute mixer */
12829 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12830 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12831 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12835 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12836 { 2, alc861_uniwill_m31_ch2_init },
12837 { 4, alc861_uniwill_m31_ch4_init },
12840 /* Set mic1 and line-in as input and unmute the mixer */
12841 static struct hda_verb alc861_asus_ch2_init[] = {
12842 /* set pin widget 1Ah (line in) for input */
12843 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12844 /* set pin widget 18h (mic1/2) for input, for mic also enable
12847 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12849 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12851 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12852 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12856 /* Set mic1 nad line-in as output and mute mixer */
12857 static struct hda_verb alc861_asus_ch6_init[] = {
12858 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12859 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12860 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12861 /* set pin widget 18h (mic1) for output (CLFE)*/
12862 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12863 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12864 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12865 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12867 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12869 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12870 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12875 static struct hda_channel_mode alc861_asus_modes[2] = {
12876 { 2, alc861_asus_ch2_init },
12877 { 6, alc861_asus_ch6_init },
12882 static struct snd_kcontrol_new alc861_base_mixer[] = {
12883 /* output mixer control */
12884 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12885 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12886 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12887 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12888 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12890 /*Input mixer control */
12891 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12892 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12893 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12894 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12895 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12896 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12898 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12905 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12906 /* output mixer control */
12907 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12908 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12909 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12910 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12911 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12913 /* Input mixer control */
12914 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12915 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12916 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12917 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12918 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12919 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12921 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12922 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12926 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12927 .name = "Channel Mode",
12928 .info = alc_ch_mode_info,
12929 .get = alc_ch_mode_get,
12930 .put = alc_ch_mode_put,
12931 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12936 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12937 /* output mixer control */
12938 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12939 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12940 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12945 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12946 /* output mixer control */
12947 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12948 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12949 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12950 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12951 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12953 /* Input mixer control */
12954 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12955 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
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("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12959 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12961 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12962 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12966 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12967 .name = "Channel Mode",
12968 .info = alc_ch_mode_info,
12969 .get = alc_ch_mode_get,
12970 .put = alc_ch_mode_put,
12971 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12976 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12977 /* output mixer control */
12978 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12979 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12980 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12981 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12982 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12984 /* Input mixer control */
12985 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12986 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12987 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12988 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12989 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12990 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12992 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12993 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12998 .name = "Channel Mode",
12999 .info = alc_ch_mode_info,
13000 .get = alc_ch_mode_get,
13001 .put = alc_ch_mode_put,
13002 .private_value = ARRAY_SIZE(alc861_asus_modes),
13007 /* additional mixer */
13008 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13009 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13010 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13011 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
13012 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
13017 * generic initialization of ADC, input mixers and output mixers
13019 static struct hda_verb alc861_base_init_verbs[] = {
13021 * Unmute ADC0 and set the default input to mic-in
13023 /* port-A for surround (rear panel) */
13024 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13025 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13026 /* port-B for mic-in (rear panel) with vref */
13027 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13028 /* port-C for line-in (rear panel) */
13029 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13030 /* port-D for Front */
13031 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13032 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13033 /* port-E for HP out (front panel) */
13034 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13035 /* route front PCM to HP */
13036 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13037 /* port-F for mic-in (front panel) with vref */
13038 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13039 /* port-G for CLFE (rear panel) */
13040 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13041 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13042 /* port-H for side (rear panel) */
13043 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13044 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13046 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13047 /* route front mic to ADC1*/
13048 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13049 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13051 /* Unmute DAC0~3 & spdif out*/
13052 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13053 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13054 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13055 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13058 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13059 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13060 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13061 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13062 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13064 /* Unmute Stereo Mixer 15 */
13065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13070 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13071 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13072 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13073 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13077 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13078 /* hp used DAC 3 (Front) */
13079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13080 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13085 static struct hda_verb alc861_threestack_init_verbs[] = {
13087 * Unmute ADC0 and set the default input to mic-in
13089 /* port-A for surround (rear panel) */
13090 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13091 /* port-B for mic-in (rear panel) with vref */
13092 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13093 /* port-C for line-in (rear panel) */
13094 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13095 /* port-D for Front */
13096 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13097 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13098 /* port-E for HP out (front panel) */
13099 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13100 /* route front PCM to HP */
13101 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13102 /* port-F for mic-in (front panel) with vref */
13103 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13104 /* port-G for CLFE (rear panel) */
13105 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13106 /* port-H for side (rear panel) */
13107 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13109 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13110 /* route front mic to ADC1*/
13111 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13112 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13113 /* Unmute DAC0~3 & spdif out*/
13114 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13115 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13116 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13117 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13120 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13121 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13122 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13123 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13124 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13126 /* Unmute Stereo Mixer 15 */
13127 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13128 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13130 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13132 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13133 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13134 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13135 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13136 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13137 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13138 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13139 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13140 /* hp used DAC 3 (Front) */
13141 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13142 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13146 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13148 * Unmute ADC0 and set the default input to mic-in
13150 /* port-A for surround (rear panel) */
13151 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13152 /* port-B for mic-in (rear panel) with vref */
13153 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13154 /* port-C for line-in (rear panel) */
13155 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13156 /* port-D for Front */
13157 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13158 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13159 /* port-E for HP out (front panel) */
13160 /* this has to be set to VREF80 */
13161 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13162 /* route front PCM to HP */
13163 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13164 /* port-F for mic-in (front panel) with vref */
13165 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13166 /* port-G for CLFE (rear panel) */
13167 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13168 /* port-H for side (rear panel) */
13169 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13171 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13172 /* route front mic to ADC1*/
13173 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13174 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13175 /* Unmute DAC0~3 & spdif out*/
13176 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13177 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13178 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13179 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13182 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13183 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13184 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13185 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13186 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13188 /* Unmute Stereo Mixer 15 */
13189 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13190 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13194 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13195 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13196 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13197 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13198 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13199 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13200 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13201 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13202 /* hp used DAC 3 (Front) */
13203 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13204 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13208 static struct hda_verb alc861_asus_init_verbs[] = {
13210 * Unmute ADC0 and set the default input to mic-in
13212 /* port-A for surround (rear panel)
13213 * according to codec#0 this is the HP jack
13215 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13216 /* route front PCM to HP */
13217 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13218 /* port-B for mic-in (rear panel) with vref */
13219 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13220 /* port-C for line-in (rear panel) */
13221 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13222 /* port-D for Front */
13223 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13224 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13225 /* port-E for HP out (front panel) */
13226 /* this has to be set to VREF80 */
13227 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13228 /* route front PCM to HP */
13229 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13230 /* port-F for mic-in (front panel) with vref */
13231 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13232 /* port-G for CLFE (rear panel) */
13233 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13234 /* port-H for side (rear panel) */
13235 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13237 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13238 /* route front mic to ADC1*/
13239 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13241 /* Unmute DAC0~3 & spdif out*/
13242 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13243 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13244 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13245 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13247 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13248 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13249 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13250 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13251 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13253 /* Unmute Stereo Mixer 15 */
13254 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13259 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13260 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13262 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13263 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13265 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13266 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13267 /* hp used DAC 3 (Front) */
13268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13269 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13273 /* additional init verbs for ASUS laptops */
13274 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13275 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13276 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13281 * generic initialization of ADC, input mixers and output mixers
13283 static struct hda_verb alc861_auto_init_verbs[] = {
13285 * Unmute ADC0 and set the default input to mic-in
13287 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13288 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13290 /* Unmute DAC0~3 & spdif out*/
13291 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13292 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13293 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13294 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13297 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13298 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13299 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13300 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13301 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13303 /* Unmute Stereo Mixer 15 */
13304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13309 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13310 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13311 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13312 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13313 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13314 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13315 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13316 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13318 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13321 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13322 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13323 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13324 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13325 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13327 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13332 static struct hda_verb alc861_toshiba_init_verbs[] = {
13333 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13338 /* toggle speaker-output according to the hp-jack state */
13339 static void alc861_toshiba_automute(struct hda_codec *codec)
13341 unsigned int present;
13343 present = snd_hda_codec_read(codec, 0x0f, 0,
13344 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13345 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13346 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13347 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13348 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13351 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13354 if ((res >> 26) == ALC880_HP_EVENT)
13355 alc861_toshiba_automute(codec);
13358 /* pcm configuration: identiacal with ALC880 */
13359 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13360 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13361 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13362 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13365 #define ALC861_DIGOUT_NID 0x07
13367 static struct hda_channel_mode alc861_8ch_modes[1] = {
13371 static hda_nid_t alc861_dac_nids[4] = {
13372 /* front, surround, clfe, side */
13373 0x03, 0x06, 0x05, 0x04
13376 static hda_nid_t alc660_dac_nids[3] = {
13377 /* front, clfe, surround */
13381 static hda_nid_t alc861_adc_nids[1] = {
13386 static struct hda_input_mux alc861_capture_source = {
13390 { "Front Mic", 0x3 },
13397 /* fill in the dac_nids table from the parsed pin configuration */
13398 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13399 const struct auto_pin_cfg *cfg)
13404 spec->multiout.dac_nids = spec->private_dac_nids;
13405 for (i = 0; i < cfg->line_outs; i++) {
13406 nid = cfg->line_out_pins[i];
13408 if (i >= ARRAY_SIZE(alc861_dac_nids))
13410 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13413 spec->multiout.num_dacs = cfg->line_outs;
13417 /* add playback controls from the parsed DAC table */
13418 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13419 const struct auto_pin_cfg *cfg)
13422 static const char *chname[4] = {
13423 "Front", "Surround", NULL /*CLFE*/, "Side"
13428 for (i = 0; i < cfg->line_outs; i++) {
13429 nid = spec->multiout.dac_nids[i];
13434 err = add_control(spec, ALC_CTL_BIND_MUTE,
13435 "Center Playback Switch",
13436 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13440 err = add_control(spec, ALC_CTL_BIND_MUTE,
13441 "LFE Playback Switch",
13442 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13447 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13449 if (nid == alc861_dac_nids[idx])
13451 sprintf(name, "%s Playback Switch", chname[idx]);
13452 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13453 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13462 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13470 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13472 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13473 "Headphone Playback Switch",
13474 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13477 spec->multiout.hp_nid = nid;
13482 /* create playback/capture controls for input pins */
13483 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13484 const struct auto_pin_cfg *cfg)
13486 struct hda_input_mux *imux = &spec->private_imux;
13487 int i, err, idx, idx1;
13489 for (i = 0; i < AUTO_PIN_LAST; i++) {
13490 switch (cfg->input_pins[i]) {
13493 idx = 2; /* Line In */
13497 idx = 2; /* Line In */
13501 idx = 1; /* Mic In */
13505 idx = 1; /* Mic In */
13515 err = new_analog_input(spec, cfg->input_pins[i],
13516 auto_pin_cfg_labels[i], idx, 0x15);
13520 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13521 imux->items[imux->num_items].index = idx1;
13527 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13529 int pin_type, int dac_idx)
13531 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13533 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13537 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13539 struct alc_spec *spec = codec->spec;
13542 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13543 for (i = 0; i < spec->autocfg.line_outs; i++) {
13544 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13545 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13547 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13548 spec->multiout.dac_nids[i]);
13552 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13554 struct alc_spec *spec = codec->spec;
13557 pin = spec->autocfg.hp_pins[0];
13558 if (pin) /* connect to front */
13559 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13560 spec->multiout.dac_nids[0]);
13561 pin = spec->autocfg.speaker_pins[0];
13563 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13566 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13568 struct alc_spec *spec = codec->spec;
13571 for (i = 0; i < AUTO_PIN_LAST; i++) {
13572 hda_nid_t nid = spec->autocfg.input_pins[i];
13573 if (nid >= 0x0c && nid <= 0x11) {
13574 snd_hda_codec_write(codec, nid, 0,
13575 AC_VERB_SET_PIN_WIDGET_CONTROL,
13576 i <= AUTO_PIN_FRONT_MIC ?
13577 PIN_VREF80 : PIN_IN);
13582 /* parse the BIOS configuration and set up the alc_spec */
13583 /* return 1 if successful, 0 if the proper config is not found,
13584 * or a negative error code
13586 static int alc861_parse_auto_config(struct hda_codec *codec)
13588 struct alc_spec *spec = codec->spec;
13590 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13592 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13596 if (!spec->autocfg.line_outs)
13597 return 0; /* can't find valid BIOS pin config */
13599 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13602 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13605 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13608 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13612 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13614 if (spec->autocfg.dig_out_pin)
13615 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13617 if (spec->kctls.list)
13618 add_mixer(spec, spec->kctls.list);
13620 add_verb(spec, alc861_auto_init_verbs);
13622 spec->num_mux_defs = 1;
13623 spec->input_mux = &spec->private_imux;
13625 spec->adc_nids = alc861_adc_nids;
13626 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13627 set_capture_mixer(spec);
13629 store_pin_configs(codec);
13633 /* additional initialization for auto-configuration model */
13634 static void alc861_auto_init(struct hda_codec *codec)
13636 struct alc_spec *spec = codec->spec;
13637 alc861_auto_init_multi_out(codec);
13638 alc861_auto_init_hp_out(codec);
13639 alc861_auto_init_analog_input(codec);
13640 if (spec->unsol_event)
13641 alc_inithook(codec);
13644 #ifdef CONFIG_SND_HDA_POWER_SAVE
13645 static struct hda_amp_list alc861_loopbacks[] = {
13646 { 0x15, HDA_INPUT, 0 },
13647 { 0x15, HDA_INPUT, 1 },
13648 { 0x15, HDA_INPUT, 2 },
13649 { 0x15, HDA_INPUT, 3 },
13656 * configuration and preset
13658 static const char *alc861_models[ALC861_MODEL_LAST] = {
13659 [ALC861_3ST] = "3stack",
13660 [ALC660_3ST] = "3stack-660",
13661 [ALC861_3ST_DIG] = "3stack-dig",
13662 [ALC861_6ST_DIG] = "6stack-dig",
13663 [ALC861_UNIWILL_M31] = "uniwill-m31",
13664 [ALC861_TOSHIBA] = "toshiba",
13665 [ALC861_ASUS] = "asus",
13666 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13667 [ALC861_AUTO] = "auto",
13670 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13671 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13672 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13673 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13674 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13675 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13676 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13677 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13678 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13679 * Any other models that need this preset?
13681 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13682 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13683 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13684 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13685 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13686 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13687 /* FIXME: the below seems conflict */
13688 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13689 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13690 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13694 static struct alc_config_preset alc861_presets[] = {
13696 .mixers = { alc861_3ST_mixer },
13697 .init_verbs = { alc861_threestack_init_verbs },
13698 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13699 .dac_nids = alc861_dac_nids,
13700 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13701 .channel_mode = alc861_threestack_modes,
13703 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13704 .adc_nids = alc861_adc_nids,
13705 .input_mux = &alc861_capture_source,
13707 [ALC861_3ST_DIG] = {
13708 .mixers = { alc861_base_mixer },
13709 .init_verbs = { alc861_threestack_init_verbs },
13710 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13711 .dac_nids = alc861_dac_nids,
13712 .dig_out_nid = ALC861_DIGOUT_NID,
13713 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13714 .channel_mode = alc861_threestack_modes,
13716 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13717 .adc_nids = alc861_adc_nids,
13718 .input_mux = &alc861_capture_source,
13720 [ALC861_6ST_DIG] = {
13721 .mixers = { alc861_base_mixer },
13722 .init_verbs = { alc861_base_init_verbs },
13723 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13724 .dac_nids = alc861_dac_nids,
13725 .dig_out_nid = ALC861_DIGOUT_NID,
13726 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13727 .channel_mode = alc861_8ch_modes,
13728 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13729 .adc_nids = alc861_adc_nids,
13730 .input_mux = &alc861_capture_source,
13733 .mixers = { alc861_3ST_mixer },
13734 .init_verbs = { alc861_threestack_init_verbs },
13735 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13736 .dac_nids = alc660_dac_nids,
13737 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13738 .channel_mode = alc861_threestack_modes,
13740 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13741 .adc_nids = alc861_adc_nids,
13742 .input_mux = &alc861_capture_source,
13744 [ALC861_UNIWILL_M31] = {
13745 .mixers = { alc861_uniwill_m31_mixer },
13746 .init_verbs = { alc861_uniwill_m31_init_verbs },
13747 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13748 .dac_nids = alc861_dac_nids,
13749 .dig_out_nid = ALC861_DIGOUT_NID,
13750 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13751 .channel_mode = alc861_uniwill_m31_modes,
13753 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13754 .adc_nids = alc861_adc_nids,
13755 .input_mux = &alc861_capture_source,
13757 [ALC861_TOSHIBA] = {
13758 .mixers = { alc861_toshiba_mixer },
13759 .init_verbs = { alc861_base_init_verbs,
13760 alc861_toshiba_init_verbs },
13761 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13762 .dac_nids = alc861_dac_nids,
13763 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13764 .channel_mode = alc883_3ST_2ch_modes,
13765 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13766 .adc_nids = alc861_adc_nids,
13767 .input_mux = &alc861_capture_source,
13768 .unsol_event = alc861_toshiba_unsol_event,
13769 .init_hook = alc861_toshiba_automute,
13772 .mixers = { alc861_asus_mixer },
13773 .init_verbs = { alc861_asus_init_verbs },
13774 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13775 .dac_nids = alc861_dac_nids,
13776 .dig_out_nid = ALC861_DIGOUT_NID,
13777 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13778 .channel_mode = alc861_asus_modes,
13781 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13782 .adc_nids = alc861_adc_nids,
13783 .input_mux = &alc861_capture_source,
13785 [ALC861_ASUS_LAPTOP] = {
13786 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13787 .init_verbs = { alc861_asus_init_verbs,
13788 alc861_asus_laptop_init_verbs },
13789 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13790 .dac_nids = alc861_dac_nids,
13791 .dig_out_nid = ALC861_DIGOUT_NID,
13792 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13793 .channel_mode = alc883_3ST_2ch_modes,
13795 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13796 .adc_nids = alc861_adc_nids,
13797 .input_mux = &alc861_capture_source,
13802 static int patch_alc861(struct hda_codec *codec)
13804 struct alc_spec *spec;
13808 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13812 codec->spec = spec;
13814 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13818 if (board_config < 0) {
13819 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13820 "trying auto-probe from BIOS...\n");
13821 board_config = ALC861_AUTO;
13824 if (board_config == ALC861_AUTO) {
13825 /* automatic parse from the BIOS config */
13826 err = alc861_parse_auto_config(codec);
13832 "hda_codec: Cannot set up configuration "
13833 "from BIOS. Using base mode...\n");
13834 board_config = ALC861_3ST_DIG;
13838 if (board_config != ALC861_AUTO)
13839 setup_preset(spec, &alc861_presets[board_config]);
13841 spec->stream_name_analog = "ALC861 Analog";
13842 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13843 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13845 spec->stream_name_digital = "ALC861 Digital";
13846 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13847 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13849 spec->vmaster_nid = 0x03;
13851 codec->patch_ops = alc_patch_ops;
13852 if (board_config == ALC861_AUTO)
13853 spec->init_hook = alc861_auto_init;
13854 #ifdef CONFIG_SND_HDA_POWER_SAVE
13855 if (!spec->loopback.amplist)
13856 spec->loopback.amplist = alc861_loopbacks;
13858 codec->proc_widget_hook = print_realtek_coef;
13864 * ALC861-VD support
13868 * In addition, an independent DAC
13870 #define ALC861VD_DIGOUT_NID 0x06
13872 static hda_nid_t alc861vd_dac_nids[4] = {
13873 /* front, surr, clfe, side surr */
13874 0x02, 0x03, 0x04, 0x05
13877 /* dac_nids for ALC660vd are in a different order - according to
13878 * Realtek's driver.
13879 * This should probably tesult in a different mixer for 6stack models
13880 * of ALC660vd codecs, but for now there is only 3stack mixer
13881 * - and it is the same as in 861vd.
13882 * adc_nids in ALC660vd are (is) the same as in 861vd
13884 static hda_nid_t alc660vd_dac_nids[3] = {
13885 /* front, rear, clfe, rear_surr */
13889 static hda_nid_t alc861vd_adc_nids[1] = {
13894 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13897 /* FIXME: should be a matrix-type input source selection */
13898 static struct hda_input_mux alc861vd_capture_source = {
13902 { "Front Mic", 0x1 },
13908 static struct hda_input_mux alc861vd_dallas_capture_source = {
13911 { "Ext Mic", 0x0 },
13912 { "Int Mic", 0x1 },
13916 static struct hda_input_mux alc861vd_hp_capture_source = {
13919 { "Front Mic", 0x0 },
13920 { "ATAPI Mic", 0x1 },
13927 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13934 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13935 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13936 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13937 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13938 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13945 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13946 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13947 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13948 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13949 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13953 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13954 { 6, alc861vd_6stack_ch6_init },
13955 { 8, alc861vd_6stack_ch8_init },
13958 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13961 .name = "Channel Mode",
13962 .info = alc_ch_mode_info,
13963 .get = alc_ch_mode_get,
13964 .put = alc_ch_mode_put,
13969 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13970 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13972 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13973 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13974 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13976 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13977 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13979 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13981 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13983 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13984 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13986 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13987 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13991 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13995 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13996 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13999 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14000 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14005 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14006 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14011 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14012 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14013 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14015 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14017 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14019 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14021 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14022 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14023 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14026 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14028 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14029 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14031 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14032 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14037 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14038 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14039 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14040 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14044 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14046 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14048 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14049 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14050 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14052 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14053 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14058 /* Pin assignment: Speaker=0x14, HP = 0x15,
14059 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14061 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14062 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14063 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14064 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14065 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14066 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14067 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14068 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14069 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14070 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14071 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14072 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
14073 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
14077 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14078 * Front Mic=0x18, ATAPI Mic = 0x19,
14080 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14081 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14082 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14083 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14084 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14085 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14086 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14087 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14088 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14094 * generic initialization of ADC, input mixers and output mixers
14096 static struct hda_verb alc861vd_volume_init_verbs[] = {
14098 * Unmute ADC0 and set the default input to mic-in
14100 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14101 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14103 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14104 * the analog-loopback mixer widget
14106 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14113 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14115 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14120 * Set up output mixers (0x02 - 0x05)
14122 /* set vol=0 to output mixers */
14123 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14124 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14125 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14126 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14128 /* set up input amps for analog loopback */
14129 /* Amp Indices: DAC = 0, mixer = 1 */
14130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14132 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14133 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14134 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14135 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14136 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14137 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14143 * 3-stack pin configuration:
14144 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14146 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14148 * Set pin mode and muting
14150 /* set front pin widgets 0x14 for output */
14151 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14152 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14153 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14155 /* Mic (rear) pin: input vref at 80% */
14156 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14157 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14158 /* Front Mic pin: input vref at 80% */
14159 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14160 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14161 /* Line In pin: input */
14162 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14163 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14164 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14165 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14166 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14167 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14168 /* CD pin widget for input */
14169 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14175 * 6-stack pin configuration:
14177 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14179 * Set pin mode and muting
14181 /* set front pin widgets 0x14 for output */
14182 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14183 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14184 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14186 /* Rear Pin: output 1 (0x0d) */
14187 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14188 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14189 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14190 /* CLFE Pin: output 2 (0x0e) */
14191 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14192 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14193 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14194 /* Side Pin: output 3 (0x0f) */
14195 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14196 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14197 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14199 /* Mic (rear) pin: input vref at 80% */
14200 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14201 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14202 /* Front Mic pin: input vref at 80% */
14203 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14204 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14205 /* Line In pin: input */
14206 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14207 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14208 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14209 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14210 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14211 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14212 /* CD pin widget for input */
14213 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14218 static struct hda_verb alc861vd_eapd_verbs[] = {
14219 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14223 static struct hda_verb alc660vd_eapd_verbs[] = {
14224 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14225 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14229 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14231 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14233 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14234 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14238 /* toggle speaker-output according to the hp-jack state */
14239 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14241 unsigned int present;
14242 unsigned char bits;
14244 present = snd_hda_codec_read(codec, 0x1b, 0,
14245 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14246 bits = present ? HDA_AMP_MUTE : 0;
14247 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14248 HDA_AMP_MUTE, bits);
14251 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14253 unsigned int present;
14254 unsigned char bits;
14256 present = snd_hda_codec_read(codec, 0x18, 0,
14257 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14258 bits = present ? HDA_AMP_MUTE : 0;
14259 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14260 HDA_AMP_MUTE, bits);
14263 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14265 alc861vd_lenovo_hp_automute(codec);
14266 alc861vd_lenovo_mic_automute(codec);
14269 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14272 switch (res >> 26) {
14273 case ALC880_HP_EVENT:
14274 alc861vd_lenovo_hp_automute(codec);
14276 case ALC880_MIC_EVENT:
14277 alc861vd_lenovo_mic_automute(codec);
14282 static struct hda_verb alc861vd_dallas_verbs[] = {
14283 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14284 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14285 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14286 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14290 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14291 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14293 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14294 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14295 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14297 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14298 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14300 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14301 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14302 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14303 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14304 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14306 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14307 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14308 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14309 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14310 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14311 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14312 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14313 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14320 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14321 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14322 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14327 /* toggle speaker-output according to the hp-jack state */
14328 static void alc861vd_dallas_automute(struct hda_codec *codec)
14330 unsigned int present;
14332 present = snd_hda_codec_read(codec, 0x15, 0,
14333 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14334 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14335 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14338 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14340 if ((res >> 26) == ALC880_HP_EVENT)
14341 alc861vd_dallas_automute(codec);
14344 #ifdef CONFIG_SND_HDA_POWER_SAVE
14345 #define alc861vd_loopbacks alc880_loopbacks
14348 /* pcm configuration: identiacal with ALC880 */
14349 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14350 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14351 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14352 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14355 * configuration and preset
14357 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14358 [ALC660VD_3ST] = "3stack-660",
14359 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14360 [ALC660VD_ASUS_V1S] = "asus-v1s",
14361 [ALC861VD_3ST] = "3stack",
14362 [ALC861VD_3ST_DIG] = "3stack-digout",
14363 [ALC861VD_6ST_DIG] = "6stack-digout",
14364 [ALC861VD_LENOVO] = "lenovo",
14365 [ALC861VD_DALLAS] = "dallas",
14366 [ALC861VD_HP] = "hp",
14367 [ALC861VD_AUTO] = "auto",
14370 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14371 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14372 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14373 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14374 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14375 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14376 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14377 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14378 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14379 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14380 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14381 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14382 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14383 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14384 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14385 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14386 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14387 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14391 static struct alc_config_preset alc861vd_presets[] = {
14393 .mixers = { alc861vd_3st_mixer },
14394 .init_verbs = { alc861vd_volume_init_verbs,
14395 alc861vd_3stack_init_verbs },
14396 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14397 .dac_nids = alc660vd_dac_nids,
14398 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14399 .channel_mode = alc861vd_3stack_2ch_modes,
14400 .input_mux = &alc861vd_capture_source,
14402 [ALC660VD_3ST_DIG] = {
14403 .mixers = { alc861vd_3st_mixer },
14404 .init_verbs = { alc861vd_volume_init_verbs,
14405 alc861vd_3stack_init_verbs },
14406 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14407 .dac_nids = alc660vd_dac_nids,
14408 .dig_out_nid = ALC861VD_DIGOUT_NID,
14409 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14410 .channel_mode = alc861vd_3stack_2ch_modes,
14411 .input_mux = &alc861vd_capture_source,
14414 .mixers = { alc861vd_3st_mixer },
14415 .init_verbs = { alc861vd_volume_init_verbs,
14416 alc861vd_3stack_init_verbs },
14417 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14418 .dac_nids = alc861vd_dac_nids,
14419 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14420 .channel_mode = alc861vd_3stack_2ch_modes,
14421 .input_mux = &alc861vd_capture_source,
14423 [ALC861VD_3ST_DIG] = {
14424 .mixers = { alc861vd_3st_mixer },
14425 .init_verbs = { alc861vd_volume_init_verbs,
14426 alc861vd_3stack_init_verbs },
14427 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14428 .dac_nids = alc861vd_dac_nids,
14429 .dig_out_nid = ALC861VD_DIGOUT_NID,
14430 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14431 .channel_mode = alc861vd_3stack_2ch_modes,
14432 .input_mux = &alc861vd_capture_source,
14434 [ALC861VD_6ST_DIG] = {
14435 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14436 .init_verbs = { alc861vd_volume_init_verbs,
14437 alc861vd_6stack_init_verbs },
14438 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14439 .dac_nids = alc861vd_dac_nids,
14440 .dig_out_nid = ALC861VD_DIGOUT_NID,
14441 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14442 .channel_mode = alc861vd_6stack_modes,
14443 .input_mux = &alc861vd_capture_source,
14445 [ALC861VD_LENOVO] = {
14446 .mixers = { alc861vd_lenovo_mixer },
14447 .init_verbs = { alc861vd_volume_init_verbs,
14448 alc861vd_3stack_init_verbs,
14449 alc861vd_eapd_verbs,
14450 alc861vd_lenovo_unsol_verbs },
14451 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14452 .dac_nids = alc660vd_dac_nids,
14453 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14454 .channel_mode = alc861vd_3stack_2ch_modes,
14455 .input_mux = &alc861vd_capture_source,
14456 .unsol_event = alc861vd_lenovo_unsol_event,
14457 .init_hook = alc861vd_lenovo_automute,
14459 [ALC861VD_DALLAS] = {
14460 .mixers = { alc861vd_dallas_mixer },
14461 .init_verbs = { alc861vd_dallas_verbs },
14462 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14463 .dac_nids = alc861vd_dac_nids,
14464 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14465 .channel_mode = alc861vd_3stack_2ch_modes,
14466 .input_mux = &alc861vd_dallas_capture_source,
14467 .unsol_event = alc861vd_dallas_unsol_event,
14468 .init_hook = alc861vd_dallas_automute,
14471 .mixers = { alc861vd_hp_mixer },
14472 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14473 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14474 .dac_nids = alc861vd_dac_nids,
14475 .dig_out_nid = ALC861VD_DIGOUT_NID,
14476 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14477 .channel_mode = alc861vd_3stack_2ch_modes,
14478 .input_mux = &alc861vd_hp_capture_source,
14479 .unsol_event = alc861vd_dallas_unsol_event,
14480 .init_hook = alc861vd_dallas_automute,
14482 [ALC660VD_ASUS_V1S] = {
14483 .mixers = { alc861vd_lenovo_mixer },
14484 .init_verbs = { alc861vd_volume_init_verbs,
14485 alc861vd_3stack_init_verbs,
14486 alc861vd_eapd_verbs,
14487 alc861vd_lenovo_unsol_verbs },
14488 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14489 .dac_nids = alc660vd_dac_nids,
14490 .dig_out_nid = ALC861VD_DIGOUT_NID,
14491 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14492 .channel_mode = alc861vd_3stack_2ch_modes,
14493 .input_mux = &alc861vd_capture_source,
14494 .unsol_event = alc861vd_lenovo_unsol_event,
14495 .init_hook = alc861vd_lenovo_automute,
14500 * BIOS auto configuration
14502 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14503 hda_nid_t nid, int pin_type, int dac_idx)
14505 alc_set_pin_output(codec, nid, pin_type);
14508 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14510 struct alc_spec *spec = codec->spec;
14513 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14514 for (i = 0; i <= HDA_SIDE; i++) {
14515 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14516 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14518 alc861vd_auto_set_output_and_unmute(codec, nid,
14524 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14526 struct alc_spec *spec = codec->spec;
14529 pin = spec->autocfg.hp_pins[0];
14530 if (pin) /* connect to front and use dac 0 */
14531 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14532 pin = spec->autocfg.speaker_pins[0];
14534 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14537 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14538 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14540 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14542 struct alc_spec *spec = codec->spec;
14545 for (i = 0; i < AUTO_PIN_LAST; i++) {
14546 hda_nid_t nid = spec->autocfg.input_pins[i];
14547 if (alc861vd_is_input_pin(nid)) {
14548 snd_hda_codec_write(codec, nid, 0,
14549 AC_VERB_SET_PIN_WIDGET_CONTROL,
14550 i <= AUTO_PIN_FRONT_MIC ?
14551 PIN_VREF80 : PIN_IN);
14552 if (nid != ALC861VD_PIN_CD_NID)
14553 snd_hda_codec_write(codec, nid, 0,
14554 AC_VERB_SET_AMP_GAIN_MUTE,
14560 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14562 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14563 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14565 /* add playback controls from the parsed DAC table */
14566 /* Based on ALC880 version. But ALC861VD has separate,
14567 * different NIDs for mute/unmute switch and volume control */
14568 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14569 const struct auto_pin_cfg *cfg)
14572 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14573 hda_nid_t nid_v, nid_s;
14576 for (i = 0; i < cfg->line_outs; i++) {
14577 if (!spec->multiout.dac_nids[i])
14579 nid_v = alc861vd_idx_to_mixer_vol(
14581 spec->multiout.dac_nids[i]));
14582 nid_s = alc861vd_idx_to_mixer_switch(
14584 spec->multiout.dac_nids[i]));
14588 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14589 "Center Playback Volume",
14590 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14594 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14595 "LFE Playback Volume",
14596 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14600 err = add_control(spec, ALC_CTL_BIND_MUTE,
14601 "Center Playback Switch",
14602 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14606 err = add_control(spec, ALC_CTL_BIND_MUTE,
14607 "LFE Playback Switch",
14608 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14613 sprintf(name, "%s Playback Volume", chname[i]);
14614 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14615 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14619 sprintf(name, "%s Playback Switch", chname[i]);
14620 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14621 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14630 /* add playback controls for speaker and HP outputs */
14631 /* Based on ALC880 version. But ALC861VD has separate,
14632 * different NIDs for mute/unmute switch and volume control */
14633 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14634 hda_nid_t pin, const char *pfx)
14636 hda_nid_t nid_v, nid_s;
14643 if (alc880_is_fixed_pin(pin)) {
14644 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14645 /* specify the DAC as the extra output */
14646 if (!spec->multiout.hp_nid)
14647 spec->multiout.hp_nid = nid_v;
14649 spec->multiout.extra_out_nid[0] = nid_v;
14650 /* control HP volume/switch on the output mixer amp */
14651 nid_v = alc861vd_idx_to_mixer_vol(
14652 alc880_fixed_pin_idx(pin));
14653 nid_s = alc861vd_idx_to_mixer_switch(
14654 alc880_fixed_pin_idx(pin));
14656 sprintf(name, "%s Playback Volume", pfx);
14657 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14658 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14661 sprintf(name, "%s Playback Switch", pfx);
14662 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14663 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14666 } else if (alc880_is_multi_pin(pin)) {
14667 /* set manual connection */
14668 /* we have only a switch on HP-out PIN */
14669 sprintf(name, "%s Playback Switch", pfx);
14670 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14671 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14678 /* parse the BIOS configuration and set up the alc_spec
14679 * return 1 if successful, 0 if the proper config is not found,
14680 * or a negative error code
14681 * Based on ALC880 version - had to change it to override
14682 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14683 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14685 struct alc_spec *spec = codec->spec;
14687 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14689 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14693 if (!spec->autocfg.line_outs)
14694 return 0; /* can't find valid BIOS pin config */
14696 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14699 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14702 err = alc861vd_auto_create_extra_out(spec,
14703 spec->autocfg.speaker_pins[0],
14707 err = alc861vd_auto_create_extra_out(spec,
14708 spec->autocfg.hp_pins[0],
14712 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14716 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14718 if (spec->autocfg.dig_out_pin)
14719 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14721 if (spec->kctls.list)
14722 add_mixer(spec, spec->kctls.list);
14724 add_verb(spec, alc861vd_volume_init_verbs);
14726 spec->num_mux_defs = 1;
14727 spec->input_mux = &spec->private_imux;
14729 err = alc_auto_add_mic_boost(codec);
14733 store_pin_configs(codec);
14737 /* additional initialization for auto-configuration model */
14738 static void alc861vd_auto_init(struct hda_codec *codec)
14740 struct alc_spec *spec = codec->spec;
14741 alc861vd_auto_init_multi_out(codec);
14742 alc861vd_auto_init_hp_out(codec);
14743 alc861vd_auto_init_analog_input(codec);
14744 alc861vd_auto_init_input_src(codec);
14745 if (spec->unsol_event)
14746 alc_inithook(codec);
14749 static int patch_alc861vd(struct hda_codec *codec)
14751 struct alc_spec *spec;
14752 int err, board_config;
14754 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14758 codec->spec = spec;
14760 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14764 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14765 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14766 "ALC861VD, trying auto-probe from BIOS...\n");
14767 board_config = ALC861VD_AUTO;
14770 if (board_config == ALC861VD_AUTO) {
14771 /* automatic parse from the BIOS config */
14772 err = alc861vd_parse_auto_config(codec);
14778 "hda_codec: Cannot set up configuration "
14779 "from BIOS. Using base mode...\n");
14780 board_config = ALC861VD_3ST;
14784 if (board_config != ALC861VD_AUTO)
14785 setup_preset(spec, &alc861vd_presets[board_config]);
14787 if (codec->vendor_id == 0x10ec0660) {
14788 spec->stream_name_analog = "ALC660-VD Analog";
14789 spec->stream_name_digital = "ALC660-VD Digital";
14790 /* always turn on EAPD */
14791 add_verb(spec, alc660vd_eapd_verbs);
14793 spec->stream_name_analog = "ALC861VD Analog";
14794 spec->stream_name_digital = "ALC861VD Digital";
14797 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14798 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14800 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14801 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14803 spec->adc_nids = alc861vd_adc_nids;
14804 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14805 spec->capsrc_nids = alc861vd_capsrc_nids;
14806 spec->is_mix_capture = 1;
14808 set_capture_mixer(spec);
14810 spec->vmaster_nid = 0x02;
14812 codec->patch_ops = alc_patch_ops;
14814 if (board_config == ALC861VD_AUTO)
14815 spec->init_hook = alc861vd_auto_init;
14816 #ifdef CONFIG_SND_HDA_POWER_SAVE
14817 if (!spec->loopback.amplist)
14818 spec->loopback.amplist = alc861vd_loopbacks;
14820 codec->proc_widget_hook = print_realtek_coef;
14828 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14829 * configuration. Each pin widget can choose any input DACs and a mixer.
14830 * Each ADC is connected from a mixer of all inputs. This makes possible
14831 * 6-channel independent captures.
14833 * In addition, an independent DAC for the multi-playback (not used in this
14836 #define ALC662_DIGOUT_NID 0x06
14837 #define ALC662_DIGIN_NID 0x0a
14839 static hda_nid_t alc662_dac_nids[4] = {
14840 /* front, rear, clfe, rear_surr */
14844 static hda_nid_t alc662_adc_nids[1] = {
14849 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14852 /* FIXME: should be a matrix-type input source selection */
14853 static struct hda_input_mux alc662_capture_source = {
14857 { "Front Mic", 0x1 },
14863 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14871 static struct hda_input_mux alc662_eeepc_capture_source = {
14879 static struct hda_input_mux alc663_capture_source = {
14883 { "Front Mic", 0x1 },
14888 static struct hda_input_mux alc663_m51va_capture_source = {
14891 { "Ext-Mic", 0x0 },
14899 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14906 static struct hda_verb alc662_3ST_ch2_init[] = {
14907 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14908 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14909 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14910 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14917 static struct hda_verb alc662_3ST_ch6_init[] = {
14918 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14919 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14920 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14921 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14922 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14923 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14927 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14928 { 2, alc662_3ST_ch2_init },
14929 { 6, alc662_3ST_ch6_init },
14935 static struct hda_verb alc662_sixstack_ch6_init[] = {
14936 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14937 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14938 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14945 static struct hda_verb alc662_sixstack_ch8_init[] = {
14946 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14947 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14948 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14952 static struct hda_channel_mode alc662_5stack_modes[2] = {
14953 { 2, alc662_sixstack_ch6_init },
14954 { 6, alc662_sixstack_ch8_init },
14957 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14958 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14961 static struct snd_kcontrol_new alc662_base_mixer[] = {
14962 /* output mixer control */
14963 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14964 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14965 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14966 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14967 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14968 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14969 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14970 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14971 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14973 /*Input mixer control */
14974 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14975 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14976 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14977 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14978 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14979 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14980 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14981 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14985 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14986 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14987 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14997 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14998 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15002 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15003 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15004 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15005 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15006 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15007 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15008 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15009 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15010 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15012 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15013 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15014 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15015 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15017 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15018 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15019 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15020 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
15021 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15025 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15026 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15027 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15028 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15029 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15031 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15032 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15038 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15039 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15041 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15042 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15044 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15045 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15046 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15048 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15049 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15050 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15054 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15055 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15056 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15057 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15058 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15059 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15060 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15061 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15062 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15063 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15064 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15065 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15066 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15072 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15073 .ops = &snd_hda_bind_vol,
15075 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15076 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15081 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15082 .ops = &snd_hda_bind_sw,
15084 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15085 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15090 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15091 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15092 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15094 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15098 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15099 .ops = &snd_hda_bind_sw,
15101 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15102 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15103 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15108 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15109 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15110 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15113 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15114 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15119 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15120 .ops = &snd_hda_bind_sw,
15122 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15123 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15124 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15129 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15130 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15131 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15134 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15135 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15139 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15140 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15141 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15142 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15145 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15146 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15150 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15151 .ops = &snd_hda_bind_vol,
15153 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15154 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15159 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15160 .ops = &snd_hda_bind_sw,
15162 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15163 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15168 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15169 HDA_BIND_VOL("Master Playback Volume",
15170 &alc663_asus_two_bind_master_vol),
15171 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15172 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15174 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15179 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15180 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15181 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15189 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15190 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15191 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15192 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15193 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15194 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15198 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15199 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15203 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15204 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15205 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15210 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15211 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15212 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15213 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15217 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15220 .name = "Channel Mode",
15221 .info = alc_ch_mode_info,
15222 .get = alc_ch_mode_get,
15223 .put = alc_ch_mode_put,
15228 static struct hda_verb alc662_init_verbs[] = {
15229 /* ADC: mute amp left and right */
15230 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15231 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15232 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15238 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15240 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15247 /* Front Pin: output 0 (0x0c) */
15248 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15249 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15251 /* Rear Pin: output 1 (0x0d) */
15252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15255 /* CLFE Pin: output 2 (0x0e) */
15256 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15257 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15259 /* Mic (rear) pin: input vref at 80% */
15260 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15261 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15262 /* Front Mic pin: input vref at 80% */
15263 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15264 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15265 /* Line In pin: input */
15266 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15268 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15269 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15270 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15271 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15272 /* CD pin widget for input */
15273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15275 /* FIXME: use matrix-type input source selection */
15276 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15278 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15279 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15280 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15281 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15286 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15288 /* always trun on EAPD */
15289 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15290 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15295 static struct hda_verb alc662_sue_init_verbs[] = {
15296 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15297 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15301 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15302 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15303 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15307 /* Set Unsolicited Event*/
15308 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15309 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15310 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15315 * generic initialization of ADC, input mixers and output mixers
15317 static struct hda_verb alc662_auto_init_verbs[] = {
15319 * Unmute ADC and set the default input to mic-in
15321 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15322 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15324 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15326 * Note: PASD motherboards uses the Line In 2 as the input for front
15327 * panel mic (mic 2)
15329 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15332 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15333 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15334 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15337 * Set up output mixers (0x0c - 0x0f)
15339 /* set vol=0 to output mixers */
15340 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15341 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15342 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15344 /* set up input amps for analog loopback */
15345 /* Amp Indices: DAC = 0, mixer = 1 */
15346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15350 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15351 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15354 /* FIXME: use matrix-type input source selection */
15355 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15362 /* additional verbs for ALC663 */
15363 static struct hda_verb alc663_auto_init_verbs[] = {
15364 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15365 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15369 static struct hda_verb alc663_m51va_init_verbs[] = {
15370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15371 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15372 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15373 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15374 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15377 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15378 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15382 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15383 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15384 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15385 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15388 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15389 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15393 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15394 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15395 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15396 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15397 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15400 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15401 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15405 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15406 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15407 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15408 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15411 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15412 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15416 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15417 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15418 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15419 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15420 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15421 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15423 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15426 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15427 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15428 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15432 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15433 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15434 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15435 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15436 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15438 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15439 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15441 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15442 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15443 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15448 static struct hda_verb alc663_g71v_init_verbs[] = {
15449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15450 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15451 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15453 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15454 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15455 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15458 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15459 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15463 static struct hda_verb alc663_g50v_init_verbs[] = {
15464 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15465 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15466 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15468 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15469 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15473 static struct hda_verb alc662_ecs_init_verbs[] = {
15474 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15475 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15476 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15477 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15481 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15482 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15483 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15487 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15489 unsigned int present;
15490 unsigned char bits;
15492 present = snd_hda_codec_read(codec, 0x14, 0,
15493 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15494 bits = present ? HDA_AMP_MUTE : 0;
15495 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15496 HDA_AMP_MUTE, bits);
15499 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15501 unsigned int present;
15502 unsigned char bits;
15504 present = snd_hda_codec_read(codec, 0x1b, 0,
15505 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15506 bits = present ? HDA_AMP_MUTE : 0;
15507 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15508 HDA_AMP_MUTE, bits);
15509 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15510 HDA_AMP_MUTE, bits);
15513 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15516 if ((res >> 26) == ALC880_HP_EVENT)
15517 alc662_lenovo_101e_all_automute(codec);
15518 if ((res >> 26) == ALC880_FRONT_EVENT)
15519 alc662_lenovo_101e_ispeaker_automute(codec);
15522 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15524 unsigned int present;
15526 present = snd_hda_codec_read(codec, 0x18, 0,
15527 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15528 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15529 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15530 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15531 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15532 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15533 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15534 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15535 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15538 /* unsolicited event for HP jack sensing */
15539 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15542 if ((res >> 26) == ALC880_HP_EVENT)
15543 alc262_hippo1_automute( codec );
15545 if ((res >> 26) == ALC880_MIC_EVENT)
15546 alc662_eeepc_mic_automute(codec);
15549 static void alc662_eeepc_inithook(struct hda_codec *codec)
15551 alc262_hippo1_automute( codec );
15552 alc662_eeepc_mic_automute(codec);
15555 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15558 unsigned int present;
15560 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15561 present = snd_hda_codec_read(codec, 0x14, 0,
15562 AC_VERB_GET_PIN_SENSE, 0);
15563 present = (present & 0x80000000) != 0;
15565 /* mute internal speaker */
15566 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15567 HDA_AMP_MUTE, HDA_AMP_MUTE);
15569 /* unmute internal speaker if necessary */
15570 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15571 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15572 HDA_AMP_MUTE, mute);
15576 /* unsolicited event for HP jack sensing */
15577 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15580 if ((res >> 26) == ALC880_HP_EVENT)
15581 alc662_eeepc_ep20_automute(codec);
15584 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15586 alc662_eeepc_ep20_automute(codec);
15589 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15591 unsigned int present;
15592 unsigned char bits;
15594 present = snd_hda_codec_read(codec, 0x21, 0,
15595 AC_VERB_GET_PIN_SENSE, 0)
15596 & AC_PINSENSE_PRESENCE;
15597 bits = present ? HDA_AMP_MUTE : 0;
15598 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15599 AMP_IN_MUTE(0), bits);
15600 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15601 AMP_IN_MUTE(0), bits);
15604 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15606 unsigned int present;
15607 unsigned char bits;
15609 present = snd_hda_codec_read(codec, 0x21, 0,
15610 AC_VERB_GET_PIN_SENSE, 0)
15611 & AC_PINSENSE_PRESENCE;
15612 bits = present ? HDA_AMP_MUTE : 0;
15613 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15614 AMP_IN_MUTE(0), bits);
15615 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15616 AMP_IN_MUTE(0), bits);
15617 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15618 AMP_IN_MUTE(0), bits);
15619 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15620 AMP_IN_MUTE(0), bits);
15623 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15625 unsigned int present;
15626 unsigned char bits;
15628 present = snd_hda_codec_read(codec, 0x15, 0,
15629 AC_VERB_GET_PIN_SENSE, 0)
15630 & AC_PINSENSE_PRESENCE;
15631 bits = present ? HDA_AMP_MUTE : 0;
15632 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15633 AMP_IN_MUTE(0), bits);
15634 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15635 AMP_IN_MUTE(0), bits);
15636 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15637 AMP_IN_MUTE(0), bits);
15638 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15639 AMP_IN_MUTE(0), bits);
15642 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15644 unsigned int present;
15645 unsigned char bits;
15647 present = snd_hda_codec_read(codec, 0x1b, 0,
15648 AC_VERB_GET_PIN_SENSE, 0)
15649 & AC_PINSENSE_PRESENCE;
15650 bits = present ? 0 : PIN_OUT;
15651 snd_hda_codec_write(codec, 0x14, 0,
15652 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15655 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15657 unsigned int present1, present2;
15659 present1 = snd_hda_codec_read(codec, 0x21, 0,
15660 AC_VERB_GET_PIN_SENSE, 0)
15661 & AC_PINSENSE_PRESENCE;
15662 present2 = snd_hda_codec_read(codec, 0x15, 0,
15663 AC_VERB_GET_PIN_SENSE, 0)
15664 & AC_PINSENSE_PRESENCE;
15666 if (present1 || present2) {
15667 snd_hda_codec_write_cache(codec, 0x14, 0,
15668 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15670 snd_hda_codec_write_cache(codec, 0x14, 0,
15671 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15675 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15677 unsigned int present1, present2;
15679 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15680 AC_VERB_GET_PIN_SENSE, 0)
15681 & AC_PINSENSE_PRESENCE;
15682 present2 = snd_hda_codec_read(codec, 0x15, 0,
15683 AC_VERB_GET_PIN_SENSE, 0)
15684 & AC_PINSENSE_PRESENCE;
15686 if (present1 || present2) {
15687 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15688 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15689 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15690 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15692 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15693 AMP_IN_MUTE(0), 0);
15694 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15695 AMP_IN_MUTE(0), 0);
15699 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15701 unsigned int present;
15703 present = snd_hda_codec_read(codec, 0x18, 0,
15704 AC_VERB_GET_PIN_SENSE, 0)
15705 & AC_PINSENSE_PRESENCE;
15706 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15707 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15708 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15709 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15710 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15711 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15712 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15713 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15716 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15719 switch (res >> 26) {
15720 case ALC880_HP_EVENT:
15721 alc663_m51va_speaker_automute(codec);
15723 case ALC880_MIC_EVENT:
15724 alc663_m51va_mic_automute(codec);
15729 static void alc663_m51va_inithook(struct hda_codec *codec)
15731 alc663_m51va_speaker_automute(codec);
15732 alc663_m51va_mic_automute(codec);
15735 /* ***************** Mode1 ******************************/
15736 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15739 switch (res >> 26) {
15740 case ALC880_HP_EVENT:
15741 alc663_m51va_speaker_automute(codec);
15743 case ALC880_MIC_EVENT:
15744 alc662_eeepc_mic_automute(codec);
15749 static void alc663_mode1_inithook(struct hda_codec *codec)
15751 alc663_m51va_speaker_automute(codec);
15752 alc662_eeepc_mic_automute(codec);
15754 /* ***************** Mode2 ******************************/
15755 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15758 switch (res >> 26) {
15759 case ALC880_HP_EVENT:
15760 alc662_f5z_speaker_automute(codec);
15762 case ALC880_MIC_EVENT:
15763 alc662_eeepc_mic_automute(codec);
15768 static void alc662_mode2_inithook(struct hda_codec *codec)
15770 alc662_f5z_speaker_automute(codec);
15771 alc662_eeepc_mic_automute(codec);
15773 /* ***************** Mode3 ******************************/
15774 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15777 switch (res >> 26) {
15778 case ALC880_HP_EVENT:
15779 alc663_two_hp_m1_speaker_automute(codec);
15781 case ALC880_MIC_EVENT:
15782 alc662_eeepc_mic_automute(codec);
15787 static void alc663_mode3_inithook(struct hda_codec *codec)
15789 alc663_two_hp_m1_speaker_automute(codec);
15790 alc662_eeepc_mic_automute(codec);
15792 /* ***************** Mode4 ******************************/
15793 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15796 switch (res >> 26) {
15797 case ALC880_HP_EVENT:
15798 alc663_21jd_two_speaker_automute(codec);
15800 case ALC880_MIC_EVENT:
15801 alc662_eeepc_mic_automute(codec);
15806 static void alc663_mode4_inithook(struct hda_codec *codec)
15808 alc663_21jd_two_speaker_automute(codec);
15809 alc662_eeepc_mic_automute(codec);
15811 /* ***************** Mode5 ******************************/
15812 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15815 switch (res >> 26) {
15816 case ALC880_HP_EVENT:
15817 alc663_15jd_two_speaker_automute(codec);
15819 case ALC880_MIC_EVENT:
15820 alc662_eeepc_mic_automute(codec);
15825 static void alc663_mode5_inithook(struct hda_codec *codec)
15827 alc663_15jd_two_speaker_automute(codec);
15828 alc662_eeepc_mic_automute(codec);
15830 /* ***************** Mode6 ******************************/
15831 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15834 switch (res >> 26) {
15835 case ALC880_HP_EVENT:
15836 alc663_two_hp_m2_speaker_automute(codec);
15838 case ALC880_MIC_EVENT:
15839 alc662_eeepc_mic_automute(codec);
15844 static void alc663_mode6_inithook(struct hda_codec *codec)
15846 alc663_two_hp_m2_speaker_automute(codec);
15847 alc662_eeepc_mic_automute(codec);
15850 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15852 unsigned int present;
15853 unsigned char bits;
15855 present = snd_hda_codec_read(codec, 0x21, 0,
15856 AC_VERB_GET_PIN_SENSE, 0)
15857 & AC_PINSENSE_PRESENCE;
15858 bits = present ? HDA_AMP_MUTE : 0;
15859 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15860 HDA_AMP_MUTE, bits);
15861 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15862 HDA_AMP_MUTE, bits);
15865 static void alc663_g71v_front_automute(struct hda_codec *codec)
15867 unsigned int present;
15868 unsigned char bits;
15870 present = snd_hda_codec_read(codec, 0x15, 0,
15871 AC_VERB_GET_PIN_SENSE, 0)
15872 & AC_PINSENSE_PRESENCE;
15873 bits = present ? HDA_AMP_MUTE : 0;
15874 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15875 HDA_AMP_MUTE, bits);
15878 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15881 switch (res >> 26) {
15882 case ALC880_HP_EVENT:
15883 alc663_g71v_hp_automute(codec);
15885 case ALC880_FRONT_EVENT:
15886 alc663_g71v_front_automute(codec);
15888 case ALC880_MIC_EVENT:
15889 alc662_eeepc_mic_automute(codec);
15894 static void alc663_g71v_inithook(struct hda_codec *codec)
15896 alc663_g71v_front_automute(codec);
15897 alc663_g71v_hp_automute(codec);
15898 alc662_eeepc_mic_automute(codec);
15901 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15904 switch (res >> 26) {
15905 case ALC880_HP_EVENT:
15906 alc663_m51va_speaker_automute(codec);
15908 case ALC880_MIC_EVENT:
15909 alc662_eeepc_mic_automute(codec);
15914 static void alc663_g50v_inithook(struct hda_codec *codec)
15916 alc663_m51va_speaker_automute(codec);
15917 alc662_eeepc_mic_automute(codec);
15920 /* bind hp and internal speaker mute (with plug check) */
15921 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15922 struct snd_ctl_elem_value *ucontrol)
15924 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15925 long *valp = ucontrol->value.integer.value;
15928 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15930 valp[0] ? 0 : HDA_AMP_MUTE);
15931 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15933 valp[1] ? 0 : HDA_AMP_MUTE);
15935 alc262_hippo1_automute(codec);
15939 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15940 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15943 .name = "Master Playback Switch",
15944 .info = snd_hda_mixer_amp_switch_info,
15945 .get = snd_hda_mixer_amp_switch_get,
15946 .put = alc662_ecs_master_sw_put,
15947 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15950 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15951 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15952 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15954 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15955 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15956 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15960 #ifdef CONFIG_SND_HDA_POWER_SAVE
15961 #define alc662_loopbacks alc880_loopbacks
15965 /* pcm configuration: identiacal with ALC880 */
15966 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15967 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15968 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15969 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15972 * configuration and preset
15974 static const char *alc662_models[ALC662_MODEL_LAST] = {
15975 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15976 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15977 [ALC662_3ST_6ch] = "3stack-6ch",
15978 [ALC662_5ST_DIG] = "6stack-dig",
15979 [ALC662_LENOVO_101E] = "lenovo-101e",
15980 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15981 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15982 [ALC662_ECS] = "ecs",
15983 [ALC663_ASUS_M51VA] = "m51va",
15984 [ALC663_ASUS_G71V] = "g71v",
15985 [ALC663_ASUS_H13] = "h13",
15986 [ALC663_ASUS_G50V] = "g50v",
15987 [ALC663_ASUS_MODE1] = "asus-mode1",
15988 [ALC662_ASUS_MODE2] = "asus-mode2",
15989 [ALC663_ASUS_MODE3] = "asus-mode3",
15990 [ALC663_ASUS_MODE4] = "asus-mode4",
15991 [ALC663_ASUS_MODE5] = "asus-mode5",
15992 [ALC663_ASUS_MODE6] = "asus-mode6",
15993 [ALC662_AUTO] = "auto",
15996 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15997 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15998 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15999 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16000 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16001 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16002 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16003 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
16004 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16005 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16006 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16007 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
16008 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16009 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16010 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16011 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16012 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16013 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16014 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16015 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16016 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16017 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16018 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16019 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16020 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16021 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16022 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16023 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16024 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16025 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16026 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16027 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16028 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16029 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16030 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16031 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16032 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16033 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16034 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16035 ALC662_3ST_6ch_DIG),
16036 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16037 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16038 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16039 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16040 ALC662_3ST_6ch_DIG),
16041 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16042 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16043 ALC662_3ST_6ch_DIG),
16044 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
16045 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
16046 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
16050 static struct alc_config_preset alc662_presets[] = {
16051 [ALC662_3ST_2ch_DIG] = {
16052 .mixers = { alc662_3ST_2ch_mixer },
16053 .init_verbs = { alc662_init_verbs },
16054 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16055 .dac_nids = alc662_dac_nids,
16056 .dig_out_nid = ALC662_DIGOUT_NID,
16057 .dig_in_nid = ALC662_DIGIN_NID,
16058 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16059 .channel_mode = alc662_3ST_2ch_modes,
16060 .input_mux = &alc662_capture_source,
16062 [ALC662_3ST_6ch_DIG] = {
16063 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16064 .init_verbs = { alc662_init_verbs },
16065 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16066 .dac_nids = alc662_dac_nids,
16067 .dig_out_nid = ALC662_DIGOUT_NID,
16068 .dig_in_nid = ALC662_DIGIN_NID,
16069 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16070 .channel_mode = alc662_3ST_6ch_modes,
16072 .input_mux = &alc662_capture_source,
16074 [ALC662_3ST_6ch] = {
16075 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16076 .init_verbs = { alc662_init_verbs },
16077 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16078 .dac_nids = alc662_dac_nids,
16079 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16080 .channel_mode = alc662_3ST_6ch_modes,
16082 .input_mux = &alc662_capture_source,
16084 [ALC662_5ST_DIG] = {
16085 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16086 .init_verbs = { alc662_init_verbs },
16087 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16088 .dac_nids = alc662_dac_nids,
16089 .dig_out_nid = ALC662_DIGOUT_NID,
16090 .dig_in_nid = ALC662_DIGIN_NID,
16091 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16092 .channel_mode = alc662_5stack_modes,
16093 .input_mux = &alc662_capture_source,
16095 [ALC662_LENOVO_101E] = {
16096 .mixers = { alc662_lenovo_101e_mixer },
16097 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16098 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16099 .dac_nids = alc662_dac_nids,
16100 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16101 .channel_mode = alc662_3ST_2ch_modes,
16102 .input_mux = &alc662_lenovo_101e_capture_source,
16103 .unsol_event = alc662_lenovo_101e_unsol_event,
16104 .init_hook = alc662_lenovo_101e_all_automute,
16106 [ALC662_ASUS_EEEPC_P701] = {
16107 .mixers = { alc662_eeepc_p701_mixer },
16108 .init_verbs = { alc662_init_verbs,
16109 alc662_eeepc_sue_init_verbs },
16110 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16111 .dac_nids = alc662_dac_nids,
16112 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16113 .channel_mode = alc662_3ST_2ch_modes,
16114 .input_mux = &alc662_eeepc_capture_source,
16115 .unsol_event = alc662_eeepc_unsol_event,
16116 .init_hook = alc662_eeepc_inithook,
16118 [ALC662_ASUS_EEEPC_EP20] = {
16119 .mixers = { alc662_eeepc_ep20_mixer,
16120 alc662_chmode_mixer },
16121 .init_verbs = { alc662_init_verbs,
16122 alc662_eeepc_ep20_sue_init_verbs },
16123 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16124 .dac_nids = alc662_dac_nids,
16125 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16126 .channel_mode = alc662_3ST_6ch_modes,
16127 .input_mux = &alc662_lenovo_101e_capture_source,
16128 .unsol_event = alc662_eeepc_ep20_unsol_event,
16129 .init_hook = alc662_eeepc_ep20_inithook,
16132 .mixers = { alc662_ecs_mixer },
16133 .init_verbs = { alc662_init_verbs,
16134 alc662_ecs_init_verbs },
16135 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16136 .dac_nids = alc662_dac_nids,
16137 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16138 .channel_mode = alc662_3ST_2ch_modes,
16139 .input_mux = &alc662_eeepc_capture_source,
16140 .unsol_event = alc662_eeepc_unsol_event,
16141 .init_hook = alc662_eeepc_inithook,
16143 [ALC663_ASUS_M51VA] = {
16144 .mixers = { alc663_m51va_mixer },
16145 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16146 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16147 .dac_nids = alc662_dac_nids,
16148 .dig_out_nid = ALC662_DIGOUT_NID,
16149 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16150 .channel_mode = alc662_3ST_2ch_modes,
16151 .input_mux = &alc663_m51va_capture_source,
16152 .unsol_event = alc663_m51va_unsol_event,
16153 .init_hook = alc663_m51va_inithook,
16155 [ALC663_ASUS_G71V] = {
16156 .mixers = { alc663_g71v_mixer },
16157 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16158 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16159 .dac_nids = alc662_dac_nids,
16160 .dig_out_nid = ALC662_DIGOUT_NID,
16161 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16162 .channel_mode = alc662_3ST_2ch_modes,
16163 .input_mux = &alc662_eeepc_capture_source,
16164 .unsol_event = alc663_g71v_unsol_event,
16165 .init_hook = alc663_g71v_inithook,
16167 [ALC663_ASUS_H13] = {
16168 .mixers = { alc663_m51va_mixer },
16169 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16170 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16171 .dac_nids = alc662_dac_nids,
16172 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16173 .channel_mode = alc662_3ST_2ch_modes,
16174 .input_mux = &alc663_m51va_capture_source,
16175 .unsol_event = alc663_m51va_unsol_event,
16176 .init_hook = alc663_m51va_inithook,
16178 [ALC663_ASUS_G50V] = {
16179 .mixers = { alc663_g50v_mixer },
16180 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16181 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16182 .dac_nids = alc662_dac_nids,
16183 .dig_out_nid = ALC662_DIGOUT_NID,
16184 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16185 .channel_mode = alc662_3ST_6ch_modes,
16186 .input_mux = &alc663_capture_source,
16187 .unsol_event = alc663_g50v_unsol_event,
16188 .init_hook = alc663_g50v_inithook,
16190 [ALC663_ASUS_MODE1] = {
16191 .mixers = { alc663_m51va_mixer },
16192 .cap_mixer = alc662_auto_capture_mixer,
16193 .init_verbs = { alc662_init_verbs,
16194 alc663_21jd_amic_init_verbs },
16195 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16197 .dac_nids = alc662_dac_nids,
16198 .dig_out_nid = ALC662_DIGOUT_NID,
16199 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16200 .channel_mode = alc662_3ST_2ch_modes,
16201 .input_mux = &alc662_eeepc_capture_source,
16202 .unsol_event = alc663_mode1_unsol_event,
16203 .init_hook = alc663_mode1_inithook,
16205 [ALC662_ASUS_MODE2] = {
16206 .mixers = { alc662_1bjd_mixer },
16207 .cap_mixer = alc662_auto_capture_mixer,
16208 .init_verbs = { alc662_init_verbs,
16209 alc662_1bjd_amic_init_verbs },
16210 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16211 .dac_nids = alc662_dac_nids,
16212 .dig_out_nid = ALC662_DIGOUT_NID,
16213 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16214 .channel_mode = alc662_3ST_2ch_modes,
16215 .input_mux = &alc662_eeepc_capture_source,
16216 .unsol_event = alc662_mode2_unsol_event,
16217 .init_hook = alc662_mode2_inithook,
16219 [ALC663_ASUS_MODE3] = {
16220 .mixers = { alc663_two_hp_m1_mixer },
16221 .cap_mixer = alc662_auto_capture_mixer,
16222 .init_verbs = { alc662_init_verbs,
16223 alc663_two_hp_amic_m1_init_verbs },
16224 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16226 .dac_nids = alc662_dac_nids,
16227 .dig_out_nid = ALC662_DIGOUT_NID,
16228 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16229 .channel_mode = alc662_3ST_2ch_modes,
16230 .input_mux = &alc662_eeepc_capture_source,
16231 .unsol_event = alc663_mode3_unsol_event,
16232 .init_hook = alc663_mode3_inithook,
16234 [ALC663_ASUS_MODE4] = {
16235 .mixers = { alc663_asus_21jd_clfe_mixer },
16236 .cap_mixer = alc662_auto_capture_mixer,
16237 .init_verbs = { alc662_init_verbs,
16238 alc663_21jd_amic_init_verbs},
16239 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16241 .dac_nids = alc662_dac_nids,
16242 .dig_out_nid = ALC662_DIGOUT_NID,
16243 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16244 .channel_mode = alc662_3ST_2ch_modes,
16245 .input_mux = &alc662_eeepc_capture_source,
16246 .unsol_event = alc663_mode4_unsol_event,
16247 .init_hook = alc663_mode4_inithook,
16249 [ALC663_ASUS_MODE5] = {
16250 .mixers = { alc663_asus_15jd_clfe_mixer },
16251 .cap_mixer = alc662_auto_capture_mixer,
16252 .init_verbs = { alc662_init_verbs,
16253 alc663_15jd_amic_init_verbs },
16254 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16256 .dac_nids = alc662_dac_nids,
16257 .dig_out_nid = ALC662_DIGOUT_NID,
16258 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16259 .channel_mode = alc662_3ST_2ch_modes,
16260 .input_mux = &alc662_eeepc_capture_source,
16261 .unsol_event = alc663_mode5_unsol_event,
16262 .init_hook = alc663_mode5_inithook,
16264 [ALC663_ASUS_MODE6] = {
16265 .mixers = { alc663_two_hp_m2_mixer },
16266 .cap_mixer = alc662_auto_capture_mixer,
16267 .init_verbs = { alc662_init_verbs,
16268 alc663_two_hp_amic_m2_init_verbs },
16269 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16271 .dac_nids = alc662_dac_nids,
16272 .dig_out_nid = ALC662_DIGOUT_NID,
16273 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16274 .channel_mode = alc662_3ST_2ch_modes,
16275 .input_mux = &alc662_eeepc_capture_source,
16276 .unsol_event = alc663_mode6_unsol_event,
16277 .init_hook = alc663_mode6_inithook,
16283 * BIOS auto configuration
16286 /* add playback controls from the parsed DAC table */
16287 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16288 const struct auto_pin_cfg *cfg)
16291 static const char *chname[4] = {
16292 "Front", "Surround", NULL /*CLFE*/, "Side"
16297 for (i = 0; i < cfg->line_outs; i++) {
16298 if (!spec->multiout.dac_nids[i])
16300 nid = alc880_idx_to_dac(i);
16303 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16304 "Center Playback Volume",
16305 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16309 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16310 "LFE Playback Volume",
16311 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16315 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16316 "Center Playback Switch",
16317 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16321 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16322 "LFE Playback Switch",
16323 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16328 sprintf(name, "%s Playback Volume", chname[i]);
16329 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16330 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16334 sprintf(name, "%s Playback Switch", chname[i]);
16335 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16336 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16345 /* add playback controls for speaker and HP outputs */
16346 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16357 /* ALC663 has a mono output pin on 0x17 */
16358 sprintf(name, "%s Playback Switch", pfx);
16359 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16360 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16364 if (alc880_is_fixed_pin(pin)) {
16365 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16366 /* printk("DAC nid=%x\n",nid); */
16367 /* specify the DAC as the extra output */
16368 if (!spec->multiout.hp_nid)
16369 spec->multiout.hp_nid = nid;
16371 spec->multiout.extra_out_nid[0] = nid;
16372 /* control HP volume/switch on the output mixer amp */
16373 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16374 sprintf(name, "%s Playback Volume", pfx);
16375 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16376 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16379 sprintf(name, "%s Playback Switch", pfx);
16380 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16381 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16384 } else if (alc880_is_multi_pin(pin)) {
16385 /* set manual connection */
16386 /* we have only a switch on HP-out PIN */
16387 sprintf(name, "%s Playback Switch", pfx);
16388 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16389 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16396 /* create playback/capture controls for input pins */
16397 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16398 const struct auto_pin_cfg *cfg)
16400 struct hda_input_mux *imux = &spec->private_imux;
16403 for (i = 0; i < AUTO_PIN_LAST; i++) {
16404 if (alc880_is_input_pin(cfg->input_pins[i])) {
16405 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16406 err = new_analog_input(spec, cfg->input_pins[i],
16407 auto_pin_cfg_labels[i],
16411 imux->items[imux->num_items].label =
16412 auto_pin_cfg_labels[i];
16413 imux->items[imux->num_items].index =
16414 alc880_input_pin_idx(cfg->input_pins[i]);
16421 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16422 hda_nid_t nid, int pin_type,
16425 alc_set_pin_output(codec, nid, pin_type);
16426 /* need the manual connection? */
16427 if (alc880_is_multi_pin(nid)) {
16428 struct alc_spec *spec = codec->spec;
16429 int idx = alc880_multi_pin_idx(nid);
16430 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16431 AC_VERB_SET_CONNECT_SEL,
16432 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16436 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16438 struct alc_spec *spec = codec->spec;
16441 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16442 for (i = 0; i <= HDA_SIDE; i++) {
16443 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16444 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16446 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16451 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16453 struct alc_spec *spec = codec->spec;
16456 pin = spec->autocfg.hp_pins[0];
16457 if (pin) /* connect to front */
16459 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16460 pin = spec->autocfg.speaker_pins[0];
16462 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16465 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16466 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16468 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16470 struct alc_spec *spec = codec->spec;
16473 for (i = 0; i < AUTO_PIN_LAST; i++) {
16474 hda_nid_t nid = spec->autocfg.input_pins[i];
16475 if (alc662_is_input_pin(nid)) {
16476 snd_hda_codec_write(codec, nid, 0,
16477 AC_VERB_SET_PIN_WIDGET_CONTROL,
16478 (i <= AUTO_PIN_FRONT_MIC ?
16479 PIN_VREF80 : PIN_IN));
16480 if (nid != ALC662_PIN_CD_NID)
16481 snd_hda_codec_write(codec, nid, 0,
16482 AC_VERB_SET_AMP_GAIN_MUTE,
16488 #define alc662_auto_init_input_src alc882_auto_init_input_src
16490 static int alc662_parse_auto_config(struct hda_codec *codec)
16492 struct alc_spec *spec = codec->spec;
16494 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16496 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16500 if (!spec->autocfg.line_outs)
16501 return 0; /* can't find valid BIOS pin config */
16503 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16506 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16509 err = alc662_auto_create_extra_out(spec,
16510 spec->autocfg.speaker_pins[0],
16514 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16518 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16522 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16524 if (spec->autocfg.dig_out_pin)
16525 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16527 if (spec->kctls.list)
16528 add_mixer(spec, spec->kctls.list);
16530 spec->num_mux_defs = 1;
16531 spec->input_mux = &spec->private_imux;
16533 add_verb(spec, alc662_auto_init_verbs);
16534 if (codec->vendor_id == 0x10ec0663)
16535 add_verb(spec, alc663_auto_init_verbs);
16537 err = alc_auto_add_mic_boost(codec);
16541 store_pin_configs(codec);
16545 /* additional initialization for auto-configuration model */
16546 static void alc662_auto_init(struct hda_codec *codec)
16548 struct alc_spec *spec = codec->spec;
16549 alc662_auto_init_multi_out(codec);
16550 alc662_auto_init_hp_out(codec);
16551 alc662_auto_init_analog_input(codec);
16552 alc662_auto_init_input_src(codec);
16553 if (spec->unsol_event)
16554 alc_inithook(codec);
16557 static int patch_alc662(struct hda_codec *codec)
16559 struct alc_spec *spec;
16560 int err, board_config;
16562 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16566 codec->spec = spec;
16568 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16570 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16573 if (board_config < 0) {
16574 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16575 "trying auto-probe from BIOS...\n");
16576 board_config = ALC662_AUTO;
16579 if (board_config == ALC662_AUTO) {
16580 /* automatic parse from the BIOS config */
16581 err = alc662_parse_auto_config(codec);
16587 "hda_codec: Cannot set up configuration "
16588 "from BIOS. Using base mode...\n");
16589 board_config = ALC662_3ST_2ch_DIG;
16593 if (board_config != ALC662_AUTO)
16594 setup_preset(spec, &alc662_presets[board_config]);
16596 if (codec->vendor_id == 0x10ec0663) {
16597 spec->stream_name_analog = "ALC663 Analog";
16598 spec->stream_name_digital = "ALC663 Digital";
16599 } else if (codec->vendor_id == 0x10ec0272) {
16600 spec->stream_name_analog = "ALC272 Analog";
16601 spec->stream_name_digital = "ALC272 Digital";
16603 spec->stream_name_analog = "ALC662 Analog";
16604 spec->stream_name_digital = "ALC662 Digital";
16607 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16608 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16610 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16611 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16613 spec->adc_nids = alc662_adc_nids;
16614 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16615 spec->capsrc_nids = alc662_capsrc_nids;
16616 spec->is_mix_capture = 1;
16618 if (!spec->cap_mixer)
16619 set_capture_mixer(spec);
16621 spec->vmaster_nid = 0x02;
16623 codec->patch_ops = alc_patch_ops;
16624 if (board_config == ALC662_AUTO)
16625 spec->init_hook = alc662_auto_init;
16626 #ifdef CONFIG_SND_HDA_POWER_SAVE
16627 if (!spec->loopback.amplist)
16628 spec->loopback.amplist = alc662_loopbacks;
16630 codec->proc_widget_hook = print_realtek_coef;
16638 static struct hda_codec_preset snd_hda_preset_realtek[] = {
16639 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16640 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16641 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16642 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16643 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16644 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16645 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16646 .patch = patch_alc861 },
16647 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16648 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16649 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16650 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16651 .patch = patch_alc883 },
16652 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16653 .patch = patch_alc662 },
16654 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16655 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16656 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16657 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16658 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16659 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16660 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16661 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16662 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16663 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16664 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16665 .patch = patch_alc883 },
16666 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16667 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16668 {} /* terminator */
16671 MODULE_ALIAS("snd-hda-codec-id:10ec*");
16673 MODULE_LICENSE("GPL");
16674 MODULE_DESCRIPTION("Realtek HD-audio codec");
16676 static struct hda_codec_preset_list realtek_list = {
16677 .preset = snd_hda_preset_realtek,
16678 .owner = THIS_MODULE,
16681 static int __init patch_realtek_init(void)
16683 return snd_hda_add_codec_preset(&realtek_list);
16686 static void __exit patch_realtek_exit(void)
16688 snd_hda_delete_codec_preset(&realtek_list);
16691 module_init(patch_realtek_init)
16692 module_exit(patch_realtek_exit)