2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
81 #ifdef CONFIG_SND_DEBUG
85 ALC260_MODEL_LAST /* last tag */
95 ALC262_HP_BPC_D7000_WL,
96 ALC262_HP_BPC_D7000_WF,
108 ALC262_MODEL_LAST /* last tag */
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,
134 ALC269_MODEL_LAST /* last tag */
151 /* ALC861-VD models */
172 ALC662_ASUS_EEEPC_P701,
173 ALC662_ASUS_EEEPC_EP20,
212 ALC883_TARGA_2ch_DIG,
218 ALC883_LENOVO_101E_2ch,
219 ALC883_LENOVO_NB0763,
220 ALC888_LENOVO_MS7195_DIG,
227 ALC883_FUJITSU_PI2515,
228 ALC883_3ST_6ch_INTEL,
236 #define GPIO_MASK 0x03
239 /* codec parameterization */
240 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
241 unsigned int num_mixers;
243 const struct hda_verb *init_verbs[5]; /* initialization verbs
247 unsigned int num_init_verbs;
249 char *stream_name_analog; /* analog PCM stream */
250 struct hda_pcm_stream *stream_analog_playback;
251 struct hda_pcm_stream *stream_analog_capture;
252 struct hda_pcm_stream *stream_analog_alt_playback;
253 struct hda_pcm_stream *stream_analog_alt_capture;
255 char *stream_name_digital; /* digital PCM stream */
256 struct hda_pcm_stream *stream_digital_playback;
257 struct hda_pcm_stream *stream_digital_capture;
260 struct hda_multi_out multiout; /* playback set-up
261 * max_channels, dacs must be set
262 * dig_out_nid and hp_nid are optional
264 hda_nid_t alt_dac_nid;
267 unsigned int num_adc_nids;
269 hda_nid_t *capsrc_nids;
270 hda_nid_t dig_in_nid; /* digital-in NID; optional */
271 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */
274 unsigned int num_mux_defs;
275 const struct hda_input_mux *input_mux;
276 unsigned int cur_mux[3];
279 const struct hda_channel_mode *channel_mode;
280 int num_channel_mode;
283 /* PCM information */
284 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
286 /* dynamic controls, init_verbs and input_mux */
287 struct auto_pin_cfg autocfg;
288 struct snd_array kctls;
289 struct hda_input_mux private_imux;
290 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
293 void (*init_hook)(struct hda_codec *codec);
294 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
296 /* for pin sensing */
297 unsigned int sense_updated: 1;
298 unsigned int jack_present: 1;
299 unsigned int master_sw: 1;
301 /* for virtual master */
302 hda_nid_t vmaster_nid;
303 #ifdef CONFIG_SND_HDA_POWER_SAVE
304 struct hda_loopback_check loopback;
309 unsigned int pll_coef_idx, pll_coef_bit;
311 #ifdef SND_HDA_NEEDS_RESUME
312 #define ALC_MAX_PINS 16
313 unsigned int num_pins;
314 hda_nid_t pin_nids[ALC_MAX_PINS];
315 unsigned int pin_cfgs[ALC_MAX_PINS];
320 * configuration template - to be copied to the spec instance
322 struct alc_config_preset {
323 struct snd_kcontrol_new *mixers[5]; /* should be identical size
326 const struct hda_verb *init_verbs[5];
327 unsigned int num_dacs;
329 hda_nid_t dig_out_nid; /* optional */
330 hda_nid_t hp_nid; /* optional */
331 unsigned int num_adc_nids;
333 hda_nid_t *capsrc_nids;
334 hda_nid_t dig_in_nid;
335 unsigned int num_channel_mode;
336 const struct hda_channel_mode *channel_mode;
338 unsigned int num_mux_defs;
339 const struct hda_input_mux *input_mux;
340 void (*unsol_event)(struct hda_codec *, unsigned int);
341 void (*init_hook)(struct hda_codec *);
342 #ifdef CONFIG_SND_HDA_POWER_SAVE
343 struct hda_amp_list *loopbacks;
351 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
352 struct snd_ctl_elem_info *uinfo)
354 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
355 struct alc_spec *spec = codec->spec;
356 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
357 if (mux_idx >= spec->num_mux_defs)
359 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
362 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
363 struct snd_ctl_elem_value *ucontrol)
365 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
366 struct alc_spec *spec = codec->spec;
367 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
369 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
373 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
374 struct snd_ctl_elem_value *ucontrol)
376 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
377 struct alc_spec *spec = codec->spec;
378 const struct hda_input_mux *imux = spec->input_mux;
379 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
380 hda_nid_t nid = spec->capsrc_nids ?
381 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
383 if (spec->is_mix_capture) {
384 /* Matrix-mixer style (e.g. ALC882) */
385 unsigned int *cur_val = &spec->cur_mux[adc_idx];
388 idx = ucontrol->value.enumerated.item[0];
389 if (idx >= imux->num_items)
390 idx = imux->num_items - 1;
393 for (i = 0; i < imux->num_items; i++) {
394 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
395 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
396 imux->items[i].index,
402 /* MUX style (e.g. ALC880) */
403 unsigned int mux_idx;
404 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
405 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx],
407 &spec->cur_mux[adc_idx]);
412 * channel mode setting
414 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
415 struct snd_ctl_elem_info *uinfo)
417 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
418 struct alc_spec *spec = codec->spec;
419 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
420 spec->num_channel_mode);
423 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
424 struct snd_ctl_elem_value *ucontrol)
426 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
427 struct alc_spec *spec = codec->spec;
428 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
429 spec->num_channel_mode,
430 spec->multiout.max_channels);
433 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
434 struct snd_ctl_elem_value *ucontrol)
436 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
437 struct alc_spec *spec = codec->spec;
438 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
439 spec->num_channel_mode,
440 &spec->multiout.max_channels);
441 if (err >= 0 && spec->need_dac_fix)
442 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
447 * Control the mode of pin widget settings via the mixer. "pc" is used
448 * instead of "%" to avoid consequences of accidently treating the % as
449 * being part of a format specifier. Maximum allowed length of a value is
450 * 63 characters plus NULL terminator.
452 * Note: some retasking pin complexes seem to ignore requests for input
453 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
454 * are requested. Therefore order this list so that this behaviour will not
455 * cause problems when mixer clients move through the enum sequentially.
456 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
459 static char *alc_pin_mode_names[] = {
460 "Mic 50pc bias", "Mic 80pc bias",
461 "Line in", "Line out", "Headphone out",
463 static unsigned char alc_pin_mode_values[] = {
464 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
466 /* The control can present all 5 options, or it can limit the options based
467 * in the pin being assumed to be exclusively an input or an output pin. In
468 * addition, "input" pins may or may not process the mic bias option
469 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
470 * accept requests for bias as of chip versions up to March 2006) and/or
471 * wiring in the computer.
473 #define ALC_PIN_DIR_IN 0x00
474 #define ALC_PIN_DIR_OUT 0x01
475 #define ALC_PIN_DIR_INOUT 0x02
476 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
477 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
479 /* Info about the pin modes supported by the different pin direction modes.
480 * For each direction the minimum and maximum values are given.
482 static signed char alc_pin_mode_dir_info[5][2] = {
483 { 0, 2 }, /* ALC_PIN_DIR_IN */
484 { 3, 4 }, /* ALC_PIN_DIR_OUT */
485 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
486 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
487 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
489 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
490 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
491 #define alc_pin_mode_n_items(_dir) \
492 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
494 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
495 struct snd_ctl_elem_info *uinfo)
497 unsigned int item_num = uinfo->value.enumerated.item;
498 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
500 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
502 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
504 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
505 item_num = alc_pin_mode_min(dir);
506 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
510 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
511 struct snd_ctl_elem_value *ucontrol)
514 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
515 hda_nid_t nid = kcontrol->private_value & 0xffff;
516 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
517 long *valp = ucontrol->value.integer.value;
518 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
519 AC_VERB_GET_PIN_WIDGET_CONTROL,
522 /* Find enumerated value for current pinctl setting */
523 i = alc_pin_mode_min(dir);
524 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
526 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
530 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
531 struct snd_ctl_elem_value *ucontrol)
534 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
535 hda_nid_t nid = kcontrol->private_value & 0xffff;
536 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
537 long val = *ucontrol->value.integer.value;
538 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
539 AC_VERB_GET_PIN_WIDGET_CONTROL,
542 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
543 val = alc_pin_mode_min(dir);
545 change = pinctl != alc_pin_mode_values[val];
547 /* Set pin mode to that requested */
548 snd_hda_codec_write_cache(codec, nid, 0,
549 AC_VERB_SET_PIN_WIDGET_CONTROL,
550 alc_pin_mode_values[val]);
552 /* Also enable the retasking pin's input/output as required
553 * for the requested pin mode. Enum values of 2 or less are
556 * Dynamically switching the input/output buffers probably
557 * reduces noise slightly (particularly on input) so we'll
558 * do it. However, having both input and output buffers
559 * enabled simultaneously doesn't seem to be problematic if
560 * this turns out to be necessary in the future.
563 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
564 HDA_AMP_MUTE, HDA_AMP_MUTE);
565 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
568 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
569 HDA_AMP_MUTE, HDA_AMP_MUTE);
570 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
577 #define ALC_PIN_MODE(xname, nid, dir) \
578 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
579 .info = alc_pin_mode_info, \
580 .get = alc_pin_mode_get, \
581 .put = alc_pin_mode_put, \
582 .private_value = nid | (dir<<16) }
584 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
585 * together using a mask with more than one bit set. This control is
586 * currently used only by the ALC260 test model. At this stage they are not
587 * needed for any "production" models.
589 #ifdef CONFIG_SND_DEBUG
590 #define alc_gpio_data_info snd_ctl_boolean_mono_info
592 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
593 struct snd_ctl_elem_value *ucontrol)
595 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
596 hda_nid_t nid = kcontrol->private_value & 0xffff;
597 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
598 long *valp = ucontrol->value.integer.value;
599 unsigned int val = snd_hda_codec_read(codec, nid, 0,
600 AC_VERB_GET_GPIO_DATA, 0x00);
602 *valp = (val & mask) != 0;
605 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
606 struct snd_ctl_elem_value *ucontrol)
609 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
610 hda_nid_t nid = kcontrol->private_value & 0xffff;
611 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
612 long val = *ucontrol->value.integer.value;
613 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
614 AC_VERB_GET_GPIO_DATA,
617 /* Set/unset the masked GPIO bit(s) as needed */
618 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
623 snd_hda_codec_write_cache(codec, nid, 0,
624 AC_VERB_SET_GPIO_DATA, gpio_data);
628 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
629 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
630 .info = alc_gpio_data_info, \
631 .get = alc_gpio_data_get, \
632 .put = alc_gpio_data_put, \
633 .private_value = nid | (mask<<16) }
634 #endif /* CONFIG_SND_DEBUG */
636 /* A switch control to allow the enabling of the digital IO pins on the
637 * ALC260. This is incredibly simplistic; the intention of this control is
638 * to provide something in the test model allowing digital outputs to be
639 * identified if present. If models are found which can utilise these
640 * outputs a more complete mixer control can be devised for those models if
643 #ifdef CONFIG_SND_DEBUG
644 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
646 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
647 struct snd_ctl_elem_value *ucontrol)
649 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
650 hda_nid_t nid = kcontrol->private_value & 0xffff;
651 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
652 long *valp = ucontrol->value.integer.value;
653 unsigned int val = snd_hda_codec_read(codec, nid, 0,
654 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
656 *valp = (val & mask) != 0;
659 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
660 struct snd_ctl_elem_value *ucontrol)
663 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
664 hda_nid_t nid = kcontrol->private_value & 0xffff;
665 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
666 long val = *ucontrol->value.integer.value;
667 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
668 AC_VERB_GET_DIGI_CONVERT_1,
671 /* Set/unset the masked control bit(s) as needed */
672 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
677 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
682 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
683 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
684 .info = alc_spdif_ctrl_info, \
685 .get = alc_spdif_ctrl_get, \
686 .put = alc_spdif_ctrl_put, \
687 .private_value = nid | (mask<<16) }
688 #endif /* CONFIG_SND_DEBUG */
690 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
691 * Again, this is only used in the ALC26x test models to help identify when
692 * the EAPD line must be asserted for features to work.
694 #ifdef CONFIG_SND_DEBUG
695 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
697 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
698 struct snd_ctl_elem_value *ucontrol)
700 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
701 hda_nid_t nid = kcontrol->private_value & 0xffff;
702 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
703 long *valp = ucontrol->value.integer.value;
704 unsigned int val = snd_hda_codec_read(codec, nid, 0,
705 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
707 *valp = (val & mask) != 0;
711 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
712 struct snd_ctl_elem_value *ucontrol)
715 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
716 hda_nid_t nid = kcontrol->private_value & 0xffff;
717 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
718 long val = *ucontrol->value.integer.value;
719 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
720 AC_VERB_GET_EAPD_BTLENABLE,
723 /* Set/unset the masked control bit(s) as needed */
724 change = (!val ? 0 : mask) != (ctrl_data & mask);
729 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
735 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
736 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
737 .info = alc_eapd_ctrl_info, \
738 .get = alc_eapd_ctrl_get, \
739 .put = alc_eapd_ctrl_put, \
740 .private_value = nid | (mask<<16) }
741 #endif /* CONFIG_SND_DEBUG */
745 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
747 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
749 spec->mixers[spec->num_mixers++] = mix;
752 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
754 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
756 spec->init_verbs[spec->num_init_verbs++] = verb;
760 * set up from the preset table
762 static void setup_preset(struct alc_spec *spec,
763 const struct alc_config_preset *preset)
767 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
768 add_mixer(spec, preset->mixers[i]);
769 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
771 add_verb(spec, preset->init_verbs[i]);
773 spec->channel_mode = preset->channel_mode;
774 spec->num_channel_mode = preset->num_channel_mode;
775 spec->need_dac_fix = preset->need_dac_fix;
777 spec->multiout.max_channels = spec->channel_mode[0].channels;
779 spec->multiout.num_dacs = preset->num_dacs;
780 spec->multiout.dac_nids = preset->dac_nids;
781 spec->multiout.dig_out_nid = preset->dig_out_nid;
782 spec->multiout.hp_nid = preset->hp_nid;
784 spec->num_mux_defs = preset->num_mux_defs;
785 if (!spec->num_mux_defs)
786 spec->num_mux_defs = 1;
787 spec->input_mux = preset->input_mux;
789 spec->num_adc_nids = preset->num_adc_nids;
790 spec->adc_nids = preset->adc_nids;
791 spec->capsrc_nids = preset->capsrc_nids;
792 spec->dig_in_nid = preset->dig_in_nid;
794 spec->unsol_event = preset->unsol_event;
795 spec->init_hook = preset->init_hook;
796 #ifdef CONFIG_SND_HDA_POWER_SAVE
797 spec->loopback.amplist = preset->loopbacks;
801 /* Enable GPIO mask and set output */
802 static struct hda_verb alc_gpio1_init_verbs[] = {
803 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
804 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
805 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
809 static struct hda_verb alc_gpio2_init_verbs[] = {
810 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
811 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
812 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
816 static struct hda_verb alc_gpio3_init_verbs[] = {
817 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
818 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
819 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
824 * Fix hardware PLL issue
825 * On some codecs, the analog PLL gating control must be off while
826 * the default value is 1.
828 static void alc_fix_pll(struct hda_codec *codec)
830 struct alc_spec *spec = codec->spec;
835 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
837 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
838 AC_VERB_GET_PROC_COEF, 0);
839 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
841 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
842 val & ~(1 << spec->pll_coef_bit));
845 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
846 unsigned int coef_idx, unsigned int coef_bit)
848 struct alc_spec *spec = codec->spec;
850 spec->pll_coef_idx = coef_idx;
851 spec->pll_coef_bit = coef_bit;
855 static void alc_sku_automute(struct hda_codec *codec)
857 struct alc_spec *spec = codec->spec;
858 unsigned int present;
859 unsigned int hp_nid = spec->autocfg.hp_pins[0];
860 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
862 /* need to execute and sync at first */
863 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
864 present = snd_hda_codec_read(codec, hp_nid, 0,
865 AC_VERB_GET_PIN_SENSE, 0);
866 spec->jack_present = (present & 0x80000000) != 0;
867 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
868 spec->jack_present ? 0 : PIN_OUT);
871 #if 0 /* it's broken in some acses -- temporarily disabled */
872 static void alc_mic_automute(struct hda_codec *codec)
874 struct alc_spec *spec = codec->spec;
875 unsigned int present;
876 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
877 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
878 unsigned int mix_nid = spec->capsrc_nids[0];
879 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
881 capsrc_idx_mic = mic_nid - 0x18;
882 capsrc_idx_fmic = fmic_nid - 0x18;
883 present = snd_hda_codec_read(codec, mic_nid, 0,
884 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
885 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
886 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
887 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
888 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
889 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
890 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
893 #define alc_mic_automute(codec) /* NOP */
894 #endif /* disabled */
896 /* unsolicited event for HP jack sensing */
897 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
899 if (codec->vendor_id == 0x10ec0880)
903 if (res == ALC880_HP_EVENT)
904 alc_sku_automute(codec);
906 if (res == ALC880_MIC_EVENT)
907 alc_mic_automute(codec);
910 static void alc_inithook(struct hda_codec *codec)
912 alc_sku_automute(codec);
913 alc_mic_automute(codec);
916 /* additional initialization for ALC888 variants */
917 static void alc888_coef_init(struct hda_codec *codec)
921 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
922 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
923 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
924 if ((tmp & 0xf0) == 2)
926 snd_hda_codec_read(codec, 0x20, 0,
927 AC_VERB_SET_PROC_COEF, 0x830);
930 snd_hda_codec_read(codec, 0x20, 0,
931 AC_VERB_SET_PROC_COEF, 0x3030);
934 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
935 * 31 ~ 16 : Manufacture ID
937 * 7 ~ 0 : Assembly ID
938 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
940 static void alc_subsystem_id(struct hda_codec *codec,
941 unsigned int porta, unsigned int porte,
944 unsigned int ass, tmp, i;
946 struct alc_spec *spec = codec->spec;
948 ass = codec->subsystem_id & 0xffff;
949 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
953 * 31~30 : port conetcivity
956 * 19~16 : Check sum (15:1)
961 if (codec->vendor_id == 0x10ec0260)
963 ass = snd_hda_codec_read(codec, nid, 0,
964 AC_VERB_GET_CONFIG_DEFAULT, 0);
965 if (!(ass & 1) && !(ass & 0x100000))
967 if ((ass >> 30) != 1) /* no physical connection */
972 for (i = 1; i < 16; i++) {
976 if (((ass >> 16) & 0xf) != tmp)
982 * 2 : 0 --> Desktop, 1 --> Laptop
983 * 3~5 : External Amplifier control
986 tmp = (ass & 0x38) >> 3; /* external Amp control */
989 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
992 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
995 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
997 case 5: /* set EAPD output high */
998 switch (codec->vendor_id) {
1000 snd_hda_codec_write(codec, 0x0f, 0,
1001 AC_VERB_SET_EAPD_BTLENABLE, 2);
1002 snd_hda_codec_write(codec, 0x10, 0,
1003 AC_VERB_SET_EAPD_BTLENABLE, 2);
1014 snd_hda_codec_write(codec, 0x14, 0,
1015 AC_VERB_SET_EAPD_BTLENABLE, 2);
1016 snd_hda_codec_write(codec, 0x15, 0,
1017 AC_VERB_SET_EAPD_BTLENABLE, 2);
1020 switch (codec->vendor_id) {
1022 snd_hda_codec_write(codec, 0x1a, 0,
1023 AC_VERB_SET_COEF_INDEX, 7);
1024 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1025 AC_VERB_GET_PROC_COEF, 0);
1026 snd_hda_codec_write(codec, 0x1a, 0,
1027 AC_VERB_SET_COEF_INDEX, 7);
1028 snd_hda_codec_write(codec, 0x1a, 0,
1029 AC_VERB_SET_PROC_COEF,
1038 snd_hda_codec_write(codec, 0x20, 0,
1039 AC_VERB_SET_COEF_INDEX, 7);
1040 tmp = snd_hda_codec_read(codec, 0x20, 0,
1041 AC_VERB_GET_PROC_COEF, 0);
1042 snd_hda_codec_write(codec, 0x20, 0,
1043 AC_VERB_SET_COEF_INDEX, 7);
1044 snd_hda_codec_write(codec, 0x20, 0,
1045 AC_VERB_SET_PROC_COEF,
1049 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1053 snd_hda_codec_write(codec, 0x20, 0,
1054 AC_VERB_SET_COEF_INDEX, 7);
1055 tmp = snd_hda_codec_read(codec, 0x20, 0,
1056 AC_VERB_GET_PROC_COEF, 0);
1057 snd_hda_codec_write(codec, 0x20, 0,
1058 AC_VERB_SET_COEF_INDEX, 7);
1059 snd_hda_codec_write(codec, 0x20, 0,
1060 AC_VERB_SET_PROC_COEF,
1068 /* is laptop or Desktop and enable the function "Mute internal speaker
1069 * when the external headphone out jack is plugged"
1071 if (!(ass & 0x8000))
1074 * 10~8 : Jack location
1075 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1077 * 15 : 1 --> enable the function "Mute internal speaker
1078 * when the external headphone out jack is plugged"
1080 if (!spec->autocfg.speaker_pins[0]) {
1081 if (spec->autocfg.line_out_pins[0])
1082 spec->autocfg.speaker_pins[0] =
1083 spec->autocfg.line_out_pins[0];
1088 if (!spec->autocfg.hp_pins[0]) {
1089 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1091 spec->autocfg.hp_pins[0] = porta;
1093 spec->autocfg.hp_pins[0] = porte;
1095 spec->autocfg.hp_pins[0] = portd;
1099 if (spec->autocfg.hp_pins[0])
1100 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1101 AC_VERB_SET_UNSOLICITED_ENABLE,
1102 AC_USRSP_EN | ALC880_HP_EVENT);
1104 #if 0 /* it's broken in some acses -- temporarily disabled */
1105 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1106 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1107 snd_hda_codec_write(codec,
1108 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1109 AC_VERB_SET_UNSOLICITED_ENABLE,
1110 AC_USRSP_EN | ALC880_MIC_EVENT);
1111 #endif /* disabled */
1113 spec->unsol_event = alc_sku_unsol_event;
1117 * Fix-up pin default configurations
1125 static void alc_fix_pincfg(struct hda_codec *codec,
1126 const struct snd_pci_quirk *quirk,
1127 const struct alc_pincfg **pinfix)
1129 const struct alc_pincfg *cfg;
1131 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1135 cfg = pinfix[quirk->value];
1136 for (; cfg->nid; cfg++) {
1139 for (i = 0; i < 4; i++) {
1140 snd_hda_codec_write(codec, cfg->nid, 0,
1141 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1149 * ALC880 3-stack model
1151 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1152 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1153 * F-Mic = 0x1b, HP = 0x19
1156 static hda_nid_t alc880_dac_nids[4] = {
1157 /* front, rear, clfe, rear_surr */
1158 0x02, 0x05, 0x04, 0x03
1161 static hda_nid_t alc880_adc_nids[3] = {
1166 /* The datasheet says the node 0x07 is connected from inputs,
1167 * but it shows zero connection in the real implementation on some devices.
1168 * Note: this is a 915GAV bug, fixed on 915GLV
1170 static hda_nid_t alc880_adc_nids_alt[2] = {
1175 #define ALC880_DIGOUT_NID 0x06
1176 #define ALC880_DIGIN_NID 0x0a
1178 static struct hda_input_mux alc880_capture_source = {
1182 { "Front Mic", 0x3 },
1188 /* channel source setting (2/6 channel selection for 3-stack) */
1190 static struct hda_verb alc880_threestack_ch2_init[] = {
1191 /* set line-in to input, mute it */
1192 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1193 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1194 /* set mic-in to input vref 80%, mute it */
1195 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1196 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1201 static struct hda_verb alc880_threestack_ch6_init[] = {
1202 /* set line-in to output, unmute it */
1203 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1204 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1205 /* set mic-in to output, unmute it */
1206 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1207 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1211 static struct hda_channel_mode alc880_threestack_modes[2] = {
1212 { 2, alc880_threestack_ch2_init },
1213 { 6, alc880_threestack_ch6_init },
1216 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1217 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1218 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1219 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1220 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1221 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1222 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1223 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1224 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1225 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1226 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1227 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1228 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1231 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1232 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1233 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1234 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1235 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1238 .name = "Channel Mode",
1239 .info = alc_ch_mode_info,
1240 .get = alc_ch_mode_get,
1241 .put = alc_ch_mode_put,
1246 /* capture mixer elements */
1247 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1248 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1249 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1250 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1251 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1252 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1253 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1255 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1256 /* The multiple "Capture Source" controls confuse alsamixer
1257 * So call somewhat different..
1259 /* .name = "Capture Source", */
1260 .name = "Input Source",
1262 .info = alc_mux_enum_info,
1263 .get = alc_mux_enum_get,
1264 .put = alc_mux_enum_put,
1269 /* capture mixer elements (in case NID 0x07 not available) */
1270 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1271 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1272 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1273 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1274 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1277 /* The multiple "Capture Source" controls confuse alsamixer
1278 * So call somewhat different..
1280 /* .name = "Capture Source", */
1281 .name = "Input Source",
1283 .info = alc_mux_enum_info,
1284 .get = alc_mux_enum_get,
1285 .put = alc_mux_enum_put,
1292 * ALC880 5-stack model
1294 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1296 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1297 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1300 /* additional mixers to alc880_three_stack_mixer */
1301 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1302 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1303 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1307 /* channel source setting (6/8 channel selection for 5-stack) */
1309 static struct hda_verb alc880_fivestack_ch6_init[] = {
1310 /* set line-in to input, mute it */
1311 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1312 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1317 static struct hda_verb alc880_fivestack_ch8_init[] = {
1318 /* set line-in to output, unmute it */
1319 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1320 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1324 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1325 { 6, alc880_fivestack_ch6_init },
1326 { 8, alc880_fivestack_ch8_init },
1331 * ALC880 6-stack model
1333 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1334 * Side = 0x05 (0x0f)
1335 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1336 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1339 static hda_nid_t alc880_6st_dac_nids[4] = {
1340 /* front, rear, clfe, rear_surr */
1341 0x02, 0x03, 0x04, 0x05
1344 static struct hda_input_mux alc880_6stack_capture_source = {
1348 { "Front Mic", 0x1 },
1354 /* fixed 8-channels */
1355 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1359 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1360 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1361 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1362 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1363 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1364 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1365 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1366 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1367 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1368 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1369 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1370 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1371 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1372 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1373 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1376 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1377 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1378 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1379 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1381 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1382 .name = "Channel Mode",
1383 .info = alc_ch_mode_info,
1384 .get = alc_ch_mode_get,
1385 .put = alc_ch_mode_put,
1394 * W810 has rear IO for:
1397 * Center/LFE (DAC 04)
1400 * The system also has a pair of internal speakers, and a headphone jack.
1401 * These are both connected to Line2 on the codec, hence to DAC 02.
1403 * There is a variable resistor to control the speaker or headphone
1404 * volume. This is a hardware-only device without a software API.
1406 * Plugging headphones in will disable the internal speakers. This is
1407 * implemented in hardware, not via the driver using jack sense. In
1408 * a similar fashion, plugging into the rear socket marked "front" will
1409 * disable both the speakers and headphones.
1411 * For input, there's a microphone jack, and an "audio in" jack.
1412 * These may not do anything useful with this driver yet, because I
1413 * haven't setup any initialization verbs for these yet...
1416 static hda_nid_t alc880_w810_dac_nids[3] = {
1417 /* front, rear/surround, clfe */
1421 /* fixed 6 channels */
1422 static struct hda_channel_mode alc880_w810_modes[1] = {
1426 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1427 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1428 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1429 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1430 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1431 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1432 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1433 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1434 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1435 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1436 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1444 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1445 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1449 static hda_nid_t alc880_z71v_dac_nids[1] = {
1452 #define ALC880_Z71V_HP_DAC 0x03
1454 /* fixed 2 channels */
1455 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1459 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1460 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1461 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1462 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1463 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1464 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1465 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1466 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1467 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1473 * ALC880 F1734 model
1475 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1476 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1479 static hda_nid_t alc880_f1734_dac_nids[1] = {
1482 #define ALC880_F1734_HP_DAC 0x02
1484 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1485 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1486 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1487 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1488 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1489 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1490 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1492 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1496 static struct hda_input_mux alc880_f1734_capture_source = {
1508 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1509 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1510 * Mic = 0x18, Line = 0x1a
1513 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1514 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1516 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1517 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1518 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1519 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1520 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1521 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1522 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1523 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1524 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1525 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1526 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1527 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1528 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1532 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1533 .name = "Channel Mode",
1534 .info = alc_ch_mode_info,
1535 .get = alc_ch_mode_get,
1536 .put = alc_ch_mode_put,
1542 * ALC880 ASUS W1V model
1544 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1545 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1546 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1549 /* additional mixers to alc880_asus_mixer */
1550 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1551 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1552 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1556 /* additional mixers to alc880_asus_mixer */
1557 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1558 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1559 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1564 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1565 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1566 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1567 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1568 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1569 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1570 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1571 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1572 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1573 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1575 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1576 /* The multiple "Capture Source" controls confuse alsamixer
1577 * So call somewhat different..
1579 /* .name = "Capture Source", */
1580 .name = "Input Source",
1582 .info = alc_mux_enum_info,
1583 .get = alc_mux_enum_get,
1584 .put = alc_mux_enum_put,
1590 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1591 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1592 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1593 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1594 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1595 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1596 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1597 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1598 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1599 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1600 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1605 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1606 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1607 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1608 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1610 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1611 .name = "Channel Mode",
1612 .info = alc_ch_mode_info,
1613 .get = alc_ch_mode_get,
1614 .put = alc_ch_mode_put,
1619 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1620 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1621 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1622 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1623 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1624 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1625 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1626 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1627 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1628 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1629 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1633 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1634 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1635 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1636 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1637 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1644 * virtual master controls
1648 * slave controls for virtual master
1650 static const char *alc_slave_vols[] = {
1651 "Front Playback Volume",
1652 "Surround Playback Volume",
1653 "Center Playback Volume",
1654 "LFE Playback Volume",
1655 "Side Playback Volume",
1656 "Headphone Playback Volume",
1657 "Speaker Playback Volume",
1658 "Mono Playback Volume",
1659 "Line-Out Playback Volume",
1663 static const char *alc_slave_sws[] = {
1664 "Front Playback Switch",
1665 "Surround Playback Switch",
1666 "Center Playback Switch",
1667 "LFE Playback Switch",
1668 "Side Playback Switch",
1669 "Headphone Playback Switch",
1670 "Speaker Playback Switch",
1671 "Mono Playback Switch",
1672 "IEC958 Playback Switch",
1677 * build control elements
1680 static void alc_free_kctls(struct hda_codec *codec);
1682 static int alc_build_controls(struct hda_codec *codec)
1684 struct alc_spec *spec = codec->spec;
1688 for (i = 0; i < spec->num_mixers; i++) {
1689 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1694 if (spec->multiout.dig_out_nid) {
1695 err = snd_hda_create_spdif_out_ctls(codec,
1696 spec->multiout.dig_out_nid);
1699 err = snd_hda_create_spdif_share_sw(codec,
1703 spec->multiout.share_spdif = 1;
1705 if (spec->dig_in_nid) {
1706 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1711 /* if we have no master control, let's create it */
1712 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1713 unsigned int vmaster_tlv[4];
1714 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1715 HDA_OUTPUT, vmaster_tlv);
1716 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1717 vmaster_tlv, alc_slave_vols);
1721 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1722 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1723 NULL, alc_slave_sws);
1728 alc_free_kctls(codec); /* no longer needed */
1734 * initialize the codec volumes, etc
1738 * generic initialization of ADC, input mixers and output mixers
1740 static struct hda_verb alc880_volume_init_verbs[] = {
1742 * Unmute ADC0-2 and set the default input to mic-in
1744 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1746 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1747 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1748 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1749 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1751 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1753 * Note: PASD motherboards uses the Line In 2 as the input for front
1756 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1757 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1761 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1762 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1766 * Set up output mixers (0x0c - 0x0f)
1768 /* set vol=0 to output mixers */
1769 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1770 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1771 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1772 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1773 /* set up input amps for analog loopback */
1774 /* Amp Indices: DAC = 0, mixer = 1 */
1775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1780 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1782 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1788 * 3-stack pin configuration:
1789 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1791 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1793 * preset connection lists of input pins
1794 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1796 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1797 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1798 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1801 * Set pin mode and muting
1803 /* set front pin widgets 0x14 for output */
1804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1806 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1807 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1808 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1809 /* Mic2 (as headphone out) for HP output */
1810 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1812 /* Line In pin widget for input */
1813 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1814 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1815 /* Line2 (as front mic) pin widget for input and vref at 80% */
1816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1817 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1818 /* CD pin widget for input */
1819 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1825 * 5-stack pin configuration:
1826 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1827 * line-in/side = 0x1a, f-mic = 0x1b
1829 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1831 * preset connection lists of input pins
1832 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1834 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1835 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1838 * Set pin mode and muting
1840 /* set pin widgets 0x14-0x17 for output */
1841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1843 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1844 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1845 /* unmute pins for output (no gain on this amp) */
1846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1847 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1848 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1849 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1851 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1853 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1854 /* Mic2 (as headphone out) for HP output */
1855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1856 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1857 /* Line In pin widget for input */
1858 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1859 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1860 /* Line2 (as front mic) pin widget for input and vref at 80% */
1861 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1862 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1863 /* CD pin widget for input */
1864 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1870 * W810 pin configuration:
1871 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1873 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1874 /* hphone/speaker input selector: front DAC */
1875 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1877 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1878 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1879 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1881 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1882 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1884 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1885 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1891 * Z71V pin configuration:
1892 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1894 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1895 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1896 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1897 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1900 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1901 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1902 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1903 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1909 * 6-stack pin configuration:
1910 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1911 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1913 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1914 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1916 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1917 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1919 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1920 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1921 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1922 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1923 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1925 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1926 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1927 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1928 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1929 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1931 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1932 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1933 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1939 * Uniwill pin configuration:
1940 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1943 static struct hda_verb alc880_uniwill_init_verbs[] = {
1944 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1946 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1948 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1949 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1950 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1951 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1952 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1953 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1957 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1959 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1961 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1962 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1963 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1964 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1965 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1966 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1967 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1968 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1969 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1971 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1972 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1979 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1981 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1982 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1985 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1987 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1989 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1990 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1992 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1993 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1994 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1995 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1997 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1998 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1999 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2000 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2001 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2002 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2004 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2005 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2010 static struct hda_verb alc880_beep_init_verbs[] = {
2011 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2015 /* toggle speaker-output according to the hp-jack state */
2016 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2018 unsigned int present;
2021 present = snd_hda_codec_read(codec, 0x14, 0,
2022 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2023 bits = present ? HDA_AMP_MUTE : 0;
2024 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2025 HDA_AMP_MUTE, bits);
2026 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2027 HDA_AMP_MUTE, bits);
2030 /* auto-toggle front mic */
2031 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2033 unsigned int present;
2036 present = snd_hda_codec_read(codec, 0x18, 0,
2037 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2038 bits = present ? HDA_AMP_MUTE : 0;
2039 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2042 static void alc880_uniwill_automute(struct hda_codec *codec)
2044 alc880_uniwill_hp_automute(codec);
2045 alc880_uniwill_mic_automute(codec);
2048 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2051 /* Looks like the unsol event is incompatible with the standard
2052 * definition. 4bit tag is placed at 28 bit!
2054 switch (res >> 28) {
2055 case ALC880_HP_EVENT:
2056 alc880_uniwill_hp_automute(codec);
2058 case ALC880_MIC_EVENT:
2059 alc880_uniwill_mic_automute(codec);
2064 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2066 unsigned int present;
2069 present = snd_hda_codec_read(codec, 0x14, 0,
2070 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2071 bits = present ? HDA_AMP_MUTE : 0;
2072 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2075 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2077 unsigned int present;
2079 present = snd_hda_codec_read(codec, 0x21, 0,
2080 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2081 present &= HDA_AMP_VOLMASK;
2082 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2083 HDA_AMP_VOLMASK, present);
2084 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2085 HDA_AMP_VOLMASK, present);
2088 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2091 /* Looks like the unsol event is incompatible with the standard
2092 * definition. 4bit tag is placed at 28 bit!
2094 if ((res >> 28) == ALC880_HP_EVENT)
2095 alc880_uniwill_p53_hp_automute(codec);
2096 if ((res >> 28) == ALC880_DCVOL_EVENT)
2097 alc880_uniwill_p53_dcvol_automute(codec);
2101 * F1734 pin configuration:
2102 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2104 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2105 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2106 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2107 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2108 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2109 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2111 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2112 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2113 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2116 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2117 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2118 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2119 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2120 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2121 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2122 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2123 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2124 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2126 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2127 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2133 * ASUS pin configuration:
2134 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2136 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2137 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2138 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2139 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2140 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2142 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2143 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2145 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2147 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2148 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2151 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2152 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2153 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2154 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2155 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2158 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2159 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2164 /* Enable GPIO mask and set output */
2165 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2166 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2168 /* Clevo m520g init */
2169 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2170 /* headphone output */
2171 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2173 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2174 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2176 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2177 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2179 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2180 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2181 /* Mic1 (rear panel) */
2182 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2183 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2184 /* Mic2 (front panel) */
2185 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2188 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2190 /* change to EAPD mode */
2191 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2192 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2197 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2198 /* change to EAPD mode */
2199 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2200 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2202 /* Headphone output */
2203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2205 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2206 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2208 /* Line In pin widget for input */
2209 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2210 /* CD pin widget for input */
2211 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2212 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2213 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2215 /* change to EAPD mode */
2216 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2217 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2223 * LG m1 express dual
2226 * Rear Line-In/Out (blue): 0x14
2227 * Build-in Mic-In: 0x15
2229 * HP-Out (green): 0x1b
2230 * Mic-In/Out (red): 0x19
2234 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2235 static hda_nid_t alc880_lg_dac_nids[3] = {
2239 /* seems analog CD is not working */
2240 static struct hda_input_mux alc880_lg_capture_source = {
2245 { "Internal Mic", 0x6 },
2249 /* 2,4,6 channel modes */
2250 static struct hda_verb alc880_lg_ch2_init[] = {
2251 /* set line-in and mic-in to input */
2252 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2253 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2257 static struct hda_verb alc880_lg_ch4_init[] = {
2258 /* set line-in to out and mic-in to input */
2259 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2260 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2264 static struct hda_verb alc880_lg_ch6_init[] = {
2265 /* set line-in and mic-in to output */
2266 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2267 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2271 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2272 { 2, alc880_lg_ch2_init },
2273 { 4, alc880_lg_ch4_init },
2274 { 6, alc880_lg_ch6_init },
2277 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2278 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2279 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2280 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2281 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2282 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2283 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2284 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2285 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2286 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2287 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2288 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2289 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2290 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2291 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2293 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2294 .name = "Channel Mode",
2295 .info = alc_ch_mode_info,
2296 .get = alc_ch_mode_get,
2297 .put = alc_ch_mode_put,
2302 static struct hda_verb alc880_lg_init_verbs[] = {
2303 /* set capture source to mic-in */
2304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2307 /* mute all amp mixer inputs */
2308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2311 /* line-in to input */
2312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2313 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2316 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2318 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2319 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2320 /* mic-in to input */
2321 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2322 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2323 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2325 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2326 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2327 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2329 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2333 /* toggle speaker-output according to the hp-jack state */
2334 static void alc880_lg_automute(struct hda_codec *codec)
2336 unsigned int present;
2339 present = snd_hda_codec_read(codec, 0x1b, 0,
2340 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2341 bits = present ? HDA_AMP_MUTE : 0;
2342 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2343 HDA_AMP_MUTE, bits);
2346 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2348 /* Looks like the unsol event is incompatible with the standard
2349 * definition. 4bit tag is placed at 28 bit!
2351 if ((res >> 28) == 0x01)
2352 alc880_lg_automute(codec);
2361 * Built-in Mic-In: 0x19
2367 static struct hda_input_mux alc880_lg_lw_capture_source = {
2371 { "Internal Mic", 0x1 },
2376 #define alc880_lg_lw_modes alc880_threestack_modes
2378 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2379 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2380 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2381 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2382 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2383 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2384 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2385 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2386 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2387 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2388 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2391 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2392 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2394 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2395 .name = "Channel Mode",
2396 .info = alc_ch_mode_info,
2397 .get = alc_ch_mode_get,
2398 .put = alc_ch_mode_put,
2403 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2404 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2405 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2406 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2408 /* set capture source to mic-in */
2409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2410 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2411 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2415 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2417 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2418 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2419 /* mic-in to input */
2420 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2421 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2423 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2424 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2426 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2430 /* toggle speaker-output according to the hp-jack state */
2431 static void alc880_lg_lw_automute(struct hda_codec *codec)
2433 unsigned int present;
2436 present = snd_hda_codec_read(codec, 0x1b, 0,
2437 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2438 bits = present ? HDA_AMP_MUTE : 0;
2439 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2440 HDA_AMP_MUTE, bits);
2443 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2445 /* Looks like the unsol event is incompatible with the standard
2446 * definition. 4bit tag is placed at 28 bit!
2448 if ((res >> 28) == 0x01)
2449 alc880_lg_lw_automute(codec);
2452 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2453 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2454 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2455 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2456 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2457 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2458 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2462 static struct hda_input_mux alc880_medion_rim_capture_source = {
2466 { "Internal Mic", 0x1 },
2470 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2471 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2474 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2476 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2477 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2478 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2479 /* Mic2 (as headphone out) for HP output */
2480 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2481 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2482 /* Internal Speaker */
2483 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2484 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2486 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2487 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2489 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2493 /* toggle speaker-output according to the hp-jack state */
2494 static void alc880_medion_rim_automute(struct hda_codec *codec)
2496 unsigned int present;
2499 present = snd_hda_codec_read(codec, 0x14, 0,
2500 AC_VERB_GET_PIN_SENSE, 0)
2501 & AC_PINSENSE_PRESENCE;
2502 bits = present ? HDA_AMP_MUTE : 0;
2503 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2504 HDA_AMP_MUTE, bits);
2506 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2508 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2511 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2514 /* Looks like the unsol event is incompatible with the standard
2515 * definition. 4bit tag is placed at 28 bit!
2517 if ((res >> 28) == ALC880_HP_EVENT)
2518 alc880_medion_rim_automute(codec);
2521 #ifdef CONFIG_SND_HDA_POWER_SAVE
2522 static struct hda_amp_list alc880_loopbacks[] = {
2523 { 0x0b, HDA_INPUT, 0 },
2524 { 0x0b, HDA_INPUT, 1 },
2525 { 0x0b, HDA_INPUT, 2 },
2526 { 0x0b, HDA_INPUT, 3 },
2527 { 0x0b, HDA_INPUT, 4 },
2531 static struct hda_amp_list alc880_lg_loopbacks[] = {
2532 { 0x0b, HDA_INPUT, 1 },
2533 { 0x0b, HDA_INPUT, 6 },
2534 { 0x0b, HDA_INPUT, 7 },
2543 static int alc_init(struct hda_codec *codec)
2545 struct alc_spec *spec = codec->spec;
2549 if (codec->vendor_id == 0x10ec0888)
2550 alc888_coef_init(codec);
2552 for (i = 0; i < spec->num_init_verbs; i++)
2553 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2555 if (spec->init_hook)
2556 spec->init_hook(codec);
2561 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2563 struct alc_spec *spec = codec->spec;
2565 if (spec->unsol_event)
2566 spec->unsol_event(codec, res);
2569 #ifdef CONFIG_SND_HDA_POWER_SAVE
2570 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2572 struct alc_spec *spec = codec->spec;
2573 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2578 * Analog playback callbacks
2580 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2581 struct hda_codec *codec,
2582 struct snd_pcm_substream *substream)
2584 struct alc_spec *spec = codec->spec;
2585 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2589 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2590 struct hda_codec *codec,
2591 unsigned int stream_tag,
2592 unsigned int format,
2593 struct snd_pcm_substream *substream)
2595 struct alc_spec *spec = codec->spec;
2596 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2597 stream_tag, format, substream);
2600 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2601 struct hda_codec *codec,
2602 struct snd_pcm_substream *substream)
2604 struct alc_spec *spec = codec->spec;
2605 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2611 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2612 struct hda_codec *codec,
2613 struct snd_pcm_substream *substream)
2615 struct alc_spec *spec = codec->spec;
2616 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2619 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2620 struct hda_codec *codec,
2621 unsigned int stream_tag,
2622 unsigned int format,
2623 struct snd_pcm_substream *substream)
2625 struct alc_spec *spec = codec->spec;
2626 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2627 stream_tag, format, substream);
2630 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2631 struct hda_codec *codec,
2632 struct snd_pcm_substream *substream)
2634 struct alc_spec *spec = codec->spec;
2635 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2641 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2642 struct hda_codec *codec,
2643 unsigned int stream_tag,
2644 unsigned int format,
2645 struct snd_pcm_substream *substream)
2647 struct alc_spec *spec = codec->spec;
2649 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2650 stream_tag, 0, format);
2654 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2655 struct hda_codec *codec,
2656 struct snd_pcm_substream *substream)
2658 struct alc_spec *spec = codec->spec;
2660 snd_hda_codec_cleanup_stream(codec,
2661 spec->adc_nids[substream->number + 1]);
2668 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2672 /* NID is set in alc_build_pcms */
2674 .open = alc880_playback_pcm_open,
2675 .prepare = alc880_playback_pcm_prepare,
2676 .cleanup = alc880_playback_pcm_cleanup
2680 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2684 /* NID is set in alc_build_pcms */
2687 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2691 /* NID is set in alc_build_pcms */
2694 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2695 .substreams = 2, /* can be overridden */
2698 /* NID is set in alc_build_pcms */
2700 .prepare = alc880_alt_capture_pcm_prepare,
2701 .cleanup = alc880_alt_capture_pcm_cleanup
2705 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2709 /* NID is set in alc_build_pcms */
2711 .open = alc880_dig_playback_pcm_open,
2712 .close = alc880_dig_playback_pcm_close,
2713 .prepare = alc880_dig_playback_pcm_prepare
2717 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2721 /* NID is set in alc_build_pcms */
2724 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2725 static struct hda_pcm_stream alc_pcm_null_stream = {
2731 static int alc_build_pcms(struct hda_codec *codec)
2733 struct alc_spec *spec = codec->spec;
2734 struct hda_pcm *info = spec->pcm_rec;
2737 codec->num_pcms = 1;
2738 codec->pcm_info = info;
2740 info->name = spec->stream_name_analog;
2741 if (spec->stream_analog_playback) {
2742 if (snd_BUG_ON(!spec->multiout.dac_nids))
2744 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2745 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2747 if (spec->stream_analog_capture) {
2748 if (snd_BUG_ON(!spec->adc_nids))
2750 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2751 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2754 if (spec->channel_mode) {
2755 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2756 for (i = 0; i < spec->num_channel_mode; i++) {
2757 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2758 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2763 /* SPDIF for stream index #1 */
2764 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2765 codec->num_pcms = 2;
2766 info = spec->pcm_rec + 1;
2767 info->name = spec->stream_name_digital;
2768 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2769 if (spec->multiout.dig_out_nid &&
2770 spec->stream_digital_playback) {
2771 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2772 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2774 if (spec->dig_in_nid &&
2775 spec->stream_digital_capture) {
2776 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2777 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2779 /* FIXME: do we need this for all Realtek codec models? */
2780 codec->spdif_status_reset = 1;
2783 /* If the use of more than one ADC is requested for the current
2784 * model, configure a second analog capture-only PCM.
2786 /* Additional Analaog capture for index #2 */
2787 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2788 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2789 codec->num_pcms = 3;
2790 info = spec->pcm_rec + 2;
2791 info->name = spec->stream_name_analog;
2792 if (spec->alt_dac_nid) {
2793 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2794 *spec->stream_analog_alt_playback;
2795 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2798 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2799 alc_pcm_null_stream;
2800 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2802 if (spec->num_adc_nids > 1) {
2803 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2804 *spec->stream_analog_alt_capture;
2805 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2807 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2808 spec->num_adc_nids - 1;
2810 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2811 alc_pcm_null_stream;
2812 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2819 static void alc_free_kctls(struct hda_codec *codec)
2821 struct alc_spec *spec = codec->spec;
2823 if (spec->kctls.list) {
2824 struct snd_kcontrol_new *kctl = spec->kctls.list;
2826 for (i = 0; i < spec->kctls.used; i++)
2827 kfree(kctl[i].name);
2829 snd_array_free(&spec->kctls);
2832 static void alc_free(struct hda_codec *codec)
2834 struct alc_spec *spec = codec->spec;
2839 alc_free_kctls(codec);
2841 codec->spec = NULL; /* to be sure */
2844 #ifdef SND_HDA_NEEDS_RESUME
2845 static void store_pin_configs(struct hda_codec *codec)
2847 struct alc_spec *spec = codec->spec;
2848 hda_nid_t nid, end_nid;
2850 end_nid = codec->start_nid + codec->num_nodes;
2851 for (nid = codec->start_nid; nid < end_nid; nid++) {
2852 unsigned int wid_caps = get_wcaps(codec, nid);
2853 unsigned int wid_type =
2854 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2855 if (wid_type != AC_WID_PIN)
2857 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
2859 spec->pin_nids[spec->num_pins] = nid;
2860 spec->pin_cfgs[spec->num_pins] =
2861 snd_hda_codec_read(codec, nid, 0,
2862 AC_VERB_GET_CONFIG_DEFAULT, 0);
2867 static void resume_pin_configs(struct hda_codec *codec)
2869 struct alc_spec *spec = codec->spec;
2872 for (i = 0; i < spec->num_pins; i++) {
2873 hda_nid_t pin_nid = spec->pin_nids[i];
2874 unsigned int pin_config = spec->pin_cfgs[i];
2875 snd_hda_codec_write(codec, pin_nid, 0,
2876 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2877 pin_config & 0x000000ff);
2878 snd_hda_codec_write(codec, pin_nid, 0,
2879 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2880 (pin_config & 0x0000ff00) >> 8);
2881 snd_hda_codec_write(codec, pin_nid, 0,
2882 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2883 (pin_config & 0x00ff0000) >> 16);
2884 snd_hda_codec_write(codec, pin_nid, 0,
2885 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2890 static int alc_resume(struct hda_codec *codec)
2892 resume_pin_configs(codec);
2893 codec->patch_ops.init(codec);
2894 snd_hda_codec_resume_amp(codec);
2895 snd_hda_codec_resume_cache(codec);
2899 #define store_pin_configs(codec)
2904 static struct hda_codec_ops alc_patch_ops = {
2905 .build_controls = alc_build_controls,
2906 .build_pcms = alc_build_pcms,
2909 .unsol_event = alc_unsol_event,
2910 #ifdef SND_HDA_NEEDS_RESUME
2911 .resume = alc_resume,
2913 #ifdef CONFIG_SND_HDA_POWER_SAVE
2914 .check_power_status = alc_check_power_status,
2920 * Test configuration for debugging
2922 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2925 #ifdef CONFIG_SND_DEBUG
2926 static hda_nid_t alc880_test_dac_nids[4] = {
2927 0x02, 0x03, 0x04, 0x05
2930 static struct hda_input_mux alc880_test_capture_source = {
2939 { "Surround", 0x6 },
2943 static struct hda_channel_mode alc880_test_modes[4] = {
2950 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2951 struct snd_ctl_elem_info *uinfo)
2953 static char *texts[] = {
2954 "N/A", "Line Out", "HP Out",
2955 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2957 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2959 uinfo->value.enumerated.items = 8;
2960 if (uinfo->value.enumerated.item >= 8)
2961 uinfo->value.enumerated.item = 7;
2962 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2966 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2967 struct snd_ctl_elem_value *ucontrol)
2969 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2970 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2971 unsigned int pin_ctl, item = 0;
2973 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2974 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2975 if (pin_ctl & AC_PINCTL_OUT_EN) {
2976 if (pin_ctl & AC_PINCTL_HP_EN)
2980 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2981 switch (pin_ctl & AC_PINCTL_VREFEN) {
2982 case AC_PINCTL_VREF_HIZ: item = 3; break;
2983 case AC_PINCTL_VREF_50: item = 4; break;
2984 case AC_PINCTL_VREF_GRD: item = 5; break;
2985 case AC_PINCTL_VREF_80: item = 6; break;
2986 case AC_PINCTL_VREF_100: item = 7; break;
2989 ucontrol->value.enumerated.item[0] = item;
2993 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2994 struct snd_ctl_elem_value *ucontrol)
2996 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2997 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2998 static unsigned int ctls[] = {
2999 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3000 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3001 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3002 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3003 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3004 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3006 unsigned int old_ctl, new_ctl;
3008 old_ctl = snd_hda_codec_read(codec, nid, 0,
3009 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3010 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3011 if (old_ctl != new_ctl) {
3013 snd_hda_codec_write_cache(codec, nid, 0,
3014 AC_VERB_SET_PIN_WIDGET_CONTROL,
3016 val = ucontrol->value.enumerated.item[0] >= 3 ?
3018 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3025 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3026 struct snd_ctl_elem_info *uinfo)
3028 static char *texts[] = {
3029 "Front", "Surround", "CLFE", "Side"
3031 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3033 uinfo->value.enumerated.items = 4;
3034 if (uinfo->value.enumerated.item >= 4)
3035 uinfo->value.enumerated.item = 3;
3036 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3040 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3041 struct snd_ctl_elem_value *ucontrol)
3043 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3044 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3047 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3048 ucontrol->value.enumerated.item[0] = sel & 3;
3052 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3053 struct snd_ctl_elem_value *ucontrol)
3055 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3056 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3059 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3060 if (ucontrol->value.enumerated.item[0] != sel) {
3061 sel = ucontrol->value.enumerated.item[0] & 3;
3062 snd_hda_codec_write_cache(codec, nid, 0,
3063 AC_VERB_SET_CONNECT_SEL, sel);
3069 #define PIN_CTL_TEST(xname,nid) { \
3070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3072 .info = alc_test_pin_ctl_info, \
3073 .get = alc_test_pin_ctl_get, \
3074 .put = alc_test_pin_ctl_put, \
3075 .private_value = nid \
3078 #define PIN_SRC_TEST(xname,nid) { \
3079 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3081 .info = alc_test_pin_src_info, \
3082 .get = alc_test_pin_src_get, \
3083 .put = alc_test_pin_src_put, \
3084 .private_value = nid \
3087 static struct snd_kcontrol_new alc880_test_mixer[] = {
3088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3089 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3090 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3091 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3092 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3093 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3094 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3095 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3096 PIN_CTL_TEST("Front Pin Mode", 0x14),
3097 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3098 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3099 PIN_CTL_TEST("Side Pin Mode", 0x17),
3100 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3101 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3102 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3103 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3104 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3105 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3106 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3107 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3108 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3109 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3110 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3111 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3112 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3113 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3114 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3115 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3116 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3117 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3120 .name = "Channel Mode",
3121 .info = alc_ch_mode_info,
3122 .get = alc_ch_mode_get,
3123 .put = alc_ch_mode_put,
3128 static struct hda_verb alc880_test_init_verbs[] = {
3129 /* Unmute inputs of 0x0c - 0x0f */
3130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3131 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3132 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3133 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3134 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3135 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3136 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3137 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3138 /* Vol output for 0x0c-0x0f */
3139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3140 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3141 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3142 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3143 /* Set output pins 0x14-0x17 */
3144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3147 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3148 /* Unmute output pins 0x14-0x17 */
3149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3150 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3151 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3152 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3153 /* Set input pins 0x18-0x1c */
3154 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3155 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3158 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3159 /* Mute input pins 0x18-0x1b */
3160 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3161 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3162 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3163 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3166 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3167 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3168 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3169 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3170 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3171 /* Analog input/passthru */
3172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3184 static const char *alc880_models[ALC880_MODEL_LAST] = {
3185 [ALC880_3ST] = "3stack",
3186 [ALC880_TCL_S700] = "tcl",
3187 [ALC880_3ST_DIG] = "3stack-digout",
3188 [ALC880_CLEVO] = "clevo",
3189 [ALC880_5ST] = "5stack",
3190 [ALC880_5ST_DIG] = "5stack-digout",
3191 [ALC880_W810] = "w810",
3192 [ALC880_Z71V] = "z71v",
3193 [ALC880_6ST] = "6stack",
3194 [ALC880_6ST_DIG] = "6stack-digout",
3195 [ALC880_ASUS] = "asus",
3196 [ALC880_ASUS_W1V] = "asus-w1v",
3197 [ALC880_ASUS_DIG] = "asus-dig",
3198 [ALC880_ASUS_DIG2] = "asus-dig2",
3199 [ALC880_UNIWILL_DIG] = "uniwill",
3200 [ALC880_UNIWILL_P53] = "uniwill-p53",
3201 [ALC880_FUJITSU] = "fujitsu",
3202 [ALC880_F1734] = "F1734",
3204 [ALC880_LG_LW] = "lg-lw",
3205 [ALC880_MEDION_RIM] = "medion",
3206 #ifdef CONFIG_SND_DEBUG
3207 [ALC880_TEST] = "test",
3209 [ALC880_AUTO] = "auto",
3212 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3213 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3214 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3215 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3216 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3217 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3218 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3219 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3220 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3221 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3222 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3223 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3224 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3225 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3226 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3227 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3228 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3229 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3230 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3231 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3232 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3233 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3234 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3235 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3236 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3237 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3238 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3239 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3240 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3241 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3242 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3243 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3244 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3245 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3246 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3247 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3248 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3249 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3250 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3251 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3252 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3253 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3254 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3255 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3256 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3257 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3258 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3259 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3260 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3261 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3262 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3263 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3264 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3265 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3266 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3267 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3268 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3269 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3270 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3271 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3272 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3273 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3274 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3275 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3276 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3277 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3278 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3279 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3280 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3281 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3282 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3283 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3288 * ALC880 codec presets
3290 static struct alc_config_preset alc880_presets[] = {
3292 .mixers = { alc880_three_stack_mixer },
3293 .init_verbs = { alc880_volume_init_verbs,
3294 alc880_pin_3stack_init_verbs },
3295 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3296 .dac_nids = alc880_dac_nids,
3297 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3298 .channel_mode = alc880_threestack_modes,
3300 .input_mux = &alc880_capture_source,
3302 [ALC880_3ST_DIG] = {
3303 .mixers = { alc880_three_stack_mixer },
3304 .init_verbs = { alc880_volume_init_verbs,
3305 alc880_pin_3stack_init_verbs },
3306 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3307 .dac_nids = alc880_dac_nids,
3308 .dig_out_nid = ALC880_DIGOUT_NID,
3309 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3310 .channel_mode = alc880_threestack_modes,
3312 .input_mux = &alc880_capture_source,
3314 [ALC880_TCL_S700] = {
3315 .mixers = { alc880_tcl_s700_mixer },
3316 .init_verbs = { alc880_volume_init_verbs,
3317 alc880_pin_tcl_S700_init_verbs,
3318 alc880_gpio2_init_verbs },
3319 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3320 .dac_nids = alc880_dac_nids,
3322 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3323 .channel_mode = alc880_2_jack_modes,
3324 .input_mux = &alc880_capture_source,
3327 .mixers = { alc880_three_stack_mixer,
3328 alc880_five_stack_mixer},
3329 .init_verbs = { alc880_volume_init_verbs,
3330 alc880_pin_5stack_init_verbs },
3331 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3332 .dac_nids = alc880_dac_nids,
3333 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3334 .channel_mode = alc880_fivestack_modes,
3335 .input_mux = &alc880_capture_source,
3337 [ALC880_5ST_DIG] = {
3338 .mixers = { alc880_three_stack_mixer,
3339 alc880_five_stack_mixer },
3340 .init_verbs = { alc880_volume_init_verbs,
3341 alc880_pin_5stack_init_verbs },
3342 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3343 .dac_nids = alc880_dac_nids,
3344 .dig_out_nid = ALC880_DIGOUT_NID,
3345 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3346 .channel_mode = alc880_fivestack_modes,
3347 .input_mux = &alc880_capture_source,
3350 .mixers = { alc880_six_stack_mixer },
3351 .init_verbs = { alc880_volume_init_verbs,
3352 alc880_pin_6stack_init_verbs },
3353 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3354 .dac_nids = alc880_6st_dac_nids,
3355 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3356 .channel_mode = alc880_sixstack_modes,
3357 .input_mux = &alc880_6stack_capture_source,
3359 [ALC880_6ST_DIG] = {
3360 .mixers = { alc880_six_stack_mixer },
3361 .init_verbs = { alc880_volume_init_verbs,
3362 alc880_pin_6stack_init_verbs },
3363 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3364 .dac_nids = alc880_6st_dac_nids,
3365 .dig_out_nid = ALC880_DIGOUT_NID,
3366 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3367 .channel_mode = alc880_sixstack_modes,
3368 .input_mux = &alc880_6stack_capture_source,
3371 .mixers = { alc880_w810_base_mixer },
3372 .init_verbs = { alc880_volume_init_verbs,
3373 alc880_pin_w810_init_verbs,
3374 alc880_gpio2_init_verbs },
3375 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3376 .dac_nids = alc880_w810_dac_nids,
3377 .dig_out_nid = ALC880_DIGOUT_NID,
3378 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3379 .channel_mode = alc880_w810_modes,
3380 .input_mux = &alc880_capture_source,
3383 .mixers = { alc880_z71v_mixer },
3384 .init_verbs = { alc880_volume_init_verbs,
3385 alc880_pin_z71v_init_verbs },
3386 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3387 .dac_nids = alc880_z71v_dac_nids,
3388 .dig_out_nid = ALC880_DIGOUT_NID,
3390 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3391 .channel_mode = alc880_2_jack_modes,
3392 .input_mux = &alc880_capture_source,
3395 .mixers = { alc880_f1734_mixer },
3396 .init_verbs = { alc880_volume_init_verbs,
3397 alc880_pin_f1734_init_verbs },
3398 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3399 .dac_nids = alc880_f1734_dac_nids,
3401 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3402 .channel_mode = alc880_2_jack_modes,
3403 .input_mux = &alc880_f1734_capture_source,
3404 .unsol_event = alc880_uniwill_p53_unsol_event,
3405 .init_hook = alc880_uniwill_p53_hp_automute,
3408 .mixers = { alc880_asus_mixer },
3409 .init_verbs = { alc880_volume_init_verbs,
3410 alc880_pin_asus_init_verbs,
3411 alc880_gpio1_init_verbs },
3412 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3413 .dac_nids = alc880_asus_dac_nids,
3414 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3415 .channel_mode = alc880_asus_modes,
3417 .input_mux = &alc880_capture_source,
3419 [ALC880_ASUS_DIG] = {
3420 .mixers = { alc880_asus_mixer },
3421 .init_verbs = { alc880_volume_init_verbs,
3422 alc880_pin_asus_init_verbs,
3423 alc880_gpio1_init_verbs },
3424 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3425 .dac_nids = alc880_asus_dac_nids,
3426 .dig_out_nid = ALC880_DIGOUT_NID,
3427 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3428 .channel_mode = alc880_asus_modes,
3430 .input_mux = &alc880_capture_source,
3432 [ALC880_ASUS_DIG2] = {
3433 .mixers = { alc880_asus_mixer },
3434 .init_verbs = { alc880_volume_init_verbs,
3435 alc880_pin_asus_init_verbs,
3436 alc880_gpio2_init_verbs }, /* use GPIO2 */
3437 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3438 .dac_nids = alc880_asus_dac_nids,
3439 .dig_out_nid = ALC880_DIGOUT_NID,
3440 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3441 .channel_mode = alc880_asus_modes,
3443 .input_mux = &alc880_capture_source,
3445 [ALC880_ASUS_W1V] = {
3446 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3447 .init_verbs = { alc880_volume_init_verbs,
3448 alc880_pin_asus_init_verbs,
3449 alc880_gpio1_init_verbs },
3450 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3451 .dac_nids = alc880_asus_dac_nids,
3452 .dig_out_nid = ALC880_DIGOUT_NID,
3453 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3454 .channel_mode = alc880_asus_modes,
3456 .input_mux = &alc880_capture_source,
3458 [ALC880_UNIWILL_DIG] = {
3459 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3460 .init_verbs = { alc880_volume_init_verbs,
3461 alc880_pin_asus_init_verbs },
3462 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3463 .dac_nids = alc880_asus_dac_nids,
3464 .dig_out_nid = ALC880_DIGOUT_NID,
3465 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3466 .channel_mode = alc880_asus_modes,
3468 .input_mux = &alc880_capture_source,
3470 [ALC880_UNIWILL] = {
3471 .mixers = { alc880_uniwill_mixer },
3472 .init_verbs = { alc880_volume_init_verbs,
3473 alc880_uniwill_init_verbs },
3474 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3475 .dac_nids = alc880_asus_dac_nids,
3476 .dig_out_nid = ALC880_DIGOUT_NID,
3477 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3478 .channel_mode = alc880_threestack_modes,
3480 .input_mux = &alc880_capture_source,
3481 .unsol_event = alc880_uniwill_unsol_event,
3482 .init_hook = alc880_uniwill_automute,
3484 [ALC880_UNIWILL_P53] = {
3485 .mixers = { alc880_uniwill_p53_mixer },
3486 .init_verbs = { alc880_volume_init_verbs,
3487 alc880_uniwill_p53_init_verbs },
3488 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3489 .dac_nids = alc880_asus_dac_nids,
3490 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3491 .channel_mode = alc880_threestack_modes,
3492 .input_mux = &alc880_capture_source,
3493 .unsol_event = alc880_uniwill_p53_unsol_event,
3494 .init_hook = alc880_uniwill_p53_hp_automute,
3496 [ALC880_FUJITSU] = {
3497 .mixers = { alc880_fujitsu_mixer,
3498 alc880_pcbeep_mixer, },
3499 .init_verbs = { alc880_volume_init_verbs,
3500 alc880_uniwill_p53_init_verbs,
3501 alc880_beep_init_verbs },
3502 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3503 .dac_nids = alc880_dac_nids,
3504 .dig_out_nid = ALC880_DIGOUT_NID,
3505 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3506 .channel_mode = alc880_2_jack_modes,
3507 .input_mux = &alc880_capture_source,
3508 .unsol_event = alc880_uniwill_p53_unsol_event,
3509 .init_hook = alc880_uniwill_p53_hp_automute,
3512 .mixers = { alc880_three_stack_mixer },
3513 .init_verbs = { alc880_volume_init_verbs,
3514 alc880_pin_clevo_init_verbs },
3515 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3516 .dac_nids = alc880_dac_nids,
3518 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3519 .channel_mode = alc880_threestack_modes,
3521 .input_mux = &alc880_capture_source,
3524 .mixers = { alc880_lg_mixer },
3525 .init_verbs = { alc880_volume_init_verbs,
3526 alc880_lg_init_verbs },
3527 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3528 .dac_nids = alc880_lg_dac_nids,
3529 .dig_out_nid = ALC880_DIGOUT_NID,
3530 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3531 .channel_mode = alc880_lg_ch_modes,
3533 .input_mux = &alc880_lg_capture_source,
3534 .unsol_event = alc880_lg_unsol_event,
3535 .init_hook = alc880_lg_automute,
3536 #ifdef CONFIG_SND_HDA_POWER_SAVE
3537 .loopbacks = alc880_lg_loopbacks,
3541 .mixers = { alc880_lg_lw_mixer },
3542 .init_verbs = { alc880_volume_init_verbs,
3543 alc880_lg_lw_init_verbs },
3544 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3545 .dac_nids = alc880_dac_nids,
3546 .dig_out_nid = ALC880_DIGOUT_NID,
3547 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3548 .channel_mode = alc880_lg_lw_modes,
3549 .input_mux = &alc880_lg_lw_capture_source,
3550 .unsol_event = alc880_lg_lw_unsol_event,
3551 .init_hook = alc880_lg_lw_automute,
3553 [ALC880_MEDION_RIM] = {
3554 .mixers = { alc880_medion_rim_mixer },
3555 .init_verbs = { alc880_volume_init_verbs,
3556 alc880_medion_rim_init_verbs,
3557 alc_gpio2_init_verbs },
3558 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3559 .dac_nids = alc880_dac_nids,
3560 .dig_out_nid = ALC880_DIGOUT_NID,
3561 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3562 .channel_mode = alc880_2_jack_modes,
3563 .input_mux = &alc880_medion_rim_capture_source,
3564 .unsol_event = alc880_medion_rim_unsol_event,
3565 .init_hook = alc880_medion_rim_automute,
3567 #ifdef CONFIG_SND_DEBUG
3569 .mixers = { alc880_test_mixer },
3570 .init_verbs = { alc880_test_init_verbs },
3571 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3572 .dac_nids = alc880_test_dac_nids,
3573 .dig_out_nid = ALC880_DIGOUT_NID,
3574 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3575 .channel_mode = alc880_test_modes,
3576 .input_mux = &alc880_test_capture_source,
3582 * Automatic parse of I/O pins from the BIOS configuration
3587 ALC_CTL_WIDGET_MUTE,
3590 static struct snd_kcontrol_new alc880_control_templates[] = {
3591 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3592 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3593 HDA_BIND_MUTE(NULL, 0, 0, 0),
3596 /* add dynamic controls */
3597 static int add_control(struct alc_spec *spec, int type, const char *name,
3600 struct snd_kcontrol_new *knew;
3602 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3603 knew = snd_array_new(&spec->kctls);
3606 *knew = alc880_control_templates[type];
3607 knew->name = kstrdup(name, GFP_KERNEL);
3610 knew->private_value = val;
3614 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3615 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3616 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3617 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3618 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3619 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3620 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3621 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3622 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3623 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3624 #define ALC880_PIN_CD_NID 0x1c
3626 /* fill in the dac_nids table from the parsed pin configuration */
3627 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3628 const struct auto_pin_cfg *cfg)
3634 memset(assigned, 0, sizeof(assigned));
3635 spec->multiout.dac_nids = spec->private_dac_nids;
3637 /* check the pins hardwired to audio widget */
3638 for (i = 0; i < cfg->line_outs; i++) {
3639 nid = cfg->line_out_pins[i];
3640 if (alc880_is_fixed_pin(nid)) {
3641 int idx = alc880_fixed_pin_idx(nid);
3642 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3646 /* left pins can be connect to any audio widget */
3647 for (i = 0; i < cfg->line_outs; i++) {
3648 nid = cfg->line_out_pins[i];
3649 if (alc880_is_fixed_pin(nid))
3651 /* search for an empty channel */
3652 for (j = 0; j < cfg->line_outs; j++) {
3654 spec->multiout.dac_nids[i] =
3655 alc880_idx_to_dac(j);
3661 spec->multiout.num_dacs = cfg->line_outs;
3665 /* add playback controls from the parsed DAC table */
3666 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3667 const struct auto_pin_cfg *cfg)
3670 static const char *chname[4] = {
3671 "Front", "Surround", NULL /*CLFE*/, "Side"
3676 for (i = 0; i < cfg->line_outs; i++) {
3677 if (!spec->multiout.dac_nids[i])
3679 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3682 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3683 "Center Playback Volume",
3684 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3688 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3689 "LFE Playback Volume",
3690 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3694 err = add_control(spec, ALC_CTL_BIND_MUTE,
3695 "Center Playback Switch",
3696 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3700 err = add_control(spec, ALC_CTL_BIND_MUTE,
3701 "LFE Playback Switch",
3702 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3707 sprintf(name, "%s Playback Volume", chname[i]);
3708 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3709 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3713 sprintf(name, "%s Playback Switch", chname[i]);
3714 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3715 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3724 /* add playback controls for speaker and HP outputs */
3725 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3735 if (alc880_is_fixed_pin(pin)) {
3736 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3737 /* specify the DAC as the extra output */
3738 if (!spec->multiout.hp_nid)
3739 spec->multiout.hp_nid = nid;
3741 spec->multiout.extra_out_nid[0] = nid;
3742 /* control HP volume/switch on the output mixer amp */
3743 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3744 sprintf(name, "%s Playback Volume", pfx);
3745 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3746 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3749 sprintf(name, "%s Playback Switch", pfx);
3750 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3751 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3754 } else if (alc880_is_multi_pin(pin)) {
3755 /* set manual connection */
3756 /* we have only a switch on HP-out PIN */
3757 sprintf(name, "%s Playback Switch", pfx);
3758 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3759 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3766 /* create input playback/capture controls for the given pin */
3767 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3768 const char *ctlname,
3769 int idx, hda_nid_t mix_nid)
3774 sprintf(name, "%s Playback Volume", ctlname);
3775 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3776 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3779 sprintf(name, "%s Playback Switch", ctlname);
3780 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3781 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3787 /* create playback/capture controls for input pins */
3788 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3789 const struct auto_pin_cfg *cfg)
3791 struct hda_input_mux *imux = &spec->private_imux;
3794 for (i = 0; i < AUTO_PIN_LAST; i++) {
3795 if (alc880_is_input_pin(cfg->input_pins[i])) {
3796 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3797 err = new_analog_input(spec, cfg->input_pins[i],
3798 auto_pin_cfg_labels[i],
3802 imux->items[imux->num_items].label =
3803 auto_pin_cfg_labels[i];
3804 imux->items[imux->num_items].index =
3805 alc880_input_pin_idx(cfg->input_pins[i]);
3812 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3813 unsigned int pin_type)
3815 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3818 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3822 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3823 hda_nid_t nid, int pin_type,
3826 alc_set_pin_output(codec, nid, pin_type);
3827 /* need the manual connection? */
3828 if (alc880_is_multi_pin(nid)) {
3829 struct alc_spec *spec = codec->spec;
3830 int idx = alc880_multi_pin_idx(nid);
3831 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3832 AC_VERB_SET_CONNECT_SEL,
3833 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3837 static int get_pin_type(int line_out_type)
3839 if (line_out_type == AUTO_PIN_HP_OUT)
3845 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3847 struct alc_spec *spec = codec->spec;
3850 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3851 for (i = 0; i < spec->autocfg.line_outs; i++) {
3852 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3853 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3854 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3858 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3860 struct alc_spec *spec = codec->spec;
3863 pin = spec->autocfg.speaker_pins[0];
3864 if (pin) /* connect to front */
3865 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3866 pin = spec->autocfg.hp_pins[0];
3867 if (pin) /* connect to front */
3868 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3871 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3873 struct alc_spec *spec = codec->spec;
3876 for (i = 0; i < AUTO_PIN_LAST; i++) {
3877 hda_nid_t nid = spec->autocfg.input_pins[i];
3878 if (alc880_is_input_pin(nid)) {
3879 snd_hda_codec_write(codec, nid, 0,
3880 AC_VERB_SET_PIN_WIDGET_CONTROL,
3881 i <= AUTO_PIN_FRONT_MIC ?
3882 PIN_VREF80 : PIN_IN);
3883 if (nid != ALC880_PIN_CD_NID)
3884 snd_hda_codec_write(codec, nid, 0,
3885 AC_VERB_SET_AMP_GAIN_MUTE,
3891 /* parse the BIOS configuration and set up the alc_spec */
3892 /* return 1 if successful, 0 if the proper config is not found,
3893 * or a negative error code
3895 static int alc880_parse_auto_config(struct hda_codec *codec)
3897 struct alc_spec *spec = codec->spec;
3899 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3901 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3905 if (!spec->autocfg.line_outs)
3906 return 0; /* can't find valid BIOS pin config */
3908 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3911 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3914 err = alc880_auto_create_extra_out(spec,
3915 spec->autocfg.speaker_pins[0],
3919 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3923 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3927 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3929 if (spec->autocfg.dig_out_pin)
3930 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3931 if (spec->autocfg.dig_in_pin)
3932 spec->dig_in_nid = ALC880_DIGIN_NID;
3934 if (spec->kctls.list)
3935 add_mixer(spec, spec->kctls.list);
3937 add_verb(spec, alc880_volume_init_verbs);
3939 spec->num_mux_defs = 1;
3940 spec->input_mux = &spec->private_imux;
3942 store_pin_configs(codec);
3946 /* additional initialization for auto-configuration model */
3947 static void alc880_auto_init(struct hda_codec *codec)
3949 struct alc_spec *spec = codec->spec;
3950 alc880_auto_init_multi_out(codec);
3951 alc880_auto_init_extra_out(codec);
3952 alc880_auto_init_analog_input(codec);
3953 if (spec->unsol_event)
3954 alc_inithook(codec);
3958 * OK, here we have finally the patch for ALC880
3961 static int patch_alc880(struct hda_codec *codec)
3963 struct alc_spec *spec;
3967 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3973 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3976 if (board_config < 0) {
3977 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3978 "trying auto-probe from BIOS...\n");
3979 board_config = ALC880_AUTO;
3982 if (board_config == ALC880_AUTO) {
3983 /* automatic parse from the BIOS config */
3984 err = alc880_parse_auto_config(codec);
3990 "hda_codec: Cannot set up configuration "
3991 "from BIOS. Using 3-stack mode...\n");
3992 board_config = ALC880_3ST;
3996 if (board_config != ALC880_AUTO)
3997 setup_preset(spec, &alc880_presets[board_config]);
3999 spec->stream_name_analog = "ALC880 Analog";
4000 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4001 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4002 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4004 spec->stream_name_digital = "ALC880 Digital";
4005 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4006 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4008 if (!spec->adc_nids && spec->input_mux) {
4009 /* check whether NID 0x07 is valid */
4010 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4012 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4013 if (wcap != AC_WID_AUD_IN) {
4014 spec->adc_nids = alc880_adc_nids_alt;
4015 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4016 add_mixer(spec, alc880_capture_alt_mixer);
4018 spec->adc_nids = alc880_adc_nids;
4019 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4020 add_mixer(spec, alc880_capture_mixer);
4024 spec->vmaster_nid = 0x0c;
4026 codec->patch_ops = alc_patch_ops;
4027 if (board_config == ALC880_AUTO)
4028 spec->init_hook = alc880_auto_init;
4029 #ifdef CONFIG_SND_HDA_POWER_SAVE
4030 if (!spec->loopback.amplist)
4031 spec->loopback.amplist = alc880_loopbacks;
4042 static hda_nid_t alc260_dac_nids[1] = {
4047 static hda_nid_t alc260_adc_nids[1] = {
4052 static hda_nid_t alc260_adc_nids_alt[1] = {
4057 static hda_nid_t alc260_hp_adc_nids[2] = {
4062 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4063 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4065 static hda_nid_t alc260_dual_adc_nids[2] = {
4070 #define ALC260_DIGOUT_NID 0x03
4071 #define ALC260_DIGIN_NID 0x06
4073 static struct hda_input_mux alc260_capture_source = {
4077 { "Front Mic", 0x1 },
4083 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4084 * headphone jack and the internal CD lines since these are the only pins at
4085 * which audio can appear. For flexibility, also allow the option of
4086 * recording the mixer output on the second ADC (ADC0 doesn't have a
4087 * connection to the mixer output).
4089 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4093 { "Mic/Line", 0x0 },
4095 { "Headphone", 0x2 },
4101 { "Mic/Line", 0x0 },
4103 { "Headphone", 0x2 },
4110 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4111 * the Fujitsu S702x, but jacks are marked differently.
4113 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4120 { "Headphone", 0x5 },
4129 { "Headphone", 0x6 },
4135 * This is just place-holder, so there's something for alc_build_pcms to look
4136 * at when it calculates the maximum number of channels. ALC260 has no mixer
4137 * element which allows changing the channel mode, so the verb list is
4140 static struct hda_channel_mode alc260_modes[1] = {
4145 /* Mixer combinations
4147 * basic: base_output + input + pc_beep + capture
4148 * HP: base_output + input + capture_alt
4149 * HP_3013: hp_3013 + input + capture
4150 * fujitsu: fujitsu + capture
4151 * acer: acer + capture
4154 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4155 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4156 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4157 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4158 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4159 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4160 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4164 static struct snd_kcontrol_new alc260_input_mixer[] = {
4165 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4166 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4167 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4168 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4170 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4171 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4172 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4176 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4177 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4178 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4182 /* update HP, line and mono out pins according to the master switch */
4183 static void alc260_hp_master_update(struct hda_codec *codec,
4184 hda_nid_t hp, hda_nid_t line,
4187 struct alc_spec *spec = codec->spec;
4188 unsigned int val = spec->master_sw ? PIN_HP : 0;
4189 /* change HP and line-out pins */
4190 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4192 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4194 /* mono (speaker) depending on the HP jack sense */
4195 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4196 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4200 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4201 struct snd_ctl_elem_value *ucontrol)
4203 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4204 struct alc_spec *spec = codec->spec;
4205 *ucontrol->value.integer.value = spec->master_sw;
4209 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4210 struct snd_ctl_elem_value *ucontrol)
4212 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4213 struct alc_spec *spec = codec->spec;
4214 int val = !!*ucontrol->value.integer.value;
4215 hda_nid_t hp, line, mono;
4217 if (val == spec->master_sw)
4219 spec->master_sw = val;
4220 hp = (kcontrol->private_value >> 16) & 0xff;
4221 line = (kcontrol->private_value >> 8) & 0xff;
4222 mono = kcontrol->private_value & 0xff;
4223 alc260_hp_master_update(codec, hp, line, mono);
4227 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4229 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4230 .name = "Master Playback Switch",
4231 .info = snd_ctl_boolean_mono_info,
4232 .get = alc260_hp_master_sw_get,
4233 .put = alc260_hp_master_sw_put,
4234 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4236 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4237 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4238 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4239 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4240 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4242 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4246 static struct hda_verb alc260_hp_unsol_verbs[] = {
4247 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4251 static void alc260_hp_automute(struct hda_codec *codec)
4253 struct alc_spec *spec = codec->spec;
4254 unsigned int present;
4256 present = snd_hda_codec_read(codec, 0x10, 0,
4257 AC_VERB_GET_PIN_SENSE, 0);
4258 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4259 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4262 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4264 if ((res >> 26) == ALC880_HP_EVENT)
4265 alc260_hp_automute(codec);
4268 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4270 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4271 .name = "Master Playback Switch",
4272 .info = snd_ctl_boolean_mono_info,
4273 .get = alc260_hp_master_sw_get,
4274 .put = alc260_hp_master_sw_put,
4275 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4277 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4278 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4279 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4280 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4281 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4282 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4283 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4284 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4288 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4289 .ops = &snd_hda_bind_vol,
4291 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4292 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4293 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4298 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4299 .ops = &snd_hda_bind_sw,
4301 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4302 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4307 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4308 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4309 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4310 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4315 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4316 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4320 static void alc260_hp_3013_automute(struct hda_codec *codec)
4322 struct alc_spec *spec = codec->spec;
4323 unsigned int present;
4325 present = snd_hda_codec_read(codec, 0x15, 0,
4326 AC_VERB_GET_PIN_SENSE, 0);
4327 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4328 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4331 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4334 if ((res >> 26) == ALC880_HP_EVENT)
4335 alc260_hp_3013_automute(codec);
4338 static void alc260_hp_3012_automute(struct hda_codec *codec)
4340 unsigned int present, bits;
4342 present = snd_hda_codec_read(codec, 0x10, 0,
4343 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4345 bits = present ? 0 : PIN_OUT;
4346 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4348 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4350 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4354 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4357 if ((res >> 26) == ALC880_HP_EVENT)
4358 alc260_hp_3012_automute(codec);
4361 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4362 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4364 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4366 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4367 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4368 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4369 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4370 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4371 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4372 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4373 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4374 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4375 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4376 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4380 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4381 * versions of the ALC260 don't act on requests to enable mic bias from NID
4382 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4383 * datasheet doesn't mention this restriction. At this stage it's not clear
4384 * whether this behaviour is intentional or is a hardware bug in chip
4385 * revisions available in early 2006. Therefore for now allow the
4386 * "Headphone Jack Mode" control to span all choices, but if it turns out
4387 * that the lack of mic bias for this NID is intentional we could change the
4388 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4390 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4391 * don't appear to make the mic bias available from the "line" jack, even
4392 * though the NID used for this jack (0x14) can supply it. The theory is
4393 * that perhaps Acer have included blocking capacitors between the ALC260
4394 * and the output jack. If this turns out to be the case for all such
4395 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4396 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4398 * The C20x Tablet series have a mono internal speaker which is controlled
4399 * via the chip's Mono sum widget and pin complex, so include the necessary
4400 * controls for such models. On models without a "mono speaker" the control
4401 * won't do anything.
4403 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4404 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4405 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4406 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4407 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4409 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4411 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4412 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4414 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4415 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4416 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4417 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4418 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4419 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4420 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4424 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4425 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4427 static struct snd_kcontrol_new alc260_will_mixer[] = {
4428 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4429 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4431 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4432 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4433 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4434 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4435 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4436 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4437 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4438 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4439 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4443 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4444 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4446 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4447 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4448 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4450 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4451 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4452 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4453 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4454 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4455 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4456 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4460 /* capture mixer elements */
4461 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4462 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4463 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4464 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4465 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4468 /* The multiple "Capture Source" controls confuse alsamixer
4469 * So call somewhat different..
4471 /* .name = "Capture Source", */
4472 .name = "Input Source",
4474 .info = alc_mux_enum_info,
4475 .get = alc_mux_enum_get,
4476 .put = alc_mux_enum_put,
4481 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4482 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4483 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4485 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4486 /* The multiple "Capture Source" controls confuse alsamixer
4487 * So call somewhat different..
4489 /* .name = "Capture Source", */
4490 .name = "Input Source",
4492 .info = alc_mux_enum_info,
4493 .get = alc_mux_enum_get,
4494 .put = alc_mux_enum_put,
4500 * initialization verbs
4502 static struct hda_verb alc260_init_verbs[] = {
4503 /* Line In pin widget for input */
4504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4505 /* CD pin widget for input */
4506 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4507 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4508 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4509 /* Mic2 (front panel) pin widget for input and vref at 80% */
4510 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4511 /* LINE-2 is used for line-out in rear */
4512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4513 /* select line-out */
4514 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4516 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4518 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4520 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4521 /* mute capture amp left and right */
4522 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4523 /* set connection select to line in (default select for this ADC) */
4524 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4525 /* mute capture amp left and right */
4526 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4527 /* set connection select to line in (default select for this ADC) */
4528 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4529 /* set vol=0 Line-Out mixer amp left and right */
4530 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4531 /* unmute pin widget amp left and right (no gain on this amp) */
4532 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4533 /* set vol=0 HP mixer amp left and right */
4534 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4535 /* unmute pin widget amp left and right (no gain on this amp) */
4536 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4537 /* set vol=0 Mono mixer amp left and right */
4538 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4539 /* unmute pin widget amp left and right (no gain on this amp) */
4540 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4541 /* unmute LINE-2 out pin */
4542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4543 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4546 /* mute analog inputs */
4547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4552 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4553 /* mute Front out path */
4554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4556 /* mute Headphone out path */
4557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4558 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4559 /* mute Mono out path */
4560 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4561 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4565 #if 0 /* should be identical with alc260_init_verbs? */
4566 static struct hda_verb alc260_hp_init_verbs[] = {
4567 /* Headphone and output */
4568 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4570 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4571 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4572 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4573 /* Mic2 (front panel) pin widget for input and vref at 80% */
4574 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4575 /* Line In pin widget for input */
4576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4577 /* Line-2 pin widget for output */
4578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4579 /* CD pin widget for input */
4580 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4581 /* unmute amp left and right */
4582 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4583 /* set connection select to line in (default select for this ADC) */
4584 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4585 /* unmute Line-Out mixer amp left and right (volume = 0) */
4586 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4587 /* mute pin widget amp left and right (no gain on this amp) */
4588 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4589 /* unmute HP mixer amp left and right (volume = 0) */
4590 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4591 /* mute pin widget amp left and right (no gain on this amp) */
4592 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4593 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4596 /* mute analog inputs */
4597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4602 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4603 /* Unmute Front out path */
4604 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4605 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4606 /* Unmute Headphone out path */
4607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4608 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4609 /* Unmute Mono out path */
4610 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4611 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4616 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4617 /* Line out and output */
4618 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4620 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4621 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4622 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4623 /* Mic2 (front panel) pin widget for input and vref at 80% */
4624 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4625 /* Line In pin widget for input */
4626 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4627 /* Headphone pin widget for output */
4628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4629 /* CD pin widget for input */
4630 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4631 /* unmute amp left and right */
4632 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4633 /* set connection select to line in (default select for this ADC) */
4634 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4635 /* unmute Line-Out mixer amp left and right (volume = 0) */
4636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4637 /* mute pin widget amp left and right (no gain on this amp) */
4638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4639 /* unmute HP mixer amp left and right (volume = 0) */
4640 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4641 /* mute pin widget amp left and right (no gain on this amp) */
4642 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4643 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4646 /* mute analog inputs */
4647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4649 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4652 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4653 /* Unmute Front out path */
4654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4656 /* Unmute Headphone out path */
4657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4659 /* Unmute Mono out path */
4660 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4661 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4665 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4666 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4667 * audio = 0x16, internal speaker = 0x10.
4669 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4670 /* Disable all GPIOs */
4671 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4672 /* Internal speaker is connected to headphone pin */
4673 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4674 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4676 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4677 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4678 /* Ensure all other unused pins are disabled and muted. */
4679 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4680 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4681 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4682 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4683 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4684 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4688 /* Disable digital (SPDIF) pins */
4689 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4690 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4692 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4693 * when acting as an output.
4695 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4697 /* Start with output sum widgets muted and their output gains at min */
4698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4700 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4703 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4704 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4705 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4706 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4708 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4709 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4710 /* Unmute Line1 pin widget output buffer since it starts as an output.
4711 * If the pin mode is changed by the user the pin mode control will
4712 * take care of enabling the pin's input/output buffers as needed.
4713 * Therefore there's no need to enable the input buffer at this
4716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4717 /* Unmute input buffer of pin widget used for Line-in (no equiv
4720 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4722 /* Mute capture amp left and right */
4723 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4724 /* Set ADC connection select to match default mixer setting - line
4727 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4729 /* Do the same for the second ADC: mute capture input amp and
4730 * set ADC connection to line in (on mic1 pin)
4732 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4733 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4735 /* Mute all inputs to mixer widget (even unconnected ones) */
4736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4743 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4748 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4749 * similar laptops (adapted from Fujitsu init verbs).
4751 static struct hda_verb alc260_acer_init_verbs[] = {
4752 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4753 * the headphone jack. Turn this on and rely on the standard mute
4754 * methods whenever the user wants to turn these outputs off.
4756 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4757 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4758 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4759 /* Internal speaker/Headphone jack is connected to Line-out pin */
4760 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4761 /* Internal microphone/Mic jack is connected to Mic1 pin */
4762 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4763 /* Line In jack is connected to Line1 pin */
4764 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4765 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4766 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4767 /* Ensure all other unused pins are disabled and muted. */
4768 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4769 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4770 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4771 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4772 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4774 /* Disable digital (SPDIF) pins */
4775 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4776 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4778 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4779 * bus when acting as outputs.
4781 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4782 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4784 /* Start with output sum widgets muted and their output gains at min */
4785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4790 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4791 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4792 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4793 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4795 /* Unmute Line-out pin widget amp left and right
4796 * (no equiv mixer ctrl)
4798 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4799 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4800 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4801 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4802 * inputs. If the pin mode is changed by the user the pin mode control
4803 * will take care of enabling the pin's input/output buffers as needed.
4804 * Therefore there's no need to enable the input buffer at this
4807 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4810 /* Mute capture amp left and right */
4811 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4812 /* Set ADC connection select to match default mixer setting - mic
4815 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4817 /* Do similar with the second ADC: mute capture input amp and
4818 * set ADC connection to mic to match ALSA's default state.
4820 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4821 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4823 /* Mute all inputs to mixer widget (even unconnected ones) */
4824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4827 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4836 static struct hda_verb alc260_will_verbs[] = {
4837 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4838 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4839 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4840 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4841 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4842 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4846 static struct hda_verb alc260_replacer_672v_verbs[] = {
4847 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4848 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4849 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4851 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4852 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4853 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4855 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4859 /* toggle speaker-output according to the hp-jack state */
4860 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4862 unsigned int present;
4864 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4865 present = snd_hda_codec_read(codec, 0x0f, 0,
4866 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4868 snd_hda_codec_write_cache(codec, 0x01, 0,
4869 AC_VERB_SET_GPIO_DATA, 1);
4870 snd_hda_codec_write_cache(codec, 0x0f, 0,
4871 AC_VERB_SET_PIN_WIDGET_CONTROL,
4874 snd_hda_codec_write_cache(codec, 0x01, 0,
4875 AC_VERB_SET_GPIO_DATA, 0);
4876 snd_hda_codec_write_cache(codec, 0x0f, 0,
4877 AC_VERB_SET_PIN_WIDGET_CONTROL,
4882 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4885 if ((res >> 26) == ALC880_HP_EVENT)
4886 alc260_replacer_672v_automute(codec);
4889 static struct hda_verb alc260_hp_dc7600_verbs[] = {
4890 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4891 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4892 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4893 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4894 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4896 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4897 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4898 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4899 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4903 /* Test configuration for debugging, modelled after the ALC880 test
4906 #ifdef CONFIG_SND_DEBUG
4907 static hda_nid_t alc260_test_dac_nids[1] = {
4910 static hda_nid_t alc260_test_adc_nids[2] = {
4913 /* For testing the ALC260, each input MUX needs its own definition since
4914 * the signal assignments are different. This assumes that the first ADC
4917 static struct hda_input_mux alc260_test_capture_sources[2] = {
4921 { "MIC1 pin", 0x0 },
4922 { "MIC2 pin", 0x1 },
4923 { "LINE1 pin", 0x2 },
4924 { "LINE2 pin", 0x3 },
4926 { "LINE-OUT pin", 0x5 },
4927 { "HP-OUT pin", 0x6 },
4933 { "MIC1 pin", 0x0 },
4934 { "MIC2 pin", 0x1 },
4935 { "LINE1 pin", 0x2 },
4936 { "LINE2 pin", 0x3 },
4939 { "LINE-OUT pin", 0x6 },
4940 { "HP-OUT pin", 0x7 },
4944 static struct snd_kcontrol_new alc260_test_mixer[] = {
4945 /* Output driver widgets */
4946 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4947 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4948 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4949 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4950 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4951 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4953 /* Modes for retasking pin widgets
4954 * Note: the ALC260 doesn't seem to act on requests to enable mic
4955 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4956 * mention this restriction. At this stage it's not clear whether
4957 * this behaviour is intentional or is a hardware bug in chip
4958 * revisions available at least up until early 2006. Therefore for
4959 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4960 * choices, but if it turns out that the lack of mic bias for these
4961 * NIDs is intentional we could change their modes from
4962 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4964 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4965 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4966 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4967 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4968 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4969 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4971 /* Loopback mixer controls */
4972 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4973 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4974 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4975 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4976 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4977 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4978 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4979 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4980 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4981 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4982 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4983 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4984 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4985 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4986 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4987 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4989 /* Controls for GPIO pins, assuming they are configured as outputs */
4990 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4991 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4992 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4993 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4995 /* Switches to allow the digital IO pins to be enabled. The datasheet
4996 * is ambigious as to which NID is which; testing on laptops which
4997 * make this output available should provide clarification.
4999 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5000 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5002 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5003 * this output to turn on an external amplifier.
5005 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5006 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5010 static struct hda_verb alc260_test_init_verbs[] = {
5011 /* Enable all GPIOs as outputs with an initial value of 0 */
5012 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5013 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5014 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5016 /* Enable retasking pins as output, initially without power amp */
5017 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5018 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5020 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5021 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5022 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5024 /* Disable digital (SPDIF) pins initially, but users can enable
5025 * them via a mixer switch. In the case of SPDIF-out, this initverb
5026 * payload also sets the generation to 0, output to be in "consumer"
5027 * PCM format, copyright asserted, no pre-emphasis and no validity
5030 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5031 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5033 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5034 * OUT1 sum bus when acting as an output.
5036 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5037 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5038 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5039 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5041 /* Start with output sum widgets muted and their output gains at min */
5042 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5043 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5045 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5046 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5048 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5049 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5050 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5052 /* Unmute retasking pin widget output buffers since the default
5053 * state appears to be output. As the pin mode is changed by the
5054 * user the pin mode control will take care of enabling the pin's
5055 * input/output buffers as needed.
5057 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5058 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5060 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5061 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5062 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5063 /* Also unmute the mono-out pin widget */
5064 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5066 /* Mute capture amp left and right */
5067 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5068 /* Set ADC connection select to match default mixer setting (mic1
5071 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5073 /* Do the same for the second ADC: mute capture input amp and
5074 * set ADC connection to mic1 pin
5076 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5077 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5079 /* Mute all inputs to mixer widget (even unconnected ones) */
5080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5084 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5086 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5087 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5093 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5094 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5096 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5097 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5100 * for BIOS auto-configuration
5103 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5104 const char *pfx, int *vol_bits)
5107 unsigned long vol_val, sw_val;
5111 if (nid >= 0x0f && nid < 0x11) {
5112 nid_vol = nid - 0x7;
5113 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5114 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5115 } else if (nid == 0x11) {
5116 nid_vol = nid - 0x7;
5117 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5118 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5119 } else if (nid >= 0x12 && nid <= 0x15) {
5121 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5122 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5126 if (!(*vol_bits & (1 << nid_vol))) {
5127 /* first control for the volume widget */
5128 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5129 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5132 *vol_bits |= (1 << nid_vol);
5134 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5135 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5141 /* add playback controls from the parsed DAC table */
5142 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5143 const struct auto_pin_cfg *cfg)
5149 spec->multiout.num_dacs = 1;
5150 spec->multiout.dac_nids = spec->private_dac_nids;
5151 spec->multiout.dac_nids[0] = 0x02;
5153 nid = cfg->line_out_pins[0];
5155 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5160 nid = cfg->speaker_pins[0];
5162 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5167 nid = cfg->hp_pins[0];
5169 err = alc260_add_playback_controls(spec, nid, "Headphone",
5177 /* create playback/capture controls for input pins */
5178 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5179 const struct auto_pin_cfg *cfg)
5181 struct hda_input_mux *imux = &spec->private_imux;
5184 for (i = 0; i < AUTO_PIN_LAST; i++) {
5185 if (cfg->input_pins[i] >= 0x12) {
5186 idx = cfg->input_pins[i] - 0x12;
5187 err = new_analog_input(spec, cfg->input_pins[i],
5188 auto_pin_cfg_labels[i], idx,
5192 imux->items[imux->num_items].label =
5193 auto_pin_cfg_labels[i];
5194 imux->items[imux->num_items].index = idx;
5197 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5198 idx = cfg->input_pins[i] - 0x09;
5199 err = new_analog_input(spec, cfg->input_pins[i],
5200 auto_pin_cfg_labels[i], idx,
5204 imux->items[imux->num_items].label =
5205 auto_pin_cfg_labels[i];
5206 imux->items[imux->num_items].index = idx;
5213 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5214 hda_nid_t nid, int pin_type,
5217 alc_set_pin_output(codec, nid, pin_type);
5218 /* need the manual connection? */
5220 int idx = nid - 0x12;
5221 snd_hda_codec_write(codec, idx + 0x0b, 0,
5222 AC_VERB_SET_CONNECT_SEL, sel_idx);
5226 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5228 struct alc_spec *spec = codec->spec;
5231 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5232 nid = spec->autocfg.line_out_pins[0];
5234 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5235 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5238 nid = spec->autocfg.speaker_pins[0];
5240 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5242 nid = spec->autocfg.hp_pins[0];
5244 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5247 #define ALC260_PIN_CD_NID 0x16
5248 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5250 struct alc_spec *spec = codec->spec;
5253 for (i = 0; i < AUTO_PIN_LAST; i++) {
5254 hda_nid_t nid = spec->autocfg.input_pins[i];
5256 snd_hda_codec_write(codec, nid, 0,
5257 AC_VERB_SET_PIN_WIDGET_CONTROL,
5258 i <= AUTO_PIN_FRONT_MIC ?
5259 PIN_VREF80 : PIN_IN);
5260 if (nid != ALC260_PIN_CD_NID)
5261 snd_hda_codec_write(codec, nid, 0,
5262 AC_VERB_SET_AMP_GAIN_MUTE,
5269 * generic initialization of ADC, input mixers and output mixers
5271 static struct hda_verb alc260_volume_init_verbs[] = {
5273 * Unmute ADC0-1 and set the default input to mic-in
5275 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5276 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5277 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5278 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5280 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5282 * Note: PASD motherboards uses the Line In 2 as the input for
5283 * front panel mic (mic 2)
5285 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5286 /* mute analog inputs */
5287 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5294 * Set up output mixers (0x08 - 0x0a)
5296 /* set vol=0 to output mixers */
5297 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5299 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5300 /* set up input amps for analog loopback */
5301 /* Amp Indices: DAC = 0, mixer = 1 */
5302 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5303 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5304 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5306 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5307 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5312 static int alc260_parse_auto_config(struct hda_codec *codec)
5314 struct alc_spec *spec = codec->spec;
5317 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5319 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5323 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5326 if (!spec->kctls.list)
5327 return 0; /* can't find valid BIOS pin config */
5328 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5332 spec->multiout.max_channels = 2;
5334 if (spec->autocfg.dig_out_pin)
5335 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5336 if (spec->kctls.list)
5337 add_mixer(spec, spec->kctls.list);
5339 add_verb(spec, alc260_volume_init_verbs);
5341 spec->num_mux_defs = 1;
5342 spec->input_mux = &spec->private_imux;
5344 /* check whether NID 0x04 is valid */
5345 wcap = get_wcaps(codec, 0x04);
5346 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5347 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5348 spec->adc_nids = alc260_adc_nids_alt;
5349 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5350 add_mixer(spec, alc260_capture_alt_mixer);
5352 spec->adc_nids = alc260_adc_nids;
5353 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5354 add_mixer(spec, alc260_capture_mixer);
5357 store_pin_configs(codec);
5361 /* additional initialization for auto-configuration model */
5362 static void alc260_auto_init(struct hda_codec *codec)
5364 struct alc_spec *spec = codec->spec;
5365 alc260_auto_init_multi_out(codec);
5366 alc260_auto_init_analog_input(codec);
5367 if (spec->unsol_event)
5368 alc_inithook(codec);
5371 #ifdef CONFIG_SND_HDA_POWER_SAVE
5372 static struct hda_amp_list alc260_loopbacks[] = {
5373 { 0x07, HDA_INPUT, 0 },
5374 { 0x07, HDA_INPUT, 1 },
5375 { 0x07, HDA_INPUT, 2 },
5376 { 0x07, HDA_INPUT, 3 },
5377 { 0x07, HDA_INPUT, 4 },
5383 * ALC260 configurations
5385 static const char *alc260_models[ALC260_MODEL_LAST] = {
5386 [ALC260_BASIC] = "basic",
5388 [ALC260_HP_3013] = "hp-3013",
5389 [ALC260_HP_DC7600] = "hp-dc7600",
5390 [ALC260_FUJITSU_S702X] = "fujitsu",
5391 [ALC260_ACER] = "acer",
5392 [ALC260_WILL] = "will",
5393 [ALC260_REPLACER_672V] = "replacer",
5394 #ifdef CONFIG_SND_DEBUG
5395 [ALC260_TEST] = "test",
5397 [ALC260_AUTO] = "auto",
5400 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5401 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5402 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5403 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5404 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5405 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5406 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5407 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5408 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5409 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5410 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5411 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5412 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5413 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5414 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5415 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5416 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5417 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5418 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5422 static struct alc_config_preset alc260_presets[] = {
5424 .mixers = { alc260_base_output_mixer,
5426 alc260_pc_beep_mixer,
5427 alc260_capture_mixer },
5428 .init_verbs = { alc260_init_verbs },
5429 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5430 .dac_nids = alc260_dac_nids,
5431 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5432 .adc_nids = alc260_adc_nids,
5433 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5434 .channel_mode = alc260_modes,
5435 .input_mux = &alc260_capture_source,
5438 .mixers = { alc260_hp_output_mixer,
5440 alc260_capture_alt_mixer },
5441 .init_verbs = { alc260_init_verbs,
5442 alc260_hp_unsol_verbs },
5443 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5444 .dac_nids = alc260_dac_nids,
5445 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5446 .adc_nids = alc260_hp_adc_nids,
5447 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5448 .channel_mode = alc260_modes,
5449 .input_mux = &alc260_capture_source,
5450 .unsol_event = alc260_hp_unsol_event,
5451 .init_hook = alc260_hp_automute,
5453 [ALC260_HP_DC7600] = {
5454 .mixers = { alc260_hp_dc7600_mixer,
5456 alc260_capture_alt_mixer },
5457 .init_verbs = { alc260_init_verbs,
5458 alc260_hp_dc7600_verbs },
5459 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5460 .dac_nids = alc260_dac_nids,
5461 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5462 .adc_nids = alc260_hp_adc_nids,
5463 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5464 .channel_mode = alc260_modes,
5465 .input_mux = &alc260_capture_source,
5466 .unsol_event = alc260_hp_3012_unsol_event,
5467 .init_hook = alc260_hp_3012_automute,
5469 [ALC260_HP_3013] = {
5470 .mixers = { alc260_hp_3013_mixer,
5472 alc260_capture_alt_mixer },
5473 .init_verbs = { alc260_hp_3013_init_verbs,
5474 alc260_hp_3013_unsol_verbs },
5475 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5476 .dac_nids = alc260_dac_nids,
5477 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5478 .adc_nids = alc260_hp_adc_nids,
5479 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5480 .channel_mode = alc260_modes,
5481 .input_mux = &alc260_capture_source,
5482 .unsol_event = alc260_hp_3013_unsol_event,
5483 .init_hook = alc260_hp_3013_automute,
5485 [ALC260_FUJITSU_S702X] = {
5486 .mixers = { alc260_fujitsu_mixer,
5487 alc260_capture_mixer },
5488 .init_verbs = { alc260_fujitsu_init_verbs },
5489 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5490 .dac_nids = alc260_dac_nids,
5491 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5492 .adc_nids = alc260_dual_adc_nids,
5493 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5494 .channel_mode = alc260_modes,
5495 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5496 .input_mux = alc260_fujitsu_capture_sources,
5499 .mixers = { alc260_acer_mixer,
5500 alc260_capture_mixer },
5501 .init_verbs = { alc260_acer_init_verbs },
5502 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5503 .dac_nids = alc260_dac_nids,
5504 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5505 .adc_nids = alc260_dual_adc_nids,
5506 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5507 .channel_mode = alc260_modes,
5508 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5509 .input_mux = alc260_acer_capture_sources,
5512 .mixers = { alc260_will_mixer,
5513 alc260_capture_mixer },
5514 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5515 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5516 .dac_nids = alc260_dac_nids,
5517 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5518 .adc_nids = alc260_adc_nids,
5519 .dig_out_nid = ALC260_DIGOUT_NID,
5520 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5521 .channel_mode = alc260_modes,
5522 .input_mux = &alc260_capture_source,
5524 [ALC260_REPLACER_672V] = {
5525 .mixers = { alc260_replacer_672v_mixer,
5526 alc260_capture_mixer },
5527 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5528 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5529 .dac_nids = alc260_dac_nids,
5530 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5531 .adc_nids = alc260_adc_nids,
5532 .dig_out_nid = ALC260_DIGOUT_NID,
5533 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5534 .channel_mode = alc260_modes,
5535 .input_mux = &alc260_capture_source,
5536 .unsol_event = alc260_replacer_672v_unsol_event,
5537 .init_hook = alc260_replacer_672v_automute,
5539 #ifdef CONFIG_SND_DEBUG
5541 .mixers = { alc260_test_mixer,
5542 alc260_capture_mixer },
5543 .init_verbs = { alc260_test_init_verbs },
5544 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5545 .dac_nids = alc260_test_dac_nids,
5546 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5547 .adc_nids = alc260_test_adc_nids,
5548 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5549 .channel_mode = alc260_modes,
5550 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5551 .input_mux = alc260_test_capture_sources,
5556 static int patch_alc260(struct hda_codec *codec)
5558 struct alc_spec *spec;
5559 int err, board_config;
5561 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5567 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5570 if (board_config < 0) {
5571 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5572 "trying auto-probe from BIOS...\n");
5573 board_config = ALC260_AUTO;
5576 if (board_config == ALC260_AUTO) {
5577 /* automatic parse from the BIOS config */
5578 err = alc260_parse_auto_config(codec);
5584 "hda_codec: Cannot set up configuration "
5585 "from BIOS. Using base mode...\n");
5586 board_config = ALC260_BASIC;
5590 if (board_config != ALC260_AUTO)
5591 setup_preset(spec, &alc260_presets[board_config]);
5593 spec->stream_name_analog = "ALC260 Analog";
5594 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5595 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5597 spec->stream_name_digital = "ALC260 Digital";
5598 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5599 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5601 spec->vmaster_nid = 0x08;
5603 codec->patch_ops = alc_patch_ops;
5604 if (board_config == ALC260_AUTO)
5605 spec->init_hook = alc260_auto_init;
5606 #ifdef CONFIG_SND_HDA_POWER_SAVE
5607 if (!spec->loopback.amplist)
5608 spec->loopback.amplist = alc260_loopbacks;
5618 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5619 * configuration. Each pin widget can choose any input DACs and a mixer.
5620 * Each ADC is connected from a mixer of all inputs. This makes possible
5621 * 6-channel independent captures.
5623 * In addition, an independent DAC for the multi-playback (not used in this
5626 #define ALC882_DIGOUT_NID 0x06
5627 #define ALC882_DIGIN_NID 0x0a
5629 static struct hda_channel_mode alc882_ch_modes[1] = {
5633 static hda_nid_t alc882_dac_nids[4] = {
5634 /* front, rear, clfe, rear_surr */
5635 0x02, 0x03, 0x04, 0x05
5638 /* identical with ALC880 */
5639 #define alc882_adc_nids alc880_adc_nids
5640 #define alc882_adc_nids_alt alc880_adc_nids_alt
5642 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5643 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5646 /* FIXME: should be a matrix-type input source selection */
5648 static struct hda_input_mux alc882_capture_source = {
5652 { "Front Mic", 0x1 },
5660 static struct hda_verb alc882_3ST_ch2_init[] = {
5661 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5662 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5663 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5664 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5671 static struct hda_verb alc882_3ST_ch6_init[] = {
5672 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5673 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5674 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5675 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5676 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5677 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5681 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5682 { 2, alc882_3ST_ch2_init },
5683 { 6, alc882_3ST_ch6_init },
5689 static struct hda_verb alc882_sixstack_ch6_init[] = {
5690 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5691 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5692 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5693 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5700 static struct hda_verb alc882_sixstack_ch8_init[] = {
5701 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5702 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5703 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5704 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5708 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5709 { 6, alc882_sixstack_ch6_init },
5710 { 8, alc882_sixstack_ch8_init },
5714 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5720 static struct hda_verb alc885_mbp_ch2_init[] = {
5721 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5722 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5723 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5730 static struct hda_verb alc885_mbp_ch6_init[] = {
5731 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5732 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5733 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5734 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5735 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5739 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5740 { 2, alc885_mbp_ch2_init },
5741 { 6, alc885_mbp_ch6_init },
5745 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5746 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5748 static struct snd_kcontrol_new alc882_base_mixer[] = {
5749 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5750 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5751 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5752 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5753 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5754 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5755 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5756 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5757 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5758 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5759 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5760 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5761 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5762 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5763 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5765 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5766 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5767 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5768 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5769 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5770 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5771 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5775 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5776 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5777 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5778 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5779 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5780 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5781 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5783 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5784 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5785 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5788 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5789 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5790 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5791 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5792 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5793 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5794 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5798 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5799 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5803 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5804 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5805 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5806 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5807 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5808 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5809 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5810 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5812 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5813 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5814 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5815 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5816 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5820 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5821 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5823 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5824 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5825 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5826 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5827 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5828 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5829 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5830 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5831 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5832 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5833 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5834 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5836 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5840 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5841 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5842 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5843 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5844 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5845 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5846 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5847 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5849 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5850 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5851 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5852 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5856 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5858 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5859 .name = "Channel Mode",
5860 .info = alc_ch_mode_info,
5861 .get = alc_ch_mode_get,
5862 .put = alc_ch_mode_put,
5867 static struct hda_verb alc882_init_verbs[] = {
5868 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5869 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5873 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5874 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5877 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5881 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5882 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5885 /* Front Pin: output 0 (0x0c) */
5886 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5887 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5888 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5889 /* Rear Pin: output 1 (0x0d) */
5890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5892 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5893 /* CLFE Pin: output 2 (0x0e) */
5894 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5895 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5896 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5897 /* Side Pin: output 3 (0x0f) */
5898 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5899 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5900 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5901 /* Mic (rear) pin: input vref at 80% */
5902 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5903 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5904 /* Front Mic pin: input vref at 80% */
5905 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5906 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5907 /* Line In pin: input */
5908 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5909 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5910 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5911 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5912 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5913 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5914 /* CD pin widget for input */
5915 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5917 /* FIXME: use matrix-type input source selection */
5918 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5919 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5920 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5921 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5922 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5923 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5925 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5926 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5927 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5928 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5934 /* ADC1: mute amp left and right */
5935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5936 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5937 /* ADC2: mute amp left and right */
5938 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5939 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5940 /* ADC3: mute amp left and right */
5941 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5942 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5947 static struct hda_verb alc882_eapd_verbs[] = {
5948 /* change to EAPD mode */
5949 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5950 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5955 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5956 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5957 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5958 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5959 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5960 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5961 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5962 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5966 static struct hda_verb alc882_macpro_init_verbs[] = {
5967 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5969 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5970 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5971 /* Front Pin: output 0 (0x0c) */
5972 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5973 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5974 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5975 /* Front Mic pin: input vref at 80% */
5976 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5977 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5978 /* Speaker: output */
5979 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5980 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5981 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5982 /* Headphone output (output 0 - 0x0c) */
5983 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5984 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5985 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5987 /* FIXME: use matrix-type input source selection */
5988 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5989 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5990 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5991 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5992 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5993 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5995 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5996 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5997 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5998 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6004 /* ADC1: mute amp left and right */
6005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6006 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6007 /* ADC2: mute amp left and right */
6008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6009 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6010 /* ADC3: mute amp left and right */
6011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6012 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6017 /* Macbook Pro rev3 */
6018 static struct hda_verb alc885_mbp3_init_verbs[] = {
6019 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6024 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6025 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6026 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6027 /* Front Pin: output 0 (0x0c) */
6028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6030 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6031 /* HP Pin: output 0 (0x0d) */
6032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6034 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6035 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6036 /* Mic (rear) pin: input vref at 80% */
6037 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6038 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6039 /* Front Mic pin: input vref at 80% */
6040 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6041 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6042 /* Line In pin: use output 1 when in LineOut mode */
6043 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6044 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6045 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6047 /* FIXME: use matrix-type input source selection */
6048 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6049 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6050 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6051 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6052 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6053 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6055 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6056 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6058 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6064 /* ADC1: mute amp left and right */
6065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6066 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6067 /* ADC2: mute amp left and right */
6068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6069 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6070 /* ADC3: mute amp left and right */
6071 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6072 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6077 /* iMac 24 mixer. */
6078 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6079 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6080 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6084 /* iMac 24 init verbs. */
6085 static struct hda_verb alc885_imac24_init_verbs[] = {
6086 /* Internal speakers: output 0 (0x0c) */
6087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6088 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6089 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6090 /* Internal speakers: output 0 (0x0c) */
6091 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6092 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6093 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6094 /* Headphone: output 0 (0x0c) */
6095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6096 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6097 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6098 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6099 /* Front Mic: input vref at 80% */
6100 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6101 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6105 /* Toggle speaker-output according to the hp-jack state */
6106 static void alc885_imac24_automute(struct hda_codec *codec)
6108 unsigned int present;
6110 present = snd_hda_codec_read(codec, 0x14, 0,
6111 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6112 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6113 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6114 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6115 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6118 /* Processes unsolicited events. */
6119 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6122 /* Headphone insertion or removal. */
6123 if ((res >> 26) == ALC880_HP_EVENT)
6124 alc885_imac24_automute(codec);
6127 static void alc885_mbp3_automute(struct hda_codec *codec)
6129 unsigned int present;
6131 present = snd_hda_codec_read(codec, 0x15, 0,
6132 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6133 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6134 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6135 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6136 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6139 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6142 /* Headphone insertion or removal. */
6143 if ((res >> 26) == ALC880_HP_EVENT)
6144 alc885_mbp3_automute(codec);
6148 static struct hda_verb alc882_targa_verbs[] = {
6149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6152 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6153 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6155 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6156 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6157 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6159 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6160 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6161 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6162 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6166 /* toggle speaker-output according to the hp-jack state */
6167 static void alc882_targa_automute(struct hda_codec *codec)
6169 unsigned int present;
6171 present = snd_hda_codec_read(codec, 0x14, 0,
6172 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6173 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6174 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6175 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6179 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6181 /* Looks like the unsol event is incompatible with the standard
6182 * definition. 4bit tag is placed at 26 bit!
6184 if (((res >> 26) == ALC880_HP_EVENT)) {
6185 alc882_targa_automute(codec);
6189 static struct hda_verb alc882_asus_a7j_verbs[] = {
6190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6193 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6194 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6195 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6197 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6198 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6199 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6201 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6202 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6203 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6207 static struct hda_verb alc882_asus_a7m_verbs[] = {
6208 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6209 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6212 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6213 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6215 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6216 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6217 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6219 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6220 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6221 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6225 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6227 unsigned int gpiostate, gpiomask, gpiodir;
6229 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6230 AC_VERB_GET_GPIO_DATA, 0);
6233 gpiostate |= (1 << pin);
6235 gpiostate &= ~(1 << pin);
6237 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6238 AC_VERB_GET_GPIO_MASK, 0);
6239 gpiomask |= (1 << pin);
6241 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6242 AC_VERB_GET_GPIO_DIRECTION, 0);
6243 gpiodir |= (1 << pin);
6246 snd_hda_codec_write(codec, codec->afg, 0,
6247 AC_VERB_SET_GPIO_MASK, gpiomask);
6248 snd_hda_codec_write(codec, codec->afg, 0,
6249 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6253 snd_hda_codec_write(codec, codec->afg, 0,
6254 AC_VERB_SET_GPIO_DATA, gpiostate);
6257 /* set up GPIO at initialization */
6258 static void alc885_macpro_init_hook(struct hda_codec *codec)
6260 alc882_gpio_mute(codec, 0, 0);
6261 alc882_gpio_mute(codec, 1, 0);
6264 /* set up GPIO and update auto-muting at initialization */
6265 static void alc885_imac24_init_hook(struct hda_codec *codec)
6267 alc885_macpro_init_hook(codec);
6268 alc885_imac24_automute(codec);
6272 * generic initialization of ADC, input mixers and output mixers
6274 static struct hda_verb alc882_auto_init_verbs[] = {
6276 * Unmute ADC0-2 and set the default input to mic-in
6278 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6280 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6281 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6282 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6283 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6285 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6287 * Note: PASD motherboards uses the Line In 2 as the input for
6288 * front panel mic (mic 2)
6290 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6298 * Set up output mixers (0x0c - 0x0f)
6300 /* set vol=0 to output mixers */
6301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6303 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6304 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6305 /* set up input amps for analog loopback */
6306 /* Amp Indices: DAC = 0, mixer = 1 */
6307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6313 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6315 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6316 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6318 /* FIXME: use matrix-type input source selection */
6319 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6320 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6322 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6339 #define alc882_capture_alt_mixer alc880_capture_alt_mixer
6340 #define alc882_capture_mixer alc880_capture_mixer
6342 #ifdef CONFIG_SND_HDA_POWER_SAVE
6343 #define alc882_loopbacks alc880_loopbacks
6346 /* pcm configuration: identiacal with ALC880 */
6347 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6348 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6349 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6350 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6353 * configuration and preset
6355 static const char *alc882_models[ALC882_MODEL_LAST] = {
6356 [ALC882_3ST_DIG] = "3stack-dig",
6357 [ALC882_6ST_DIG] = "6stack-dig",
6358 [ALC882_ARIMA] = "arima",
6359 [ALC882_W2JC] = "w2jc",
6360 [ALC882_TARGA] = "targa",
6361 [ALC882_ASUS_A7J] = "asus-a7j",
6362 [ALC882_ASUS_A7M] = "asus-a7m",
6363 [ALC885_MACPRO] = "macpro",
6364 [ALC885_MBP3] = "mbp3",
6365 [ALC885_IMAC24] = "imac24",
6366 [ALC882_AUTO] = "auto",
6369 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6370 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6371 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6372 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6373 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6374 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6375 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6376 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6377 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6378 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6379 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6380 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6381 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6385 static struct alc_config_preset alc882_presets[] = {
6386 [ALC882_3ST_DIG] = {
6387 .mixers = { alc882_base_mixer },
6388 .init_verbs = { alc882_init_verbs },
6389 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6390 .dac_nids = alc882_dac_nids,
6391 .dig_out_nid = ALC882_DIGOUT_NID,
6392 .dig_in_nid = ALC882_DIGIN_NID,
6393 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6394 .channel_mode = alc882_ch_modes,
6396 .input_mux = &alc882_capture_source,
6398 [ALC882_6ST_DIG] = {
6399 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6400 .init_verbs = { alc882_init_verbs },
6401 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6402 .dac_nids = alc882_dac_nids,
6403 .dig_out_nid = ALC882_DIGOUT_NID,
6404 .dig_in_nid = ALC882_DIGIN_NID,
6405 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6406 .channel_mode = alc882_sixstack_modes,
6407 .input_mux = &alc882_capture_source,
6410 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6411 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6412 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6413 .dac_nids = alc882_dac_nids,
6414 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6415 .channel_mode = alc882_sixstack_modes,
6416 .input_mux = &alc882_capture_source,
6419 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6420 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6421 alc880_gpio1_init_verbs },
6422 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6423 .dac_nids = alc882_dac_nids,
6424 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6425 .channel_mode = alc880_threestack_modes,
6427 .input_mux = &alc882_capture_source,
6428 .dig_out_nid = ALC882_DIGOUT_NID,
6431 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6432 .init_verbs = { alc885_mbp3_init_verbs,
6433 alc880_gpio1_init_verbs },
6434 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6435 .dac_nids = alc882_dac_nids,
6436 .channel_mode = alc885_mbp_6ch_modes,
6437 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6438 .input_mux = &alc882_capture_source,
6439 .dig_out_nid = ALC882_DIGOUT_NID,
6440 .dig_in_nid = ALC882_DIGIN_NID,
6441 .unsol_event = alc885_mbp3_unsol_event,
6442 .init_hook = alc885_mbp3_automute,
6445 .mixers = { alc882_macpro_mixer },
6446 .init_verbs = { alc882_macpro_init_verbs },
6447 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6448 .dac_nids = alc882_dac_nids,
6449 .dig_out_nid = ALC882_DIGOUT_NID,
6450 .dig_in_nid = ALC882_DIGIN_NID,
6451 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6452 .channel_mode = alc882_ch_modes,
6453 .input_mux = &alc882_capture_source,
6454 .init_hook = alc885_macpro_init_hook,
6457 .mixers = { alc885_imac24_mixer },
6458 .init_verbs = { alc885_imac24_init_verbs },
6459 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6460 .dac_nids = alc882_dac_nids,
6461 .dig_out_nid = ALC882_DIGOUT_NID,
6462 .dig_in_nid = ALC882_DIGIN_NID,
6463 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6464 .channel_mode = alc882_ch_modes,
6465 .input_mux = &alc882_capture_source,
6466 .unsol_event = alc885_imac24_unsol_event,
6467 .init_hook = alc885_imac24_init_hook,
6470 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6471 alc882_capture_mixer },
6472 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6473 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6474 .dac_nids = alc882_dac_nids,
6475 .dig_out_nid = ALC882_DIGOUT_NID,
6476 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6477 .adc_nids = alc882_adc_nids,
6478 .capsrc_nids = alc882_capsrc_nids,
6479 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6480 .channel_mode = alc882_3ST_6ch_modes,
6482 .input_mux = &alc882_capture_source,
6483 .unsol_event = alc882_targa_unsol_event,
6484 .init_hook = alc882_targa_automute,
6486 [ALC882_ASUS_A7J] = {
6487 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6488 alc882_capture_mixer },
6489 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6490 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6491 .dac_nids = alc882_dac_nids,
6492 .dig_out_nid = ALC882_DIGOUT_NID,
6493 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6494 .adc_nids = alc882_adc_nids,
6495 .capsrc_nids = alc882_capsrc_nids,
6496 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6497 .channel_mode = alc882_3ST_6ch_modes,
6499 .input_mux = &alc882_capture_source,
6501 [ALC882_ASUS_A7M] = {
6502 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6503 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6504 alc880_gpio1_init_verbs,
6505 alc882_asus_a7m_verbs },
6506 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6507 .dac_nids = alc882_dac_nids,
6508 .dig_out_nid = ALC882_DIGOUT_NID,
6509 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6510 .channel_mode = alc880_threestack_modes,
6512 .input_mux = &alc882_capture_source,
6521 PINFIX_ABIT_AW9D_MAX
6524 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6525 { 0x15, 0x01080104 }, /* side */
6526 { 0x16, 0x01011012 }, /* rear */
6527 { 0x17, 0x01016011 }, /* clfe */
6531 static const struct alc_pincfg *alc882_pin_fixes[] = {
6532 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6535 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6536 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6541 * BIOS auto configuration
6543 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6544 hda_nid_t nid, int pin_type,
6548 struct alc_spec *spec = codec->spec;
6551 alc_set_pin_output(codec, nid, pin_type);
6552 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6555 idx = spec->multiout.dac_nids[dac_idx] - 2;
6556 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6560 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6562 struct alc_spec *spec = codec->spec;
6565 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6566 for (i = 0; i <= HDA_SIDE; i++) {
6567 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6568 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6570 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6575 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6577 struct alc_spec *spec = codec->spec;
6580 pin = spec->autocfg.hp_pins[0];
6581 if (pin) /* connect to front */
6583 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6584 pin = spec->autocfg.speaker_pins[0];
6586 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6589 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6590 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6592 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6594 struct alc_spec *spec = codec->spec;
6597 for (i = 0; i < AUTO_PIN_LAST; i++) {
6598 hda_nid_t nid = spec->autocfg.input_pins[i];
6603 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6604 unsigned int pincap;
6605 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6606 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6610 snd_hda_codec_write(codec, nid, 0,
6611 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6612 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6613 snd_hda_codec_write(codec, nid, 0,
6614 AC_VERB_SET_AMP_GAIN_MUTE,
6619 static void alc882_auto_init_input_src(struct hda_codec *codec)
6621 struct alc_spec *spec = codec->spec;
6622 const struct hda_input_mux *imux = spec->input_mux;
6625 for (c = 0; c < spec->num_adc_nids; c++) {
6626 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6627 hda_nid_t nid = spec->capsrc_nids[c];
6628 int conns, mute, idx, item;
6630 conns = snd_hda_get_connections(codec, nid, conn_list,
6631 ARRAY_SIZE(conn_list));
6634 for (idx = 0; idx < conns; idx++) {
6635 /* if the current connection is the selected one,
6636 * unmute it as default - otherwise mute it
6638 mute = AMP_IN_MUTE(idx);
6639 for (item = 0; item < imux->num_items; item++) {
6640 if (imux->items[item].index == idx) {
6641 if (spec->cur_mux[c] == item)
6642 mute = AMP_IN_UNMUTE(idx);
6646 snd_hda_codec_write(codec, nid, 0,
6647 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6652 /* add mic boosts if needed */
6653 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6655 struct alc_spec *spec = codec->spec;
6659 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6660 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6661 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6663 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6667 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6668 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6669 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6671 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6678 /* almost identical with ALC880 parser... */
6679 static int alc882_parse_auto_config(struct hda_codec *codec)
6681 struct alc_spec *spec = codec->spec;
6682 int err = alc880_parse_auto_config(codec);
6687 return 0; /* no config found */
6689 err = alc_auto_add_mic_boost(codec);
6693 /* hack - override the init verbs */
6694 spec->init_verbs[0] = alc882_auto_init_verbs;
6696 return 1; /* config found */
6699 /* additional initialization for auto-configuration model */
6700 static void alc882_auto_init(struct hda_codec *codec)
6702 struct alc_spec *spec = codec->spec;
6703 alc882_auto_init_multi_out(codec);
6704 alc882_auto_init_hp_out(codec);
6705 alc882_auto_init_analog_input(codec);
6706 alc882_auto_init_input_src(codec);
6707 if (spec->unsol_event)
6708 alc_inithook(codec);
6711 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6713 static int patch_alc882(struct hda_codec *codec)
6715 struct alc_spec *spec;
6716 int err, board_config;
6718 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6724 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6728 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6729 /* Pick up systems that don't supply PCI SSID */
6730 switch (codec->subsystem_id) {
6731 case 0x106b0c00: /* Mac Pro */
6732 board_config = ALC885_MACPRO;
6734 case 0x106b1000: /* iMac 24 */
6735 case 0x106b2800: /* AppleTV */
6736 board_config = ALC885_IMAC24;
6738 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6739 case 0x106b00a4: /* MacbookPro4,1 */
6740 case 0x106b2c00: /* Macbook Pro rev3 */
6741 case 0x106b3600: /* Macbook 3.1 */
6742 board_config = ALC885_MBP3;
6745 /* ALC889A is handled better as ALC888-compatible */
6746 if (codec->revision_id == 0x100101 ||
6747 codec->revision_id == 0x100103) {
6749 return patch_alc883(codec);
6751 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6752 "trying auto-probe from BIOS...\n");
6753 board_config = ALC882_AUTO;
6757 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6759 if (board_config == ALC882_AUTO) {
6760 /* automatic parse from the BIOS config */
6761 err = alc882_parse_auto_config(codec);
6767 "hda_codec: Cannot set up configuration "
6768 "from BIOS. Using base mode...\n");
6769 board_config = ALC882_3ST_DIG;
6773 if (board_config != ALC882_AUTO)
6774 setup_preset(spec, &alc882_presets[board_config]);
6776 if (codec->vendor_id == 0x10ec0885) {
6777 spec->stream_name_analog = "ALC885 Analog";
6778 spec->stream_name_digital = "ALC885 Digital";
6780 spec->stream_name_analog = "ALC882 Analog";
6781 spec->stream_name_digital = "ALC882 Digital";
6784 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6785 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6786 /* FIXME: setup DAC5 */
6787 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6788 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6790 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6791 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6793 spec->is_mix_capture = 1; /* matrix-style capture */
6794 if (!spec->adc_nids && spec->input_mux) {
6795 /* check whether NID 0x07 is valid */
6796 unsigned int wcap = get_wcaps(codec, 0x07);
6798 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6799 if (wcap != AC_WID_AUD_IN) {
6800 spec->adc_nids = alc882_adc_nids_alt;
6801 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6802 spec->capsrc_nids = alc882_capsrc_nids_alt;
6803 add_mixer(spec, alc882_capture_alt_mixer);
6805 spec->adc_nids = alc882_adc_nids;
6806 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6807 spec->capsrc_nids = alc882_capsrc_nids;
6808 add_mixer(spec, alc882_capture_mixer);
6812 spec->vmaster_nid = 0x0c;
6814 codec->patch_ops = alc_patch_ops;
6815 if (board_config == ALC882_AUTO)
6816 spec->init_hook = alc882_auto_init;
6817 #ifdef CONFIG_SND_HDA_POWER_SAVE
6818 if (!spec->loopback.amplist)
6819 spec->loopback.amplist = alc882_loopbacks;
6828 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6829 * configuration. Each pin widget can choose any input DACs and a mixer.
6830 * Each ADC is connected from a mixer of all inputs. This makes possible
6831 * 6-channel independent captures.
6833 * In addition, an independent DAC for the multi-playback (not used in this
6836 #define ALC883_DIGOUT_NID 0x06
6837 #define ALC883_DIGIN_NID 0x0a
6839 static hda_nid_t alc883_dac_nids[4] = {
6840 /* front, rear, clfe, rear_surr */
6841 0x02, 0x03, 0x04, 0x05
6844 static hda_nid_t alc883_adc_nids[2] = {
6849 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6852 /* FIXME: should be a matrix-type input source selection */
6854 static struct hda_input_mux alc883_capture_source = {
6858 { "Front Mic", 0x1 },
6864 static struct hda_input_mux alc883_3stack_6ch_intel = {
6868 { "Front Mic", 0x0 },
6874 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6882 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6892 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6900 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6904 { "Front Mic", 0x1 },
6909 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6920 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6927 static struct hda_verb alc883_3ST_ch2_init[] = {
6928 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6929 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6930 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6931 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6938 static struct hda_verb alc883_3ST_ch4_init[] = {
6939 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6940 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6941 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6942 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6943 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6950 static struct hda_verb alc883_3ST_ch6_init[] = {
6951 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6952 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6953 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6954 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6955 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6956 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6960 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6961 { 2, alc883_3ST_ch2_init },
6962 { 4, alc883_3ST_ch4_init },
6963 { 6, alc883_3ST_ch6_init },
6969 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6970 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6971 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6972 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6973 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6980 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6981 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6982 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6983 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6984 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6985 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6992 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6993 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6994 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6995 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6996 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6997 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6998 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7002 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7003 { 2, alc883_3ST_ch2_intel_init },
7004 { 4, alc883_3ST_ch4_intel_init },
7005 { 6, alc883_3ST_ch6_intel_init },
7011 static struct hda_verb alc883_sixstack_ch6_init[] = {
7012 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7013 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7014 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7015 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7022 static struct hda_verb alc883_sixstack_ch8_init[] = {
7023 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7024 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7025 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7026 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7030 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7031 { 6, alc883_sixstack_ch6_init },
7032 { 8, alc883_sixstack_ch8_init },
7035 static struct hda_verb alc883_medion_eapd_verbs[] = {
7036 /* eanable EAPD on medion laptop */
7037 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7038 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7042 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7043 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7046 static struct snd_kcontrol_new alc883_base_mixer[] = {
7047 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7048 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7049 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7050 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7051 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7052 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7053 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7054 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7055 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7056 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7057 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7058 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7059 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7060 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7061 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7065 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7068 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7069 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7071 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7072 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7073 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7075 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7076 /* .name = "Capture Source", */
7077 .name = "Input Source",
7079 .info = alc_mux_enum_info,
7080 .get = alc_mux_enum_get,
7081 .put = alc_mux_enum_put,
7086 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7087 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7088 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7089 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7090 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7091 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7092 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7095 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7096 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7098 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7099 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7100 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7101 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7102 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7103 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7106 /* .name = "Capture Source", */
7107 .name = "Input Source",
7109 .info = alc_mux_enum_info,
7110 .get = alc_mux_enum_get,
7111 .put = alc_mux_enum_put,
7116 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7117 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7118 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7119 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7120 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7122 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7124 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7125 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7126 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7127 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7128 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7129 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7130 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7133 /* .name = "Capture Source", */
7134 .name = "Input Source",
7136 .info = alc_mux_enum_info,
7137 .get = alc_mux_enum_get,
7138 .put = alc_mux_enum_put,
7143 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7145 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7146 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7147 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7149 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7151 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7152 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7153 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7154 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7155 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7156 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7157 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7159 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7160 /* .name = "Capture Source", */
7161 .name = "Input Source",
7163 .info = alc_mux_enum_info,
7164 .get = alc_mux_enum_get,
7165 .put = alc_mux_enum_put,
7170 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7171 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7172 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7174 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7175 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7176 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7177 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7179 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7180 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7181 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7182 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7183 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7184 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7185 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7186 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7187 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7188 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7189 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7191 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7192 /* .name = "Capture Source", */
7193 .name = "Input Source",
7195 .info = alc_mux_enum_info,
7196 .get = alc_mux_enum_get,
7197 .put = alc_mux_enum_put,
7202 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7203 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7204 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7205 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7206 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7207 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7208 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7209 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7210 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7211 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7212 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7213 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7214 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7215 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7217 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7219 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7220 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7221 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7222 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7223 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7224 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7225 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7228 /* .name = "Capture Source", */
7229 .name = "Input Source",
7231 .info = alc_mux_enum_info,
7232 .get = alc_mux_enum_get,
7233 .put = alc_mux_enum_put,
7238 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7239 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7240 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7241 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7242 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7243 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7245 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7246 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7247 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7248 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7249 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7250 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7254 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7256 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7257 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7258 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7259 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7260 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7261 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7262 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7263 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7264 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7267 /* .name = "Capture Source", */
7268 .name = "Input Source",
7270 .info = alc_mux_enum_info,
7271 .get = alc_mux_enum_get,
7272 .put = alc_mux_enum_put,
7277 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7278 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7279 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7280 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7281 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7282 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7283 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7284 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7285 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7286 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7287 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7288 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7289 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7290 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7291 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7292 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7293 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7294 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7295 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7296 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7297 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7298 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7299 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7300 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7304 /* .name = "Capture Source", */
7305 .name = "Input Source",
7307 .info = alc_mux_enum_info,
7308 .get = alc_mux_enum_get,
7309 .put = alc_mux_enum_put,
7314 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7315 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7316 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7317 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7318 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7319 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7320 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7321 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7322 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7323 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7324 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7325 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7326 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7327 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7328 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7329 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7330 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7331 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7332 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7333 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7334 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7337 /* .name = "Capture Source", */
7338 .name = "Input Source",
7340 .info = alc_mux_enum_info,
7341 .get = alc_mux_enum_get,
7342 .put = alc_mux_enum_put,
7347 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7348 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7350 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7351 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7352 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7354 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7356 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7357 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7358 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7359 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7360 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7361 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7362 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7364 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7365 /* .name = "Capture Source", */
7366 .name = "Input Source",
7368 .info = alc_mux_enum_info,
7369 .get = alc_mux_enum_get,
7370 .put = alc_mux_enum_put,
7375 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7376 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7377 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7378 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7379 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7380 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7382 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7383 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7384 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7385 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7388 /* .name = "Capture Source", */
7389 .name = "Input Source",
7391 .info = alc_mux_enum_info,
7392 .get = alc_mux_enum_get,
7393 .put = alc_mux_enum_put,
7398 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7399 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7400 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7402 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7403 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7406 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7407 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7408 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7409 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7410 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7411 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7413 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7414 /* .name = "Capture Source", */
7415 .name = "Input Source",
7417 .info = alc_mux_enum_info,
7418 .get = alc_mux_enum_get,
7419 .put = alc_mux_enum_put,
7424 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7425 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7426 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7427 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7428 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7429 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7431 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7432 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7433 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7435 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7436 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7437 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7439 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7440 /* .name = "Capture Source", */
7441 .name = "Input Source",
7443 .info = alc_mux_enum_info,
7444 .get = alc_mux_enum_get,
7445 .put = alc_mux_enum_put,
7450 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7451 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7452 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7453 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7454 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7455 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7457 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7458 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7459 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7460 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7461 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7462 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7464 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7465 /* .name = "Capture Source", */
7466 .name = "Input Source",
7468 .info = alc_mux_enum_info,
7469 .get = alc_mux_enum_get,
7470 .put = alc_mux_enum_put,
7475 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7476 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7478 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7479 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7480 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7481 0x0d, 1, 0x0, HDA_OUTPUT),
7482 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7483 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7484 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7485 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7486 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7487 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7488 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7489 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7490 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7491 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7492 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7494 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7495 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7496 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7498 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7499 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7500 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7501 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7502 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7504 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7505 /* .name = "Capture Source", */
7506 .name = "Input Source",
7508 .info = alc_mux_enum_info,
7509 .get = alc_mux_enum_get,
7510 .put = alc_mux_enum_put,
7515 static struct hda_bind_ctls alc883_bind_cap_vol = {
7516 .ops = &snd_hda_bind_vol,
7518 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7519 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7524 static struct hda_bind_ctls alc883_bind_cap_switch = {
7525 .ops = &snd_hda_bind_sw,
7527 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7528 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7533 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7534 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7535 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7537 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7538 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7540 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7542 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7543 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7545 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7546 /* .name = "Capture Source", */
7547 .name = "Input Source",
7549 .info = alc_mux_enum_info,
7550 .get = alc_mux_enum_get,
7551 .put = alc_mux_enum_put,
7556 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7558 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7559 .name = "Channel Mode",
7560 .info = alc_ch_mode_info,
7561 .get = alc_ch_mode_get,
7562 .put = alc_ch_mode_put,
7567 static struct hda_verb alc883_init_verbs[] = {
7568 /* ADC1: mute amp left and right */
7569 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7570 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7571 /* ADC2: mute amp left and right */
7572 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7573 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7574 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7575 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7580 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7581 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7583 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7584 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7587 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7591 /* mute analog input loopbacks */
7592 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7593 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7594 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7596 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7598 /* Front Pin: output 0 (0x0c) */
7599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7601 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7602 /* Rear Pin: output 1 (0x0d) */
7603 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7604 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7606 /* CLFE Pin: output 2 (0x0e) */
7607 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7608 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7609 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7610 /* Side Pin: output 3 (0x0f) */
7611 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7612 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7613 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7614 /* Mic (rear) pin: input vref at 80% */
7615 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7616 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7617 /* Front Mic pin: input vref at 80% */
7618 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7619 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7620 /* Line In pin: input */
7621 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7622 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7623 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7624 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7625 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7626 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7627 /* CD pin widget for input */
7628 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7630 /* FIXME: use matrix-type input source selection */
7631 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7633 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7635 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7638 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7645 /* toggle speaker-output according to the hp-jack state */
7646 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7648 unsigned int present;
7650 present = snd_hda_codec_read(codec, 0x15, 0,
7651 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7652 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7653 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7654 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7655 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7658 /* auto-toggle front mic */
7660 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7662 unsigned int present;
7665 present = snd_hda_codec_read(codec, 0x18, 0,
7666 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7667 bits = present ? HDA_AMP_MUTE : 0;
7668 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7672 static void alc883_mitac_automute(struct hda_codec *codec)
7674 alc883_mitac_hp_automute(codec);
7675 /* alc883_mitac_mic_automute(codec); */
7678 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7681 switch (res >> 26) {
7682 case ALC880_HP_EVENT:
7683 alc883_mitac_hp_automute(codec);
7685 case ALC880_MIC_EVENT:
7686 /* alc883_mitac_mic_automute(codec); */
7691 static struct hda_verb alc883_mitac_verbs[] = {
7693 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7696 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7697 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7699 /* enable unsolicited event */
7700 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7701 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7706 static struct hda_verb alc883_clevo_m720_verbs[] = {
7708 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7711 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7712 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7714 /* enable unsolicited event */
7715 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7716 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7721 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7723 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7724 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7726 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7729 /* enable unsolicited event */
7730 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7735 static struct hda_verb alc883_tagra_verbs[] = {
7736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7739 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7740 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7742 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7743 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7744 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7746 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7747 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7748 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7749 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7754 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7755 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7756 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7757 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7761 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7762 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7763 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7764 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7769 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7770 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7771 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7772 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7773 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7774 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7778 static struct hda_verb alc883_haier_w66_verbs[] = {
7779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7780 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7782 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7784 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7785 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7786 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7787 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7791 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7792 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7793 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7794 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7795 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7796 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7797 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7798 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7799 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7803 static struct hda_verb alc888_3st_hp_verbs[] = {
7804 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7805 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7806 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7810 static struct hda_verb alc888_6st_dell_verbs[] = {
7811 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7815 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7816 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7817 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7818 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7819 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7823 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7824 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7825 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7826 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7827 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7831 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7832 { 2, alc888_3st_hp_2ch_init },
7833 { 6, alc888_3st_hp_6ch_init },
7836 /* toggle front-jack and RCA according to the hp-jack state */
7837 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7839 unsigned int present;
7841 present = snd_hda_codec_read(codec, 0x1b, 0,
7842 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7843 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7844 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7845 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7846 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7849 /* toggle RCA according to the front-jack state */
7850 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7852 unsigned int present;
7854 present = snd_hda_codec_read(codec, 0x14, 0,
7855 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7856 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7857 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7860 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7863 if ((res >> 26) == ALC880_HP_EVENT)
7864 alc888_lenovo_ms7195_front_automute(codec);
7865 if ((res >> 26) == ALC880_FRONT_EVENT)
7866 alc888_lenovo_ms7195_rca_automute(codec);
7869 static struct hda_verb alc883_medion_md2_verbs[] = {
7870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7875 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7879 /* toggle speaker-output according to the hp-jack state */
7880 static void alc883_medion_md2_automute(struct hda_codec *codec)
7882 unsigned int present;
7884 present = snd_hda_codec_read(codec, 0x14, 0,
7885 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7886 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7887 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7890 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7893 if ((res >> 26) == ALC880_HP_EVENT)
7894 alc883_medion_md2_automute(codec);
7897 /* toggle speaker-output according to the hp-jack state */
7898 static void alc883_tagra_automute(struct hda_codec *codec)
7900 unsigned int present;
7903 present = snd_hda_codec_read(codec, 0x14, 0,
7904 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7905 bits = present ? HDA_AMP_MUTE : 0;
7906 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7907 HDA_AMP_MUTE, bits);
7908 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7912 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7914 if ((res >> 26) == ALC880_HP_EVENT)
7915 alc883_tagra_automute(codec);
7918 /* toggle speaker-output according to the hp-jack state */
7919 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7921 unsigned int present;
7924 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7925 & AC_PINSENSE_PRESENCE;
7926 bits = present ? HDA_AMP_MUTE : 0;
7927 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7928 HDA_AMP_MUTE, bits);
7931 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7933 unsigned int present;
7935 present = snd_hda_codec_read(codec, 0x18, 0,
7936 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7937 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7938 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7941 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7943 alc883_clevo_m720_hp_automute(codec);
7944 alc883_clevo_m720_mic_automute(codec);
7947 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7950 switch (res >> 26) {
7951 case ALC880_HP_EVENT:
7952 alc883_clevo_m720_hp_automute(codec);
7954 case ALC880_MIC_EVENT:
7955 alc883_clevo_m720_mic_automute(codec);
7960 /* toggle speaker-output according to the hp-jack state */
7961 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7963 unsigned int present;
7966 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7967 & AC_PINSENSE_PRESENCE;
7968 bits = present ? HDA_AMP_MUTE : 0;
7969 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7970 HDA_AMP_MUTE, bits);
7973 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7976 if ((res >> 26) == ALC880_HP_EVENT)
7977 alc883_2ch_fujitsu_pi2515_automute(codec);
7980 static void alc883_haier_w66_automute(struct hda_codec *codec)
7982 unsigned int present;
7985 present = snd_hda_codec_read(codec, 0x1b, 0,
7986 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7987 bits = present ? 0x80 : 0;
7988 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7992 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7995 if ((res >> 26) == ALC880_HP_EVENT)
7996 alc883_haier_w66_automute(codec);
7999 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8001 unsigned int present;
8004 present = snd_hda_codec_read(codec, 0x14, 0,
8005 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8006 bits = present ? HDA_AMP_MUTE : 0;
8007 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8008 HDA_AMP_MUTE, bits);
8011 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8013 unsigned int present;
8016 present = snd_hda_codec_read(codec, 0x1b, 0,
8017 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8018 bits = present ? HDA_AMP_MUTE : 0;
8019 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8020 HDA_AMP_MUTE, bits);
8021 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8022 HDA_AMP_MUTE, bits);
8025 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8028 if ((res >> 26) == ALC880_HP_EVENT)
8029 alc883_lenovo_101e_all_automute(codec);
8030 if ((res >> 26) == ALC880_FRONT_EVENT)
8031 alc883_lenovo_101e_ispeaker_automute(codec);
8034 /* toggle speaker-output according to the hp-jack state */
8035 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8037 unsigned int present;
8039 present = snd_hda_codec_read(codec, 0x14, 0,
8040 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8041 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8042 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8043 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8044 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8047 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8050 if ((res >> 26) == ALC880_HP_EVENT)
8051 alc883_acer_aspire_automute(codec);
8054 static struct hda_verb alc883_acer_eapd_verbs[] = {
8055 /* HP Pin: output 0 (0x0c) */
8056 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8057 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8058 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8059 /* Front Pin: output 0 (0x0c) */
8060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8061 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8062 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8063 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8064 /* eanable EAPD on medion laptop */
8065 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8066 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8067 /* enable unsolicited event */
8068 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8072 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8074 unsigned int present;
8076 present = snd_hda_codec_read(codec, 0x1b, 0,
8077 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8078 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8079 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8080 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8081 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8082 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8083 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8084 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8085 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8088 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8091 switch (res >> 26) {
8092 case ALC880_HP_EVENT:
8093 printk("hp_event\n");
8094 alc888_6st_dell_front_automute(codec);
8099 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8102 unsigned int present;
8104 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8105 present = snd_hda_codec_read(codec, 0x1b, 0,
8106 AC_VERB_GET_PIN_SENSE, 0);
8107 present = (present & 0x80000000) != 0;
8109 /* mute internal speaker */
8110 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8111 HDA_AMP_MUTE, HDA_AMP_MUTE);
8112 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8113 HDA_AMP_MUTE, HDA_AMP_MUTE);
8114 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8115 HDA_AMP_MUTE, HDA_AMP_MUTE);
8116 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8117 HDA_AMP_MUTE, HDA_AMP_MUTE);
8118 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8119 HDA_AMP_MUTE, HDA_AMP_MUTE);
8121 /* unmute internal speaker if necessary */
8122 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8123 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8124 HDA_AMP_MUTE, mute);
8125 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8126 HDA_AMP_MUTE, mute);
8127 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8128 HDA_AMP_MUTE, mute);
8129 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8130 HDA_AMP_MUTE, mute);
8131 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8132 HDA_AMP_MUTE, mute);
8136 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8139 if ((res >> 26) == ALC880_HP_EVENT)
8140 alc888_lenovo_sky_front_automute(codec);
8144 * generic initialization of ADC, input mixers and output mixers
8146 static struct hda_verb alc883_auto_init_verbs[] = {
8148 * Unmute ADC0-2 and set the default input to mic-in
8150 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8151 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8152 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8153 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8155 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8157 * Note: PASD motherboards uses the Line In 2 as the input for
8158 * front panel mic (mic 2)
8160 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8161 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8162 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8163 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8168 * Set up output mixers (0x0c - 0x0f)
8170 /* set vol=0 to output mixers */
8171 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8173 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8174 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8175 /* set up input amps for analog loopback */
8176 /* Amp Indices: DAC = 0, mixer = 1 */
8177 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8178 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8179 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8181 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8182 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8183 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8184 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8185 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8186 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8188 /* FIXME: use matrix-type input source selection */
8189 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8194 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8200 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8206 /* capture mixer elements */
8207 #define alc883_capture_mixer alc880_capture_alt_mixer /* 2 ADC ver */
8209 static struct hda_verb alc888_asus_m90v_verbs[] = {
8210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8213 /* enable unsolicited event */
8214 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8215 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8219 static void alc883_nb_mic_automute(struct hda_codec *codec)
8221 unsigned int present;
8223 present = snd_hda_codec_read(codec, 0x18, 0,
8224 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8225 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8226 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8227 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8228 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8231 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8233 unsigned int present;
8236 present = snd_hda_codec_read(codec, 0x1b, 0,
8237 AC_VERB_GET_PIN_SENSE, 0)
8238 & AC_PINSENSE_PRESENCE;
8239 bits = present ? 0 : PIN_OUT;
8240 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8242 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8244 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8248 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8251 switch (res >> 26) {
8252 case ALC880_HP_EVENT:
8253 alc883_M90V_speaker_automute(codec);
8255 case ALC880_MIC_EVENT:
8256 alc883_nb_mic_automute(codec);
8261 static void alc883_mode2_inithook(struct hda_codec *codec)
8263 alc883_M90V_speaker_automute(codec);
8264 alc883_nb_mic_automute(codec);
8267 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8269 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8270 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8273 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8274 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8275 /* enable unsolicited event */
8276 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8280 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8282 unsigned int present;
8285 present = snd_hda_codec_read(codec, 0x14, 0,
8286 AC_VERB_GET_PIN_SENSE, 0)
8287 & AC_PINSENSE_PRESENCE;
8288 bits = present ? 0 : PIN_OUT;
8289 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8293 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8296 switch (res >> 26) {
8297 case ALC880_HP_EVENT:
8298 alc883_eee1601_speaker_automute(codec);
8303 static void alc883_eee1601_inithook(struct hda_codec *codec)
8305 alc883_eee1601_speaker_automute(codec);
8308 #ifdef CONFIG_SND_HDA_POWER_SAVE
8309 #define alc883_loopbacks alc880_loopbacks
8312 /* pcm configuration: identiacal with ALC880 */
8313 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8314 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8315 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8316 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8317 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8320 * configuration and preset
8322 static const char *alc883_models[ALC883_MODEL_LAST] = {
8323 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8324 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8325 [ALC883_3ST_6ch] = "3stack-6ch",
8326 [ALC883_6ST_DIG] = "6stack-dig",
8327 [ALC883_TARGA_DIG] = "targa-dig",
8328 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8329 [ALC883_ACER] = "acer",
8330 [ALC883_ACER_ASPIRE] = "acer-aspire",
8331 [ALC883_MEDION] = "medion",
8332 [ALC883_MEDION_MD2] = "medion-md2",
8333 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8334 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8335 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8336 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8337 [ALC888_LENOVO_SKY] = "lenovo-sky",
8338 [ALC883_HAIER_W66] = "haier-w66",
8339 [ALC888_3ST_HP] = "3stack-hp",
8340 [ALC888_6ST_DELL] = "6stack-dell",
8341 [ALC883_MITAC] = "mitac",
8342 [ALC883_CLEVO_M720] = "clevo-m720",
8343 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8344 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8345 [ALC883_AUTO] = "auto",
8348 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8349 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8350 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8351 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8352 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8353 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8354 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8355 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8356 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8357 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8358 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8359 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8360 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8361 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8362 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8363 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8364 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8365 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8366 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8367 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8368 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8369 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8370 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8371 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8372 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8373 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8374 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8375 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8376 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8377 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8378 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8379 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8380 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8381 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8382 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8383 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8384 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8385 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8386 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8387 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8388 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8389 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8390 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8391 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8392 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8393 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8394 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8395 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8396 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8397 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8398 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8399 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8400 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8401 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8402 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8403 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8404 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8405 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8406 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8407 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8408 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8409 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8413 static struct alc_config_preset alc883_presets[] = {
8414 [ALC883_3ST_2ch_DIG] = {
8415 .mixers = { alc883_3ST_2ch_mixer },
8416 .init_verbs = { alc883_init_verbs },
8417 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8418 .dac_nids = alc883_dac_nids,
8419 .dig_out_nid = ALC883_DIGOUT_NID,
8420 .dig_in_nid = ALC883_DIGIN_NID,
8421 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8422 .channel_mode = alc883_3ST_2ch_modes,
8423 .input_mux = &alc883_capture_source,
8425 [ALC883_3ST_6ch_DIG] = {
8426 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8427 .init_verbs = { alc883_init_verbs },
8428 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8429 .dac_nids = alc883_dac_nids,
8430 .dig_out_nid = ALC883_DIGOUT_NID,
8431 .dig_in_nid = ALC883_DIGIN_NID,
8432 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8433 .channel_mode = alc883_3ST_6ch_modes,
8435 .input_mux = &alc883_capture_source,
8437 [ALC883_3ST_6ch] = {
8438 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8439 .init_verbs = { alc883_init_verbs },
8440 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8441 .dac_nids = alc883_dac_nids,
8442 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8443 .channel_mode = alc883_3ST_6ch_modes,
8445 .input_mux = &alc883_capture_source,
8447 [ALC883_3ST_6ch_INTEL] = {
8448 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8449 .init_verbs = { alc883_init_verbs },
8450 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8451 .dac_nids = alc883_dac_nids,
8452 .dig_out_nid = ALC883_DIGOUT_NID,
8453 .dig_in_nid = ALC883_DIGIN_NID,
8454 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8455 .channel_mode = alc883_3ST_6ch_intel_modes,
8457 .input_mux = &alc883_3stack_6ch_intel,
8459 [ALC883_6ST_DIG] = {
8460 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8461 .init_verbs = { alc883_init_verbs },
8462 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8463 .dac_nids = alc883_dac_nids,
8464 .dig_out_nid = ALC883_DIGOUT_NID,
8465 .dig_in_nid = ALC883_DIGIN_NID,
8466 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8467 .channel_mode = alc883_sixstack_modes,
8468 .input_mux = &alc883_capture_source,
8470 [ALC883_TARGA_DIG] = {
8471 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8472 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8473 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8474 .dac_nids = alc883_dac_nids,
8475 .dig_out_nid = ALC883_DIGOUT_NID,
8476 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8477 .channel_mode = alc883_3ST_6ch_modes,
8479 .input_mux = &alc883_capture_source,
8480 .unsol_event = alc883_tagra_unsol_event,
8481 .init_hook = alc883_tagra_automute,
8483 [ALC883_TARGA_2ch_DIG] = {
8484 .mixers = { alc883_tagra_2ch_mixer},
8485 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8486 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8487 .dac_nids = alc883_dac_nids,
8488 .dig_out_nid = ALC883_DIGOUT_NID,
8489 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8490 .channel_mode = alc883_3ST_2ch_modes,
8491 .input_mux = &alc883_capture_source,
8492 .unsol_event = alc883_tagra_unsol_event,
8493 .init_hook = alc883_tagra_automute,
8496 .mixers = { alc883_base_mixer },
8497 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8498 * and the headphone jack. Turn this on and rely on the
8499 * standard mute methods whenever the user wants to turn
8500 * these outputs off.
8502 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8503 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8504 .dac_nids = alc883_dac_nids,
8505 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8506 .channel_mode = alc883_3ST_2ch_modes,
8507 .input_mux = &alc883_capture_source,
8509 [ALC883_ACER_ASPIRE] = {
8510 .mixers = { alc883_acer_aspire_mixer },
8511 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8512 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8513 .dac_nids = alc883_dac_nids,
8514 .dig_out_nid = ALC883_DIGOUT_NID,
8515 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8516 .channel_mode = alc883_3ST_2ch_modes,
8517 .input_mux = &alc883_capture_source,
8518 .unsol_event = alc883_acer_aspire_unsol_event,
8519 .init_hook = alc883_acer_aspire_automute,
8522 .mixers = { alc883_fivestack_mixer,
8523 alc883_chmode_mixer },
8524 .init_verbs = { alc883_init_verbs,
8525 alc883_medion_eapd_verbs },
8526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8527 .dac_nids = alc883_dac_nids,
8528 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8529 .channel_mode = alc883_sixstack_modes,
8530 .input_mux = &alc883_capture_source,
8532 [ALC883_MEDION_MD2] = {
8533 .mixers = { alc883_medion_md2_mixer},
8534 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8535 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8536 .dac_nids = alc883_dac_nids,
8537 .dig_out_nid = ALC883_DIGOUT_NID,
8538 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8539 .channel_mode = alc883_3ST_2ch_modes,
8540 .input_mux = &alc883_capture_source,
8541 .unsol_event = alc883_medion_md2_unsol_event,
8542 .init_hook = alc883_medion_md2_automute,
8544 [ALC883_LAPTOP_EAPD] = {
8545 .mixers = { alc883_base_mixer },
8546 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8547 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8548 .dac_nids = alc883_dac_nids,
8549 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8550 .channel_mode = alc883_3ST_2ch_modes,
8551 .input_mux = &alc883_capture_source,
8553 [ALC883_CLEVO_M720] = {
8554 .mixers = { alc883_clevo_m720_mixer },
8555 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8556 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8557 .dac_nids = alc883_dac_nids,
8558 .dig_out_nid = ALC883_DIGOUT_NID,
8559 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8560 .channel_mode = alc883_3ST_2ch_modes,
8561 .input_mux = &alc883_capture_source,
8562 .unsol_event = alc883_clevo_m720_unsol_event,
8563 .init_hook = alc883_clevo_m720_automute,
8565 [ALC883_LENOVO_101E_2ch] = {
8566 .mixers = { alc883_lenovo_101e_2ch_mixer},
8567 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8568 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8569 .dac_nids = alc883_dac_nids,
8570 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8571 .channel_mode = alc883_3ST_2ch_modes,
8572 .input_mux = &alc883_lenovo_101e_capture_source,
8573 .unsol_event = alc883_lenovo_101e_unsol_event,
8574 .init_hook = alc883_lenovo_101e_all_automute,
8576 [ALC883_LENOVO_NB0763] = {
8577 .mixers = { alc883_lenovo_nb0763_mixer },
8578 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8579 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8580 .dac_nids = alc883_dac_nids,
8581 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8582 .channel_mode = alc883_3ST_2ch_modes,
8584 .input_mux = &alc883_lenovo_nb0763_capture_source,
8585 .unsol_event = alc883_medion_md2_unsol_event,
8586 .init_hook = alc883_medion_md2_automute,
8588 [ALC888_LENOVO_MS7195_DIG] = {
8589 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8590 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8591 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8592 .dac_nids = alc883_dac_nids,
8593 .dig_out_nid = ALC883_DIGOUT_NID,
8594 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8595 .channel_mode = alc883_3ST_6ch_modes,
8597 .input_mux = &alc883_capture_source,
8598 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8599 .init_hook = alc888_lenovo_ms7195_front_automute,
8601 [ALC883_HAIER_W66] = {
8602 .mixers = { alc883_tagra_2ch_mixer},
8603 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8604 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8605 .dac_nids = alc883_dac_nids,
8606 .dig_out_nid = ALC883_DIGOUT_NID,
8607 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8608 .channel_mode = alc883_3ST_2ch_modes,
8609 .input_mux = &alc883_capture_source,
8610 .unsol_event = alc883_haier_w66_unsol_event,
8611 .init_hook = alc883_haier_w66_automute,
8614 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8615 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8616 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8617 .dac_nids = alc883_dac_nids,
8618 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8619 .channel_mode = alc888_3st_hp_modes,
8621 .input_mux = &alc883_capture_source,
8623 [ALC888_6ST_DELL] = {
8624 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8625 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8626 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8627 .dac_nids = alc883_dac_nids,
8628 .dig_out_nid = ALC883_DIGOUT_NID,
8629 .dig_in_nid = ALC883_DIGIN_NID,
8630 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8631 .channel_mode = alc883_sixstack_modes,
8632 .input_mux = &alc883_capture_source,
8633 .unsol_event = alc888_6st_dell_unsol_event,
8634 .init_hook = alc888_6st_dell_front_automute,
8637 .mixers = { alc883_mitac_mixer },
8638 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8639 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8640 .dac_nids = alc883_dac_nids,
8641 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8642 .channel_mode = alc883_3ST_2ch_modes,
8643 .input_mux = &alc883_capture_source,
8644 .unsol_event = alc883_mitac_unsol_event,
8645 .init_hook = alc883_mitac_automute,
8647 [ALC883_FUJITSU_PI2515] = {
8648 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8649 .init_verbs = { alc883_init_verbs,
8650 alc883_2ch_fujitsu_pi2515_verbs},
8651 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8652 .dac_nids = alc883_dac_nids,
8653 .dig_out_nid = ALC883_DIGOUT_NID,
8654 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8655 .channel_mode = alc883_3ST_2ch_modes,
8656 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8657 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8658 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8660 [ALC888_LENOVO_SKY] = {
8661 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8662 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8663 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8664 .dac_nids = alc883_dac_nids,
8665 .dig_out_nid = ALC883_DIGOUT_NID,
8666 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
8667 .adc_nids = alc883_adc_nids,
8668 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8669 .channel_mode = alc883_sixstack_modes,
8671 .input_mux = &alc883_lenovo_sky_capture_source,
8672 .unsol_event = alc883_lenovo_sky_unsol_event,
8673 .init_hook = alc888_lenovo_sky_front_automute,
8675 [ALC888_ASUS_M90V] = {
8676 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8677 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8678 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8679 .dac_nids = alc883_dac_nids,
8680 .dig_out_nid = ALC883_DIGOUT_NID,
8681 .dig_in_nid = ALC883_DIGIN_NID,
8682 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8683 .channel_mode = alc883_3ST_6ch_modes,
8685 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8686 .unsol_event = alc883_mode2_unsol_event,
8687 .init_hook = alc883_mode2_inithook,
8689 [ALC888_ASUS_EEE1601] = {
8690 .mixers = { alc883_asus_eee1601_mixer },
8691 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8692 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8693 .dac_nids = alc883_dac_nids,
8694 .dig_out_nid = ALC883_DIGOUT_NID,
8695 .dig_in_nid = ALC883_DIGIN_NID,
8696 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8697 .channel_mode = alc883_3ST_2ch_modes,
8699 .input_mux = &alc883_asus_eee1601_capture_source,
8700 .unsol_event = alc883_eee1601_unsol_event,
8701 .init_hook = alc883_eee1601_inithook,
8707 * BIOS auto configuration
8709 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8710 hda_nid_t nid, int pin_type,
8714 struct alc_spec *spec = codec->spec;
8717 alc_set_pin_output(codec, nid, pin_type);
8718 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8721 idx = spec->multiout.dac_nids[dac_idx] - 2;
8722 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8726 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8728 struct alc_spec *spec = codec->spec;
8731 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8732 for (i = 0; i <= HDA_SIDE; i++) {
8733 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8734 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8736 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8741 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8743 struct alc_spec *spec = codec->spec;
8746 pin = spec->autocfg.hp_pins[0];
8747 if (pin) /* connect to front */
8749 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8750 pin = spec->autocfg.speaker_pins[0];
8752 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8755 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8756 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8758 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8760 struct alc_spec *spec = codec->spec;
8763 for (i = 0; i < AUTO_PIN_LAST; i++) {
8764 hda_nid_t nid = spec->autocfg.input_pins[i];
8765 if (alc883_is_input_pin(nid)) {
8766 snd_hda_codec_write(codec, nid, 0,
8767 AC_VERB_SET_PIN_WIDGET_CONTROL,
8768 (i <= AUTO_PIN_FRONT_MIC ?
8769 PIN_VREF80 : PIN_IN));
8770 if (nid != ALC883_PIN_CD_NID)
8771 snd_hda_codec_write(codec, nid, 0,
8772 AC_VERB_SET_AMP_GAIN_MUTE,
8778 #define alc883_auto_init_input_src alc882_auto_init_input_src
8780 /* almost identical with ALC880 parser... */
8781 static int alc883_parse_auto_config(struct hda_codec *codec)
8783 struct alc_spec *spec = codec->spec;
8784 int err = alc880_parse_auto_config(codec);
8789 return 0; /* no config found */
8791 err = alc_auto_add_mic_boost(codec);
8795 /* hack - override the init verbs */
8796 spec->init_verbs[0] = alc883_auto_init_verbs;
8797 add_mixer(spec, alc883_capture_mixer);
8799 return 1; /* config found */
8802 /* additional initialization for auto-configuration model */
8803 static void alc883_auto_init(struct hda_codec *codec)
8805 struct alc_spec *spec = codec->spec;
8806 alc883_auto_init_multi_out(codec);
8807 alc883_auto_init_hp_out(codec);
8808 alc883_auto_init_analog_input(codec);
8809 alc883_auto_init_input_src(codec);
8810 if (spec->unsol_event)
8811 alc_inithook(codec);
8814 static int patch_alc883(struct hda_codec *codec)
8816 struct alc_spec *spec;
8817 int err, board_config;
8819 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8825 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8827 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8830 if (board_config < 0) {
8831 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8832 "trying auto-probe from BIOS...\n");
8833 board_config = ALC883_AUTO;
8836 if (board_config == ALC883_AUTO) {
8837 /* automatic parse from the BIOS config */
8838 err = alc883_parse_auto_config(codec);
8844 "hda_codec: Cannot set up configuration "
8845 "from BIOS. Using base mode...\n");
8846 board_config = ALC883_3ST_2ch_DIG;
8850 if (board_config != ALC883_AUTO)
8851 setup_preset(spec, &alc883_presets[board_config]);
8853 switch (codec->vendor_id) {
8855 if (codec->revision_id == 0x100101) {
8856 spec->stream_name_analog = "ALC1200 Analog";
8857 spec->stream_name_digital = "ALC1200 Digital";
8859 spec->stream_name_analog = "ALC888 Analog";
8860 spec->stream_name_digital = "ALC888 Digital";
8864 spec->stream_name_analog = "ALC889 Analog";
8865 spec->stream_name_digital = "ALC889 Digital";
8868 spec->stream_name_analog = "ALC883 Analog";
8869 spec->stream_name_digital = "ALC883 Digital";
8873 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8874 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8875 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8877 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8878 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8880 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8881 spec->adc_nids = alc883_adc_nids;
8882 spec->capsrc_nids = alc883_capsrc_nids;
8883 spec->is_mix_capture = 1; /* matrix-style capture */
8885 spec->vmaster_nid = 0x0c;
8887 codec->patch_ops = alc_patch_ops;
8888 if (board_config == ALC883_AUTO)
8889 spec->init_hook = alc883_auto_init;
8891 #ifdef CONFIG_SND_HDA_POWER_SAVE
8892 if (!spec->loopback.amplist)
8893 spec->loopback.amplist = alc883_loopbacks;
8903 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8904 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8906 #define alc262_dac_nids alc260_dac_nids
8907 #define alc262_adc_nids alc882_adc_nids
8908 #define alc262_adc_nids_alt alc882_adc_nids_alt
8909 #define alc262_capsrc_nids alc882_capsrc_nids
8910 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8912 #define alc262_modes alc260_modes
8913 #define alc262_capture_source alc882_capture_source
8915 static hda_nid_t alc262_dmic_adc_nids[1] = {
8920 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8922 static struct snd_kcontrol_new alc262_base_mixer[] = {
8923 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8924 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8925 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8926 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8928 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8931 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8932 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8933 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8934 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8935 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8936 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8937 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8938 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8939 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8940 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8944 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8946 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8949 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8950 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8954 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8955 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8956 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8957 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8958 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8959 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8960 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8964 /* update HP, line and mono-out pins according to the master switch */
8965 static void alc262_hp_master_update(struct hda_codec *codec)
8967 struct alc_spec *spec = codec->spec;
8968 int val = spec->master_sw;
8971 snd_hda_codec_write_cache(codec, 0x1b, 0,
8972 AC_VERB_SET_PIN_WIDGET_CONTROL,
8974 snd_hda_codec_write_cache(codec, 0x15, 0,
8975 AC_VERB_SET_PIN_WIDGET_CONTROL,
8977 /* mono (speaker) depending on the HP jack sense */
8978 val = val && !spec->jack_present;
8979 snd_hda_codec_write_cache(codec, 0x16, 0,
8980 AC_VERB_SET_PIN_WIDGET_CONTROL,
8984 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8986 struct alc_spec *spec = codec->spec;
8987 unsigned int presence;
8988 presence = snd_hda_codec_read(codec, 0x1b, 0,
8989 AC_VERB_GET_PIN_SENSE, 0);
8990 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8991 alc262_hp_master_update(codec);
8994 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8996 if ((res >> 26) != ALC880_HP_EVENT)
8998 alc262_hp_bpc_automute(codec);
9001 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9003 struct alc_spec *spec = codec->spec;
9004 unsigned int presence;
9005 presence = snd_hda_codec_read(codec, 0x15, 0,
9006 AC_VERB_GET_PIN_SENSE, 0);
9007 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9008 alc262_hp_master_update(codec);
9011 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9014 if ((res >> 26) != ALC880_HP_EVENT)
9016 alc262_hp_wildwest_automute(codec);
9019 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9020 struct snd_ctl_elem_value *ucontrol)
9022 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9023 struct alc_spec *spec = codec->spec;
9024 *ucontrol->value.integer.value = spec->master_sw;
9028 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9029 struct snd_ctl_elem_value *ucontrol)
9031 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9032 struct alc_spec *spec = codec->spec;
9033 int val = !!*ucontrol->value.integer.value;
9035 if (val == spec->master_sw)
9037 spec->master_sw = val;
9038 alc262_hp_master_update(codec);
9042 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9044 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9045 .name = "Master Playback Switch",
9046 .info = snd_ctl_boolean_mono_info,
9047 .get = alc262_hp_master_sw_get,
9048 .put = alc262_hp_master_sw_put,
9050 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9051 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9052 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9053 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9055 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9059 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9060 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9061 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9062 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9065 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9066 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9067 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9068 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9069 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9070 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9074 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9076 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9077 .name = "Master Playback Switch",
9078 .info = snd_ctl_boolean_mono_info,
9079 .get = alc262_hp_master_sw_get,
9080 .put = alc262_hp_master_sw_put,
9082 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9083 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9084 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9085 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9086 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9088 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9090 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9091 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9092 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9093 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9094 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9095 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9096 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9097 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9098 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9102 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9103 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9104 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9105 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9109 /* mute/unmute internal speaker according to the hp jack and mute state */
9110 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9112 struct alc_spec *spec = codec->spec;
9114 if (force || !spec->sense_updated) {
9115 unsigned int present;
9116 present = snd_hda_codec_read(codec, 0x15, 0,
9117 AC_VERB_GET_PIN_SENSE, 0);
9118 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9119 spec->sense_updated = 1;
9121 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9122 spec->jack_present ? HDA_AMP_MUTE : 0);
9125 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9128 if ((res >> 26) != ALC880_HP_EVENT)
9130 alc262_hp_t5735_automute(codec, 1);
9133 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9135 alc262_hp_t5735_automute(codec, 1);
9138 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9139 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9140 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9141 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9142 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9149 static struct hda_verb alc262_hp_t5735_verbs[] = {
9150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9151 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9153 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9157 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9158 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9160 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9161 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9167 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9168 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9169 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9170 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9171 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9172 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9173 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9175 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9176 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9177 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9181 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9188 /* bind hp and internal speaker mute (with plug check) */
9189 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9190 struct snd_ctl_elem_value *ucontrol)
9192 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9193 long *valp = ucontrol->value.integer.value;
9196 /* change hp mute */
9197 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9199 valp[0] ? 0 : HDA_AMP_MUTE);
9200 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9202 valp[1] ? 0 : HDA_AMP_MUTE);
9204 /* change speaker according to HP jack state */
9205 struct alc_spec *spec = codec->spec;
9207 if (spec->jack_present)
9208 mute = HDA_AMP_MUTE;
9210 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9212 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9213 HDA_AMP_MUTE, mute);
9218 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9219 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9222 .name = "Master Playback Switch",
9223 .info = snd_hda_mixer_amp_switch_info,
9224 .get = snd_hda_mixer_amp_switch_get,
9225 .put = alc262_sony_master_sw_put,
9226 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9230 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9231 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9235 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9236 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9237 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9239 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9240 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9241 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9242 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9246 #define alc262_capture_mixer alc882_capture_mixer
9247 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9250 * generic initialization of ADC, input mixers and output mixers
9252 static struct hda_verb alc262_init_verbs[] = {
9254 * Unmute ADC0-2 and set the default input to mic-in
9256 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9257 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9258 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9259 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9260 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9261 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9263 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9265 * Note: PASD motherboards uses the Line In 2 as the input for
9266 * front panel mic (mic 2)
9268 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9276 * Set up output mixers (0x0c - 0x0e)
9278 /* set vol=0 to output mixers */
9279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9281 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9282 /* set up input amps for analog loopback */
9283 /* Amp Indices: DAC = 0, mixer = 1 */
9284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9285 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9286 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9292 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9293 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9294 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9295 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9296 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9298 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9299 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9300 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9302 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9304 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9305 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9307 /* FIXME: use matrix-type input source selection */
9308 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9309 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9310 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9311 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9315 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9328 static struct hda_verb alc262_eapd_verbs[] = {
9329 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9330 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9334 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9335 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9340 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9341 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9342 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9343 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9345 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9346 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9350 static struct hda_verb alc262_sony_unsol_verbs[] = {
9351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9352 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9353 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9355 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9360 static struct hda_input_mux alc262_dmic_capture_source = {
9363 { "Int DMic", 0x9 },
9368 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9369 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9370 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9371 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9374 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9375 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9377 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9378 /* The multiple "Capture Source" controls confuse alsamixer
9379 * So call somewhat different..
9381 /* .name = "Capture Source", */
9382 .name = "Input Source",
9384 .info = alc_mux_enum_info,
9385 .get = alc_mux_enum_get,
9386 .put = alc_mux_enum_put,
9391 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9392 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9393 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9395 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9396 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9397 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9398 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9399 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9403 static void alc262_dmic_automute(struct hda_codec *codec)
9405 unsigned int present;
9407 present = snd_hda_codec_read(codec, 0x18, 0,
9408 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9409 snd_hda_codec_write(codec, 0x22, 0,
9410 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9413 /* toggle speaker-output according to the hp-jack state */
9414 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9416 unsigned int present;
9419 present = snd_hda_codec_read(codec, 0x15, 0,
9420 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9421 bits = present ? 0 : PIN_OUT;
9422 snd_hda_codec_write(codec, 0x14, 0,
9423 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9428 /* unsolicited event for HP jack sensing */
9429 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9432 if ((res >> 26) == ALC880_HP_EVENT)
9433 alc262_toshiba_s06_speaker_automute(codec);
9434 if ((res >> 26) == ALC880_MIC_EVENT)
9435 alc262_dmic_automute(codec);
9439 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9441 alc262_toshiba_s06_speaker_automute(codec);
9442 alc262_dmic_automute(codec);
9445 /* mute/unmute internal speaker according to the hp jack and mute state */
9446 static void alc262_hippo_automute(struct hda_codec *codec)
9448 struct alc_spec *spec = codec->spec;
9450 unsigned int present;
9452 /* need to execute and sync at first */
9453 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9454 present = snd_hda_codec_read(codec, 0x15, 0,
9455 AC_VERB_GET_PIN_SENSE, 0);
9456 spec->jack_present = (present & 0x80000000) != 0;
9457 if (spec->jack_present) {
9458 /* mute internal speaker */
9459 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9460 HDA_AMP_MUTE, HDA_AMP_MUTE);
9462 /* unmute internal speaker if necessary */
9463 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9464 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9465 HDA_AMP_MUTE, mute);
9469 /* unsolicited event for HP jack sensing */
9470 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9473 if ((res >> 26) != ALC880_HP_EVENT)
9475 alc262_hippo_automute(codec);
9478 static void alc262_hippo1_automute(struct hda_codec *codec)
9481 unsigned int present;
9483 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9484 present = snd_hda_codec_read(codec, 0x1b, 0,
9485 AC_VERB_GET_PIN_SENSE, 0);
9486 present = (present & 0x80000000) != 0;
9488 /* mute internal speaker */
9489 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9490 HDA_AMP_MUTE, HDA_AMP_MUTE);
9492 /* unmute internal speaker if necessary */
9493 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9494 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9495 HDA_AMP_MUTE, mute);
9499 /* unsolicited event for HP jack sensing */
9500 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9503 if ((res >> 26) != ALC880_HP_EVENT)
9505 alc262_hippo1_automute(codec);
9511 * 0x16 = internal speaker
9512 * 0x18 = external mic
9515 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9516 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9517 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9520 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9521 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9523 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9524 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9528 static struct hda_verb alc262_nec_verbs[] = {
9529 /* Unmute Speaker */
9530 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9533 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9536 /* External mic to headphone */
9537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9538 /* External mic to speaker */
9539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9545 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9546 * 0x1b = port replicator headphone out
9549 #define ALC_HP_EVENT 0x37
9551 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9552 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9554 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9559 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9560 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9561 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9565 static struct hda_input_mux alc262_fujitsu_capture_source = {
9574 static struct hda_input_mux alc262_HP_capture_source = {
9578 { "Front Mic", 0x1 },
9585 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9589 { "Front Mic", 0x2 },
9595 /* mute/unmute internal speaker according to the hp jacks and mute state */
9596 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9598 struct alc_spec *spec = codec->spec;
9601 if (force || !spec->sense_updated) {
9602 unsigned int present;
9603 /* need to execute and sync at first */
9604 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9605 /* check laptop HP jack */
9606 present = snd_hda_codec_read(codec, 0x14, 0,
9607 AC_VERB_GET_PIN_SENSE, 0);
9608 /* need to execute and sync at first */
9609 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9610 /* check docking HP jack */
9611 present |= snd_hda_codec_read(codec, 0x1b, 0,
9612 AC_VERB_GET_PIN_SENSE, 0);
9613 if (present & AC_PINSENSE_PRESENCE)
9614 spec->jack_present = 1;
9616 spec->jack_present = 0;
9617 spec->sense_updated = 1;
9619 /* unmute internal speaker only if both HPs are unplugged and
9620 * master switch is on
9622 if (spec->jack_present)
9623 mute = HDA_AMP_MUTE;
9625 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9626 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9627 HDA_AMP_MUTE, mute);
9630 /* unsolicited event for HP jack sensing */
9631 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9634 if ((res >> 26) != ALC_HP_EVENT)
9636 alc262_fujitsu_automute(codec, 1);
9639 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9641 alc262_fujitsu_automute(codec, 1);
9644 /* bind volumes of both NID 0x0c and 0x0d */
9645 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9646 .ops = &snd_hda_bind_vol,
9648 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9649 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9654 /* mute/unmute internal speaker according to the hp jack and mute state */
9655 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9657 struct alc_spec *spec = codec->spec;
9660 if (force || !spec->sense_updated) {
9661 unsigned int present_int_hp;
9662 /* need to execute and sync at first */
9663 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9664 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9665 AC_VERB_GET_PIN_SENSE, 0);
9666 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9667 spec->sense_updated = 1;
9669 if (spec->jack_present) {
9670 /* mute internal speaker */
9671 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9672 HDA_AMP_MUTE, HDA_AMP_MUTE);
9673 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9674 HDA_AMP_MUTE, HDA_AMP_MUTE);
9676 /* unmute internal speaker if necessary */
9677 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9678 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9679 HDA_AMP_MUTE, mute);
9680 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9681 HDA_AMP_MUTE, mute);
9685 /* unsolicited event for HP jack sensing */
9686 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9689 if ((res >> 26) != ALC_HP_EVENT)
9691 alc262_lenovo_3000_automute(codec, 1);
9694 /* bind hp and internal speaker mute (with plug check) */
9695 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9696 struct snd_ctl_elem_value *ucontrol)
9698 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9699 long *valp = ucontrol->value.integer.value;
9702 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9704 valp ? 0 : HDA_AMP_MUTE);
9705 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9707 valp ? 0 : HDA_AMP_MUTE);
9710 alc262_fujitsu_automute(codec, 0);
9714 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9715 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9717 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9718 .name = "Master Playback Switch",
9719 .info = snd_hda_mixer_amp_switch_info,
9720 .get = snd_hda_mixer_amp_switch_get,
9721 .put = alc262_fujitsu_master_sw_put,
9722 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9724 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9725 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9726 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9727 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9728 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9731 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9732 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9733 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9737 /* bind hp and internal speaker mute (with plug check) */
9738 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9739 struct snd_ctl_elem_value *ucontrol)
9741 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9742 long *valp = ucontrol->value.integer.value;
9745 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9747 valp ? 0 : HDA_AMP_MUTE);
9750 alc262_lenovo_3000_automute(codec, 0);
9754 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9755 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9757 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9758 .name = "Master Playback Switch",
9759 .info = snd_hda_mixer_amp_switch_info,
9760 .get = snd_hda_mixer_amp_switch_get,
9761 .put = alc262_lenovo_3000_master_sw_put,
9762 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9764 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9765 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9766 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9769 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9770 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9771 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9775 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9776 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9778 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9779 .name = "Master Playback Switch",
9780 .info = snd_hda_mixer_amp_switch_info,
9781 .get = snd_hda_mixer_amp_switch_get,
9782 .put = alc262_sony_master_sw_put,
9783 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9787 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9788 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9789 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9790 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9794 /* additional init verbs for Benq laptops */
9795 static struct hda_verb alc262_EAPD_verbs[] = {
9796 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9797 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9801 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9802 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9803 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9805 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9806 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9810 /* Samsung Q1 Ultra Vista model setup */
9811 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9812 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9813 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9816 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9817 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9821 static struct hda_verb alc262_ultra_verbs[] = {
9823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9824 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9825 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9827 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9828 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9829 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9830 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9835 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9836 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9838 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9840 /* ADC, choose mic */
9841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9842 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9843 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9850 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9854 /* mute/unmute internal speaker according to the hp jack and mute state */
9855 static void alc262_ultra_automute(struct hda_codec *codec)
9857 struct alc_spec *spec = codec->spec;
9861 /* auto-mute only when HP is used as HP */
9862 if (!spec->cur_mux[0]) {
9863 unsigned int present;
9864 /* need to execute and sync at first */
9865 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9866 present = snd_hda_codec_read(codec, 0x15, 0,
9867 AC_VERB_GET_PIN_SENSE, 0);
9868 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9869 if (spec->jack_present)
9870 mute = HDA_AMP_MUTE;
9872 /* mute/unmute internal speaker */
9873 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9874 HDA_AMP_MUTE, mute);
9875 /* mute/unmute HP */
9876 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9877 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9880 /* unsolicited event for HP jack sensing */
9881 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9884 if ((res >> 26) != ALC880_HP_EVENT)
9886 alc262_ultra_automute(codec);
9889 static struct hda_input_mux alc262_ultra_capture_source = {
9893 { "Headphone", 0x7 },
9897 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9898 struct snd_ctl_elem_value *ucontrol)
9900 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9901 struct alc_spec *spec = codec->spec;
9904 ret = alc_mux_enum_put(kcontrol, ucontrol);
9907 /* reprogram the HP pin as mic or HP according to the input source */
9908 snd_hda_codec_write_cache(codec, 0x15, 0,
9909 AC_VERB_SET_PIN_WIDGET_CONTROL,
9910 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9911 alc262_ultra_automute(codec); /* mute/unmute HP */
9915 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9916 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9917 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9919 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9920 .name = "Capture Source",
9921 .info = alc_mux_enum_info,
9922 .get = alc_mux_enum_get,
9923 .put = alc262_ultra_mux_enum_put,
9928 /* add playback controls from the parsed DAC table */
9929 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9930 const struct auto_pin_cfg *cfg)
9935 spec->multiout.num_dacs = 1; /* only use one dac */
9936 spec->multiout.dac_nids = spec->private_dac_nids;
9937 spec->multiout.dac_nids[0] = 2;
9939 nid = cfg->line_out_pins[0];
9941 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9942 "Front Playback Volume",
9943 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9946 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9947 "Front Playback Switch",
9948 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9953 nid = cfg->speaker_pins[0];
9956 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9957 "Speaker Playback Volume",
9958 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9962 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9963 "Speaker Playback Switch",
9964 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9969 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9970 "Speaker Playback Switch",
9971 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9977 nid = cfg->hp_pins[0];
9979 /* spec->multiout.hp_nid = 2; */
9981 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9982 "Headphone Playback Volume",
9983 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9987 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9988 "Headphone Playback Switch",
9989 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9994 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9995 "Headphone Playback Switch",
9996 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10005 /* identical with ALC880 */
10006 #define alc262_auto_create_analog_input_ctls \
10007 alc880_auto_create_analog_input_ctls
10010 * generic initialization of ADC, input mixers and output mixers
10012 static struct hda_verb alc262_volume_init_verbs[] = {
10014 * Unmute ADC0-2 and set the default input to mic-in
10016 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10018 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10019 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10020 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10023 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10025 * Note: PASD motherboards uses the Line In 2 as the input for
10026 * front panel mic (mic 2)
10028 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10036 * Set up output mixers (0x0c - 0x0f)
10038 /* set vol=0 to output mixers */
10039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10040 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10041 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10043 /* set up input amps for analog loopback */
10044 /* Amp Indices: DAC = 0, mixer = 1 */
10045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10047 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10050 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10052 /* FIXME: use matrix-type input source selection */
10053 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10054 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10055 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10056 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10057 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10062 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10065 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10066 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10073 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10075 * Unmute ADC0-2 and set the default input to mic-in
10077 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10078 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10079 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10080 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10081 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10084 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10086 * Note: PASD motherboards uses the Line In 2 as the input for
10087 * front panel mic (mic 2)
10089 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10092 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10093 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10094 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10099 * Set up output mixers (0x0c - 0x0e)
10101 /* set vol=0 to output mixers */
10102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10103 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10104 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10106 /* set up input amps for analog loopback */
10107 /* Amp Indices: DAC = 0, mixer = 1 */
10108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10110 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10111 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10112 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10113 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10117 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10120 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10122 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10123 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10126 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10127 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10128 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10129 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10131 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10132 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10134 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10135 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10136 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10139 /* FIXME: use matrix-type input source selection */
10140 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10141 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10142 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10143 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10144 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10147 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10148 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10149 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10154 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10157 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10162 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10164 * Unmute ADC0-2 and set the default input to mic-in
10166 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10168 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10169 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10170 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10171 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10173 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10175 * Note: PASD motherboards uses the Line In 2 as the input for front
10176 * panel mic (mic 2)
10178 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10188 * Set up output mixers (0x0c - 0x0e)
10190 /* set vol=0 to output mixers */
10191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10192 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10193 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10195 /* set up input amps for analog loopback */
10196 /* Amp Indices: DAC = 0, mixer = 1 */
10197 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10198 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10199 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10200 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10201 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10202 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10205 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10206 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10207 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10208 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10209 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10210 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10211 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10213 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10214 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10216 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10217 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10219 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10220 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10221 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10222 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10223 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10224 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10226 /* FIXME: use matrix-type input source selection */
10227 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10228 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10234 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10237 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10238 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10239 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10240 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10241 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10242 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10245 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10246 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10247 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10248 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10250 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10258 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10260 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10261 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10262 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10265 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10270 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10271 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10276 #ifdef CONFIG_SND_HDA_POWER_SAVE
10277 #define alc262_loopbacks alc880_loopbacks
10280 /* pcm configuration: identiacal with ALC880 */
10281 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10282 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10283 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10284 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10287 * BIOS auto configuration
10289 static int alc262_parse_auto_config(struct hda_codec *codec)
10291 struct alc_spec *spec = codec->spec;
10293 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10295 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10299 if (!spec->autocfg.line_outs)
10300 return 0; /* can't find valid BIOS pin config */
10301 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10304 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10308 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10310 if (spec->autocfg.dig_out_pin)
10311 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10312 if (spec->autocfg.dig_in_pin)
10313 spec->dig_in_nid = ALC262_DIGIN_NID;
10315 if (spec->kctls.list)
10316 add_mixer(spec, spec->kctls.list);
10318 add_verb(spec, alc262_volume_init_verbs);
10319 spec->num_mux_defs = 1;
10320 spec->input_mux = &spec->private_imux;
10322 err = alc_auto_add_mic_boost(codec);
10326 store_pin_configs(codec);
10330 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10331 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10332 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10333 #define alc262_auto_init_input_src alc882_auto_init_input_src
10336 /* init callback for auto-configuration model -- overriding the default init */
10337 static void alc262_auto_init(struct hda_codec *codec)
10339 struct alc_spec *spec = codec->spec;
10340 alc262_auto_init_multi_out(codec);
10341 alc262_auto_init_hp_out(codec);
10342 alc262_auto_init_analog_input(codec);
10343 alc262_auto_init_input_src(codec);
10344 if (spec->unsol_event)
10345 alc_inithook(codec);
10349 * configuration and preset
10351 static const char *alc262_models[ALC262_MODEL_LAST] = {
10352 [ALC262_BASIC] = "basic",
10353 [ALC262_HIPPO] = "hippo",
10354 [ALC262_HIPPO_1] = "hippo_1",
10355 [ALC262_FUJITSU] = "fujitsu",
10356 [ALC262_HP_BPC] = "hp-bpc",
10357 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10358 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10359 [ALC262_HP_RP5700] = "hp-rp5700",
10360 [ALC262_BENQ_ED8] = "benq",
10361 [ALC262_BENQ_T31] = "benq-t31",
10362 [ALC262_SONY_ASSAMD] = "sony-assamd",
10363 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10364 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10365 [ALC262_ULTRA] = "ultra",
10366 [ALC262_LENOVO_3000] = "lenovo-3000",
10367 [ALC262_NEC] = "nec",
10368 [ALC262_AUTO] = "auto",
10371 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10372 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10373 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10374 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10375 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10376 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10377 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10378 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10379 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10380 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10381 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10382 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10383 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10384 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10385 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10386 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10387 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10388 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10389 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10390 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10391 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10392 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10393 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10394 ALC262_HP_TC_T5735),
10395 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10396 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10397 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10398 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10399 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10400 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10401 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10402 ALC262_TOSHIBA_RX1),
10403 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10404 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10405 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10406 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10407 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10408 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10409 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10410 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10411 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10415 static struct alc_config_preset alc262_presets[] = {
10417 .mixers = { alc262_base_mixer },
10418 .init_verbs = { alc262_init_verbs },
10419 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10420 .dac_nids = alc262_dac_nids,
10422 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10423 .channel_mode = alc262_modes,
10424 .input_mux = &alc262_capture_source,
10427 .mixers = { alc262_base_mixer },
10428 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10429 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10430 .dac_nids = alc262_dac_nids,
10432 .dig_out_nid = ALC262_DIGOUT_NID,
10433 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10434 .channel_mode = alc262_modes,
10435 .input_mux = &alc262_capture_source,
10436 .unsol_event = alc262_hippo_unsol_event,
10437 .init_hook = alc262_hippo_automute,
10439 [ALC262_HIPPO_1] = {
10440 .mixers = { alc262_hippo1_mixer },
10441 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10442 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10443 .dac_nids = alc262_dac_nids,
10445 .dig_out_nid = ALC262_DIGOUT_NID,
10446 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10447 .channel_mode = alc262_modes,
10448 .input_mux = &alc262_capture_source,
10449 .unsol_event = alc262_hippo1_unsol_event,
10450 .init_hook = alc262_hippo1_automute,
10452 [ALC262_FUJITSU] = {
10453 .mixers = { alc262_fujitsu_mixer },
10454 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10455 alc262_fujitsu_unsol_verbs },
10456 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10457 .dac_nids = alc262_dac_nids,
10459 .dig_out_nid = ALC262_DIGOUT_NID,
10460 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10461 .channel_mode = alc262_modes,
10462 .input_mux = &alc262_fujitsu_capture_source,
10463 .unsol_event = alc262_fujitsu_unsol_event,
10464 .init_hook = alc262_fujitsu_init_hook,
10466 [ALC262_HP_BPC] = {
10467 .mixers = { alc262_HP_BPC_mixer },
10468 .init_verbs = { alc262_HP_BPC_init_verbs },
10469 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10470 .dac_nids = alc262_dac_nids,
10472 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10473 .channel_mode = alc262_modes,
10474 .input_mux = &alc262_HP_capture_source,
10475 .unsol_event = alc262_hp_bpc_unsol_event,
10476 .init_hook = alc262_hp_bpc_automute,
10478 [ALC262_HP_BPC_D7000_WF] = {
10479 .mixers = { alc262_HP_BPC_WildWest_mixer },
10480 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10481 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10482 .dac_nids = alc262_dac_nids,
10484 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10485 .channel_mode = alc262_modes,
10486 .input_mux = &alc262_HP_D7000_capture_source,
10487 .unsol_event = alc262_hp_wildwest_unsol_event,
10488 .init_hook = alc262_hp_wildwest_automute,
10490 [ALC262_HP_BPC_D7000_WL] = {
10491 .mixers = { alc262_HP_BPC_WildWest_mixer,
10492 alc262_HP_BPC_WildWest_option_mixer },
10493 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10494 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10495 .dac_nids = alc262_dac_nids,
10497 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10498 .channel_mode = alc262_modes,
10499 .input_mux = &alc262_HP_D7000_capture_source,
10500 .unsol_event = alc262_hp_wildwest_unsol_event,
10501 .init_hook = alc262_hp_wildwest_automute,
10503 [ALC262_HP_TC_T5735] = {
10504 .mixers = { alc262_hp_t5735_mixer },
10505 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10506 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10507 .dac_nids = alc262_dac_nids,
10509 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10510 .channel_mode = alc262_modes,
10511 .input_mux = &alc262_capture_source,
10512 .unsol_event = alc262_hp_t5735_unsol_event,
10513 .init_hook = alc262_hp_t5735_init_hook,
10515 [ALC262_HP_RP5700] = {
10516 .mixers = { alc262_hp_rp5700_mixer },
10517 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10518 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10519 .dac_nids = alc262_dac_nids,
10520 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10521 .channel_mode = alc262_modes,
10522 .input_mux = &alc262_hp_rp5700_capture_source,
10524 [ALC262_BENQ_ED8] = {
10525 .mixers = { alc262_base_mixer },
10526 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10527 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10528 .dac_nids = alc262_dac_nids,
10530 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10531 .channel_mode = alc262_modes,
10532 .input_mux = &alc262_capture_source,
10534 [ALC262_SONY_ASSAMD] = {
10535 .mixers = { alc262_sony_mixer },
10536 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10537 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10538 .dac_nids = alc262_dac_nids,
10540 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10541 .channel_mode = alc262_modes,
10542 .input_mux = &alc262_capture_source,
10543 .unsol_event = alc262_hippo_unsol_event,
10544 .init_hook = alc262_hippo_automute,
10546 [ALC262_BENQ_T31] = {
10547 .mixers = { alc262_benq_t31_mixer },
10548 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10549 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10550 .dac_nids = alc262_dac_nids,
10552 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10553 .channel_mode = alc262_modes,
10554 .input_mux = &alc262_capture_source,
10555 .unsol_event = alc262_hippo_unsol_event,
10556 .init_hook = alc262_hippo_automute,
10559 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
10560 .init_verbs = { alc262_ultra_verbs },
10561 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10562 .dac_nids = alc262_dac_nids,
10563 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10564 .channel_mode = alc262_modes,
10565 .input_mux = &alc262_ultra_capture_source,
10566 .adc_nids = alc262_adc_nids, /* ADC0 */
10567 .capsrc_nids = alc262_capsrc_nids,
10568 .num_adc_nids = 1, /* single ADC */
10569 .unsol_event = alc262_ultra_unsol_event,
10570 .init_hook = alc262_ultra_automute,
10572 [ALC262_LENOVO_3000] = {
10573 .mixers = { alc262_lenovo_3000_mixer },
10574 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10575 alc262_lenovo_3000_unsol_verbs },
10576 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10577 .dac_nids = alc262_dac_nids,
10579 .dig_out_nid = ALC262_DIGOUT_NID,
10580 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10581 .channel_mode = alc262_modes,
10582 .input_mux = &alc262_fujitsu_capture_source,
10583 .unsol_event = alc262_lenovo_3000_unsol_event,
10586 .mixers = { alc262_nec_mixer },
10587 .init_verbs = { alc262_nec_verbs },
10588 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10589 .dac_nids = alc262_dac_nids,
10591 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10592 .channel_mode = alc262_modes,
10593 .input_mux = &alc262_capture_source,
10595 [ALC262_TOSHIBA_S06] = {
10596 .mixers = { alc262_toshiba_s06_mixer },
10597 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10598 alc262_eapd_verbs },
10599 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10600 .capsrc_nids = alc262_dmic_capsrc_nids,
10601 .dac_nids = alc262_dac_nids,
10602 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10603 .dig_out_nid = ALC262_DIGOUT_NID,
10604 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10605 .channel_mode = alc262_modes,
10606 .input_mux = &alc262_dmic_capture_source,
10607 .unsol_event = alc262_toshiba_s06_unsol_event,
10608 .init_hook = alc262_toshiba_s06_init_hook,
10610 [ALC262_TOSHIBA_RX1] = {
10611 .mixers = { alc262_toshiba_rx1_mixer },
10612 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10613 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10614 .dac_nids = alc262_dac_nids,
10616 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10617 .channel_mode = alc262_modes,
10618 .input_mux = &alc262_capture_source,
10619 .unsol_event = alc262_hippo_unsol_event,
10620 .init_hook = alc262_hippo_automute,
10624 static int patch_alc262(struct hda_codec *codec)
10626 struct alc_spec *spec;
10630 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10634 codec->spec = spec;
10636 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10641 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10642 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10643 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10644 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10648 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10650 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10654 if (board_config < 0) {
10655 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10656 "trying auto-probe from BIOS...\n");
10657 board_config = ALC262_AUTO;
10660 if (board_config == ALC262_AUTO) {
10661 /* automatic parse from the BIOS config */
10662 err = alc262_parse_auto_config(codec);
10668 "hda_codec: Cannot set up configuration "
10669 "from BIOS. Using base mode...\n");
10670 board_config = ALC262_BASIC;
10674 if (board_config != ALC262_AUTO)
10675 setup_preset(spec, &alc262_presets[board_config]);
10677 spec->stream_name_analog = "ALC262 Analog";
10678 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10679 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10681 spec->stream_name_digital = "ALC262 Digital";
10682 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10683 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10685 spec->is_mix_capture = 1;
10686 if (!spec->adc_nids && spec->input_mux) {
10687 /* check whether NID 0x07 is valid */
10688 unsigned int wcap = get_wcaps(codec, 0x07);
10691 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10692 if (wcap != AC_WID_AUD_IN) {
10693 spec->adc_nids = alc262_adc_nids_alt;
10694 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10695 spec->capsrc_nids = alc262_capsrc_nids_alt;
10696 add_mixer(spec, alc262_capture_alt_mixer);
10698 spec->adc_nids = alc262_adc_nids;
10699 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10700 spec->capsrc_nids = alc262_capsrc_nids;
10701 add_mixer(spec, alc262_capture_mixer);
10705 spec->vmaster_nid = 0x0c;
10707 codec->patch_ops = alc_patch_ops;
10708 if (board_config == ALC262_AUTO)
10709 spec->init_hook = alc262_auto_init;
10710 #ifdef CONFIG_SND_HDA_POWER_SAVE
10711 if (!spec->loopback.amplist)
10712 spec->loopback.amplist = alc262_loopbacks;
10719 * ALC268 channel source setting (2 channel)
10721 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10722 #define alc268_modes alc260_modes
10724 static hda_nid_t alc268_dac_nids[2] = {
10729 static hda_nid_t alc268_adc_nids[2] = {
10734 static hda_nid_t alc268_adc_nids_alt[1] = {
10739 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10741 static struct snd_kcontrol_new alc268_base_mixer[] = {
10742 /* output mixer control */
10743 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10744 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10745 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10746 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10747 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10748 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10749 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10753 /* bind Beep switches of both NID 0x0f and 0x10 */
10754 static struct hda_bind_ctls alc268_bind_beep_sw = {
10755 .ops = &snd_hda_bind_sw,
10757 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10758 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10763 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10764 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10765 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10769 static struct hda_verb alc268_eapd_verbs[] = {
10770 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10771 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10775 /* Toshiba specific */
10776 #define alc268_toshiba_automute alc262_hippo_automute
10778 static struct hda_verb alc268_toshiba_verbs[] = {
10779 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10783 static struct hda_input_mux alc268_acer_lc_capture_source = {
10791 /* Acer specific */
10792 /* bind volumes of both NID 0x02 and 0x03 */
10793 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10794 .ops = &snd_hda_bind_vol,
10796 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10797 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10802 /* mute/unmute internal speaker according to the hp jack and mute state */
10803 static void alc268_acer_automute(struct hda_codec *codec, int force)
10805 struct alc_spec *spec = codec->spec;
10808 if (force || !spec->sense_updated) {
10809 unsigned int present;
10810 present = snd_hda_codec_read(codec, 0x14, 0,
10811 AC_VERB_GET_PIN_SENSE, 0);
10812 spec->jack_present = (present & 0x80000000) != 0;
10813 spec->sense_updated = 1;
10815 if (spec->jack_present)
10816 mute = HDA_AMP_MUTE; /* mute internal speaker */
10817 else /* unmute internal speaker if necessary */
10818 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10819 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10820 HDA_AMP_MUTE, mute);
10824 /* bind hp and internal speaker mute (with plug check) */
10825 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10826 struct snd_ctl_elem_value *ucontrol)
10828 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10829 long *valp = ucontrol->value.integer.value;
10832 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10834 valp[0] ? 0 : HDA_AMP_MUTE);
10835 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10837 valp[1] ? 0 : HDA_AMP_MUTE);
10839 alc268_acer_automute(codec, 0);
10843 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10844 /* output mixer control */
10845 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10847 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10848 .name = "Master Playback Switch",
10849 .info = snd_hda_mixer_amp_switch_info,
10850 .get = snd_hda_mixer_amp_switch_get,
10851 .put = alc268_acer_master_sw_put,
10852 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10854 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10858 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10859 /* output mixer control */
10860 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10862 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10863 .name = "Master Playback Switch",
10864 .info = snd_hda_mixer_amp_switch_info,
10865 .get = snd_hda_mixer_amp_switch_get,
10866 .put = alc268_acer_master_sw_put,
10867 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10869 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10870 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10871 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10875 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10876 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10878 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10879 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10880 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10881 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10885 static struct hda_verb alc268_acer_verbs[] = {
10886 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10887 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10888 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10889 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10890 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10891 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10892 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10896 /* unsolicited event for HP jack sensing */
10897 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10900 if ((res >> 26) != ALC880_HP_EVENT)
10902 alc268_toshiba_automute(codec);
10905 static void alc268_acer_unsol_event(struct hda_codec *codec,
10908 if ((res >> 26) != ALC880_HP_EVENT)
10910 alc268_acer_automute(codec, 1);
10913 static void alc268_acer_init_hook(struct hda_codec *codec)
10915 alc268_acer_automute(codec, 1);
10918 /* toggle speaker-output according to the hp-jack state */
10919 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10921 unsigned int present;
10922 unsigned char bits;
10924 present = snd_hda_codec_read(codec, 0x15, 0,
10925 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10926 bits = present ? AMP_IN_MUTE(0) : 0;
10927 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10928 AMP_IN_MUTE(0), bits);
10929 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10930 AMP_IN_MUTE(0), bits);
10934 static void alc268_acer_mic_automute(struct hda_codec *codec)
10936 unsigned int present;
10938 present = snd_hda_codec_read(codec, 0x18, 0,
10939 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10940 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
10941 present ? 0x0 : 0x6);
10944 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
10947 if ((res >> 26) == ALC880_HP_EVENT)
10948 alc268_aspire_one_speaker_automute(codec);
10949 if ((res >> 26) == ALC880_MIC_EVENT)
10950 alc268_acer_mic_automute(codec);
10953 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
10955 alc268_aspire_one_speaker_automute(codec);
10956 alc268_acer_mic_automute(codec);
10959 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10960 /* output mixer control */
10961 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10962 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10963 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10964 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10965 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10966 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10970 static struct hda_verb alc268_dell_verbs[] = {
10971 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10972 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10973 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10977 /* mute/unmute internal speaker according to the hp jack and mute state */
10978 static void alc268_dell_automute(struct hda_codec *codec)
10980 unsigned int present;
10983 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10984 if (present & 0x80000000)
10985 mute = HDA_AMP_MUTE;
10987 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10988 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10989 HDA_AMP_MUTE, mute);
10992 static void alc268_dell_unsol_event(struct hda_codec *codec,
10995 if ((res >> 26) != ALC880_HP_EVENT)
10997 alc268_dell_automute(codec);
11000 #define alc268_dell_init_hook alc268_dell_automute
11002 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11003 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11004 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11005 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11006 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11007 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11008 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11009 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11010 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11014 static struct hda_verb alc267_quanta_il1_verbs[] = {
11015 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11016 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11020 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11022 unsigned int present;
11024 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11025 & AC_PINSENSE_PRESENCE;
11026 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11027 present ? 0 : PIN_OUT);
11030 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11032 unsigned int present;
11034 present = snd_hda_codec_read(codec, 0x18, 0,
11035 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11036 snd_hda_codec_write(codec, 0x23, 0,
11037 AC_VERB_SET_CONNECT_SEL,
11038 present ? 0x00 : 0x01);
11041 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11043 alc267_quanta_il1_hp_automute(codec);
11044 alc267_quanta_il1_mic_automute(codec);
11047 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11050 switch (res >> 26) {
11051 case ALC880_HP_EVENT:
11052 alc267_quanta_il1_hp_automute(codec);
11054 case ALC880_MIC_EVENT:
11055 alc267_quanta_il1_mic_automute(codec);
11061 * generic initialization of ADC, input mixers and output mixers
11063 static struct hda_verb alc268_base_init_verbs[] = {
11064 /* Unmute DAC0-1 and set vol = 0 */
11065 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11066 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11067 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11068 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11069 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11070 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11073 * Set up output mixers (0x0c - 0x0e)
11075 /* set vol=0 to output mixers */
11076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11077 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11079 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11082 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11085 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11086 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11088 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11089 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11090 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11091 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11093 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11094 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11095 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11096 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11097 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11098 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11099 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11101 /* set PCBEEP vol = 0, mute connections */
11102 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11103 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11104 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11106 /* Unmute Selector 23h,24h and set the default input to mic-in */
11108 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11109 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11110 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11117 * generic initialization of ADC, input mixers and output mixers
11119 static struct hda_verb alc268_volume_init_verbs[] = {
11120 /* set output DAC */
11121 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11122 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11123 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11124 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11126 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11127 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11128 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11129 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11130 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11132 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11133 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11134 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11135 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11136 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11138 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11139 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11140 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11141 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11143 /* set PCBEEP vol = 0, mute connections */
11144 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11145 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11146 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11151 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11152 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11153 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11155 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11156 /* The multiple "Capture Source" controls confuse alsamixer
11157 * So call somewhat different..
11159 /* .name = "Capture Source", */
11160 .name = "Input Source",
11162 .info = alc_mux_enum_info,
11163 .get = alc_mux_enum_get,
11164 .put = alc_mux_enum_put,
11169 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11170 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11171 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11172 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11173 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11175 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11176 /* The multiple "Capture Source" controls confuse alsamixer
11177 * So call somewhat different..
11179 /* .name = "Capture Source", */
11180 .name = "Input Source",
11182 .info = alc_mux_enum_info,
11183 .get = alc_mux_enum_get,
11184 .put = alc_mux_enum_put,
11189 static struct hda_input_mux alc268_capture_source = {
11193 { "Front Mic", 0x1 },
11199 static struct hda_input_mux alc268_acer_capture_source = {
11203 { "Internal Mic", 0x6 },
11208 #ifdef CONFIG_SND_DEBUG
11209 static struct snd_kcontrol_new alc268_test_mixer[] = {
11210 /* Volume widgets */
11211 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11212 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11213 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11214 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11215 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11216 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11217 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11218 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11219 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11220 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11221 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11222 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11223 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11224 /* The below appears problematic on some hardwares */
11225 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11226 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11227 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11228 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11229 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11231 /* Modes for retasking pin widgets */
11232 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11233 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11234 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11235 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11237 /* Controls for GPIO pins, assuming they are configured as outputs */
11238 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11239 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11240 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11241 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11243 /* Switches to allow the digital SPDIF output pin to be enabled.
11244 * The ALC268 does not have an SPDIF input.
11246 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11248 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11249 * this output to turn on an external amplifier.
11251 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11252 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11258 /* create input playback/capture controls for the given pin */
11259 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11260 const char *ctlname, int idx)
11265 sprintf(name, "%s Playback Volume", ctlname);
11267 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11268 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11272 } else if (nid == 0x15) {
11273 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11274 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11280 sprintf(name, "%s Playback Switch", ctlname);
11281 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11282 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11288 /* add playback controls from the parsed DAC table */
11289 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11290 const struct auto_pin_cfg *cfg)
11295 spec->multiout.num_dacs = 2; /* only use one dac */
11296 spec->multiout.dac_nids = spec->private_dac_nids;
11297 spec->multiout.dac_nids[0] = 2;
11298 spec->multiout.dac_nids[1] = 3;
11300 nid = cfg->line_out_pins[0];
11302 alc268_new_analog_output(spec, nid, "Front", 0);
11304 nid = cfg->speaker_pins[0];
11306 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11307 "Speaker Playback Volume",
11308 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11312 nid = cfg->hp_pins[0];
11314 alc268_new_analog_output(spec, nid, "Headphone", 0);
11316 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11318 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11319 "Mono Playback Switch",
11320 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11327 /* create playback/capture controls for input pins */
11328 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11329 const struct auto_pin_cfg *cfg)
11331 struct hda_input_mux *imux = &spec->private_imux;
11334 for (i = 0; i < AUTO_PIN_LAST; i++) {
11335 switch(cfg->input_pins[i]) {
11337 idx1 = 0; /* Mic 1 */
11340 idx1 = 1; /* Mic 2 */
11343 idx1 = 2; /* Line In */
11350 idx1 = 6; /* digital mics */
11355 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11356 imux->items[imux->num_items].index = idx1;
11362 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11364 struct alc_spec *spec = codec->spec;
11365 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11366 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11367 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11368 unsigned int dac_vol1, dac_vol2;
11371 snd_hda_codec_write(codec, speaker_nid, 0,
11372 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11373 snd_hda_codec_write(codec, 0x0f, 0,
11374 AC_VERB_SET_AMP_GAIN_MUTE,
11376 snd_hda_codec_write(codec, 0x10, 0,
11377 AC_VERB_SET_AMP_GAIN_MUTE,
11380 snd_hda_codec_write(codec, 0x0f, 0,
11381 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11382 snd_hda_codec_write(codec, 0x10, 0,
11383 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11386 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11387 if (line_nid == 0x14)
11388 dac_vol2 = AMP_OUT_ZERO;
11389 else if (line_nid == 0x15)
11390 dac_vol1 = AMP_OUT_ZERO;
11391 if (hp_nid == 0x14)
11392 dac_vol2 = AMP_OUT_ZERO;
11393 else if (hp_nid == 0x15)
11394 dac_vol1 = AMP_OUT_ZERO;
11395 if (line_nid != 0x16 || hp_nid != 0x16 ||
11396 spec->autocfg.line_out_pins[1] != 0x16 ||
11397 spec->autocfg.line_out_pins[2] != 0x16)
11398 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11400 snd_hda_codec_write(codec, 0x02, 0,
11401 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11402 snd_hda_codec_write(codec, 0x03, 0,
11403 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11406 /* pcm configuration: identiacal with ALC880 */
11407 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11408 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11409 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11410 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11413 * BIOS auto configuration
11415 static int alc268_parse_auto_config(struct hda_codec *codec)
11417 struct alc_spec *spec = codec->spec;
11419 static hda_nid_t alc268_ignore[] = { 0 };
11421 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11425 if (!spec->autocfg.line_outs)
11426 return 0; /* can't find valid BIOS pin config */
11428 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11431 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11435 spec->multiout.max_channels = 2;
11437 /* digital only support output */
11438 if (spec->autocfg.dig_out_pin)
11439 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11441 if (spec->kctls.list)
11442 add_mixer(spec, spec->kctls.list);
11444 if (spec->autocfg.speaker_pins[0] != 0x1d)
11445 add_mixer(spec, alc268_beep_mixer);
11447 add_verb(spec, alc268_volume_init_verbs);
11448 spec->num_mux_defs = 1;
11449 spec->input_mux = &spec->private_imux;
11451 err = alc_auto_add_mic_boost(codec);
11455 store_pin_configs(codec);
11459 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11460 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11461 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11463 /* init callback for auto-configuration model -- overriding the default init */
11464 static void alc268_auto_init(struct hda_codec *codec)
11466 struct alc_spec *spec = codec->spec;
11467 alc268_auto_init_multi_out(codec);
11468 alc268_auto_init_hp_out(codec);
11469 alc268_auto_init_mono_speaker_out(codec);
11470 alc268_auto_init_analog_input(codec);
11471 if (spec->unsol_event)
11472 alc_inithook(codec);
11476 * configuration and preset
11478 static const char *alc268_models[ALC268_MODEL_LAST] = {
11479 [ALC267_QUANTA_IL1] = "quanta-il1",
11480 [ALC268_3ST] = "3stack",
11481 [ALC268_TOSHIBA] = "toshiba",
11482 [ALC268_ACER] = "acer",
11483 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11484 [ALC268_DELL] = "dell",
11485 [ALC268_ZEPTO] = "zepto",
11486 #ifdef CONFIG_SND_DEBUG
11487 [ALC268_TEST] = "test",
11489 [ALC268_AUTO] = "auto",
11492 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11493 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11494 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11495 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11496 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11497 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11498 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11499 ALC268_ACER_ASPIRE_ONE),
11500 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11501 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11502 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11503 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11504 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11505 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11506 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11507 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11508 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11509 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11513 static struct alc_config_preset alc268_presets[] = {
11514 [ALC267_QUANTA_IL1] = {
11515 .mixers = { alc267_quanta_il1_mixer },
11516 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11517 alc267_quanta_il1_verbs },
11518 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11519 .dac_nids = alc268_dac_nids,
11520 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11521 .adc_nids = alc268_adc_nids_alt,
11523 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11524 .channel_mode = alc268_modes,
11525 .input_mux = &alc268_capture_source,
11526 .unsol_event = alc267_quanta_il1_unsol_event,
11527 .init_hook = alc267_quanta_il1_automute,
11530 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11531 alc268_beep_mixer },
11532 .init_verbs = { alc268_base_init_verbs },
11533 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11534 .dac_nids = alc268_dac_nids,
11535 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11536 .adc_nids = alc268_adc_nids_alt,
11537 .capsrc_nids = alc268_capsrc_nids,
11539 .dig_out_nid = ALC268_DIGOUT_NID,
11540 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11541 .channel_mode = alc268_modes,
11542 .input_mux = &alc268_capture_source,
11544 [ALC268_TOSHIBA] = {
11545 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11546 alc268_beep_mixer },
11547 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11548 alc268_toshiba_verbs },
11549 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11550 .dac_nids = alc268_dac_nids,
11551 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11552 .adc_nids = alc268_adc_nids_alt,
11553 .capsrc_nids = alc268_capsrc_nids,
11555 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11556 .channel_mode = alc268_modes,
11557 .input_mux = &alc268_capture_source,
11558 .unsol_event = alc268_toshiba_unsol_event,
11559 .init_hook = alc268_toshiba_automute,
11562 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11563 alc268_beep_mixer },
11564 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11565 alc268_acer_verbs },
11566 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11567 .dac_nids = alc268_dac_nids,
11568 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11569 .adc_nids = alc268_adc_nids_alt,
11570 .capsrc_nids = alc268_capsrc_nids,
11572 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11573 .channel_mode = alc268_modes,
11574 .input_mux = &alc268_acer_capture_source,
11575 .unsol_event = alc268_acer_unsol_event,
11576 .init_hook = alc268_acer_init_hook,
11578 [ALC268_ACER_ASPIRE_ONE] = {
11579 .mixers = { alc268_acer_aspire_one_mixer,
11580 alc268_capture_alt_mixer },
11581 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11582 alc268_acer_aspire_one_verbs },
11583 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11584 .dac_nids = alc268_dac_nids,
11585 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11586 .adc_nids = alc268_adc_nids_alt,
11587 .capsrc_nids = alc268_capsrc_nids,
11589 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11590 .channel_mode = alc268_modes,
11591 .input_mux = &alc268_acer_lc_capture_source,
11592 .unsol_event = alc268_acer_lc_unsol_event,
11593 .init_hook = alc268_acer_lc_init_hook,
11596 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11597 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11598 alc268_dell_verbs },
11599 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11600 .dac_nids = alc268_dac_nids,
11602 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11603 .channel_mode = alc268_modes,
11604 .unsol_event = alc268_dell_unsol_event,
11605 .init_hook = alc268_dell_init_hook,
11606 .input_mux = &alc268_capture_source,
11609 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11610 alc268_beep_mixer },
11611 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11612 alc268_toshiba_verbs },
11613 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11614 .dac_nids = alc268_dac_nids,
11615 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11616 .adc_nids = alc268_adc_nids_alt,
11617 .capsrc_nids = alc268_capsrc_nids,
11619 .dig_out_nid = ALC268_DIGOUT_NID,
11620 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11621 .channel_mode = alc268_modes,
11622 .input_mux = &alc268_capture_source,
11623 .unsol_event = alc268_toshiba_unsol_event,
11624 .init_hook = alc268_toshiba_automute
11626 #ifdef CONFIG_SND_DEBUG
11628 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11629 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11630 alc268_volume_init_verbs },
11631 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11632 .dac_nids = alc268_dac_nids,
11633 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11634 .adc_nids = alc268_adc_nids_alt,
11635 .capsrc_nids = alc268_capsrc_nids,
11637 .dig_out_nid = ALC268_DIGOUT_NID,
11638 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11639 .channel_mode = alc268_modes,
11640 .input_mux = &alc268_capture_source,
11645 static int patch_alc268(struct hda_codec *codec)
11647 struct alc_spec *spec;
11651 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11655 codec->spec = spec;
11657 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11661 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11662 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11663 "trying auto-probe from BIOS...\n");
11664 board_config = ALC268_AUTO;
11667 if (board_config == ALC268_AUTO) {
11668 /* automatic parse from the BIOS config */
11669 err = alc268_parse_auto_config(codec);
11675 "hda_codec: Cannot set up configuration "
11676 "from BIOS. Using base mode...\n");
11677 board_config = ALC268_3ST;
11681 if (board_config != ALC268_AUTO)
11682 setup_preset(spec, &alc268_presets[board_config]);
11684 if (codec->vendor_id == 0x10ec0267) {
11685 spec->stream_name_analog = "ALC267 Analog";
11686 spec->stream_name_digital = "ALC267 Digital";
11688 spec->stream_name_analog = "ALC268 Analog";
11689 spec->stream_name_digital = "ALC268 Digital";
11692 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11693 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11694 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11696 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11698 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11699 /* override the amp caps for beep generator */
11700 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11701 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11702 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11703 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11704 (0 << AC_AMPCAP_MUTE_SHIFT));
11706 if (!spec->adc_nids && spec->input_mux) {
11707 /* check whether NID 0x07 is valid */
11708 unsigned int wcap = get_wcaps(codec, 0x07);
11712 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11713 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11714 spec->adc_nids = alc268_adc_nids_alt;
11715 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11716 add_mixer(spec, alc268_capture_alt_mixer);
11718 spec->adc_nids = alc268_adc_nids;
11719 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11720 add_mixer(spec, alc268_capture_mixer);
11722 spec->capsrc_nids = alc268_capsrc_nids;
11723 /* set default input source */
11724 for (i = 0; i < spec->num_adc_nids; i++)
11725 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11726 0, AC_VERB_SET_CONNECT_SEL,
11727 spec->input_mux->items[0].index);
11730 spec->vmaster_nid = 0x02;
11732 codec->patch_ops = alc_patch_ops;
11733 if (board_config == ALC268_AUTO)
11734 spec->init_hook = alc268_auto_init;
11740 * ALC269 channel source setting (2 channel)
11742 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11744 #define alc269_dac_nids alc260_dac_nids
11746 static hda_nid_t alc269_adc_nids[1] = {
11751 static hda_nid_t alc269_capsrc_nids[1] = {
11755 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11759 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11767 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11775 #define alc269_modes alc260_modes
11776 #define alc269_capture_source alc880_lg_lw_capture_source
11778 static struct snd_kcontrol_new alc269_base_mixer[] = {
11779 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11780 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11781 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11782 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11784 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11785 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11786 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11787 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11788 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11789 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11790 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11792 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11796 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11797 /* output mixer control */
11798 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11800 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11801 .name = "Master Playback Switch",
11802 .info = snd_hda_mixer_amp_switch_info,
11803 .get = snd_hda_mixer_amp_switch_get,
11804 .put = alc268_acer_master_sw_put,
11805 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11809 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11810 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11811 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11812 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11813 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11814 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11818 /* bind volumes of both NID 0x0c and 0x0d */
11819 static struct hda_bind_ctls alc269_epc_bind_vol = {
11820 .ops = &snd_hda_bind_vol,
11822 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11823 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11828 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11829 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11830 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11831 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11835 /* capture mixer elements */
11836 static struct snd_kcontrol_new alc269_capture_mixer[] = {
11837 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11838 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11841 /* The multiple "Capture Source" controls confuse alsamixer
11842 * So call somewhat different..
11844 /* .name = "Capture Source", */
11845 .name = "Input Source",
11847 .info = alc_mux_enum_info,
11848 .get = alc_mux_enum_get,
11849 .put = alc_mux_enum_put,
11854 /* capture mixer elements */
11855 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11856 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11857 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11862 static struct snd_kcontrol_new alc269_beep_mixer[] = {
11863 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11864 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11868 static struct hda_verb alc269_quanta_fl1_verbs[] = {
11869 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11870 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11872 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11873 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11874 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11878 /* toggle speaker-output according to the hp-jack state */
11879 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11881 unsigned int present;
11882 unsigned char bits;
11884 present = snd_hda_codec_read(codec, 0x15, 0,
11885 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11886 bits = present ? AMP_IN_MUTE(0) : 0;
11887 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11888 AMP_IN_MUTE(0), bits);
11889 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11890 AMP_IN_MUTE(0), bits);
11892 snd_hda_codec_write(codec, 0x20, 0,
11893 AC_VERB_SET_COEF_INDEX, 0x0c);
11894 snd_hda_codec_write(codec, 0x20, 0,
11895 AC_VERB_SET_PROC_COEF, 0x680);
11897 snd_hda_codec_write(codec, 0x20, 0,
11898 AC_VERB_SET_COEF_INDEX, 0x0c);
11899 snd_hda_codec_write(codec, 0x20, 0,
11900 AC_VERB_SET_PROC_COEF, 0x480);
11903 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11905 unsigned int present;
11907 present = snd_hda_codec_read(codec, 0x18, 0,
11908 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11909 snd_hda_codec_write(codec, 0x23, 0,
11910 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11913 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11916 if ((res >> 26) == ALC880_HP_EVENT)
11917 alc269_quanta_fl1_speaker_automute(codec);
11918 if ((res >> 26) == ALC880_MIC_EVENT)
11919 alc269_quanta_fl1_mic_automute(codec);
11922 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
11924 alc269_quanta_fl1_speaker_automute(codec);
11925 alc269_quanta_fl1_mic_automute(codec);
11928 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11929 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11930 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
11931 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11932 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
11933 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11934 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11935 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11939 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11940 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11941 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
11942 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11943 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
11944 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11945 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11949 /* toggle speaker-output according to the hp-jack state */
11950 static void alc269_speaker_automute(struct hda_codec *codec)
11952 unsigned int present;
11953 unsigned char bits;
11955 present = snd_hda_codec_read(codec, 0x15, 0,
11956 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11957 bits = present ? AMP_IN_MUTE(0) : 0;
11958 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11959 AMP_IN_MUTE(0), bits);
11960 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11961 AMP_IN_MUTE(0), bits);
11964 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11966 unsigned int present;
11968 present = snd_hda_codec_read(codec, 0x18, 0,
11969 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11970 snd_hda_codec_write(codec, 0x23, 0,
11971 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
11974 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11976 unsigned int present;
11978 present = snd_hda_codec_read(codec, 0x18, 0,
11979 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11980 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11981 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11982 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11983 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11986 /* unsolicited event for HP jack sensing */
11987 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11990 if ((res >> 26) == ALC880_HP_EVENT)
11991 alc269_speaker_automute(codec);
11993 if ((res >> 26) == ALC880_MIC_EVENT)
11994 alc269_eeepc_dmic_automute(codec);
11997 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11999 alc269_speaker_automute(codec);
12000 alc269_eeepc_dmic_automute(codec);
12003 /* unsolicited event for HP jack sensing */
12004 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12007 if ((res >> 26) == ALC880_HP_EVENT)
12008 alc269_speaker_automute(codec);
12010 if ((res >> 26) == ALC880_MIC_EVENT)
12011 alc269_eeepc_amic_automute(codec);
12014 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12016 alc269_speaker_automute(codec);
12017 alc269_eeepc_amic_automute(codec);
12021 * generic initialization of ADC, input mixers and output mixers
12023 static struct hda_verb alc269_init_verbs[] = {
12025 * Unmute ADC0 and set the default input to mic-in
12027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12029 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12030 * analog-loopback mixer widget
12031 * Note: PASD motherboards uses the Line In 2 as the input for
12032 * front panel mic (mic 2)
12034 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12042 * Set up output mixers (0x0c - 0x0e)
12044 /* set vol=0 to output mixers */
12045 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12046 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12048 /* set up input amps for analog loopback */
12049 /* Amp Indices: DAC = 0, mixer = 1 */
12050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12053 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12055 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12058 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12059 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12060 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12061 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12062 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12063 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12065 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12067 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12068 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12070 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12071 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12073 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12074 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12076 /* FIXME: use matrix-type input source selection */
12077 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12078 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12085 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12086 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12090 /* add playback controls from the parsed DAC table */
12091 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12092 const struct auto_pin_cfg *cfg)
12097 spec->multiout.num_dacs = 1; /* only use one dac */
12098 spec->multiout.dac_nids = spec->private_dac_nids;
12099 spec->multiout.dac_nids[0] = 2;
12101 nid = cfg->line_out_pins[0];
12103 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12104 "Front Playback Volume",
12105 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12108 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12109 "Front Playback Switch",
12110 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12115 nid = cfg->speaker_pins[0];
12117 if (!cfg->line_out_pins[0]) {
12118 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12119 "Speaker Playback Volume",
12120 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12126 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12127 "Speaker Playback Switch",
12128 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12133 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12134 "Speaker Playback Switch",
12135 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12141 nid = cfg->hp_pins[0];
12143 /* spec->multiout.hp_nid = 2; */
12144 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12145 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12146 "Headphone Playback Volume",
12147 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12153 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12154 "Headphone Playback Switch",
12155 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12160 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12161 "Headphone Playback Switch",
12162 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12171 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12172 const struct auto_pin_cfg *cfg)
12176 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12179 /* digital-mic input pin is excluded in alc880_auto_create..()
12180 * because it's under 0x18
12182 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12183 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12184 struct hda_input_mux *imux = &spec->private_imux;
12185 imux->items[imux->num_items].label = "Int Mic";
12186 imux->items[imux->num_items].index = 0x05;
12192 #ifdef CONFIG_SND_HDA_POWER_SAVE
12193 #define alc269_loopbacks alc880_loopbacks
12196 /* pcm configuration: identiacal with ALC880 */
12197 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12198 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12199 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12200 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12203 * BIOS auto configuration
12205 static int alc269_parse_auto_config(struct hda_codec *codec)
12207 struct alc_spec *spec = codec->spec;
12209 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12211 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12216 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12219 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12223 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12225 if (spec->autocfg.dig_out_pin)
12226 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12228 if (spec->kctls.list)
12229 add_mixer(spec, spec->kctls.list);
12231 /* create a beep mixer control if the pin 0x1d isn't assigned */
12232 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12233 if (spec->autocfg.input_pins[i] == 0x1d)
12235 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12236 add_mixer(spec, alc269_beep_mixer);
12238 add_verb(spec, alc269_init_verbs);
12239 spec->num_mux_defs = 1;
12240 spec->input_mux = &spec->private_imux;
12241 /* set default input source */
12242 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12243 0, AC_VERB_SET_CONNECT_SEL,
12244 spec->input_mux->items[0].index);
12246 err = alc_auto_add_mic_boost(codec);
12250 add_mixer(spec, alc269_capture_mixer);
12252 store_pin_configs(codec);
12256 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12257 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12258 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12261 /* init callback for auto-configuration model -- overriding the default init */
12262 static void alc269_auto_init(struct hda_codec *codec)
12264 struct alc_spec *spec = codec->spec;
12265 alc269_auto_init_multi_out(codec);
12266 alc269_auto_init_hp_out(codec);
12267 alc269_auto_init_analog_input(codec);
12268 if (spec->unsol_event)
12269 alc_inithook(codec);
12273 * configuration and preset
12275 static const char *alc269_models[ALC269_MODEL_LAST] = {
12276 [ALC269_BASIC] = "basic",
12277 [ALC269_QUANTA_FL1] = "quanta",
12278 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12279 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901"
12282 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12283 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12284 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12285 ALC269_ASUS_EEEPC_P703),
12286 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12287 ALC269_ASUS_EEEPC_P901),
12288 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12289 ALC269_ASUS_EEEPC_P901),
12293 static struct alc_config_preset alc269_presets[] = {
12295 .mixers = { alc269_base_mixer, alc269_capture_mixer },
12296 .init_verbs = { alc269_init_verbs },
12297 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12298 .dac_nids = alc269_dac_nids,
12300 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12301 .channel_mode = alc269_modes,
12302 .input_mux = &alc269_capture_source,
12304 [ALC269_QUANTA_FL1] = {
12305 .mixers = { alc269_quanta_fl1_mixer },
12306 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12307 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12308 .dac_nids = alc269_dac_nids,
12310 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12311 .channel_mode = alc269_modes,
12312 .input_mux = &alc269_capture_source,
12313 .unsol_event = alc269_quanta_fl1_unsol_event,
12314 .init_hook = alc269_quanta_fl1_init_hook,
12316 [ALC269_ASUS_EEEPC_P703] = {
12317 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer },
12318 .init_verbs = { alc269_init_verbs,
12319 alc269_eeepc_amic_init_verbs },
12320 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12321 .dac_nids = alc269_dac_nids,
12323 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12324 .channel_mode = alc269_modes,
12325 .input_mux = &alc269_eeepc_amic_capture_source,
12326 .unsol_event = alc269_eeepc_amic_unsol_event,
12327 .init_hook = alc269_eeepc_amic_inithook,
12329 [ALC269_ASUS_EEEPC_P901] = {
12330 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer},
12331 .init_verbs = { alc269_init_verbs,
12332 alc269_eeepc_dmic_init_verbs },
12333 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12334 .dac_nids = alc269_dac_nids,
12336 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12337 .channel_mode = alc269_modes,
12338 .input_mux = &alc269_eeepc_dmic_capture_source,
12339 .unsol_event = alc269_eeepc_dmic_unsol_event,
12340 .init_hook = alc269_eeepc_dmic_inithook,
12344 static int patch_alc269(struct hda_codec *codec)
12346 struct alc_spec *spec;
12350 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12354 codec->spec = spec;
12356 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12358 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12362 if (board_config < 0) {
12363 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12364 "trying auto-probe from BIOS...\n");
12365 board_config = ALC269_AUTO;
12368 if (board_config == ALC269_AUTO) {
12369 /* automatic parse from the BIOS config */
12370 err = alc269_parse_auto_config(codec);
12376 "hda_codec: Cannot set up configuration "
12377 "from BIOS. Using base mode...\n");
12378 board_config = ALC269_BASIC;
12382 if (board_config != ALC269_AUTO)
12383 setup_preset(spec, &alc269_presets[board_config]);
12385 spec->stream_name_analog = "ALC269 Analog";
12386 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12387 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12389 spec->stream_name_digital = "ALC269 Digital";
12390 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12391 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12393 spec->adc_nids = alc269_adc_nids;
12394 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12395 spec->capsrc_nids = alc269_capsrc_nids;
12397 codec->patch_ops = alc_patch_ops;
12398 if (board_config == ALC269_AUTO)
12399 spec->init_hook = alc269_auto_init;
12400 #ifdef CONFIG_SND_HDA_POWER_SAVE
12401 if (!spec->loopback.amplist)
12402 spec->loopback.amplist = alc269_loopbacks;
12409 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12413 * set the path ways for 2 channel output
12414 * need to set the codec line out and mic 1 pin widgets to inputs
12416 static struct hda_verb alc861_threestack_ch2_init[] = {
12417 /* set pin widget 1Ah (line in) for input */
12418 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12419 /* set pin widget 18h (mic1/2) for input, for mic also enable
12422 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12424 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12426 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12427 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12433 * need to set the codec line out and mic 1 pin widgets to outputs
12435 static struct hda_verb alc861_threestack_ch6_init[] = {
12436 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12437 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12438 /* set pin widget 18h (mic1) for output (CLFE)*/
12439 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12441 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12442 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12444 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12446 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12447 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12452 static struct hda_channel_mode alc861_threestack_modes[2] = {
12453 { 2, alc861_threestack_ch2_init },
12454 { 6, alc861_threestack_ch6_init },
12456 /* Set mic1 as input and unmute the mixer */
12457 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12458 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12459 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12462 /* Set mic1 as output and mute mixer */
12463 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12464 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12465 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12469 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12470 { 2, alc861_uniwill_m31_ch2_init },
12471 { 4, alc861_uniwill_m31_ch4_init },
12474 /* Set mic1 and line-in as input and unmute the mixer */
12475 static struct hda_verb alc861_asus_ch2_init[] = {
12476 /* set pin widget 1Ah (line in) for input */
12477 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12478 /* set pin widget 18h (mic1/2) for input, for mic also enable
12481 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12483 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12485 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12486 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12490 /* Set mic1 nad line-in as output and mute mixer */
12491 static struct hda_verb alc861_asus_ch6_init[] = {
12492 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12493 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12494 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12495 /* set pin widget 18h (mic1) for output (CLFE)*/
12496 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12497 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12498 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12499 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12501 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12503 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12504 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12509 static struct hda_channel_mode alc861_asus_modes[2] = {
12510 { 2, alc861_asus_ch2_init },
12511 { 6, alc861_asus_ch6_init },
12516 static struct snd_kcontrol_new alc861_base_mixer[] = {
12517 /* output mixer control */
12518 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12519 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12520 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12521 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12522 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12524 /*Input mixer control */
12525 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12526 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12527 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12528 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12529 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12530 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12532 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12533 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12536 /* Capture mixer control */
12537 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12538 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12540 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12541 .name = "Capture Source",
12543 .info = alc_mux_enum_info,
12544 .get = alc_mux_enum_get,
12545 .put = alc_mux_enum_put,
12550 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12551 /* output mixer control */
12552 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12553 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12554 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12555 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12556 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12558 /* Input mixer control */
12559 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12560 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12561 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12562 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12563 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12564 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12565 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12566 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12567 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12568 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12570 /* Capture mixer control */
12571 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12572 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12574 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12575 .name = "Capture Source",
12577 .info = alc_mux_enum_info,
12578 .get = alc_mux_enum_get,
12579 .put = alc_mux_enum_put,
12582 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12583 .name = "Channel Mode",
12584 .info = alc_ch_mode_info,
12585 .get = alc_ch_mode_get,
12586 .put = alc_ch_mode_put,
12587 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12592 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12593 /* output mixer control */
12594 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12596 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12598 /*Capture mixer control */
12599 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12600 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12602 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12603 .name = "Capture Source",
12605 .info = alc_mux_enum_info,
12606 .get = alc_mux_enum_get,
12607 .put = alc_mux_enum_put,
12613 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12614 /* output mixer control */
12615 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12616 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12617 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12618 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12619 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12621 /* Input mixer control */
12622 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12623 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12624 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12625 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12626 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12627 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12629 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12630 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12631 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12633 /* Capture mixer control */
12634 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12635 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12637 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12638 .name = "Capture Source",
12640 .info = alc_mux_enum_info,
12641 .get = alc_mux_enum_get,
12642 .put = alc_mux_enum_put,
12645 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12646 .name = "Channel Mode",
12647 .info = alc_ch_mode_info,
12648 .get = alc_ch_mode_get,
12649 .put = alc_ch_mode_put,
12650 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12655 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12656 /* output mixer control */
12657 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12658 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12659 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12660 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12661 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12663 /* Input mixer control */
12664 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12665 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12666 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12667 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12668 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12669 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12671 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12672 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12673 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12675 /* Capture mixer control */
12676 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12677 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12680 .name = "Capture Source",
12682 .info = alc_mux_enum_info,
12683 .get = alc_mux_enum_get,
12684 .put = alc_mux_enum_put,
12687 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12688 .name = "Channel Mode",
12689 .info = alc_ch_mode_info,
12690 .get = alc_ch_mode_get,
12691 .put = alc_ch_mode_put,
12692 .private_value = ARRAY_SIZE(alc861_asus_modes),
12697 /* additional mixer */
12698 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12699 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12700 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12701 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12702 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12707 * generic initialization of ADC, input mixers and output mixers
12709 static struct hda_verb alc861_base_init_verbs[] = {
12711 * Unmute ADC0 and set the default input to mic-in
12713 /* port-A for surround (rear panel) */
12714 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12715 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
12716 /* port-B for mic-in (rear panel) with vref */
12717 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12718 /* port-C for line-in (rear panel) */
12719 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12720 /* port-D for Front */
12721 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12722 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12723 /* port-E for HP out (front panel) */
12724 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12725 /* route front PCM to HP */
12726 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12727 /* port-F for mic-in (front panel) with vref */
12728 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12729 /* port-G for CLFE (rear panel) */
12730 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12731 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12732 /* port-H for side (rear panel) */
12733 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12734 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
12736 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12737 /* route front mic to ADC1*/
12738 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12741 /* Unmute DAC0~3 & spdif out*/
12742 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12743 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12744 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12745 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12748 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12749 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12750 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12751 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12752 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12754 /* Unmute Stereo Mixer 15 */
12755 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12760 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12761 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12762 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12763 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12764 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12766 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12767 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12768 /* hp used DAC 3 (Front) */
12769 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12770 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12775 static struct hda_verb alc861_threestack_init_verbs[] = {
12777 * Unmute ADC0 and set the default input to mic-in
12779 /* port-A for surround (rear panel) */
12780 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12781 /* port-B for mic-in (rear panel) with vref */
12782 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12783 /* port-C for line-in (rear panel) */
12784 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12785 /* port-D for Front */
12786 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12787 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12788 /* port-E for HP out (front panel) */
12789 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12790 /* route front PCM to HP */
12791 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12792 /* port-F for mic-in (front panel) with vref */
12793 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12794 /* port-G for CLFE (rear panel) */
12795 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12796 /* port-H for side (rear panel) */
12797 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12799 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12800 /* route front mic to ADC1*/
12801 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12803 /* Unmute DAC0~3 & spdif out*/
12804 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12805 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12806 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12807 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12808 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12810 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12811 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12812 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12813 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12814 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12816 /* Unmute Stereo Mixer 15 */
12817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12818 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12822 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12823 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12824 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12825 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12827 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12828 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12829 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12830 /* hp used DAC 3 (Front) */
12831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12832 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12836 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
12838 * Unmute ADC0 and set the default input to mic-in
12840 /* port-A for surround (rear panel) */
12841 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12842 /* port-B for mic-in (rear panel) with vref */
12843 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12844 /* port-C for line-in (rear panel) */
12845 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12846 /* port-D for Front */
12847 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12848 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12849 /* port-E for HP out (front panel) */
12850 /* this has to be set to VREF80 */
12851 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12852 /* route front PCM to HP */
12853 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12854 /* port-F for mic-in (front panel) with vref */
12855 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12856 /* port-G for CLFE (rear panel) */
12857 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12858 /* port-H for side (rear panel) */
12859 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12861 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12862 /* route front mic to ADC1*/
12863 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12864 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12865 /* Unmute DAC0~3 & spdif out*/
12866 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12867 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12868 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12869 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12870 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12872 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12873 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12874 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12875 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12876 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12878 /* Unmute Stereo Mixer 15 */
12879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12882 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12885 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12886 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12887 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12888 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12890 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12891 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12892 /* hp used DAC 3 (Front) */
12893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12894 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12898 static struct hda_verb alc861_asus_init_verbs[] = {
12900 * Unmute ADC0 and set the default input to mic-in
12902 /* port-A for surround (rear panel)
12903 * according to codec#0 this is the HP jack
12905 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12906 /* route front PCM to HP */
12907 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12908 /* port-B for mic-in (rear panel) with vref */
12909 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12910 /* port-C for line-in (rear panel) */
12911 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12912 /* port-D for Front */
12913 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12914 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12915 /* port-E for HP out (front panel) */
12916 /* this has to be set to VREF80 */
12917 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12918 /* route front PCM to HP */
12919 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12920 /* port-F for mic-in (front panel) with vref */
12921 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12922 /* port-G for CLFE (rear panel) */
12923 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12924 /* port-H for side (rear panel) */
12925 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12927 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12928 /* route front mic to ADC1*/
12929 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12931 /* Unmute DAC0~3 & spdif out*/
12932 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12933 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12934 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12935 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12937 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12938 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12939 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12940 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12941 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12943 /* Unmute Stereo Mixer 15 */
12944 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12945 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12946 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12949 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12950 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12951 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12952 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12953 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12954 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12955 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12956 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12957 /* hp used DAC 3 (Front) */
12958 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12959 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12963 /* additional init verbs for ASUS laptops */
12964 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
12965 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
12966 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
12971 * generic initialization of ADC, input mixers and output mixers
12973 static struct hda_verb alc861_auto_init_verbs[] = {
12975 * Unmute ADC0 and set the default input to mic-in
12977 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12978 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12980 /* Unmute DAC0~3 & spdif out*/
12981 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12982 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12983 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12984 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12985 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12987 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12988 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12989 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12990 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12991 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12993 /* Unmute Stereo Mixer 15 */
12994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
12999 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13000 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13001 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13002 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13003 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13004 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13005 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13006 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13008 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13009 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13010 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13011 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13012 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13013 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13014 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13015 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13017 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13022 static struct hda_verb alc861_toshiba_init_verbs[] = {
13023 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13028 /* toggle speaker-output according to the hp-jack state */
13029 static void alc861_toshiba_automute(struct hda_codec *codec)
13031 unsigned int present;
13033 present = snd_hda_codec_read(codec, 0x0f, 0,
13034 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13035 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13036 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13037 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13038 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13041 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13044 if ((res >> 26) == ALC880_HP_EVENT)
13045 alc861_toshiba_automute(codec);
13048 /* pcm configuration: identiacal with ALC880 */
13049 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13050 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13051 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13052 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13055 #define ALC861_DIGOUT_NID 0x07
13057 static struct hda_channel_mode alc861_8ch_modes[1] = {
13061 static hda_nid_t alc861_dac_nids[4] = {
13062 /* front, surround, clfe, side */
13063 0x03, 0x06, 0x05, 0x04
13066 static hda_nid_t alc660_dac_nids[3] = {
13067 /* front, clfe, surround */
13071 static hda_nid_t alc861_adc_nids[1] = {
13076 static struct hda_input_mux alc861_capture_source = {
13080 { "Front Mic", 0x3 },
13087 /* fill in the dac_nids table from the parsed pin configuration */
13088 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13089 const struct auto_pin_cfg *cfg)
13094 spec->multiout.dac_nids = spec->private_dac_nids;
13095 for (i = 0; i < cfg->line_outs; i++) {
13096 nid = cfg->line_out_pins[i];
13098 if (i >= ARRAY_SIZE(alc861_dac_nids))
13100 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13103 spec->multiout.num_dacs = cfg->line_outs;
13107 /* add playback controls from the parsed DAC table */
13108 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13109 const struct auto_pin_cfg *cfg)
13112 static const char *chname[4] = {
13113 "Front", "Surround", NULL /*CLFE*/, "Side"
13118 for (i = 0; i < cfg->line_outs; i++) {
13119 nid = spec->multiout.dac_nids[i];
13124 err = add_control(spec, ALC_CTL_BIND_MUTE,
13125 "Center Playback Switch",
13126 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13130 err = add_control(spec, ALC_CTL_BIND_MUTE,
13131 "LFE Playback Switch",
13132 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13137 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13139 if (nid == alc861_dac_nids[idx])
13141 sprintf(name, "%s Playback Switch", chname[idx]);
13142 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13143 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13152 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13160 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13162 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13163 "Headphone Playback Switch",
13164 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13167 spec->multiout.hp_nid = nid;
13172 /* create playback/capture controls for input pins */
13173 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13174 const struct auto_pin_cfg *cfg)
13176 struct hda_input_mux *imux = &spec->private_imux;
13177 int i, err, idx, idx1;
13179 for (i = 0; i < AUTO_PIN_LAST; i++) {
13180 switch (cfg->input_pins[i]) {
13183 idx = 2; /* Line In */
13187 idx = 2; /* Line In */
13191 idx = 1; /* Mic In */
13195 idx = 1; /* Mic In */
13205 err = new_analog_input(spec, cfg->input_pins[i],
13206 auto_pin_cfg_labels[i], idx, 0x15);
13210 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13211 imux->items[imux->num_items].index = idx1;
13217 static struct snd_kcontrol_new alc861_capture_mixer[] = {
13218 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13219 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13222 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13223 /* The multiple "Capture Source" controls confuse alsamixer
13224 * So call somewhat different..
13226 /* .name = "Capture Source", */
13227 .name = "Input Source",
13229 .info = alc_mux_enum_info,
13230 .get = alc_mux_enum_get,
13231 .put = alc_mux_enum_put,
13236 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13238 int pin_type, int dac_idx)
13240 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13242 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13246 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13248 struct alc_spec *spec = codec->spec;
13251 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13252 for (i = 0; i < spec->autocfg.line_outs; i++) {
13253 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13254 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13256 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13257 spec->multiout.dac_nids[i]);
13261 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13263 struct alc_spec *spec = codec->spec;
13266 pin = spec->autocfg.hp_pins[0];
13267 if (pin) /* connect to front */
13268 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13269 spec->multiout.dac_nids[0]);
13270 pin = spec->autocfg.speaker_pins[0];
13272 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13275 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13277 struct alc_spec *spec = codec->spec;
13280 for (i = 0; i < AUTO_PIN_LAST; i++) {
13281 hda_nid_t nid = spec->autocfg.input_pins[i];
13282 if (nid >= 0x0c && nid <= 0x11) {
13283 snd_hda_codec_write(codec, nid, 0,
13284 AC_VERB_SET_PIN_WIDGET_CONTROL,
13285 i <= AUTO_PIN_FRONT_MIC ?
13286 PIN_VREF80 : PIN_IN);
13291 /* parse the BIOS configuration and set up the alc_spec */
13292 /* return 1 if successful, 0 if the proper config is not found,
13293 * or a negative error code
13295 static int alc861_parse_auto_config(struct hda_codec *codec)
13297 struct alc_spec *spec = codec->spec;
13299 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13301 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13305 if (!spec->autocfg.line_outs)
13306 return 0; /* can't find valid BIOS pin config */
13308 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13311 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13314 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13317 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13321 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13323 if (spec->autocfg.dig_out_pin)
13324 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13326 if (spec->kctls.list)
13327 add_mixer(spec, spec->kctls.list);
13329 add_verb(spec, alc861_auto_init_verbs);
13331 spec->num_mux_defs = 1;
13332 spec->input_mux = &spec->private_imux;
13334 spec->adc_nids = alc861_adc_nids;
13335 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13336 add_mixer(spec, alc861_capture_mixer);
13338 store_pin_configs(codec);
13342 /* additional initialization for auto-configuration model */
13343 static void alc861_auto_init(struct hda_codec *codec)
13345 struct alc_spec *spec = codec->spec;
13346 alc861_auto_init_multi_out(codec);
13347 alc861_auto_init_hp_out(codec);
13348 alc861_auto_init_analog_input(codec);
13349 if (spec->unsol_event)
13350 alc_inithook(codec);
13353 #ifdef CONFIG_SND_HDA_POWER_SAVE
13354 static struct hda_amp_list alc861_loopbacks[] = {
13355 { 0x15, HDA_INPUT, 0 },
13356 { 0x15, HDA_INPUT, 1 },
13357 { 0x15, HDA_INPUT, 2 },
13358 { 0x15, HDA_INPUT, 3 },
13365 * configuration and preset
13367 static const char *alc861_models[ALC861_MODEL_LAST] = {
13368 [ALC861_3ST] = "3stack",
13369 [ALC660_3ST] = "3stack-660",
13370 [ALC861_3ST_DIG] = "3stack-dig",
13371 [ALC861_6ST_DIG] = "6stack-dig",
13372 [ALC861_UNIWILL_M31] = "uniwill-m31",
13373 [ALC861_TOSHIBA] = "toshiba",
13374 [ALC861_ASUS] = "asus",
13375 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13376 [ALC861_AUTO] = "auto",
13379 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13380 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13381 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13382 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13383 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13384 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13385 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13386 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13387 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13388 * Any other models that need this preset?
13390 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13391 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13392 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13393 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13394 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13395 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13396 /* FIXME: the below seems conflict */
13397 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13398 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13399 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13403 static struct alc_config_preset alc861_presets[] = {
13405 .mixers = { alc861_3ST_mixer },
13406 .init_verbs = { alc861_threestack_init_verbs },
13407 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13408 .dac_nids = alc861_dac_nids,
13409 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13410 .channel_mode = alc861_threestack_modes,
13412 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13413 .adc_nids = alc861_adc_nids,
13414 .input_mux = &alc861_capture_source,
13416 [ALC861_3ST_DIG] = {
13417 .mixers = { alc861_base_mixer },
13418 .init_verbs = { alc861_threestack_init_verbs },
13419 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13420 .dac_nids = alc861_dac_nids,
13421 .dig_out_nid = ALC861_DIGOUT_NID,
13422 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13423 .channel_mode = alc861_threestack_modes,
13425 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13426 .adc_nids = alc861_adc_nids,
13427 .input_mux = &alc861_capture_source,
13429 [ALC861_6ST_DIG] = {
13430 .mixers = { alc861_base_mixer },
13431 .init_verbs = { alc861_base_init_verbs },
13432 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13433 .dac_nids = alc861_dac_nids,
13434 .dig_out_nid = ALC861_DIGOUT_NID,
13435 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13436 .channel_mode = alc861_8ch_modes,
13437 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13438 .adc_nids = alc861_adc_nids,
13439 .input_mux = &alc861_capture_source,
13442 .mixers = { alc861_3ST_mixer },
13443 .init_verbs = { alc861_threestack_init_verbs },
13444 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13445 .dac_nids = alc660_dac_nids,
13446 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13447 .channel_mode = alc861_threestack_modes,
13449 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13450 .adc_nids = alc861_adc_nids,
13451 .input_mux = &alc861_capture_source,
13453 [ALC861_UNIWILL_M31] = {
13454 .mixers = { alc861_uniwill_m31_mixer },
13455 .init_verbs = { alc861_uniwill_m31_init_verbs },
13456 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13457 .dac_nids = alc861_dac_nids,
13458 .dig_out_nid = ALC861_DIGOUT_NID,
13459 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13460 .channel_mode = alc861_uniwill_m31_modes,
13462 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13463 .adc_nids = alc861_adc_nids,
13464 .input_mux = &alc861_capture_source,
13466 [ALC861_TOSHIBA] = {
13467 .mixers = { alc861_toshiba_mixer },
13468 .init_verbs = { alc861_base_init_verbs,
13469 alc861_toshiba_init_verbs },
13470 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13471 .dac_nids = alc861_dac_nids,
13472 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13473 .channel_mode = alc883_3ST_2ch_modes,
13474 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13475 .adc_nids = alc861_adc_nids,
13476 .input_mux = &alc861_capture_source,
13477 .unsol_event = alc861_toshiba_unsol_event,
13478 .init_hook = alc861_toshiba_automute,
13481 .mixers = { alc861_asus_mixer },
13482 .init_verbs = { alc861_asus_init_verbs },
13483 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13484 .dac_nids = alc861_dac_nids,
13485 .dig_out_nid = ALC861_DIGOUT_NID,
13486 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13487 .channel_mode = alc861_asus_modes,
13490 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13491 .adc_nids = alc861_adc_nids,
13492 .input_mux = &alc861_capture_source,
13494 [ALC861_ASUS_LAPTOP] = {
13495 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13496 .init_verbs = { alc861_asus_init_verbs,
13497 alc861_asus_laptop_init_verbs },
13498 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13499 .dac_nids = alc861_dac_nids,
13500 .dig_out_nid = ALC861_DIGOUT_NID,
13501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13502 .channel_mode = alc883_3ST_2ch_modes,
13504 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13505 .adc_nids = alc861_adc_nids,
13506 .input_mux = &alc861_capture_source,
13511 static int patch_alc861(struct hda_codec *codec)
13513 struct alc_spec *spec;
13517 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13521 codec->spec = spec;
13523 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13527 if (board_config < 0) {
13528 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13529 "trying auto-probe from BIOS...\n");
13530 board_config = ALC861_AUTO;
13533 if (board_config == ALC861_AUTO) {
13534 /* automatic parse from the BIOS config */
13535 err = alc861_parse_auto_config(codec);
13541 "hda_codec: Cannot set up configuration "
13542 "from BIOS. Using base mode...\n");
13543 board_config = ALC861_3ST_DIG;
13547 if (board_config != ALC861_AUTO)
13548 setup_preset(spec, &alc861_presets[board_config]);
13550 spec->stream_name_analog = "ALC861 Analog";
13551 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13552 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13554 spec->stream_name_digital = "ALC861 Digital";
13555 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13556 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13558 spec->vmaster_nid = 0x03;
13560 codec->patch_ops = alc_patch_ops;
13561 if (board_config == ALC861_AUTO)
13562 spec->init_hook = alc861_auto_init;
13563 #ifdef CONFIG_SND_HDA_POWER_SAVE
13564 if (!spec->loopback.amplist)
13565 spec->loopback.amplist = alc861_loopbacks;
13572 * ALC861-VD support
13576 * In addition, an independent DAC
13578 #define ALC861VD_DIGOUT_NID 0x06
13580 static hda_nid_t alc861vd_dac_nids[4] = {
13581 /* front, surr, clfe, side surr */
13582 0x02, 0x03, 0x04, 0x05
13585 /* dac_nids for ALC660vd are in a different order - according to
13586 * Realtek's driver.
13587 * This should probably tesult in a different mixer for 6stack models
13588 * of ALC660vd codecs, but for now there is only 3stack mixer
13589 * - and it is the same as in 861vd.
13590 * adc_nids in ALC660vd are (is) the same as in 861vd
13592 static hda_nid_t alc660vd_dac_nids[3] = {
13593 /* front, rear, clfe, rear_surr */
13597 static hda_nid_t alc861vd_adc_nids[1] = {
13602 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13605 /* FIXME: should be a matrix-type input source selection */
13606 static struct hda_input_mux alc861vd_capture_source = {
13610 { "Front Mic", 0x1 },
13616 static struct hda_input_mux alc861vd_dallas_capture_source = {
13619 { "Ext Mic", 0x0 },
13620 { "Int Mic", 0x1 },
13624 static struct hda_input_mux alc861vd_hp_capture_source = {
13627 { "Front Mic", 0x0 },
13628 { "ATAPI Mic", 0x1 },
13635 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13642 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13643 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13644 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13645 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13646 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13653 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13654 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13655 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13656 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13657 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13661 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13662 { 6, alc861vd_6stack_ch6_init },
13663 { 8, alc861vd_6stack_ch8_init },
13666 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13668 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13669 .name = "Channel Mode",
13670 .info = alc_ch_mode_info,
13671 .get = alc_ch_mode_get,
13672 .put = alc_ch_mode_put,
13677 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
13678 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13679 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13682 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13683 /* The multiple "Capture Source" controls confuse alsamixer
13684 * So call somewhat different..
13686 /* .name = "Capture Source", */
13687 .name = "Input Source",
13689 .info = alc_mux_enum_info,
13690 .get = alc_mux_enum_get,
13691 .put = alc_mux_enum_put,
13696 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13697 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13699 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13700 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13701 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13703 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13704 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13706 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13708 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13710 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13711 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13713 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13714 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13716 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13718 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13722 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13723 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13724 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13726 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13727 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13729 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13730 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13732 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13733 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13738 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13739 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13740 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13744 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13748 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13749 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13750 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13752 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13753 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13755 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13756 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13758 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13759 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13764 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
13765 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13766 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13767 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13769 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13771 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13775 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13779 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13780 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13785 /* Pin assignment: Speaker=0x14, HP = 0x15,
13786 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
13788 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
13789 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13790 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
13791 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13792 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13793 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13794 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13795 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13796 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13797 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13798 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13799 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
13800 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
13804 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
13805 * Front Mic=0x18, ATAPI Mic = 0x19,
13807 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
13808 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13809 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13810 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13811 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13812 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13813 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13814 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13815 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13821 * generic initialization of ADC, input mixers and output mixers
13823 static struct hda_verb alc861vd_volume_init_verbs[] = {
13825 * Unmute ADC0 and set the default input to mic-in
13827 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13830 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13831 * the analog-loopback mixer widget
13833 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13840 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13842 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13847 * Set up output mixers (0x02 - 0x05)
13849 /* set vol=0 to output mixers */
13850 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13851 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13852 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13853 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13855 /* set up input amps for analog loopback */
13856 /* Amp Indices: DAC = 0, mixer = 1 */
13857 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13858 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13859 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13860 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13861 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13862 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13863 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13864 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13870 * 3-stack pin configuration:
13871 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13873 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13875 * Set pin mode and muting
13877 /* set front pin widgets 0x14 for output */
13878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13880 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13882 /* Mic (rear) pin: input vref at 80% */
13883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13885 /* Front Mic pin: input vref at 80% */
13886 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13887 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13888 /* Line In pin: input */
13889 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13891 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13892 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13893 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13894 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13895 /* CD pin widget for input */
13896 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13902 * 6-stack pin configuration:
13904 static struct hda_verb alc861vd_6stack_init_verbs[] = {
13906 * Set pin mode and muting
13908 /* set front pin widgets 0x14 for output */
13909 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13911 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13913 /* Rear Pin: output 1 (0x0d) */
13914 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13916 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13917 /* CLFE Pin: output 2 (0x0e) */
13918 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13919 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13920 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13921 /* Side Pin: output 3 (0x0f) */
13922 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13923 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13924 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13926 /* Mic (rear) pin: input vref at 80% */
13927 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13928 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13929 /* Front Mic pin: input vref at 80% */
13930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13932 /* Line In pin: input */
13933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13935 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13938 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13939 /* CD pin widget for input */
13940 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13945 static struct hda_verb alc861vd_eapd_verbs[] = {
13946 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13950 static struct hda_verb alc660vd_eapd_verbs[] = {
13951 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13952 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13956 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13959 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13960 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13961 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13965 /* toggle speaker-output according to the hp-jack state */
13966 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
13968 unsigned int present;
13969 unsigned char bits;
13971 present = snd_hda_codec_read(codec, 0x1b, 0,
13972 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13973 bits = present ? HDA_AMP_MUTE : 0;
13974 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13975 HDA_AMP_MUTE, bits);
13978 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
13980 unsigned int present;
13981 unsigned char bits;
13983 present = snd_hda_codec_read(codec, 0x18, 0,
13984 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13985 bits = present ? HDA_AMP_MUTE : 0;
13986 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
13987 HDA_AMP_MUTE, bits);
13990 static void alc861vd_lenovo_automute(struct hda_codec *codec)
13992 alc861vd_lenovo_hp_automute(codec);
13993 alc861vd_lenovo_mic_automute(codec);
13996 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
13999 switch (res >> 26) {
14000 case ALC880_HP_EVENT:
14001 alc861vd_lenovo_hp_automute(codec);
14003 case ALC880_MIC_EVENT:
14004 alc861vd_lenovo_mic_automute(codec);
14009 static struct hda_verb alc861vd_dallas_verbs[] = {
14010 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14011 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14012 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14013 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14017 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14020 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14022 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14024 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14029 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14030 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14031 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14033 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14034 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14035 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14036 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14037 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14038 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14039 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14040 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14043 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14048 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14049 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14054 /* toggle speaker-output according to the hp-jack state */
14055 static void alc861vd_dallas_automute(struct hda_codec *codec)
14057 unsigned int present;
14059 present = snd_hda_codec_read(codec, 0x15, 0,
14060 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14061 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14062 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14065 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14067 if ((res >> 26) == ALC880_HP_EVENT)
14068 alc861vd_dallas_automute(codec);
14071 #ifdef CONFIG_SND_HDA_POWER_SAVE
14072 #define alc861vd_loopbacks alc880_loopbacks
14075 /* pcm configuration: identiacal with ALC880 */
14076 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14077 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14078 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14079 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14082 * configuration and preset
14084 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14085 [ALC660VD_3ST] = "3stack-660",
14086 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14087 [ALC861VD_3ST] = "3stack",
14088 [ALC861VD_3ST_DIG] = "3stack-digout",
14089 [ALC861VD_6ST_DIG] = "6stack-digout",
14090 [ALC861VD_LENOVO] = "lenovo",
14091 [ALC861VD_DALLAS] = "dallas",
14092 [ALC861VD_HP] = "hp",
14093 [ALC861VD_AUTO] = "auto",
14096 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14097 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14098 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14099 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14100 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14101 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO),
14102 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14103 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14104 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14105 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14106 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14107 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14108 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14109 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14110 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14111 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14112 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14113 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14117 static struct alc_config_preset alc861vd_presets[] = {
14119 .mixers = { alc861vd_3st_mixer },
14120 .init_verbs = { alc861vd_volume_init_verbs,
14121 alc861vd_3stack_init_verbs },
14122 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14123 .dac_nids = alc660vd_dac_nids,
14124 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14125 .channel_mode = alc861vd_3stack_2ch_modes,
14126 .input_mux = &alc861vd_capture_source,
14128 [ALC660VD_3ST_DIG] = {
14129 .mixers = { alc861vd_3st_mixer },
14130 .init_verbs = { alc861vd_volume_init_verbs,
14131 alc861vd_3stack_init_verbs },
14132 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14133 .dac_nids = alc660vd_dac_nids,
14134 .dig_out_nid = ALC861VD_DIGOUT_NID,
14135 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14136 .channel_mode = alc861vd_3stack_2ch_modes,
14137 .input_mux = &alc861vd_capture_source,
14140 .mixers = { alc861vd_3st_mixer },
14141 .init_verbs = { alc861vd_volume_init_verbs,
14142 alc861vd_3stack_init_verbs },
14143 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14144 .dac_nids = alc861vd_dac_nids,
14145 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14146 .channel_mode = alc861vd_3stack_2ch_modes,
14147 .input_mux = &alc861vd_capture_source,
14149 [ALC861VD_3ST_DIG] = {
14150 .mixers = { alc861vd_3st_mixer },
14151 .init_verbs = { alc861vd_volume_init_verbs,
14152 alc861vd_3stack_init_verbs },
14153 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14154 .dac_nids = alc861vd_dac_nids,
14155 .dig_out_nid = ALC861VD_DIGOUT_NID,
14156 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14157 .channel_mode = alc861vd_3stack_2ch_modes,
14158 .input_mux = &alc861vd_capture_source,
14160 [ALC861VD_6ST_DIG] = {
14161 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14162 .init_verbs = { alc861vd_volume_init_verbs,
14163 alc861vd_6stack_init_verbs },
14164 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14165 .dac_nids = alc861vd_dac_nids,
14166 .dig_out_nid = ALC861VD_DIGOUT_NID,
14167 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14168 .channel_mode = alc861vd_6stack_modes,
14169 .input_mux = &alc861vd_capture_source,
14171 [ALC861VD_LENOVO] = {
14172 .mixers = { alc861vd_lenovo_mixer },
14173 .init_verbs = { alc861vd_volume_init_verbs,
14174 alc861vd_3stack_init_verbs,
14175 alc861vd_eapd_verbs,
14176 alc861vd_lenovo_unsol_verbs },
14177 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14178 .dac_nids = alc660vd_dac_nids,
14179 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14180 .channel_mode = alc861vd_3stack_2ch_modes,
14181 .input_mux = &alc861vd_capture_source,
14182 .unsol_event = alc861vd_lenovo_unsol_event,
14183 .init_hook = alc861vd_lenovo_automute,
14185 [ALC861VD_DALLAS] = {
14186 .mixers = { alc861vd_dallas_mixer },
14187 .init_verbs = { alc861vd_dallas_verbs },
14188 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14189 .dac_nids = alc861vd_dac_nids,
14190 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14191 .channel_mode = alc861vd_3stack_2ch_modes,
14192 .input_mux = &alc861vd_dallas_capture_source,
14193 .unsol_event = alc861vd_dallas_unsol_event,
14194 .init_hook = alc861vd_dallas_automute,
14197 .mixers = { alc861vd_hp_mixer },
14198 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14199 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14200 .dac_nids = alc861vd_dac_nids,
14201 .dig_out_nid = ALC861VD_DIGOUT_NID,
14202 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14203 .channel_mode = alc861vd_3stack_2ch_modes,
14204 .input_mux = &alc861vd_hp_capture_source,
14205 .unsol_event = alc861vd_dallas_unsol_event,
14206 .init_hook = alc861vd_dallas_automute,
14211 * BIOS auto configuration
14213 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14214 hda_nid_t nid, int pin_type, int dac_idx)
14216 alc_set_pin_output(codec, nid, pin_type);
14219 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14221 struct alc_spec *spec = codec->spec;
14224 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14225 for (i = 0; i <= HDA_SIDE; i++) {
14226 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14227 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14229 alc861vd_auto_set_output_and_unmute(codec, nid,
14235 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14237 struct alc_spec *spec = codec->spec;
14240 pin = spec->autocfg.hp_pins[0];
14241 if (pin) /* connect to front and use dac 0 */
14242 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14243 pin = spec->autocfg.speaker_pins[0];
14245 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14248 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14249 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14251 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14253 struct alc_spec *spec = codec->spec;
14256 for (i = 0; i < AUTO_PIN_LAST; i++) {
14257 hda_nid_t nid = spec->autocfg.input_pins[i];
14258 if (alc861vd_is_input_pin(nid)) {
14259 snd_hda_codec_write(codec, nid, 0,
14260 AC_VERB_SET_PIN_WIDGET_CONTROL,
14261 i <= AUTO_PIN_FRONT_MIC ?
14262 PIN_VREF80 : PIN_IN);
14263 if (nid != ALC861VD_PIN_CD_NID)
14264 snd_hda_codec_write(codec, nid, 0,
14265 AC_VERB_SET_AMP_GAIN_MUTE,
14271 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14273 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14274 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14276 /* add playback controls from the parsed DAC table */
14277 /* Based on ALC880 version. But ALC861VD has separate,
14278 * different NIDs for mute/unmute switch and volume control */
14279 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14280 const struct auto_pin_cfg *cfg)
14283 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14284 hda_nid_t nid_v, nid_s;
14287 for (i = 0; i < cfg->line_outs; i++) {
14288 if (!spec->multiout.dac_nids[i])
14290 nid_v = alc861vd_idx_to_mixer_vol(
14292 spec->multiout.dac_nids[i]));
14293 nid_s = alc861vd_idx_to_mixer_switch(
14295 spec->multiout.dac_nids[i]));
14299 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14300 "Center Playback Volume",
14301 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14305 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14306 "LFE Playback Volume",
14307 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14311 err = add_control(spec, ALC_CTL_BIND_MUTE,
14312 "Center Playback Switch",
14313 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14317 err = add_control(spec, ALC_CTL_BIND_MUTE,
14318 "LFE Playback Switch",
14319 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14324 sprintf(name, "%s Playback Volume", chname[i]);
14325 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14326 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14330 sprintf(name, "%s Playback Switch", chname[i]);
14331 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14332 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14341 /* add playback controls for speaker and HP outputs */
14342 /* Based on ALC880 version. But ALC861VD has separate,
14343 * different NIDs for mute/unmute switch and volume control */
14344 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14345 hda_nid_t pin, const char *pfx)
14347 hda_nid_t nid_v, nid_s;
14354 if (alc880_is_fixed_pin(pin)) {
14355 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14356 /* specify the DAC as the extra output */
14357 if (!spec->multiout.hp_nid)
14358 spec->multiout.hp_nid = nid_v;
14360 spec->multiout.extra_out_nid[0] = nid_v;
14361 /* control HP volume/switch on the output mixer amp */
14362 nid_v = alc861vd_idx_to_mixer_vol(
14363 alc880_fixed_pin_idx(pin));
14364 nid_s = alc861vd_idx_to_mixer_switch(
14365 alc880_fixed_pin_idx(pin));
14367 sprintf(name, "%s Playback Volume", pfx);
14368 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14369 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14372 sprintf(name, "%s Playback Switch", pfx);
14373 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14374 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14377 } else if (alc880_is_multi_pin(pin)) {
14378 /* set manual connection */
14379 /* we have only a switch on HP-out PIN */
14380 sprintf(name, "%s Playback Switch", pfx);
14381 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14382 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14389 /* parse the BIOS configuration and set up the alc_spec
14390 * return 1 if successful, 0 if the proper config is not found,
14391 * or a negative error code
14392 * Based on ALC880 version - had to change it to override
14393 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14394 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14396 struct alc_spec *spec = codec->spec;
14398 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14400 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14404 if (!spec->autocfg.line_outs)
14405 return 0; /* can't find valid BIOS pin config */
14407 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14410 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14413 err = alc861vd_auto_create_extra_out(spec,
14414 spec->autocfg.speaker_pins[0],
14418 err = alc861vd_auto_create_extra_out(spec,
14419 spec->autocfg.hp_pins[0],
14423 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14427 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14429 if (spec->autocfg.dig_out_pin)
14430 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14432 if (spec->kctls.list)
14433 add_mixer(spec, spec->kctls.list);
14435 add_verb(spec, alc861vd_volume_init_verbs);
14437 spec->num_mux_defs = 1;
14438 spec->input_mux = &spec->private_imux;
14440 err = alc_auto_add_mic_boost(codec);
14444 store_pin_configs(codec);
14448 /* additional initialization for auto-configuration model */
14449 static void alc861vd_auto_init(struct hda_codec *codec)
14451 struct alc_spec *spec = codec->spec;
14452 alc861vd_auto_init_multi_out(codec);
14453 alc861vd_auto_init_hp_out(codec);
14454 alc861vd_auto_init_analog_input(codec);
14455 alc861vd_auto_init_input_src(codec);
14456 if (spec->unsol_event)
14457 alc_inithook(codec);
14460 static int patch_alc861vd(struct hda_codec *codec)
14462 struct alc_spec *spec;
14463 int err, board_config;
14465 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14469 codec->spec = spec;
14471 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14475 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14476 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14477 "ALC861VD, trying auto-probe from BIOS...\n");
14478 board_config = ALC861VD_AUTO;
14481 if (board_config == ALC861VD_AUTO) {
14482 /* automatic parse from the BIOS config */
14483 err = alc861vd_parse_auto_config(codec);
14489 "hda_codec: Cannot set up configuration "
14490 "from BIOS. Using base mode...\n");
14491 board_config = ALC861VD_3ST;
14495 if (board_config != ALC861VD_AUTO)
14496 setup_preset(spec, &alc861vd_presets[board_config]);
14498 if (codec->vendor_id == 0x10ec0660) {
14499 spec->stream_name_analog = "ALC660-VD Analog";
14500 spec->stream_name_digital = "ALC660-VD Digital";
14501 /* always turn on EAPD */
14502 add_verb(spec, alc660vd_eapd_verbs);
14504 spec->stream_name_analog = "ALC861VD Analog";
14505 spec->stream_name_digital = "ALC861VD Digital";
14508 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14509 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14511 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14512 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14514 spec->adc_nids = alc861vd_adc_nids;
14515 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14516 spec->capsrc_nids = alc861vd_capsrc_nids;
14517 spec->is_mix_capture = 1;
14519 add_mixer(spec, alc861vd_capture_mixer);
14521 spec->vmaster_nid = 0x02;
14523 codec->patch_ops = alc_patch_ops;
14525 if (board_config == ALC861VD_AUTO)
14526 spec->init_hook = alc861vd_auto_init;
14527 #ifdef CONFIG_SND_HDA_POWER_SAVE
14528 if (!spec->loopback.amplist)
14529 spec->loopback.amplist = alc861vd_loopbacks;
14538 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14539 * configuration. Each pin widget can choose any input DACs and a mixer.
14540 * Each ADC is connected from a mixer of all inputs. This makes possible
14541 * 6-channel independent captures.
14543 * In addition, an independent DAC for the multi-playback (not used in this
14546 #define ALC662_DIGOUT_NID 0x06
14547 #define ALC662_DIGIN_NID 0x0a
14549 static hda_nid_t alc662_dac_nids[4] = {
14550 /* front, rear, clfe, rear_surr */
14554 static hda_nid_t alc662_adc_nids[1] = {
14559 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14562 /* FIXME: should be a matrix-type input source selection */
14563 static struct hda_input_mux alc662_capture_source = {
14567 { "Front Mic", 0x1 },
14573 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14581 static struct hda_input_mux alc662_eeepc_capture_source = {
14589 static struct hda_input_mux alc663_capture_source = {
14593 { "Front Mic", 0x1 },
14598 static struct hda_input_mux alc663_m51va_capture_source = {
14601 { "Ext-Mic", 0x0 },
14609 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14616 static struct hda_verb alc662_3ST_ch2_init[] = {
14617 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14618 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14619 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14620 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14627 static struct hda_verb alc662_3ST_ch6_init[] = {
14628 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14629 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14630 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14631 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14632 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14633 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14637 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14638 { 2, alc662_3ST_ch2_init },
14639 { 6, alc662_3ST_ch6_init },
14645 static struct hda_verb alc662_sixstack_ch6_init[] = {
14646 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14647 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14648 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14655 static struct hda_verb alc662_sixstack_ch8_init[] = {
14656 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14657 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14658 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14662 static struct hda_channel_mode alc662_5stack_modes[2] = {
14663 { 2, alc662_sixstack_ch6_init },
14664 { 6, alc662_sixstack_ch8_init },
14667 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14668 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14671 static struct snd_kcontrol_new alc662_base_mixer[] = {
14672 /* output mixer control */
14673 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14674 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14675 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14676 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14677 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14678 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14679 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14680 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14683 /*Input mixer control */
14684 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14685 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14686 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14687 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14688 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14689 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14690 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14691 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14695 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14696 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14697 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14698 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14699 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14700 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14701 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14702 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14704 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14705 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14706 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14707 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14708 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14712 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14713 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14714 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14715 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14716 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14717 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14718 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14719 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14720 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14722 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14723 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14724 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14725 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14726 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14727 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14728 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14729 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14730 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14731 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14735 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
14736 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14737 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
14738 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14739 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
14740 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14741 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14742 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14748 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
14749 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14751 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14752 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14754 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
14755 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14756 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14758 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
14759 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14760 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14764 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
14765 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14766 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14767 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14768 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
14769 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14770 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14771 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
14772 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
14773 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14774 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
14775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14776 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14782 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14783 .ops = &snd_hda_bind_vol,
14785 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14786 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14791 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14792 .ops = &snd_hda_bind_sw,
14794 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14795 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14800 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14801 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14802 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14808 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14809 .ops = &snd_hda_bind_sw,
14811 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14812 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14813 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14818 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14819 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14820 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14822 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14823 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14824 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14829 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14830 .ops = &snd_hda_bind_sw,
14832 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14833 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14834 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14839 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14840 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14841 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14844 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14845 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14849 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
14850 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14851 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14852 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14853 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14855 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14856 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14860 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14861 .ops = &snd_hda_bind_vol,
14863 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14864 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14869 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14870 .ops = &snd_hda_bind_sw,
14872 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14873 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14878 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14879 HDA_BIND_VOL("Master Playback Volume",
14880 &alc663_asus_two_bind_master_vol),
14881 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14882 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14883 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14884 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14885 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14889 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14890 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14891 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14892 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14893 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14899 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
14900 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14901 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14902 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14903 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14904 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14908 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14909 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14913 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
14914 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14915 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14916 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14918 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14920 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14921 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14922 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14923 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14927 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
14929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14930 .name = "Channel Mode",
14931 .info = alc_ch_mode_info,
14932 .get = alc_ch_mode_get,
14933 .put = alc_ch_mode_put,
14938 static struct hda_verb alc662_init_verbs[] = {
14939 /* ADC: mute amp left and right */
14940 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14941 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14942 /* Front mixer: unmute input/output amp left and right (volume = 0) */
14944 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14946 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14954 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14957 /* Front Pin: output 0 (0x0c) */
14958 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14959 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14961 /* Rear Pin: output 1 (0x0d) */
14962 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14963 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14965 /* CLFE Pin: output 2 (0x0e) */
14966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14967 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14969 /* Mic (rear) pin: input vref at 80% */
14970 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14971 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14972 /* Front Mic pin: input vref at 80% */
14973 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14975 /* Line In pin: input */
14976 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14977 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14978 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14979 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14980 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14981 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14982 /* CD pin widget for input */
14983 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14985 /* FIXME: use matrix-type input source selection */
14986 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14989 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14990 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14991 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14994 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14995 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14996 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14998 /* always trun on EAPD */
14999 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15000 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15005 static struct hda_verb alc662_sue_init_verbs[] = {
15006 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15007 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15011 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15012 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15013 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15017 /* Set Unsolicited Event*/
15018 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15019 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15020 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15025 * generic initialization of ADC, input mixers and output mixers
15027 static struct hda_verb alc662_auto_init_verbs[] = {
15029 * Unmute ADC and set the default input to mic-in
15031 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15032 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15034 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15036 * Note: PASD motherboards uses the Line In 2 as the input for front
15037 * panel mic (mic 2)
15039 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15047 * Set up output mixers (0x0c - 0x0f)
15049 /* set vol=0 to output mixers */
15050 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15051 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15052 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15054 /* set up input amps for analog loopback */
15055 /* Amp Indices: DAC = 0, mixer = 1 */
15056 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15058 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15059 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15061 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15064 /* FIXME: use matrix-type input source selection */
15065 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15068 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15072 /* additional verbs for ALC663 */
15073 static struct hda_verb alc663_auto_init_verbs[] = {
15074 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15075 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15079 static struct hda_verb alc663_m51va_init_verbs[] = {
15080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15081 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15082 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15083 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15084 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15087 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15088 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15092 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15093 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15094 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15095 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15098 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15099 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15103 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15104 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15105 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15106 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15107 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15110 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15111 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15115 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15118 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15121 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15122 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15126 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15127 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15128 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15129 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15130 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15131 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15132 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15133 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15136 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15137 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15138 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15142 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15143 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15144 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15145 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15146 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15147 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15148 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15149 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15152 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15153 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15154 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15158 static struct hda_verb alc663_g71v_init_verbs[] = {
15159 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15160 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15161 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15163 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15164 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15165 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15167 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15168 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15169 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15173 static struct hda_verb alc663_g50v_init_verbs[] = {
15174 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15175 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15176 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15178 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15179 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15183 static struct hda_verb alc662_ecs_init_verbs[] = {
15184 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15186 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15187 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15191 /* capture mixer elements */
15192 static struct snd_kcontrol_new alc662_capture_mixer[] = {
15193 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15194 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15196 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15197 /* The multiple "Capture Source" controls confuse alsamixer
15198 * So call somewhat different..
15200 /* .name = "Capture Source", */
15201 .name = "Input Source",
15203 .info = alc_mux_enum_info,
15204 .get = alc_mux_enum_get,
15205 .put = alc_mux_enum_put,
15210 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15211 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15212 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15216 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15218 unsigned int present;
15219 unsigned char bits;
15221 present = snd_hda_codec_read(codec, 0x14, 0,
15222 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15223 bits = present ? HDA_AMP_MUTE : 0;
15224 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15225 HDA_AMP_MUTE, bits);
15228 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15230 unsigned int present;
15231 unsigned char bits;
15233 present = snd_hda_codec_read(codec, 0x1b, 0,
15234 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15235 bits = present ? HDA_AMP_MUTE : 0;
15236 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15237 HDA_AMP_MUTE, bits);
15238 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15239 HDA_AMP_MUTE, bits);
15242 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15245 if ((res >> 26) == ALC880_HP_EVENT)
15246 alc662_lenovo_101e_all_automute(codec);
15247 if ((res >> 26) == ALC880_FRONT_EVENT)
15248 alc662_lenovo_101e_ispeaker_automute(codec);
15251 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15253 unsigned int present;
15255 present = snd_hda_codec_read(codec, 0x18, 0,
15256 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15257 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15258 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15259 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15260 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15261 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15262 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15263 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15264 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15267 /* unsolicited event for HP jack sensing */
15268 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15271 if ((res >> 26) == ALC880_HP_EVENT)
15272 alc262_hippo1_automute( codec );
15274 if ((res >> 26) == ALC880_MIC_EVENT)
15275 alc662_eeepc_mic_automute(codec);
15278 static void alc662_eeepc_inithook(struct hda_codec *codec)
15280 alc262_hippo1_automute( codec );
15281 alc662_eeepc_mic_automute(codec);
15284 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15287 unsigned int present;
15289 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15290 present = snd_hda_codec_read(codec, 0x14, 0,
15291 AC_VERB_GET_PIN_SENSE, 0);
15292 present = (present & 0x80000000) != 0;
15294 /* mute internal speaker */
15295 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15296 HDA_AMP_MUTE, HDA_AMP_MUTE);
15298 /* unmute internal speaker if necessary */
15299 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15300 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15301 HDA_AMP_MUTE, mute);
15305 /* unsolicited event for HP jack sensing */
15306 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15309 if ((res >> 26) == ALC880_HP_EVENT)
15310 alc662_eeepc_ep20_automute(codec);
15313 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15315 alc662_eeepc_ep20_automute(codec);
15318 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15320 unsigned int present;
15321 unsigned char bits;
15323 present = snd_hda_codec_read(codec, 0x21, 0,
15324 AC_VERB_GET_PIN_SENSE, 0)
15325 & AC_PINSENSE_PRESENCE;
15326 bits = present ? HDA_AMP_MUTE : 0;
15327 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15328 AMP_IN_MUTE(0), bits);
15329 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15330 AMP_IN_MUTE(0), bits);
15333 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15335 unsigned int present;
15336 unsigned char bits;
15338 present = snd_hda_codec_read(codec, 0x21, 0,
15339 AC_VERB_GET_PIN_SENSE, 0)
15340 & AC_PINSENSE_PRESENCE;
15341 bits = present ? HDA_AMP_MUTE : 0;
15342 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15343 AMP_IN_MUTE(0), bits);
15344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15345 AMP_IN_MUTE(0), bits);
15346 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15347 AMP_IN_MUTE(0), bits);
15348 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15349 AMP_IN_MUTE(0), bits);
15352 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15354 unsigned int present;
15355 unsigned char bits;
15357 present = snd_hda_codec_read(codec, 0x15, 0,
15358 AC_VERB_GET_PIN_SENSE, 0)
15359 & AC_PINSENSE_PRESENCE;
15360 bits = present ? HDA_AMP_MUTE : 0;
15361 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15362 AMP_IN_MUTE(0), bits);
15363 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15364 AMP_IN_MUTE(0), bits);
15365 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15366 AMP_IN_MUTE(0), bits);
15367 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15368 AMP_IN_MUTE(0), bits);
15371 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15373 unsigned int present;
15374 unsigned char bits;
15376 present = snd_hda_codec_read(codec, 0x1b, 0,
15377 AC_VERB_GET_PIN_SENSE, 0)
15378 & AC_PINSENSE_PRESENCE;
15379 bits = present ? 0 : PIN_OUT;
15380 snd_hda_codec_write(codec, 0x14, 0,
15381 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15384 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15386 unsigned int present1, present2;
15388 present1 = snd_hda_codec_read(codec, 0x21, 0,
15389 AC_VERB_GET_PIN_SENSE, 0)
15390 & AC_PINSENSE_PRESENCE;
15391 present2 = snd_hda_codec_read(codec, 0x15, 0,
15392 AC_VERB_GET_PIN_SENSE, 0)
15393 & AC_PINSENSE_PRESENCE;
15395 if (present1 || present2) {
15396 snd_hda_codec_write_cache(codec, 0x14, 0,
15397 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15399 snd_hda_codec_write_cache(codec, 0x14, 0,
15400 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15404 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15406 unsigned int present1, present2;
15408 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15409 AC_VERB_GET_PIN_SENSE, 0)
15410 & AC_PINSENSE_PRESENCE;
15411 present2 = snd_hda_codec_read(codec, 0x15, 0,
15412 AC_VERB_GET_PIN_SENSE, 0)
15413 & AC_PINSENSE_PRESENCE;
15415 if (present1 || present2) {
15416 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15417 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15418 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15419 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15421 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15422 AMP_IN_MUTE(0), 0);
15423 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15424 AMP_IN_MUTE(0), 0);
15428 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15430 unsigned int present;
15432 present = snd_hda_codec_read(codec, 0x18, 0,
15433 AC_VERB_GET_PIN_SENSE, 0)
15434 & AC_PINSENSE_PRESENCE;
15435 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15436 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15437 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15438 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15439 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15440 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15441 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15442 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15445 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15448 switch (res >> 26) {
15449 case ALC880_HP_EVENT:
15450 alc663_m51va_speaker_automute(codec);
15452 case ALC880_MIC_EVENT:
15453 alc663_m51va_mic_automute(codec);
15458 static void alc663_m51va_inithook(struct hda_codec *codec)
15460 alc663_m51va_speaker_automute(codec);
15461 alc663_m51va_mic_automute(codec);
15464 /* ***************** Mode1 ******************************/
15465 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15468 switch (res >> 26) {
15469 case ALC880_HP_EVENT:
15470 alc663_m51va_speaker_automute(codec);
15472 case ALC880_MIC_EVENT:
15473 alc662_eeepc_mic_automute(codec);
15478 static void alc663_mode1_inithook(struct hda_codec *codec)
15480 alc663_m51va_speaker_automute(codec);
15481 alc662_eeepc_mic_automute(codec);
15483 /* ***************** Mode2 ******************************/
15484 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15487 switch (res >> 26) {
15488 case ALC880_HP_EVENT:
15489 alc662_f5z_speaker_automute(codec);
15491 case ALC880_MIC_EVENT:
15492 alc662_eeepc_mic_automute(codec);
15497 static void alc662_mode2_inithook(struct hda_codec *codec)
15499 alc662_f5z_speaker_automute(codec);
15500 alc662_eeepc_mic_automute(codec);
15502 /* ***************** Mode3 ******************************/
15503 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15506 switch (res >> 26) {
15507 case ALC880_HP_EVENT:
15508 alc663_two_hp_m1_speaker_automute(codec);
15510 case ALC880_MIC_EVENT:
15511 alc662_eeepc_mic_automute(codec);
15516 static void alc663_mode3_inithook(struct hda_codec *codec)
15518 alc663_two_hp_m1_speaker_automute(codec);
15519 alc662_eeepc_mic_automute(codec);
15521 /* ***************** Mode4 ******************************/
15522 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15525 switch (res >> 26) {
15526 case ALC880_HP_EVENT:
15527 alc663_21jd_two_speaker_automute(codec);
15529 case ALC880_MIC_EVENT:
15530 alc662_eeepc_mic_automute(codec);
15535 static void alc663_mode4_inithook(struct hda_codec *codec)
15537 alc663_21jd_two_speaker_automute(codec);
15538 alc662_eeepc_mic_automute(codec);
15540 /* ***************** Mode5 ******************************/
15541 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15544 switch (res >> 26) {
15545 case ALC880_HP_EVENT:
15546 alc663_15jd_two_speaker_automute(codec);
15548 case ALC880_MIC_EVENT:
15549 alc662_eeepc_mic_automute(codec);
15554 static void alc663_mode5_inithook(struct hda_codec *codec)
15556 alc663_15jd_two_speaker_automute(codec);
15557 alc662_eeepc_mic_automute(codec);
15559 /* ***************** Mode6 ******************************/
15560 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15563 switch (res >> 26) {
15564 case ALC880_HP_EVENT:
15565 alc663_two_hp_m2_speaker_automute(codec);
15567 case ALC880_MIC_EVENT:
15568 alc662_eeepc_mic_automute(codec);
15573 static void alc663_mode6_inithook(struct hda_codec *codec)
15575 alc663_two_hp_m2_speaker_automute(codec);
15576 alc662_eeepc_mic_automute(codec);
15579 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15581 unsigned int present;
15582 unsigned char bits;
15584 present = snd_hda_codec_read(codec, 0x21, 0,
15585 AC_VERB_GET_PIN_SENSE, 0)
15586 & AC_PINSENSE_PRESENCE;
15587 bits = present ? HDA_AMP_MUTE : 0;
15588 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15589 HDA_AMP_MUTE, bits);
15590 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15591 HDA_AMP_MUTE, bits);
15594 static void alc663_g71v_front_automute(struct hda_codec *codec)
15596 unsigned int present;
15597 unsigned char bits;
15599 present = snd_hda_codec_read(codec, 0x15, 0,
15600 AC_VERB_GET_PIN_SENSE, 0)
15601 & AC_PINSENSE_PRESENCE;
15602 bits = present ? HDA_AMP_MUTE : 0;
15603 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15604 HDA_AMP_MUTE, bits);
15607 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15610 switch (res >> 26) {
15611 case ALC880_HP_EVENT:
15612 alc663_g71v_hp_automute(codec);
15614 case ALC880_FRONT_EVENT:
15615 alc663_g71v_front_automute(codec);
15617 case ALC880_MIC_EVENT:
15618 alc662_eeepc_mic_automute(codec);
15623 static void alc663_g71v_inithook(struct hda_codec *codec)
15625 alc663_g71v_front_automute(codec);
15626 alc663_g71v_hp_automute(codec);
15627 alc662_eeepc_mic_automute(codec);
15630 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15633 switch (res >> 26) {
15634 case ALC880_HP_EVENT:
15635 alc663_m51va_speaker_automute(codec);
15637 case ALC880_MIC_EVENT:
15638 alc662_eeepc_mic_automute(codec);
15643 static void alc663_g50v_inithook(struct hda_codec *codec)
15645 alc663_m51va_speaker_automute(codec);
15646 alc662_eeepc_mic_automute(codec);
15649 /* bind hp and internal speaker mute (with plug check) */
15650 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15651 struct snd_ctl_elem_value *ucontrol)
15653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15654 long *valp = ucontrol->value.integer.value;
15657 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15659 valp[0] ? 0 : HDA_AMP_MUTE);
15660 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15662 valp[1] ? 0 : HDA_AMP_MUTE);
15664 alc262_hippo1_automute(codec);
15668 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15669 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15671 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15672 .name = "Master Playback Switch",
15673 .info = snd_hda_mixer_amp_switch_info,
15674 .get = snd_hda_mixer_amp_switch_get,
15675 .put = alc662_ecs_master_sw_put,
15676 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15679 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15680 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15681 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15683 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15684 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15685 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15689 #ifdef CONFIG_SND_HDA_POWER_SAVE
15690 #define alc662_loopbacks alc880_loopbacks
15694 /* pcm configuration: identiacal with ALC880 */
15695 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15696 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15697 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15698 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15701 * configuration and preset
15703 static const char *alc662_models[ALC662_MODEL_LAST] = {
15704 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15705 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15706 [ALC662_3ST_6ch] = "3stack-6ch",
15707 [ALC662_5ST_DIG] = "6stack-dig",
15708 [ALC662_LENOVO_101E] = "lenovo-101e",
15709 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15710 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15711 [ALC662_ECS] = "ecs",
15712 [ALC663_ASUS_M51VA] = "m51va",
15713 [ALC663_ASUS_G71V] = "g71v",
15714 [ALC663_ASUS_H13] = "h13",
15715 [ALC663_ASUS_G50V] = "g50v",
15716 [ALC663_ASUS_MODE1] = "asus-mode1",
15717 [ALC662_ASUS_MODE2] = "asus-mode2",
15718 [ALC663_ASUS_MODE3] = "asus-mode3",
15719 [ALC663_ASUS_MODE4] = "asus-mode4",
15720 [ALC663_ASUS_MODE5] = "asus-mode5",
15721 [ALC663_ASUS_MODE6] = "asus-mode6",
15722 [ALC662_AUTO] = "auto",
15725 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15726 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15727 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15728 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15729 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15730 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15731 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15732 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15733 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15734 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15735 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15736 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15737 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15738 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15739 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15740 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15741 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15742 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15743 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15744 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15745 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15746 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15747 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15748 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15749 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15750 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15751 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15752 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15753 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15754 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15755 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15756 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15757 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15758 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15759 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15760 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15761 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15762 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15763 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15764 ALC662_3ST_6ch_DIG),
15765 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15766 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15767 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15768 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15769 ALC662_3ST_6ch_DIG),
15770 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15771 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15772 ALC662_3ST_6ch_DIG),
15773 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15774 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15775 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
15779 static struct alc_config_preset alc662_presets[] = {
15780 [ALC662_3ST_2ch_DIG] = {
15781 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
15782 .init_verbs = { alc662_init_verbs },
15783 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15784 .dac_nids = alc662_dac_nids,
15785 .dig_out_nid = ALC662_DIGOUT_NID,
15786 .dig_in_nid = ALC662_DIGIN_NID,
15787 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15788 .channel_mode = alc662_3ST_2ch_modes,
15789 .input_mux = &alc662_capture_source,
15791 [ALC662_3ST_6ch_DIG] = {
15792 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
15793 alc662_capture_mixer },
15794 .init_verbs = { alc662_init_verbs },
15795 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15796 .dac_nids = alc662_dac_nids,
15797 .dig_out_nid = ALC662_DIGOUT_NID,
15798 .dig_in_nid = ALC662_DIGIN_NID,
15799 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15800 .channel_mode = alc662_3ST_6ch_modes,
15802 .input_mux = &alc662_capture_source,
15804 [ALC662_3ST_6ch] = {
15805 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
15806 alc662_capture_mixer },
15807 .init_verbs = { alc662_init_verbs },
15808 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15809 .dac_nids = alc662_dac_nids,
15810 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15811 .channel_mode = alc662_3ST_6ch_modes,
15813 .input_mux = &alc662_capture_source,
15815 [ALC662_5ST_DIG] = {
15816 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
15817 alc662_capture_mixer },
15818 .init_verbs = { alc662_init_verbs },
15819 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15820 .dac_nids = alc662_dac_nids,
15821 .dig_out_nid = ALC662_DIGOUT_NID,
15822 .dig_in_nid = ALC662_DIGIN_NID,
15823 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
15824 .channel_mode = alc662_5stack_modes,
15825 .input_mux = &alc662_capture_source,
15827 [ALC662_LENOVO_101E] = {
15828 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
15829 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
15830 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15831 .dac_nids = alc662_dac_nids,
15832 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15833 .channel_mode = alc662_3ST_2ch_modes,
15834 .input_mux = &alc662_lenovo_101e_capture_source,
15835 .unsol_event = alc662_lenovo_101e_unsol_event,
15836 .init_hook = alc662_lenovo_101e_all_automute,
15838 [ALC662_ASUS_EEEPC_P701] = {
15839 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
15840 .init_verbs = { alc662_init_verbs,
15841 alc662_eeepc_sue_init_verbs },
15842 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15843 .dac_nids = alc662_dac_nids,
15844 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15845 .channel_mode = alc662_3ST_2ch_modes,
15846 .input_mux = &alc662_eeepc_capture_source,
15847 .unsol_event = alc662_eeepc_unsol_event,
15848 .init_hook = alc662_eeepc_inithook,
15850 [ALC662_ASUS_EEEPC_EP20] = {
15851 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
15852 alc662_chmode_mixer },
15853 .init_verbs = { alc662_init_verbs,
15854 alc662_eeepc_ep20_sue_init_verbs },
15855 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15856 .dac_nids = alc662_dac_nids,
15857 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15858 .channel_mode = alc662_3ST_6ch_modes,
15859 .input_mux = &alc662_lenovo_101e_capture_source,
15860 .unsol_event = alc662_eeepc_ep20_unsol_event,
15861 .init_hook = alc662_eeepc_ep20_inithook,
15864 .mixers = { alc662_ecs_mixer, alc662_capture_mixer },
15865 .init_verbs = { alc662_init_verbs,
15866 alc662_ecs_init_verbs },
15867 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15868 .dac_nids = alc662_dac_nids,
15869 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15870 .channel_mode = alc662_3ST_2ch_modes,
15871 .input_mux = &alc662_eeepc_capture_source,
15872 .unsol_event = alc662_eeepc_unsol_event,
15873 .init_hook = alc662_eeepc_inithook,
15875 [ALC663_ASUS_M51VA] = {
15876 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15877 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15878 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15879 .dac_nids = alc662_dac_nids,
15880 .dig_out_nid = ALC662_DIGOUT_NID,
15881 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15882 .channel_mode = alc662_3ST_2ch_modes,
15883 .input_mux = &alc663_m51va_capture_source,
15884 .unsol_event = alc663_m51va_unsol_event,
15885 .init_hook = alc663_m51va_inithook,
15887 [ALC663_ASUS_G71V] = {
15888 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
15889 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
15890 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15891 .dac_nids = alc662_dac_nids,
15892 .dig_out_nid = ALC662_DIGOUT_NID,
15893 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15894 .channel_mode = alc662_3ST_2ch_modes,
15895 .input_mux = &alc662_eeepc_capture_source,
15896 .unsol_event = alc663_g71v_unsol_event,
15897 .init_hook = alc663_g71v_inithook,
15899 [ALC663_ASUS_H13] = {
15900 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
15901 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15902 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15903 .dac_nids = alc662_dac_nids,
15904 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15905 .channel_mode = alc662_3ST_2ch_modes,
15906 .input_mux = &alc663_m51va_capture_source,
15907 .unsol_event = alc663_m51va_unsol_event,
15908 .init_hook = alc663_m51va_inithook,
15910 [ALC663_ASUS_G50V] = {
15911 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
15912 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
15913 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15914 .dac_nids = alc662_dac_nids,
15915 .dig_out_nid = ALC662_DIGOUT_NID,
15916 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15917 .channel_mode = alc662_3ST_6ch_modes,
15918 .input_mux = &alc663_capture_source,
15919 .unsol_event = alc663_g50v_unsol_event,
15920 .init_hook = alc663_g50v_inithook,
15922 [ALC663_ASUS_MODE1] = {
15923 .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer },
15924 .init_verbs = { alc662_init_verbs,
15925 alc663_21jd_amic_init_verbs },
15926 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15928 .dac_nids = alc662_dac_nids,
15929 .dig_out_nid = ALC662_DIGOUT_NID,
15930 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15931 .channel_mode = alc662_3ST_2ch_modes,
15932 .input_mux = &alc662_eeepc_capture_source,
15933 .unsol_event = alc663_mode1_unsol_event,
15934 .init_hook = alc663_mode1_inithook,
15936 [ALC662_ASUS_MODE2] = {
15937 .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer },
15938 .init_verbs = { alc662_init_verbs,
15939 alc662_1bjd_amic_init_verbs },
15940 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15941 .dac_nids = alc662_dac_nids,
15942 .dig_out_nid = ALC662_DIGOUT_NID,
15943 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15944 .channel_mode = alc662_3ST_2ch_modes,
15945 .input_mux = &alc662_eeepc_capture_source,
15946 .unsol_event = alc662_mode2_unsol_event,
15947 .init_hook = alc662_mode2_inithook,
15949 [ALC663_ASUS_MODE3] = {
15950 .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer },
15951 .init_verbs = { alc662_init_verbs,
15952 alc663_two_hp_amic_m1_init_verbs },
15953 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15955 .dac_nids = alc662_dac_nids,
15956 .dig_out_nid = ALC662_DIGOUT_NID,
15957 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15958 .channel_mode = alc662_3ST_2ch_modes,
15959 .input_mux = &alc662_eeepc_capture_source,
15960 .unsol_event = alc663_mode3_unsol_event,
15961 .init_hook = alc663_mode3_inithook,
15963 [ALC663_ASUS_MODE4] = {
15964 .mixers = { alc663_asus_21jd_clfe_mixer,
15965 alc662_auto_capture_mixer},
15966 .init_verbs = { alc662_init_verbs,
15967 alc663_21jd_amic_init_verbs},
15968 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15970 .dac_nids = alc662_dac_nids,
15971 .dig_out_nid = ALC662_DIGOUT_NID,
15972 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15973 .channel_mode = alc662_3ST_2ch_modes,
15974 .input_mux = &alc662_eeepc_capture_source,
15975 .unsol_event = alc663_mode4_unsol_event,
15976 .init_hook = alc663_mode4_inithook,
15978 [ALC663_ASUS_MODE5] = {
15979 .mixers = { alc663_asus_15jd_clfe_mixer,
15980 alc662_auto_capture_mixer },
15981 .init_verbs = { alc662_init_verbs,
15982 alc663_15jd_amic_init_verbs },
15983 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15985 .dac_nids = alc662_dac_nids,
15986 .dig_out_nid = ALC662_DIGOUT_NID,
15987 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15988 .channel_mode = alc662_3ST_2ch_modes,
15989 .input_mux = &alc662_eeepc_capture_source,
15990 .unsol_event = alc663_mode5_unsol_event,
15991 .init_hook = alc663_mode5_inithook,
15993 [ALC663_ASUS_MODE6] = {
15994 .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer },
15995 .init_verbs = { alc662_init_verbs,
15996 alc663_two_hp_amic_m2_init_verbs },
15997 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15999 .dac_nids = alc662_dac_nids,
16000 .dig_out_nid = ALC662_DIGOUT_NID,
16001 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16002 .channel_mode = alc662_3ST_2ch_modes,
16003 .input_mux = &alc662_eeepc_capture_source,
16004 .unsol_event = alc663_mode6_unsol_event,
16005 .init_hook = alc663_mode6_inithook,
16011 * BIOS auto configuration
16014 /* add playback controls from the parsed DAC table */
16015 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16016 const struct auto_pin_cfg *cfg)
16019 static const char *chname[4] = {
16020 "Front", "Surround", NULL /*CLFE*/, "Side"
16025 for (i = 0; i < cfg->line_outs; i++) {
16026 if (!spec->multiout.dac_nids[i])
16028 nid = alc880_idx_to_dac(i);
16031 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16032 "Center Playback Volume",
16033 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16037 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16038 "LFE Playback Volume",
16039 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16043 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16044 "Center Playback Switch",
16045 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16049 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16050 "LFE Playback Switch",
16051 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16056 sprintf(name, "%s Playback Volume", chname[i]);
16057 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16058 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16062 sprintf(name, "%s Playback Switch", chname[i]);
16063 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16064 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16073 /* add playback controls for speaker and HP outputs */
16074 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16085 /* ALC663 has a mono output pin on 0x17 */
16086 sprintf(name, "%s Playback Switch", pfx);
16087 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16088 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16092 if (alc880_is_fixed_pin(pin)) {
16093 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16094 /* printk("DAC nid=%x\n",nid); */
16095 /* specify the DAC as the extra output */
16096 if (!spec->multiout.hp_nid)
16097 spec->multiout.hp_nid = nid;
16099 spec->multiout.extra_out_nid[0] = nid;
16100 /* control HP volume/switch on the output mixer amp */
16101 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16102 sprintf(name, "%s Playback Volume", pfx);
16103 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16104 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16107 sprintf(name, "%s Playback Switch", pfx);
16108 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16109 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16112 } else if (alc880_is_multi_pin(pin)) {
16113 /* set manual connection */
16114 /* we have only a switch on HP-out PIN */
16115 sprintf(name, "%s Playback Switch", pfx);
16116 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16117 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16124 /* create playback/capture controls for input pins */
16125 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16126 const struct auto_pin_cfg *cfg)
16128 struct hda_input_mux *imux = &spec->private_imux;
16131 for (i = 0; i < AUTO_PIN_LAST; i++) {
16132 if (alc880_is_input_pin(cfg->input_pins[i])) {
16133 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16134 err = new_analog_input(spec, cfg->input_pins[i],
16135 auto_pin_cfg_labels[i],
16139 imux->items[imux->num_items].label =
16140 auto_pin_cfg_labels[i];
16141 imux->items[imux->num_items].index =
16142 alc880_input_pin_idx(cfg->input_pins[i]);
16149 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16150 hda_nid_t nid, int pin_type,
16153 alc_set_pin_output(codec, nid, pin_type);
16154 /* need the manual connection? */
16155 if (alc880_is_multi_pin(nid)) {
16156 struct alc_spec *spec = codec->spec;
16157 int idx = alc880_multi_pin_idx(nid);
16158 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16159 AC_VERB_SET_CONNECT_SEL,
16160 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16164 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16166 struct alc_spec *spec = codec->spec;
16169 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16170 for (i = 0; i <= HDA_SIDE; i++) {
16171 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16172 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16174 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16179 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16181 struct alc_spec *spec = codec->spec;
16184 pin = spec->autocfg.hp_pins[0];
16185 if (pin) /* connect to front */
16187 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16188 pin = spec->autocfg.speaker_pins[0];
16190 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16193 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16194 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16196 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16198 struct alc_spec *spec = codec->spec;
16201 for (i = 0; i < AUTO_PIN_LAST; i++) {
16202 hda_nid_t nid = spec->autocfg.input_pins[i];
16203 if (alc662_is_input_pin(nid)) {
16204 snd_hda_codec_write(codec, nid, 0,
16205 AC_VERB_SET_PIN_WIDGET_CONTROL,
16206 (i <= AUTO_PIN_FRONT_MIC ?
16207 PIN_VREF80 : PIN_IN));
16208 if (nid != ALC662_PIN_CD_NID)
16209 snd_hda_codec_write(codec, nid, 0,
16210 AC_VERB_SET_AMP_GAIN_MUTE,
16216 #define alc662_auto_init_input_src alc882_auto_init_input_src
16218 static int alc662_parse_auto_config(struct hda_codec *codec)
16220 struct alc_spec *spec = codec->spec;
16222 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16224 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16228 if (!spec->autocfg.line_outs)
16229 return 0; /* can't find valid BIOS pin config */
16231 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16234 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16237 err = alc662_auto_create_extra_out(spec,
16238 spec->autocfg.speaker_pins[0],
16242 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16246 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16250 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16252 if (spec->autocfg.dig_out_pin)
16253 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16255 if (spec->kctls.list)
16256 add_mixer(spec, spec->kctls.list);
16258 spec->num_mux_defs = 1;
16259 spec->input_mux = &spec->private_imux;
16261 add_verb(spec, alc662_auto_init_verbs);
16262 if (codec->vendor_id == 0x10ec0663)
16263 add_verb(spec, alc663_auto_init_verbs);
16265 err = alc_auto_add_mic_boost(codec);
16269 add_mixer(spec, alc662_capture_mixer);
16271 store_pin_configs(codec);
16275 /* additional initialization for auto-configuration model */
16276 static void alc662_auto_init(struct hda_codec *codec)
16278 struct alc_spec *spec = codec->spec;
16279 alc662_auto_init_multi_out(codec);
16280 alc662_auto_init_hp_out(codec);
16281 alc662_auto_init_analog_input(codec);
16282 alc662_auto_init_input_src(codec);
16283 if (spec->unsol_event)
16284 alc_inithook(codec);
16287 static int patch_alc662(struct hda_codec *codec)
16289 struct alc_spec *spec;
16290 int err, board_config;
16292 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16296 codec->spec = spec;
16298 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16300 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16303 if (board_config < 0) {
16304 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16305 "trying auto-probe from BIOS...\n");
16306 board_config = ALC662_AUTO;
16309 if (board_config == ALC662_AUTO) {
16310 /* automatic parse from the BIOS config */
16311 err = alc662_parse_auto_config(codec);
16317 "hda_codec: Cannot set up configuration "
16318 "from BIOS. Using base mode...\n");
16319 board_config = ALC662_3ST_2ch_DIG;
16323 if (board_config != ALC662_AUTO)
16324 setup_preset(spec, &alc662_presets[board_config]);
16326 if (codec->vendor_id == 0x10ec0663) {
16327 spec->stream_name_analog = "ALC663 Analog";
16328 spec->stream_name_digital = "ALC663 Digital";
16329 } else if (codec->vendor_id == 0x10ec0272) {
16330 spec->stream_name_analog = "ALC272 Analog";
16331 spec->stream_name_digital = "ALC272 Digital";
16333 spec->stream_name_analog = "ALC662 Analog";
16334 spec->stream_name_digital = "ALC662 Digital";
16337 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16338 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16340 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16341 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16343 spec->adc_nids = alc662_adc_nids;
16344 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16345 spec->capsrc_nids = alc662_capsrc_nids;
16346 spec->is_mix_capture = 1;
16348 spec->vmaster_nid = 0x02;
16350 codec->patch_ops = alc_patch_ops;
16351 if (board_config == ALC662_AUTO)
16352 spec->init_hook = alc662_auto_init;
16353 #ifdef CONFIG_SND_HDA_POWER_SAVE
16354 if (!spec->loopback.amplist)
16355 spec->loopback.amplist = alc662_loopbacks;
16364 struct hda_codec_preset snd_hda_preset_realtek[] = {
16365 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16366 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16367 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16368 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16369 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16370 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16371 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16372 .patch = patch_alc861 },
16373 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16374 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16375 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16376 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16377 .patch = patch_alc883 },
16378 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16379 .patch = patch_alc662 },
16380 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16381 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16382 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16383 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16384 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16385 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16386 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16387 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16388 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16389 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16390 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16391 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16392 .patch = patch_alc883 },
16393 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16394 {} /* terminator */