2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
81 #ifdef CONFIG_SND_DEBUG
85 ALC260_MODEL_LAST /* last tag */
95 ALC262_HP_BPC_D7000_WL,
96 ALC262_HP_BPC_D7000_WF,
108 ALC262_MODEL_LAST /* last tag */
118 ALC268_ACER_ASPIRE_ONE,
121 #ifdef CONFIG_SND_DEBUG
125 ALC268_MODEL_LAST /* last tag */
132 ALC269_ASUS_EEEPC_P703,
133 ALC269_ASUS_EEEPC_P901,
137 ALC269_MODEL_LAST /* last tag */
154 /* ALC861-VD models */
176 ALC662_ASUS_EEEPC_P701,
177 ALC662_ASUS_EEEPC_EP20,
216 ALC883_TARGA_2ch_DIG,
222 ALC883_LENOVO_101E_2ch,
223 ALC883_LENOVO_NB0763,
224 ALC888_LENOVO_MS7195_DIG,
231 ALC883_FUJITSU_PI2515,
232 ALC883_3ST_6ch_INTEL,
240 #define GPIO_MASK 0x03
243 /* codec parameterization */
244 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
245 unsigned int num_mixers;
246 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
248 const struct hda_verb *init_verbs[5]; /* initialization verbs
252 unsigned int num_init_verbs;
254 char *stream_name_analog; /* analog PCM stream */
255 struct hda_pcm_stream *stream_analog_playback;
256 struct hda_pcm_stream *stream_analog_capture;
257 struct hda_pcm_stream *stream_analog_alt_playback;
258 struct hda_pcm_stream *stream_analog_alt_capture;
260 char *stream_name_digital; /* digital PCM stream */
261 struct hda_pcm_stream *stream_digital_playback;
262 struct hda_pcm_stream *stream_digital_capture;
265 struct hda_multi_out multiout; /* playback set-up
266 * max_channels, dacs must be set
267 * dig_out_nid and hp_nid are optional
269 hda_nid_t alt_dac_nid;
272 unsigned int num_adc_nids;
274 hda_nid_t *capsrc_nids;
275 hda_nid_t dig_in_nid; /* digital-in NID; optional */
276 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */
279 unsigned int num_mux_defs;
280 const struct hda_input_mux *input_mux;
281 unsigned int cur_mux[3];
284 const struct hda_channel_mode *channel_mode;
285 int num_channel_mode;
288 /* PCM information */
289 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
291 /* dynamic controls, init_verbs and input_mux */
292 struct auto_pin_cfg autocfg;
293 struct snd_array kctls;
294 struct hda_input_mux private_imux;
295 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
298 void (*init_hook)(struct hda_codec *codec);
299 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
301 /* for pin sensing */
302 unsigned int sense_updated: 1;
303 unsigned int jack_present: 1;
304 unsigned int master_sw: 1;
306 /* for virtual master */
307 hda_nid_t vmaster_nid;
308 #ifdef CONFIG_SND_HDA_POWER_SAVE
309 struct hda_loopback_check loopback;
314 unsigned int pll_coef_idx, pll_coef_bit;
316 #ifdef SND_HDA_NEEDS_RESUME
317 #define ALC_MAX_PINS 16
318 unsigned int num_pins;
319 hda_nid_t pin_nids[ALC_MAX_PINS];
320 unsigned int pin_cfgs[ALC_MAX_PINS];
325 * configuration template - to be copied to the spec instance
327 struct alc_config_preset {
328 struct snd_kcontrol_new *mixers[5]; /* should be identical size
331 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
332 const struct hda_verb *init_verbs[5];
333 unsigned int num_dacs;
335 hda_nid_t dig_out_nid; /* optional */
336 hda_nid_t hp_nid; /* optional */
337 unsigned int num_adc_nids;
339 hda_nid_t *capsrc_nids;
340 hda_nid_t dig_in_nid;
341 unsigned int num_channel_mode;
342 const struct hda_channel_mode *channel_mode;
344 unsigned int num_mux_defs;
345 const struct hda_input_mux *input_mux;
346 void (*unsol_event)(struct hda_codec *, unsigned int);
347 void (*init_hook)(struct hda_codec *);
348 #ifdef CONFIG_SND_HDA_POWER_SAVE
349 struct hda_amp_list *loopbacks;
357 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
358 struct snd_ctl_elem_info *uinfo)
360 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
361 struct alc_spec *spec = codec->spec;
362 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
363 if (mux_idx >= spec->num_mux_defs)
365 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
368 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
369 struct snd_ctl_elem_value *ucontrol)
371 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
372 struct alc_spec *spec = codec->spec;
373 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
375 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
379 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
380 struct snd_ctl_elem_value *ucontrol)
382 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
383 struct alc_spec *spec = codec->spec;
384 const struct hda_input_mux *imux = spec->input_mux;
385 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
386 hda_nid_t nid = spec->capsrc_nids ?
387 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
389 if (spec->is_mix_capture) {
390 /* Matrix-mixer style (e.g. ALC882) */
391 unsigned int *cur_val = &spec->cur_mux[adc_idx];
394 idx = ucontrol->value.enumerated.item[0];
395 if (idx >= imux->num_items)
396 idx = imux->num_items - 1;
399 for (i = 0; i < imux->num_items; i++) {
400 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
401 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
402 imux->items[i].index,
408 /* MUX style (e.g. ALC880) */
409 unsigned int mux_idx;
410 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
411 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx],
413 &spec->cur_mux[adc_idx]);
418 * channel mode setting
420 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_info *uinfo)
423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
424 struct alc_spec *spec = codec->spec;
425 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
426 spec->num_channel_mode);
429 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
430 struct snd_ctl_elem_value *ucontrol)
432 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
433 struct alc_spec *spec = codec->spec;
434 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
435 spec->num_channel_mode,
436 spec->multiout.max_channels);
439 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
440 struct snd_ctl_elem_value *ucontrol)
442 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
443 struct alc_spec *spec = codec->spec;
444 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
445 spec->num_channel_mode,
446 &spec->multiout.max_channels);
447 if (err >= 0 && spec->need_dac_fix)
448 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
453 * Control the mode of pin widget settings via the mixer. "pc" is used
454 * instead of "%" to avoid consequences of accidently treating the % as
455 * being part of a format specifier. Maximum allowed length of a value is
456 * 63 characters plus NULL terminator.
458 * Note: some retasking pin complexes seem to ignore requests for input
459 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
460 * are requested. Therefore order this list so that this behaviour will not
461 * cause problems when mixer clients move through the enum sequentially.
462 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
465 static char *alc_pin_mode_names[] = {
466 "Mic 50pc bias", "Mic 80pc bias",
467 "Line in", "Line out", "Headphone out",
469 static unsigned char alc_pin_mode_values[] = {
470 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
472 /* The control can present all 5 options, or it can limit the options based
473 * in the pin being assumed to be exclusively an input or an output pin. In
474 * addition, "input" pins may or may not process the mic bias option
475 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
476 * accept requests for bias as of chip versions up to March 2006) and/or
477 * wiring in the computer.
479 #define ALC_PIN_DIR_IN 0x00
480 #define ALC_PIN_DIR_OUT 0x01
481 #define ALC_PIN_DIR_INOUT 0x02
482 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
483 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
485 /* Info about the pin modes supported by the different pin direction modes.
486 * For each direction the minimum and maximum values are given.
488 static signed char alc_pin_mode_dir_info[5][2] = {
489 { 0, 2 }, /* ALC_PIN_DIR_IN */
490 { 3, 4 }, /* ALC_PIN_DIR_OUT */
491 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
492 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
493 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
495 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
496 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
497 #define alc_pin_mode_n_items(_dir) \
498 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
500 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
501 struct snd_ctl_elem_info *uinfo)
503 unsigned int item_num = uinfo->value.enumerated.item;
504 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
506 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
508 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
510 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
511 item_num = alc_pin_mode_min(dir);
512 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
516 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
517 struct snd_ctl_elem_value *ucontrol)
520 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
521 hda_nid_t nid = kcontrol->private_value & 0xffff;
522 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
523 long *valp = ucontrol->value.integer.value;
524 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
525 AC_VERB_GET_PIN_WIDGET_CONTROL,
528 /* Find enumerated value for current pinctl setting */
529 i = alc_pin_mode_min(dir);
530 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
532 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
536 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
537 struct snd_ctl_elem_value *ucontrol)
540 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
541 hda_nid_t nid = kcontrol->private_value & 0xffff;
542 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
543 long val = *ucontrol->value.integer.value;
544 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
545 AC_VERB_GET_PIN_WIDGET_CONTROL,
548 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
549 val = alc_pin_mode_min(dir);
551 change = pinctl != alc_pin_mode_values[val];
553 /* Set pin mode to that requested */
554 snd_hda_codec_write_cache(codec, nid, 0,
555 AC_VERB_SET_PIN_WIDGET_CONTROL,
556 alc_pin_mode_values[val]);
558 /* Also enable the retasking pin's input/output as required
559 * for the requested pin mode. Enum values of 2 or less are
562 * Dynamically switching the input/output buffers probably
563 * reduces noise slightly (particularly on input) so we'll
564 * do it. However, having both input and output buffers
565 * enabled simultaneously doesn't seem to be problematic if
566 * this turns out to be necessary in the future.
569 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
570 HDA_AMP_MUTE, HDA_AMP_MUTE);
571 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
574 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
575 HDA_AMP_MUTE, HDA_AMP_MUTE);
576 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
583 #define ALC_PIN_MODE(xname, nid, dir) \
584 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
585 .info = alc_pin_mode_info, \
586 .get = alc_pin_mode_get, \
587 .put = alc_pin_mode_put, \
588 .private_value = nid | (dir<<16) }
590 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
591 * together using a mask with more than one bit set. This control is
592 * currently used only by the ALC260 test model. At this stage they are not
593 * needed for any "production" models.
595 #ifdef CONFIG_SND_DEBUG
596 #define alc_gpio_data_info snd_ctl_boolean_mono_info
598 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
599 struct snd_ctl_elem_value *ucontrol)
601 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
602 hda_nid_t nid = kcontrol->private_value & 0xffff;
603 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
604 long *valp = ucontrol->value.integer.value;
605 unsigned int val = snd_hda_codec_read(codec, nid, 0,
606 AC_VERB_GET_GPIO_DATA, 0x00);
608 *valp = (val & mask) != 0;
611 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
612 struct snd_ctl_elem_value *ucontrol)
615 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
616 hda_nid_t nid = kcontrol->private_value & 0xffff;
617 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
618 long val = *ucontrol->value.integer.value;
619 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
620 AC_VERB_GET_GPIO_DATA,
623 /* Set/unset the masked GPIO bit(s) as needed */
624 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
629 snd_hda_codec_write_cache(codec, nid, 0,
630 AC_VERB_SET_GPIO_DATA, gpio_data);
634 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
635 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
636 .info = alc_gpio_data_info, \
637 .get = alc_gpio_data_get, \
638 .put = alc_gpio_data_put, \
639 .private_value = nid | (mask<<16) }
640 #endif /* CONFIG_SND_DEBUG */
642 /* A switch control to allow the enabling of the digital IO pins on the
643 * ALC260. This is incredibly simplistic; the intention of this control is
644 * to provide something in the test model allowing digital outputs to be
645 * identified if present. If models are found which can utilise these
646 * outputs a more complete mixer control can be devised for those models if
649 #ifdef CONFIG_SND_DEBUG
650 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
652 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
653 struct snd_ctl_elem_value *ucontrol)
655 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
656 hda_nid_t nid = kcontrol->private_value & 0xffff;
657 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
658 long *valp = ucontrol->value.integer.value;
659 unsigned int val = snd_hda_codec_read(codec, nid, 0,
660 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
662 *valp = (val & mask) != 0;
665 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
666 struct snd_ctl_elem_value *ucontrol)
669 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
670 hda_nid_t nid = kcontrol->private_value & 0xffff;
671 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
672 long val = *ucontrol->value.integer.value;
673 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
674 AC_VERB_GET_DIGI_CONVERT_1,
677 /* Set/unset the masked control bit(s) as needed */
678 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
683 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
688 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
689 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
690 .info = alc_spdif_ctrl_info, \
691 .get = alc_spdif_ctrl_get, \
692 .put = alc_spdif_ctrl_put, \
693 .private_value = nid | (mask<<16) }
694 #endif /* CONFIG_SND_DEBUG */
696 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
697 * Again, this is only used in the ALC26x test models to help identify when
698 * the EAPD line must be asserted for features to work.
700 #ifdef CONFIG_SND_DEBUG
701 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
703 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
704 struct snd_ctl_elem_value *ucontrol)
706 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
707 hda_nid_t nid = kcontrol->private_value & 0xffff;
708 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
709 long *valp = ucontrol->value.integer.value;
710 unsigned int val = snd_hda_codec_read(codec, nid, 0,
711 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
713 *valp = (val & mask) != 0;
717 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
718 struct snd_ctl_elem_value *ucontrol)
721 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
722 hda_nid_t nid = kcontrol->private_value & 0xffff;
723 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
724 long val = *ucontrol->value.integer.value;
725 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
726 AC_VERB_GET_EAPD_BTLENABLE,
729 /* Set/unset the masked control bit(s) as needed */
730 change = (!val ? 0 : mask) != (ctrl_data & mask);
735 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
741 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
742 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
743 .info = alc_eapd_ctrl_info, \
744 .get = alc_eapd_ctrl_get, \
745 .put = alc_eapd_ctrl_put, \
746 .private_value = nid | (mask<<16) }
747 #endif /* CONFIG_SND_DEBUG */
751 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
753 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
755 spec->mixers[spec->num_mixers++] = mix;
758 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
760 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
762 spec->init_verbs[spec->num_init_verbs++] = verb;
766 * set up from the preset table
768 static void setup_preset(struct alc_spec *spec,
769 const struct alc_config_preset *preset)
773 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
774 add_mixer(spec, preset->mixers[i]);
775 spec->cap_mixer = preset->cap_mixer;
776 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
778 add_verb(spec, preset->init_verbs[i]);
780 spec->channel_mode = preset->channel_mode;
781 spec->num_channel_mode = preset->num_channel_mode;
782 spec->need_dac_fix = preset->need_dac_fix;
784 spec->multiout.max_channels = spec->channel_mode[0].channels;
786 spec->multiout.num_dacs = preset->num_dacs;
787 spec->multiout.dac_nids = preset->dac_nids;
788 spec->multiout.dig_out_nid = preset->dig_out_nid;
789 spec->multiout.hp_nid = preset->hp_nid;
791 spec->num_mux_defs = preset->num_mux_defs;
792 if (!spec->num_mux_defs)
793 spec->num_mux_defs = 1;
794 spec->input_mux = preset->input_mux;
796 spec->num_adc_nids = preset->num_adc_nids;
797 spec->adc_nids = preset->adc_nids;
798 spec->capsrc_nids = preset->capsrc_nids;
799 spec->dig_in_nid = preset->dig_in_nid;
801 spec->unsol_event = preset->unsol_event;
802 spec->init_hook = preset->init_hook;
803 #ifdef CONFIG_SND_HDA_POWER_SAVE
804 spec->loopback.amplist = preset->loopbacks;
808 /* Enable GPIO mask and set output */
809 static struct hda_verb alc_gpio1_init_verbs[] = {
810 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
811 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
812 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
816 static struct hda_verb alc_gpio2_init_verbs[] = {
817 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
818 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
819 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
823 static struct hda_verb alc_gpio3_init_verbs[] = {
824 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
825 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
826 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
831 * Fix hardware PLL issue
832 * On some codecs, the analog PLL gating control must be off while
833 * the default value is 1.
835 static void alc_fix_pll(struct hda_codec *codec)
837 struct alc_spec *spec = codec->spec;
842 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
844 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
845 AC_VERB_GET_PROC_COEF, 0);
846 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
848 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
849 val & ~(1 << spec->pll_coef_bit));
852 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
853 unsigned int coef_idx, unsigned int coef_bit)
855 struct alc_spec *spec = codec->spec;
857 spec->pll_coef_idx = coef_idx;
858 spec->pll_coef_bit = coef_bit;
862 static void alc_sku_automute(struct hda_codec *codec)
864 struct alc_spec *spec = codec->spec;
865 unsigned int present;
866 unsigned int hp_nid = spec->autocfg.hp_pins[0];
867 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
869 /* need to execute and sync at first */
870 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
871 present = snd_hda_codec_read(codec, hp_nid, 0,
872 AC_VERB_GET_PIN_SENSE, 0);
873 spec->jack_present = (present & 0x80000000) != 0;
874 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
875 spec->jack_present ? 0 : PIN_OUT);
878 #if 0 /* it's broken in some acses -- temporarily disabled */
879 static void alc_mic_automute(struct hda_codec *codec)
881 struct alc_spec *spec = codec->spec;
882 unsigned int present;
883 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
884 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
885 unsigned int mix_nid = spec->capsrc_nids[0];
886 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
888 capsrc_idx_mic = mic_nid - 0x18;
889 capsrc_idx_fmic = fmic_nid - 0x18;
890 present = snd_hda_codec_read(codec, mic_nid, 0,
891 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
892 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
893 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
894 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
895 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
896 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
897 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
900 #define alc_mic_automute(codec) /* NOP */
901 #endif /* disabled */
903 /* unsolicited event for HP jack sensing */
904 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
906 if (codec->vendor_id == 0x10ec0880)
910 if (res == ALC880_HP_EVENT)
911 alc_sku_automute(codec);
913 if (res == ALC880_MIC_EVENT)
914 alc_mic_automute(codec);
917 static void alc_inithook(struct hda_codec *codec)
919 alc_sku_automute(codec);
920 alc_mic_automute(codec);
923 /* additional initialization for ALC888 variants */
924 static void alc888_coef_init(struct hda_codec *codec)
928 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
929 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
930 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
931 if ((tmp & 0xf0) == 2)
933 snd_hda_codec_read(codec, 0x20, 0,
934 AC_VERB_SET_PROC_COEF, 0x830);
937 snd_hda_codec_read(codec, 0x20, 0,
938 AC_VERB_SET_PROC_COEF, 0x3030);
941 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
942 * 31 ~ 16 : Manufacture ID
944 * 7 ~ 0 : Assembly ID
945 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
947 static void alc_subsystem_id(struct hda_codec *codec,
948 unsigned int porta, unsigned int porte,
951 unsigned int ass, tmp, i;
953 struct alc_spec *spec = codec->spec;
955 ass = codec->subsystem_id & 0xffff;
956 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
960 * 31~30 : port conetcivity
963 * 19~16 : Check sum (15:1)
968 if (codec->vendor_id == 0x10ec0260)
970 ass = snd_hda_codec_read(codec, nid, 0,
971 AC_VERB_GET_CONFIG_DEFAULT, 0);
972 if (!(ass & 1) && !(ass & 0x100000))
974 if ((ass >> 30) != 1) /* no physical connection */
979 for (i = 1; i < 16; i++) {
983 if (((ass >> 16) & 0xf) != tmp)
989 * 2 : 0 --> Desktop, 1 --> Laptop
990 * 3~5 : External Amplifier control
993 tmp = (ass & 0x38) >> 3; /* external Amp control */
996 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
999 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1002 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1004 case 5: /* set EAPD output high */
1005 switch (codec->vendor_id) {
1007 snd_hda_codec_write(codec, 0x0f, 0,
1008 AC_VERB_SET_EAPD_BTLENABLE, 2);
1009 snd_hda_codec_write(codec, 0x10, 0,
1010 AC_VERB_SET_EAPD_BTLENABLE, 2);
1021 snd_hda_codec_write(codec, 0x14, 0,
1022 AC_VERB_SET_EAPD_BTLENABLE, 2);
1023 snd_hda_codec_write(codec, 0x15, 0,
1024 AC_VERB_SET_EAPD_BTLENABLE, 2);
1027 switch (codec->vendor_id) {
1029 snd_hda_codec_write(codec, 0x1a, 0,
1030 AC_VERB_SET_COEF_INDEX, 7);
1031 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1032 AC_VERB_GET_PROC_COEF, 0);
1033 snd_hda_codec_write(codec, 0x1a, 0,
1034 AC_VERB_SET_COEF_INDEX, 7);
1035 snd_hda_codec_write(codec, 0x1a, 0,
1036 AC_VERB_SET_PROC_COEF,
1045 snd_hda_codec_write(codec, 0x20, 0,
1046 AC_VERB_SET_COEF_INDEX, 7);
1047 tmp = snd_hda_codec_read(codec, 0x20, 0,
1048 AC_VERB_GET_PROC_COEF, 0);
1049 snd_hda_codec_write(codec, 0x20, 0,
1050 AC_VERB_SET_COEF_INDEX, 7);
1051 snd_hda_codec_write(codec, 0x20, 0,
1052 AC_VERB_SET_PROC_COEF,
1056 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1060 snd_hda_codec_write(codec, 0x20, 0,
1061 AC_VERB_SET_COEF_INDEX, 7);
1062 tmp = snd_hda_codec_read(codec, 0x20, 0,
1063 AC_VERB_GET_PROC_COEF, 0);
1064 snd_hda_codec_write(codec, 0x20, 0,
1065 AC_VERB_SET_COEF_INDEX, 7);
1066 snd_hda_codec_write(codec, 0x20, 0,
1067 AC_VERB_SET_PROC_COEF,
1075 /* is laptop or Desktop and enable the function "Mute internal speaker
1076 * when the external headphone out jack is plugged"
1078 if (!(ass & 0x8000))
1081 * 10~8 : Jack location
1082 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1084 * 15 : 1 --> enable the function "Mute internal speaker
1085 * when the external headphone out jack is plugged"
1087 if (!spec->autocfg.speaker_pins[0]) {
1088 if (spec->autocfg.line_out_pins[0])
1089 spec->autocfg.speaker_pins[0] =
1090 spec->autocfg.line_out_pins[0];
1095 if (!spec->autocfg.hp_pins[0]) {
1096 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1098 spec->autocfg.hp_pins[0] = porta;
1100 spec->autocfg.hp_pins[0] = porte;
1102 spec->autocfg.hp_pins[0] = portd;
1106 if (spec->autocfg.hp_pins[0])
1107 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1108 AC_VERB_SET_UNSOLICITED_ENABLE,
1109 AC_USRSP_EN | ALC880_HP_EVENT);
1111 #if 0 /* it's broken in some acses -- temporarily disabled */
1112 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1113 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1114 snd_hda_codec_write(codec,
1115 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1116 AC_VERB_SET_UNSOLICITED_ENABLE,
1117 AC_USRSP_EN | ALC880_MIC_EVENT);
1118 #endif /* disabled */
1120 spec->unsol_event = alc_sku_unsol_event;
1124 * Fix-up pin default configurations
1132 static void alc_fix_pincfg(struct hda_codec *codec,
1133 const struct snd_pci_quirk *quirk,
1134 const struct alc_pincfg **pinfix)
1136 const struct alc_pincfg *cfg;
1138 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1142 cfg = pinfix[quirk->value];
1143 for (; cfg->nid; cfg++) {
1146 for (i = 0; i < 4; i++) {
1147 snd_hda_codec_write(codec, cfg->nid, 0,
1148 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1156 * ALC880 3-stack model
1158 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1159 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1160 * F-Mic = 0x1b, HP = 0x19
1163 static hda_nid_t alc880_dac_nids[4] = {
1164 /* front, rear, clfe, rear_surr */
1165 0x02, 0x05, 0x04, 0x03
1168 static hda_nid_t alc880_adc_nids[3] = {
1173 /* The datasheet says the node 0x07 is connected from inputs,
1174 * but it shows zero connection in the real implementation on some devices.
1175 * Note: this is a 915GAV bug, fixed on 915GLV
1177 static hda_nid_t alc880_adc_nids_alt[2] = {
1182 #define ALC880_DIGOUT_NID 0x06
1183 #define ALC880_DIGIN_NID 0x0a
1185 static struct hda_input_mux alc880_capture_source = {
1189 { "Front Mic", 0x3 },
1195 /* channel source setting (2/6 channel selection for 3-stack) */
1197 static struct hda_verb alc880_threestack_ch2_init[] = {
1198 /* set line-in to input, mute it */
1199 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1200 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1201 /* set mic-in to input vref 80%, mute it */
1202 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1203 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1208 static struct hda_verb alc880_threestack_ch6_init[] = {
1209 /* set line-in to output, unmute it */
1210 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1211 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1212 /* set mic-in to output, unmute it */
1213 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1214 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1218 static struct hda_channel_mode alc880_threestack_modes[2] = {
1219 { 2, alc880_threestack_ch2_init },
1220 { 6, alc880_threestack_ch6_init },
1223 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1226 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1227 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1228 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1229 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1230 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1231 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1234 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1235 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1238 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1239 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1240 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1241 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1244 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1245 .name = "Channel Mode",
1246 .info = alc_ch_mode_info,
1247 .get = alc_ch_mode_get,
1248 .put = alc_ch_mode_put,
1253 /* capture mixer elements */
1254 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1255 struct snd_ctl_elem_info *uinfo)
1257 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1258 struct alc_spec *spec = codec->spec;
1261 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1262 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1264 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1265 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1269 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1270 unsigned int size, unsigned int __user *tlv)
1272 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1273 struct alc_spec *spec = codec->spec;
1276 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1277 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1279 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1280 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1284 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1285 struct snd_ctl_elem_value *ucontrol);
1287 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1288 struct snd_ctl_elem_value *ucontrol,
1291 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1292 struct alc_spec *spec = codec->spec;
1293 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1296 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1297 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1299 err = func(kcontrol, ucontrol);
1300 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1304 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1305 struct snd_ctl_elem_value *ucontrol)
1307 return alc_cap_getput_caller(kcontrol, ucontrol,
1308 snd_hda_mixer_amp_volume_get);
1311 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1312 struct snd_ctl_elem_value *ucontrol)
1314 return alc_cap_getput_caller(kcontrol, ucontrol,
1315 snd_hda_mixer_amp_volume_put);
1318 /* capture mixer elements */
1319 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1321 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1322 struct snd_ctl_elem_value *ucontrol)
1324 return alc_cap_getput_caller(kcontrol, ucontrol,
1325 snd_hda_mixer_amp_switch_get);
1328 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1329 struct snd_ctl_elem_value *ucontrol)
1331 return alc_cap_getput_caller(kcontrol, ucontrol,
1332 snd_hda_mixer_amp_switch_put);
1335 #define DEFINE_CAPMIX(num) \
1336 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1338 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1339 .name = "Capture Switch", \
1340 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1342 .info = alc_cap_sw_info, \
1343 .get = alc_cap_sw_get, \
1344 .put = alc_cap_sw_put, \
1347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1348 .name = "Capture Volume", \
1349 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1350 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1351 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1353 .info = alc_cap_vol_info, \
1354 .get = alc_cap_vol_get, \
1355 .put = alc_cap_vol_put, \
1356 .tlv = { .c = alc_cap_vol_tlv }, \
1359 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1360 /* .name = "Capture Source", */ \
1361 .name = "Input Source", \
1363 .info = alc_mux_enum_info, \
1364 .get = alc_mux_enum_get, \
1365 .put = alc_mux_enum_put, \
1370 /* up to three ADCs */
1377 * ALC880 5-stack model
1379 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1381 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1382 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1385 /* additional mixers to alc880_three_stack_mixer */
1386 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1387 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1388 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1392 /* channel source setting (6/8 channel selection for 5-stack) */
1394 static struct hda_verb alc880_fivestack_ch6_init[] = {
1395 /* set line-in to input, mute it */
1396 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1397 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1402 static struct hda_verb alc880_fivestack_ch8_init[] = {
1403 /* set line-in to output, unmute it */
1404 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1405 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1409 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1410 { 6, alc880_fivestack_ch6_init },
1411 { 8, alc880_fivestack_ch8_init },
1416 * ALC880 6-stack model
1418 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1419 * Side = 0x05 (0x0f)
1420 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1421 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1424 static hda_nid_t alc880_6st_dac_nids[4] = {
1425 /* front, rear, clfe, rear_surr */
1426 0x02, 0x03, 0x04, 0x05
1429 static struct hda_input_mux alc880_6stack_capture_source = {
1433 { "Front Mic", 0x1 },
1439 /* fixed 8-channels */
1440 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1444 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1445 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1446 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1447 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1448 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1449 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1450 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1451 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1452 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1453 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1454 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1455 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1456 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1457 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1458 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1461 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1462 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1463 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1464 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1466 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1467 .name = "Channel Mode",
1468 .info = alc_ch_mode_info,
1469 .get = alc_ch_mode_get,
1470 .put = alc_ch_mode_put,
1479 * W810 has rear IO for:
1482 * Center/LFE (DAC 04)
1485 * The system also has a pair of internal speakers, and a headphone jack.
1486 * These are both connected to Line2 on the codec, hence to DAC 02.
1488 * There is a variable resistor to control the speaker or headphone
1489 * volume. This is a hardware-only device without a software API.
1491 * Plugging headphones in will disable the internal speakers. This is
1492 * implemented in hardware, not via the driver using jack sense. In
1493 * a similar fashion, plugging into the rear socket marked "front" will
1494 * disable both the speakers and headphones.
1496 * For input, there's a microphone jack, and an "audio in" jack.
1497 * These may not do anything useful with this driver yet, because I
1498 * haven't setup any initialization verbs for these yet...
1501 static hda_nid_t alc880_w810_dac_nids[3] = {
1502 /* front, rear/surround, clfe */
1506 /* fixed 6 channels */
1507 static struct hda_channel_mode alc880_w810_modes[1] = {
1511 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1512 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1513 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1514 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1515 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1516 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1517 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1518 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1519 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1520 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1529 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1530 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1534 static hda_nid_t alc880_z71v_dac_nids[1] = {
1537 #define ALC880_Z71V_HP_DAC 0x03
1539 /* fixed 2 channels */
1540 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1544 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1545 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1546 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1547 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1548 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1549 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1550 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1558 * ALC880 F1734 model
1560 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1561 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1564 static hda_nid_t alc880_f1734_dac_nids[1] = {
1567 #define ALC880_F1734_HP_DAC 0x02
1569 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1570 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1571 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1573 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1574 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1575 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1576 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1577 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1581 static struct hda_input_mux alc880_f1734_capture_source = {
1593 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1594 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1595 * Mic = 0x18, Line = 0x1a
1598 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1599 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1601 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1602 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1603 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1604 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1605 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1606 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1607 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1608 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1609 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1610 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1611 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1612 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1613 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1615 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1617 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1618 .name = "Channel Mode",
1619 .info = alc_ch_mode_info,
1620 .get = alc_ch_mode_get,
1621 .put = alc_ch_mode_put,
1627 * ALC880 ASUS W1V model
1629 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1630 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1631 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1634 /* additional mixers to alc880_asus_mixer */
1635 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1636 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1637 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1641 /* additional mixers to alc880_asus_mixer */
1642 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1643 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1644 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1649 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1650 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1651 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1653 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1654 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1657 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1658 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1663 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1664 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1665 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1666 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1667 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1668 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1669 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1670 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1671 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1672 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1673 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1674 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1675 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1676 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1677 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1678 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1679 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1680 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1681 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1683 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1684 .name = "Channel Mode",
1685 .info = alc_ch_mode_info,
1686 .get = alc_ch_mode_get,
1687 .put = alc_ch_mode_put,
1692 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1693 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1694 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1695 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1696 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1697 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1698 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1699 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1700 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1701 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1702 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1706 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1707 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1708 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1709 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1710 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1712 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1717 * virtual master controls
1721 * slave controls for virtual master
1723 static const char *alc_slave_vols[] = {
1724 "Front Playback Volume",
1725 "Surround Playback Volume",
1726 "Center Playback Volume",
1727 "LFE Playback Volume",
1728 "Side Playback Volume",
1729 "Headphone Playback Volume",
1730 "Speaker Playback Volume",
1731 "Mono Playback Volume",
1732 "Line-Out Playback Volume",
1733 "PCM Playback Volume",
1737 static const char *alc_slave_sws[] = {
1738 "Front Playback Switch",
1739 "Surround Playback Switch",
1740 "Center Playback Switch",
1741 "LFE Playback Switch",
1742 "Side Playback Switch",
1743 "Headphone Playback Switch",
1744 "Speaker Playback Switch",
1745 "Mono Playback Switch",
1746 "IEC958 Playback Switch",
1751 * build control elements
1754 static void alc_free_kctls(struct hda_codec *codec);
1756 static int alc_build_controls(struct hda_codec *codec)
1758 struct alc_spec *spec = codec->spec;
1762 for (i = 0; i < spec->num_mixers; i++) {
1763 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1767 if (spec->cap_mixer) {
1768 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
1772 if (spec->multiout.dig_out_nid) {
1773 err = snd_hda_create_spdif_out_ctls(codec,
1774 spec->multiout.dig_out_nid);
1777 err = snd_hda_create_spdif_share_sw(codec,
1781 spec->multiout.share_spdif = 1;
1783 if (spec->dig_in_nid) {
1784 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1789 /* if we have no master control, let's create it */
1790 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1791 unsigned int vmaster_tlv[4];
1792 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1793 HDA_OUTPUT, vmaster_tlv);
1794 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1795 vmaster_tlv, alc_slave_vols);
1799 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1800 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1801 NULL, alc_slave_sws);
1806 alc_free_kctls(codec); /* no longer needed */
1812 * initialize the codec volumes, etc
1816 * generic initialization of ADC, input mixers and output mixers
1818 static struct hda_verb alc880_volume_init_verbs[] = {
1820 * Unmute ADC0-2 and set the default input to mic-in
1822 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1824 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1825 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1826 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1829 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1831 * Note: PASD motherboards uses the Line In 2 as the input for front
1834 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1840 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1844 * Set up output mixers (0x0c - 0x0f)
1846 /* set vol=0 to output mixers */
1847 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1850 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1851 /* set up input amps for analog loopback */
1852 /* Amp Indices: DAC = 0, mixer = 1 */
1853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1855 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1856 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1857 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1858 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1859 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1860 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1866 * 3-stack pin configuration:
1867 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1869 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1871 * preset connection lists of input pins
1872 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1874 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1875 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1876 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1879 * Set pin mode and muting
1881 /* set front pin widgets 0x14 for output */
1882 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1883 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1884 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1885 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1886 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1887 /* Mic2 (as headphone out) for HP output */
1888 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1889 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1890 /* Line In pin widget for input */
1891 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1892 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1893 /* Line2 (as front mic) pin widget for input and vref at 80% */
1894 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1895 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1896 /* CD pin widget for input */
1897 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1903 * 5-stack pin configuration:
1904 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1905 * line-in/side = 0x1a, f-mic = 0x1b
1907 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1909 * preset connection lists of input pins
1910 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1912 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1913 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1916 * Set pin mode and muting
1918 /* set pin widgets 0x14-0x17 for output */
1919 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1920 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1921 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1922 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1923 /* unmute pins for output (no gain on this amp) */
1924 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1926 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1927 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1929 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1930 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1931 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1932 /* Mic2 (as headphone out) for HP output */
1933 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1934 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1935 /* Line In pin widget for input */
1936 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1937 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1938 /* Line2 (as front mic) pin widget for input and vref at 80% */
1939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1940 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1941 /* CD pin widget for input */
1942 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1948 * W810 pin configuration:
1949 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1951 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1952 /* hphone/speaker input selector: front DAC */
1953 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1955 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1956 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1958 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1960 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1963 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1969 * Z71V pin configuration:
1970 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1972 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1973 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1974 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1975 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1978 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1979 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1981 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1987 * 6-stack pin configuration:
1988 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1989 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1991 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1992 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1994 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1995 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1999 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2000 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2001 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2003 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2004 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2005 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2006 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2007 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2008 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2009 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2010 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2011 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2017 * Uniwill pin configuration:
2018 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2021 static struct hda_verb alc880_uniwill_init_verbs[] = {
2022 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2024 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2029 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2030 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2031 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2033 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2034 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2035 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2036 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2037 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2039 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2040 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2041 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2042 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2043 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2044 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2045 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2046 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2047 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2049 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2050 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2057 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2059 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2060 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2063 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2066 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2067 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2068 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2069 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2070 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2072 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2073 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2075 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2076 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2077 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2078 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2079 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2080 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2082 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2083 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2088 static struct hda_verb alc880_beep_init_verbs[] = {
2089 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2093 /* toggle speaker-output according to the hp-jack state */
2094 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2096 unsigned int present;
2099 present = snd_hda_codec_read(codec, 0x14, 0,
2100 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2101 bits = present ? HDA_AMP_MUTE : 0;
2102 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2103 HDA_AMP_MUTE, bits);
2104 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2105 HDA_AMP_MUTE, bits);
2108 /* auto-toggle front mic */
2109 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2111 unsigned int present;
2114 present = snd_hda_codec_read(codec, 0x18, 0,
2115 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2116 bits = present ? HDA_AMP_MUTE : 0;
2117 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2120 static void alc880_uniwill_automute(struct hda_codec *codec)
2122 alc880_uniwill_hp_automute(codec);
2123 alc880_uniwill_mic_automute(codec);
2126 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2129 /* Looks like the unsol event is incompatible with the standard
2130 * definition. 4bit tag is placed at 28 bit!
2132 switch (res >> 28) {
2133 case ALC880_HP_EVENT:
2134 alc880_uniwill_hp_automute(codec);
2136 case ALC880_MIC_EVENT:
2137 alc880_uniwill_mic_automute(codec);
2142 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2144 unsigned int present;
2147 present = snd_hda_codec_read(codec, 0x14, 0,
2148 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2149 bits = present ? HDA_AMP_MUTE : 0;
2150 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2153 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2155 unsigned int present;
2157 present = snd_hda_codec_read(codec, 0x21, 0,
2158 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2159 present &= HDA_AMP_VOLMASK;
2160 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2161 HDA_AMP_VOLMASK, present);
2162 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2163 HDA_AMP_VOLMASK, present);
2166 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2169 /* Looks like the unsol event is incompatible with the standard
2170 * definition. 4bit tag is placed at 28 bit!
2172 if ((res >> 28) == ALC880_HP_EVENT)
2173 alc880_uniwill_p53_hp_automute(codec);
2174 if ((res >> 28) == ALC880_DCVOL_EVENT)
2175 alc880_uniwill_p53_dcvol_automute(codec);
2179 * F1734 pin configuration:
2180 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2182 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2183 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2184 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2185 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2186 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2187 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2189 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2190 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2194 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2195 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2196 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2197 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2198 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2199 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2200 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2201 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2202 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2204 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2205 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2211 * ASUS pin configuration:
2212 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2214 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2215 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2216 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2217 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2218 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2222 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2223 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2224 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2226 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2227 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2229 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2230 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2231 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2232 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2233 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2234 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2235 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2237 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2242 /* Enable GPIO mask and set output */
2243 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2244 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2246 /* Clevo m520g init */
2247 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2248 /* headphone output */
2249 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2252 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2254 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2255 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2257 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2258 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2259 /* Mic1 (rear panel) */
2260 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2261 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2262 /* Mic2 (front panel) */
2263 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2268 /* change to EAPD mode */
2269 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2270 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2275 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2276 /* change to EAPD mode */
2277 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2278 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2280 /* Headphone output */
2281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2283 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2284 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2286 /* Line In pin widget for input */
2287 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2288 /* CD pin widget for input */
2289 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2290 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2291 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2293 /* change to EAPD mode */
2294 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2295 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2301 * LG m1 express dual
2304 * Rear Line-In/Out (blue): 0x14
2305 * Build-in Mic-In: 0x15
2307 * HP-Out (green): 0x1b
2308 * Mic-In/Out (red): 0x19
2312 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2313 static hda_nid_t alc880_lg_dac_nids[3] = {
2317 /* seems analog CD is not working */
2318 static struct hda_input_mux alc880_lg_capture_source = {
2323 { "Internal Mic", 0x6 },
2327 /* 2,4,6 channel modes */
2328 static struct hda_verb alc880_lg_ch2_init[] = {
2329 /* set line-in and mic-in to input */
2330 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2331 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2335 static struct hda_verb alc880_lg_ch4_init[] = {
2336 /* set line-in to out and mic-in to input */
2337 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2338 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2342 static struct hda_verb alc880_lg_ch6_init[] = {
2343 /* set line-in and mic-in to output */
2344 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2345 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2349 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2350 { 2, alc880_lg_ch2_init },
2351 { 4, alc880_lg_ch4_init },
2352 { 6, alc880_lg_ch6_init },
2355 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2356 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2359 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2360 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2361 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2362 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2363 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2366 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2367 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2368 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2369 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2372 .name = "Channel Mode",
2373 .info = alc_ch_mode_info,
2374 .get = alc_ch_mode_get,
2375 .put = alc_ch_mode_put,
2380 static struct hda_verb alc880_lg_init_verbs[] = {
2381 /* set capture source to mic-in */
2382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2383 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2385 /* mute all amp mixer inputs */
2386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2389 /* line-in to input */
2390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2391 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2394 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2396 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2397 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2398 /* mic-in to input */
2399 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2400 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2401 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2403 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2404 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2405 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2407 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2411 /* toggle speaker-output according to the hp-jack state */
2412 static void alc880_lg_automute(struct hda_codec *codec)
2414 unsigned int present;
2417 present = snd_hda_codec_read(codec, 0x1b, 0,
2418 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2419 bits = present ? HDA_AMP_MUTE : 0;
2420 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2421 HDA_AMP_MUTE, bits);
2424 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2426 /* Looks like the unsol event is incompatible with the standard
2427 * definition. 4bit tag is placed at 28 bit!
2429 if ((res >> 28) == 0x01)
2430 alc880_lg_automute(codec);
2439 * Built-in Mic-In: 0x19
2445 static struct hda_input_mux alc880_lg_lw_capture_source = {
2449 { "Internal Mic", 0x1 },
2454 #define alc880_lg_lw_modes alc880_threestack_modes
2456 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2457 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2458 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2459 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2460 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2461 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2462 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2463 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2464 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2465 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2466 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2469 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2470 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2472 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2473 .name = "Channel Mode",
2474 .info = alc_ch_mode_info,
2475 .get = alc_ch_mode_get,
2476 .put = alc_ch_mode_put,
2481 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2482 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2483 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2484 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2486 /* set capture source to mic-in */
2487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2489 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2496 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2497 /* mic-in to input */
2498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2504 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2508 /* toggle speaker-output according to the hp-jack state */
2509 static void alc880_lg_lw_automute(struct hda_codec *codec)
2511 unsigned int present;
2514 present = snd_hda_codec_read(codec, 0x1b, 0,
2515 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2516 bits = present ? HDA_AMP_MUTE : 0;
2517 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2518 HDA_AMP_MUTE, bits);
2521 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2523 /* Looks like the unsol event is incompatible with the standard
2524 * definition. 4bit tag is placed at 28 bit!
2526 if ((res >> 28) == 0x01)
2527 alc880_lg_lw_automute(codec);
2530 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2531 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2532 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2535 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2536 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2540 static struct hda_input_mux alc880_medion_rim_capture_source = {
2544 { "Internal Mic", 0x1 },
2548 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2549 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2552 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2554 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2556 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2557 /* Mic2 (as headphone out) for HP output */
2558 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2559 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2560 /* Internal Speaker */
2561 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2562 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2564 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2565 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2567 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2571 /* toggle speaker-output according to the hp-jack state */
2572 static void alc880_medion_rim_automute(struct hda_codec *codec)
2574 unsigned int present;
2577 present = snd_hda_codec_read(codec, 0x14, 0,
2578 AC_VERB_GET_PIN_SENSE, 0)
2579 & AC_PINSENSE_PRESENCE;
2580 bits = present ? HDA_AMP_MUTE : 0;
2581 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2582 HDA_AMP_MUTE, bits);
2584 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2586 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2589 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2592 /* Looks like the unsol event is incompatible with the standard
2593 * definition. 4bit tag is placed at 28 bit!
2595 if ((res >> 28) == ALC880_HP_EVENT)
2596 alc880_medion_rim_automute(codec);
2599 #ifdef CONFIG_SND_HDA_POWER_SAVE
2600 static struct hda_amp_list alc880_loopbacks[] = {
2601 { 0x0b, HDA_INPUT, 0 },
2602 { 0x0b, HDA_INPUT, 1 },
2603 { 0x0b, HDA_INPUT, 2 },
2604 { 0x0b, HDA_INPUT, 3 },
2605 { 0x0b, HDA_INPUT, 4 },
2609 static struct hda_amp_list alc880_lg_loopbacks[] = {
2610 { 0x0b, HDA_INPUT, 1 },
2611 { 0x0b, HDA_INPUT, 6 },
2612 { 0x0b, HDA_INPUT, 7 },
2621 static int alc_init(struct hda_codec *codec)
2623 struct alc_spec *spec = codec->spec;
2627 if (codec->vendor_id == 0x10ec0888)
2628 alc888_coef_init(codec);
2630 for (i = 0; i < spec->num_init_verbs; i++)
2631 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2633 if (spec->init_hook)
2634 spec->init_hook(codec);
2639 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2641 struct alc_spec *spec = codec->spec;
2643 if (spec->unsol_event)
2644 spec->unsol_event(codec, res);
2647 #ifdef CONFIG_SND_HDA_POWER_SAVE
2648 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2650 struct alc_spec *spec = codec->spec;
2651 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2656 * Analog playback callbacks
2658 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2659 struct hda_codec *codec,
2660 struct snd_pcm_substream *substream)
2662 struct alc_spec *spec = codec->spec;
2663 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2667 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2668 struct hda_codec *codec,
2669 unsigned int stream_tag,
2670 unsigned int format,
2671 struct snd_pcm_substream *substream)
2673 struct alc_spec *spec = codec->spec;
2674 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2675 stream_tag, format, substream);
2678 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2679 struct hda_codec *codec,
2680 struct snd_pcm_substream *substream)
2682 struct alc_spec *spec = codec->spec;
2683 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2689 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2690 struct hda_codec *codec,
2691 struct snd_pcm_substream *substream)
2693 struct alc_spec *spec = codec->spec;
2694 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2697 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2698 struct hda_codec *codec,
2699 unsigned int stream_tag,
2700 unsigned int format,
2701 struct snd_pcm_substream *substream)
2703 struct alc_spec *spec = codec->spec;
2704 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2705 stream_tag, format, substream);
2708 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2709 struct hda_codec *codec,
2710 struct snd_pcm_substream *substream)
2712 struct alc_spec *spec = codec->spec;
2713 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2719 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2720 struct hda_codec *codec,
2721 unsigned int stream_tag,
2722 unsigned int format,
2723 struct snd_pcm_substream *substream)
2725 struct alc_spec *spec = codec->spec;
2727 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2728 stream_tag, 0, format);
2732 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2733 struct hda_codec *codec,
2734 struct snd_pcm_substream *substream)
2736 struct alc_spec *spec = codec->spec;
2738 snd_hda_codec_cleanup_stream(codec,
2739 spec->adc_nids[substream->number + 1]);
2746 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2750 /* NID is set in alc_build_pcms */
2752 .open = alc880_playback_pcm_open,
2753 .prepare = alc880_playback_pcm_prepare,
2754 .cleanup = alc880_playback_pcm_cleanup
2758 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2762 /* NID is set in alc_build_pcms */
2765 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2769 /* NID is set in alc_build_pcms */
2772 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2773 .substreams = 2, /* can be overridden */
2776 /* NID is set in alc_build_pcms */
2778 .prepare = alc880_alt_capture_pcm_prepare,
2779 .cleanup = alc880_alt_capture_pcm_cleanup
2783 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2787 /* NID is set in alc_build_pcms */
2789 .open = alc880_dig_playback_pcm_open,
2790 .close = alc880_dig_playback_pcm_close,
2791 .prepare = alc880_dig_playback_pcm_prepare
2795 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2799 /* NID is set in alc_build_pcms */
2802 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2803 static struct hda_pcm_stream alc_pcm_null_stream = {
2809 static int alc_build_pcms(struct hda_codec *codec)
2811 struct alc_spec *spec = codec->spec;
2812 struct hda_pcm *info = spec->pcm_rec;
2815 codec->num_pcms = 1;
2816 codec->pcm_info = info;
2818 info->name = spec->stream_name_analog;
2819 if (spec->stream_analog_playback) {
2820 if (snd_BUG_ON(!spec->multiout.dac_nids))
2822 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2823 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2825 if (spec->stream_analog_capture) {
2826 if (snd_BUG_ON(!spec->adc_nids))
2828 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2829 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2832 if (spec->channel_mode) {
2833 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2834 for (i = 0; i < spec->num_channel_mode; i++) {
2835 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2836 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2841 /* SPDIF for stream index #1 */
2842 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2843 codec->num_pcms = 2;
2844 info = spec->pcm_rec + 1;
2845 info->name = spec->stream_name_digital;
2846 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2847 if (spec->multiout.dig_out_nid &&
2848 spec->stream_digital_playback) {
2849 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2850 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2852 if (spec->dig_in_nid &&
2853 spec->stream_digital_capture) {
2854 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2855 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2857 /* FIXME: do we need this for all Realtek codec models? */
2858 codec->spdif_status_reset = 1;
2861 /* If the use of more than one ADC is requested for the current
2862 * model, configure a second analog capture-only PCM.
2864 /* Additional Analaog capture for index #2 */
2865 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2866 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2867 codec->num_pcms = 3;
2868 info = spec->pcm_rec + 2;
2869 info->name = spec->stream_name_analog;
2870 if (spec->alt_dac_nid) {
2871 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2872 *spec->stream_analog_alt_playback;
2873 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2876 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2877 alc_pcm_null_stream;
2878 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2880 if (spec->num_adc_nids > 1) {
2881 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2882 *spec->stream_analog_alt_capture;
2883 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2885 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2886 spec->num_adc_nids - 1;
2888 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2889 alc_pcm_null_stream;
2890 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2897 static void alc_free_kctls(struct hda_codec *codec)
2899 struct alc_spec *spec = codec->spec;
2901 if (spec->kctls.list) {
2902 struct snd_kcontrol_new *kctl = spec->kctls.list;
2904 for (i = 0; i < spec->kctls.used; i++)
2905 kfree(kctl[i].name);
2907 snd_array_free(&spec->kctls);
2910 static void alc_free(struct hda_codec *codec)
2912 struct alc_spec *spec = codec->spec;
2917 alc_free_kctls(codec);
2919 codec->spec = NULL; /* to be sure */
2922 #ifdef SND_HDA_NEEDS_RESUME
2923 static void store_pin_configs(struct hda_codec *codec)
2925 struct alc_spec *spec = codec->spec;
2926 hda_nid_t nid, end_nid;
2928 end_nid = codec->start_nid + codec->num_nodes;
2929 for (nid = codec->start_nid; nid < end_nid; nid++) {
2930 unsigned int wid_caps = get_wcaps(codec, nid);
2931 unsigned int wid_type =
2932 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2933 if (wid_type != AC_WID_PIN)
2935 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
2937 spec->pin_nids[spec->num_pins] = nid;
2938 spec->pin_cfgs[spec->num_pins] =
2939 snd_hda_codec_read(codec, nid, 0,
2940 AC_VERB_GET_CONFIG_DEFAULT, 0);
2945 static void resume_pin_configs(struct hda_codec *codec)
2947 struct alc_spec *spec = codec->spec;
2950 for (i = 0; i < spec->num_pins; i++) {
2951 hda_nid_t pin_nid = spec->pin_nids[i];
2952 unsigned int pin_config = spec->pin_cfgs[i];
2953 snd_hda_codec_write(codec, pin_nid, 0,
2954 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2955 pin_config & 0x000000ff);
2956 snd_hda_codec_write(codec, pin_nid, 0,
2957 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2958 (pin_config & 0x0000ff00) >> 8);
2959 snd_hda_codec_write(codec, pin_nid, 0,
2960 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2961 (pin_config & 0x00ff0000) >> 16);
2962 snd_hda_codec_write(codec, pin_nid, 0,
2963 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2968 static int alc_resume(struct hda_codec *codec)
2970 resume_pin_configs(codec);
2971 codec->patch_ops.init(codec);
2972 snd_hda_codec_resume_amp(codec);
2973 snd_hda_codec_resume_cache(codec);
2977 #define store_pin_configs(codec)
2982 static struct hda_codec_ops alc_patch_ops = {
2983 .build_controls = alc_build_controls,
2984 .build_pcms = alc_build_pcms,
2987 .unsol_event = alc_unsol_event,
2988 #ifdef SND_HDA_NEEDS_RESUME
2989 .resume = alc_resume,
2991 #ifdef CONFIG_SND_HDA_POWER_SAVE
2992 .check_power_status = alc_check_power_status,
2998 * Test configuration for debugging
3000 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3003 #ifdef CONFIG_SND_DEBUG
3004 static hda_nid_t alc880_test_dac_nids[4] = {
3005 0x02, 0x03, 0x04, 0x05
3008 static struct hda_input_mux alc880_test_capture_source = {
3017 { "Surround", 0x6 },
3021 static struct hda_channel_mode alc880_test_modes[4] = {
3028 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3029 struct snd_ctl_elem_info *uinfo)
3031 static char *texts[] = {
3032 "N/A", "Line Out", "HP Out",
3033 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3035 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3037 uinfo->value.enumerated.items = 8;
3038 if (uinfo->value.enumerated.item >= 8)
3039 uinfo->value.enumerated.item = 7;
3040 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3044 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3045 struct snd_ctl_elem_value *ucontrol)
3047 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3048 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3049 unsigned int pin_ctl, item = 0;
3051 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3052 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3053 if (pin_ctl & AC_PINCTL_OUT_EN) {
3054 if (pin_ctl & AC_PINCTL_HP_EN)
3058 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3059 switch (pin_ctl & AC_PINCTL_VREFEN) {
3060 case AC_PINCTL_VREF_HIZ: item = 3; break;
3061 case AC_PINCTL_VREF_50: item = 4; break;
3062 case AC_PINCTL_VREF_GRD: item = 5; break;
3063 case AC_PINCTL_VREF_80: item = 6; break;
3064 case AC_PINCTL_VREF_100: item = 7; break;
3067 ucontrol->value.enumerated.item[0] = item;
3071 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3072 struct snd_ctl_elem_value *ucontrol)
3074 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3075 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3076 static unsigned int ctls[] = {
3077 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3078 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3079 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3080 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3081 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3082 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3084 unsigned int old_ctl, new_ctl;
3086 old_ctl = snd_hda_codec_read(codec, nid, 0,
3087 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3088 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3089 if (old_ctl != new_ctl) {
3091 snd_hda_codec_write_cache(codec, nid, 0,
3092 AC_VERB_SET_PIN_WIDGET_CONTROL,
3094 val = ucontrol->value.enumerated.item[0] >= 3 ?
3096 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3103 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3104 struct snd_ctl_elem_info *uinfo)
3106 static char *texts[] = {
3107 "Front", "Surround", "CLFE", "Side"
3109 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3111 uinfo->value.enumerated.items = 4;
3112 if (uinfo->value.enumerated.item >= 4)
3113 uinfo->value.enumerated.item = 3;
3114 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3118 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3119 struct snd_ctl_elem_value *ucontrol)
3121 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3122 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3125 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3126 ucontrol->value.enumerated.item[0] = sel & 3;
3130 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3131 struct snd_ctl_elem_value *ucontrol)
3133 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3134 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3137 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3138 if (ucontrol->value.enumerated.item[0] != sel) {
3139 sel = ucontrol->value.enumerated.item[0] & 3;
3140 snd_hda_codec_write_cache(codec, nid, 0,
3141 AC_VERB_SET_CONNECT_SEL, sel);
3147 #define PIN_CTL_TEST(xname,nid) { \
3148 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3150 .info = alc_test_pin_ctl_info, \
3151 .get = alc_test_pin_ctl_get, \
3152 .put = alc_test_pin_ctl_put, \
3153 .private_value = nid \
3156 #define PIN_SRC_TEST(xname,nid) { \
3157 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3159 .info = alc_test_pin_src_info, \
3160 .get = alc_test_pin_src_get, \
3161 .put = alc_test_pin_src_put, \
3162 .private_value = nid \
3165 static struct snd_kcontrol_new alc880_test_mixer[] = {
3166 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3167 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3168 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3169 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3170 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3171 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3172 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3173 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3174 PIN_CTL_TEST("Front Pin Mode", 0x14),
3175 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3176 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3177 PIN_CTL_TEST("Side Pin Mode", 0x17),
3178 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3179 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3180 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3181 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3182 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3183 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3184 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3185 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3186 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3187 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3188 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3189 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3190 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3191 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3192 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3193 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3194 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3195 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3197 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3198 .name = "Channel Mode",
3199 .info = alc_ch_mode_info,
3200 .get = alc_ch_mode_get,
3201 .put = alc_ch_mode_put,
3206 static struct hda_verb alc880_test_init_verbs[] = {
3207 /* Unmute inputs of 0x0c - 0x0f */
3208 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3209 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3210 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3211 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3212 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3213 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3214 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3215 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3216 /* Vol output for 0x0c-0x0f */
3217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3218 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3219 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3220 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3221 /* Set output pins 0x14-0x17 */
3222 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3223 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3224 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3225 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3226 /* Unmute output pins 0x14-0x17 */
3227 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3229 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3230 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3231 /* Set input pins 0x18-0x1c */
3232 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3233 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3234 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3235 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3236 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3237 /* Mute input pins 0x18-0x1b */
3238 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3239 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3240 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3241 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3243 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3244 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3245 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3246 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3247 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3248 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3249 /* Analog input/passthru */
3250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3262 static const char *alc880_models[ALC880_MODEL_LAST] = {
3263 [ALC880_3ST] = "3stack",
3264 [ALC880_TCL_S700] = "tcl",
3265 [ALC880_3ST_DIG] = "3stack-digout",
3266 [ALC880_CLEVO] = "clevo",
3267 [ALC880_5ST] = "5stack",
3268 [ALC880_5ST_DIG] = "5stack-digout",
3269 [ALC880_W810] = "w810",
3270 [ALC880_Z71V] = "z71v",
3271 [ALC880_6ST] = "6stack",
3272 [ALC880_6ST_DIG] = "6stack-digout",
3273 [ALC880_ASUS] = "asus",
3274 [ALC880_ASUS_W1V] = "asus-w1v",
3275 [ALC880_ASUS_DIG] = "asus-dig",
3276 [ALC880_ASUS_DIG2] = "asus-dig2",
3277 [ALC880_UNIWILL_DIG] = "uniwill",
3278 [ALC880_UNIWILL_P53] = "uniwill-p53",
3279 [ALC880_FUJITSU] = "fujitsu",
3280 [ALC880_F1734] = "F1734",
3282 [ALC880_LG_LW] = "lg-lw",
3283 [ALC880_MEDION_RIM] = "medion",
3284 #ifdef CONFIG_SND_DEBUG
3285 [ALC880_TEST] = "test",
3287 [ALC880_AUTO] = "auto",
3290 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3291 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3292 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3293 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3294 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3295 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3296 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3297 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3298 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3299 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3300 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3301 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3302 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3303 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3304 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3305 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3306 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3307 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3308 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3309 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3310 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3311 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3312 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3313 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3314 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3315 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3316 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3317 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3318 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3319 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3320 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3321 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3322 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3323 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3324 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3325 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3326 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3327 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3328 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3329 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3330 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3331 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3332 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3333 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3334 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3335 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3336 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3337 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3338 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3339 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3340 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3341 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3342 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3343 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3344 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3345 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3346 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3347 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3348 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3349 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3350 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3351 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3352 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3353 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3354 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3355 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3356 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3357 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3358 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3359 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3360 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3361 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3366 * ALC880 codec presets
3368 static struct alc_config_preset alc880_presets[] = {
3370 .mixers = { alc880_three_stack_mixer },
3371 .init_verbs = { alc880_volume_init_verbs,
3372 alc880_pin_3stack_init_verbs },
3373 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3374 .dac_nids = alc880_dac_nids,
3375 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3376 .channel_mode = alc880_threestack_modes,
3378 .input_mux = &alc880_capture_source,
3380 [ALC880_3ST_DIG] = {
3381 .mixers = { alc880_three_stack_mixer },
3382 .init_verbs = { alc880_volume_init_verbs,
3383 alc880_pin_3stack_init_verbs },
3384 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3385 .dac_nids = alc880_dac_nids,
3386 .dig_out_nid = ALC880_DIGOUT_NID,
3387 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3388 .channel_mode = alc880_threestack_modes,
3390 .input_mux = &alc880_capture_source,
3392 [ALC880_TCL_S700] = {
3393 .mixers = { alc880_tcl_s700_mixer },
3394 .init_verbs = { alc880_volume_init_verbs,
3395 alc880_pin_tcl_S700_init_verbs,
3396 alc880_gpio2_init_verbs },
3397 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3398 .dac_nids = alc880_dac_nids,
3399 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3400 .num_adc_nids = 1, /* single ADC */
3402 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3403 .channel_mode = alc880_2_jack_modes,
3404 .input_mux = &alc880_capture_source,
3407 .mixers = { alc880_three_stack_mixer,
3408 alc880_five_stack_mixer},
3409 .init_verbs = { alc880_volume_init_verbs,
3410 alc880_pin_5stack_init_verbs },
3411 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3412 .dac_nids = alc880_dac_nids,
3413 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3414 .channel_mode = alc880_fivestack_modes,
3415 .input_mux = &alc880_capture_source,
3417 [ALC880_5ST_DIG] = {
3418 .mixers = { alc880_three_stack_mixer,
3419 alc880_five_stack_mixer },
3420 .init_verbs = { alc880_volume_init_verbs,
3421 alc880_pin_5stack_init_verbs },
3422 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3423 .dac_nids = alc880_dac_nids,
3424 .dig_out_nid = ALC880_DIGOUT_NID,
3425 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3426 .channel_mode = alc880_fivestack_modes,
3427 .input_mux = &alc880_capture_source,
3430 .mixers = { alc880_six_stack_mixer },
3431 .init_verbs = { alc880_volume_init_verbs,
3432 alc880_pin_6stack_init_verbs },
3433 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3434 .dac_nids = alc880_6st_dac_nids,
3435 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3436 .channel_mode = alc880_sixstack_modes,
3437 .input_mux = &alc880_6stack_capture_source,
3439 [ALC880_6ST_DIG] = {
3440 .mixers = { alc880_six_stack_mixer },
3441 .init_verbs = { alc880_volume_init_verbs,
3442 alc880_pin_6stack_init_verbs },
3443 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3444 .dac_nids = alc880_6st_dac_nids,
3445 .dig_out_nid = ALC880_DIGOUT_NID,
3446 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3447 .channel_mode = alc880_sixstack_modes,
3448 .input_mux = &alc880_6stack_capture_source,
3451 .mixers = { alc880_w810_base_mixer },
3452 .init_verbs = { alc880_volume_init_verbs,
3453 alc880_pin_w810_init_verbs,
3454 alc880_gpio2_init_verbs },
3455 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3456 .dac_nids = alc880_w810_dac_nids,
3457 .dig_out_nid = ALC880_DIGOUT_NID,
3458 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3459 .channel_mode = alc880_w810_modes,
3460 .input_mux = &alc880_capture_source,
3463 .mixers = { alc880_z71v_mixer },
3464 .init_verbs = { alc880_volume_init_verbs,
3465 alc880_pin_z71v_init_verbs },
3466 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3467 .dac_nids = alc880_z71v_dac_nids,
3468 .dig_out_nid = ALC880_DIGOUT_NID,
3470 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3471 .channel_mode = alc880_2_jack_modes,
3472 .input_mux = &alc880_capture_source,
3475 .mixers = { alc880_f1734_mixer },
3476 .init_verbs = { alc880_volume_init_verbs,
3477 alc880_pin_f1734_init_verbs },
3478 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3479 .dac_nids = alc880_f1734_dac_nids,
3481 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3482 .channel_mode = alc880_2_jack_modes,
3483 .input_mux = &alc880_f1734_capture_source,
3484 .unsol_event = alc880_uniwill_p53_unsol_event,
3485 .init_hook = alc880_uniwill_p53_hp_automute,
3488 .mixers = { alc880_asus_mixer },
3489 .init_verbs = { alc880_volume_init_verbs,
3490 alc880_pin_asus_init_verbs,
3491 alc880_gpio1_init_verbs },
3492 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3493 .dac_nids = alc880_asus_dac_nids,
3494 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3495 .channel_mode = alc880_asus_modes,
3497 .input_mux = &alc880_capture_source,
3499 [ALC880_ASUS_DIG] = {
3500 .mixers = { alc880_asus_mixer },
3501 .init_verbs = { alc880_volume_init_verbs,
3502 alc880_pin_asus_init_verbs,
3503 alc880_gpio1_init_verbs },
3504 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3505 .dac_nids = alc880_asus_dac_nids,
3506 .dig_out_nid = ALC880_DIGOUT_NID,
3507 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3508 .channel_mode = alc880_asus_modes,
3510 .input_mux = &alc880_capture_source,
3512 [ALC880_ASUS_DIG2] = {
3513 .mixers = { alc880_asus_mixer },
3514 .init_verbs = { alc880_volume_init_verbs,
3515 alc880_pin_asus_init_verbs,
3516 alc880_gpio2_init_verbs }, /* use GPIO2 */
3517 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3518 .dac_nids = alc880_asus_dac_nids,
3519 .dig_out_nid = ALC880_DIGOUT_NID,
3520 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3521 .channel_mode = alc880_asus_modes,
3523 .input_mux = &alc880_capture_source,
3525 [ALC880_ASUS_W1V] = {
3526 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3527 .init_verbs = { alc880_volume_init_verbs,
3528 alc880_pin_asus_init_verbs,
3529 alc880_gpio1_init_verbs },
3530 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3531 .dac_nids = alc880_asus_dac_nids,
3532 .dig_out_nid = ALC880_DIGOUT_NID,
3533 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3534 .channel_mode = alc880_asus_modes,
3536 .input_mux = &alc880_capture_source,
3538 [ALC880_UNIWILL_DIG] = {
3539 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3540 .init_verbs = { alc880_volume_init_verbs,
3541 alc880_pin_asus_init_verbs },
3542 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3543 .dac_nids = alc880_asus_dac_nids,
3544 .dig_out_nid = ALC880_DIGOUT_NID,
3545 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3546 .channel_mode = alc880_asus_modes,
3548 .input_mux = &alc880_capture_source,
3550 [ALC880_UNIWILL] = {
3551 .mixers = { alc880_uniwill_mixer },
3552 .init_verbs = { alc880_volume_init_verbs,
3553 alc880_uniwill_init_verbs },
3554 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3555 .dac_nids = alc880_asus_dac_nids,
3556 .dig_out_nid = ALC880_DIGOUT_NID,
3557 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3558 .channel_mode = alc880_threestack_modes,
3560 .input_mux = &alc880_capture_source,
3561 .unsol_event = alc880_uniwill_unsol_event,
3562 .init_hook = alc880_uniwill_automute,
3564 [ALC880_UNIWILL_P53] = {
3565 .mixers = { alc880_uniwill_p53_mixer },
3566 .init_verbs = { alc880_volume_init_verbs,
3567 alc880_uniwill_p53_init_verbs },
3568 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3569 .dac_nids = alc880_asus_dac_nids,
3570 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3571 .channel_mode = alc880_threestack_modes,
3572 .input_mux = &alc880_capture_source,
3573 .unsol_event = alc880_uniwill_p53_unsol_event,
3574 .init_hook = alc880_uniwill_p53_hp_automute,
3576 [ALC880_FUJITSU] = {
3577 .mixers = { alc880_fujitsu_mixer,
3578 alc880_pcbeep_mixer, },
3579 .init_verbs = { alc880_volume_init_verbs,
3580 alc880_uniwill_p53_init_verbs,
3581 alc880_beep_init_verbs },
3582 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3583 .dac_nids = alc880_dac_nids,
3584 .dig_out_nid = ALC880_DIGOUT_NID,
3585 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3586 .channel_mode = alc880_2_jack_modes,
3587 .input_mux = &alc880_capture_source,
3588 .unsol_event = alc880_uniwill_p53_unsol_event,
3589 .init_hook = alc880_uniwill_p53_hp_automute,
3592 .mixers = { alc880_three_stack_mixer },
3593 .init_verbs = { alc880_volume_init_verbs,
3594 alc880_pin_clevo_init_verbs },
3595 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3596 .dac_nids = alc880_dac_nids,
3598 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3599 .channel_mode = alc880_threestack_modes,
3601 .input_mux = &alc880_capture_source,
3604 .mixers = { alc880_lg_mixer },
3605 .init_verbs = { alc880_volume_init_verbs,
3606 alc880_lg_init_verbs },
3607 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3608 .dac_nids = alc880_lg_dac_nids,
3609 .dig_out_nid = ALC880_DIGOUT_NID,
3610 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3611 .channel_mode = alc880_lg_ch_modes,
3613 .input_mux = &alc880_lg_capture_source,
3614 .unsol_event = alc880_lg_unsol_event,
3615 .init_hook = alc880_lg_automute,
3616 #ifdef CONFIG_SND_HDA_POWER_SAVE
3617 .loopbacks = alc880_lg_loopbacks,
3621 .mixers = { alc880_lg_lw_mixer },
3622 .init_verbs = { alc880_volume_init_verbs,
3623 alc880_lg_lw_init_verbs },
3624 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3625 .dac_nids = alc880_dac_nids,
3626 .dig_out_nid = ALC880_DIGOUT_NID,
3627 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3628 .channel_mode = alc880_lg_lw_modes,
3629 .input_mux = &alc880_lg_lw_capture_source,
3630 .unsol_event = alc880_lg_lw_unsol_event,
3631 .init_hook = alc880_lg_lw_automute,
3633 [ALC880_MEDION_RIM] = {
3634 .mixers = { alc880_medion_rim_mixer },
3635 .init_verbs = { alc880_volume_init_verbs,
3636 alc880_medion_rim_init_verbs,
3637 alc_gpio2_init_verbs },
3638 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3639 .dac_nids = alc880_dac_nids,
3640 .dig_out_nid = ALC880_DIGOUT_NID,
3641 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3642 .channel_mode = alc880_2_jack_modes,
3643 .input_mux = &alc880_medion_rim_capture_source,
3644 .unsol_event = alc880_medion_rim_unsol_event,
3645 .init_hook = alc880_medion_rim_automute,
3647 #ifdef CONFIG_SND_DEBUG
3649 .mixers = { alc880_test_mixer },
3650 .init_verbs = { alc880_test_init_verbs },
3651 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3652 .dac_nids = alc880_test_dac_nids,
3653 .dig_out_nid = ALC880_DIGOUT_NID,
3654 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3655 .channel_mode = alc880_test_modes,
3656 .input_mux = &alc880_test_capture_source,
3662 * Automatic parse of I/O pins from the BIOS configuration
3667 ALC_CTL_WIDGET_MUTE,
3670 static struct snd_kcontrol_new alc880_control_templates[] = {
3671 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3672 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3673 HDA_BIND_MUTE(NULL, 0, 0, 0),
3676 /* add dynamic controls */
3677 static int add_control(struct alc_spec *spec, int type, const char *name,
3680 struct snd_kcontrol_new *knew;
3682 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3683 knew = snd_array_new(&spec->kctls);
3686 *knew = alc880_control_templates[type];
3687 knew->name = kstrdup(name, GFP_KERNEL);
3690 knew->private_value = val;
3694 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3695 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3696 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3697 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3698 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3699 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3700 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3701 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3702 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3703 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3704 #define ALC880_PIN_CD_NID 0x1c
3706 /* fill in the dac_nids table from the parsed pin configuration */
3707 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3708 const struct auto_pin_cfg *cfg)
3714 memset(assigned, 0, sizeof(assigned));
3715 spec->multiout.dac_nids = spec->private_dac_nids;
3717 /* check the pins hardwired to audio widget */
3718 for (i = 0; i < cfg->line_outs; i++) {
3719 nid = cfg->line_out_pins[i];
3720 if (alc880_is_fixed_pin(nid)) {
3721 int idx = alc880_fixed_pin_idx(nid);
3722 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3726 /* left pins can be connect to any audio widget */
3727 for (i = 0; i < cfg->line_outs; i++) {
3728 nid = cfg->line_out_pins[i];
3729 if (alc880_is_fixed_pin(nid))
3731 /* search for an empty channel */
3732 for (j = 0; j < cfg->line_outs; j++) {
3734 spec->multiout.dac_nids[i] =
3735 alc880_idx_to_dac(j);
3741 spec->multiout.num_dacs = cfg->line_outs;
3745 /* add playback controls from the parsed DAC table */
3746 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3747 const struct auto_pin_cfg *cfg)
3750 static const char *chname[4] = {
3751 "Front", "Surround", NULL /*CLFE*/, "Side"
3756 for (i = 0; i < cfg->line_outs; i++) {
3757 if (!spec->multiout.dac_nids[i])
3759 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3762 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3763 "Center Playback Volume",
3764 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3768 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3769 "LFE Playback Volume",
3770 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3774 err = add_control(spec, ALC_CTL_BIND_MUTE,
3775 "Center Playback Switch",
3776 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3780 err = add_control(spec, ALC_CTL_BIND_MUTE,
3781 "LFE Playback Switch",
3782 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3787 sprintf(name, "%s Playback Volume", chname[i]);
3788 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3789 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3793 sprintf(name, "%s Playback Switch", chname[i]);
3794 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3795 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3804 /* add playback controls for speaker and HP outputs */
3805 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3815 if (alc880_is_fixed_pin(pin)) {
3816 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3817 /* specify the DAC as the extra output */
3818 if (!spec->multiout.hp_nid)
3819 spec->multiout.hp_nid = nid;
3821 spec->multiout.extra_out_nid[0] = nid;
3822 /* control HP volume/switch on the output mixer amp */
3823 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3824 sprintf(name, "%s Playback Volume", pfx);
3825 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3826 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3829 sprintf(name, "%s Playback Switch", pfx);
3830 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3831 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3834 } else if (alc880_is_multi_pin(pin)) {
3835 /* set manual connection */
3836 /* we have only a switch on HP-out PIN */
3837 sprintf(name, "%s Playback Switch", pfx);
3838 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3839 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3846 /* create input playback/capture controls for the given pin */
3847 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3848 const char *ctlname,
3849 int idx, hda_nid_t mix_nid)
3854 sprintf(name, "%s Playback Volume", ctlname);
3855 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3856 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3859 sprintf(name, "%s Playback Switch", ctlname);
3860 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3861 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3867 /* create playback/capture controls for input pins */
3868 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3869 const struct auto_pin_cfg *cfg)
3871 struct hda_input_mux *imux = &spec->private_imux;
3874 for (i = 0; i < AUTO_PIN_LAST; i++) {
3875 if (alc880_is_input_pin(cfg->input_pins[i])) {
3876 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3877 err = new_analog_input(spec, cfg->input_pins[i],
3878 auto_pin_cfg_labels[i],
3882 imux->items[imux->num_items].label =
3883 auto_pin_cfg_labels[i];
3884 imux->items[imux->num_items].index =
3885 alc880_input_pin_idx(cfg->input_pins[i]);
3892 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3893 unsigned int pin_type)
3895 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3898 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3902 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3903 hda_nid_t nid, int pin_type,
3906 alc_set_pin_output(codec, nid, pin_type);
3907 /* need the manual connection? */
3908 if (alc880_is_multi_pin(nid)) {
3909 struct alc_spec *spec = codec->spec;
3910 int idx = alc880_multi_pin_idx(nid);
3911 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3912 AC_VERB_SET_CONNECT_SEL,
3913 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3917 static int get_pin_type(int line_out_type)
3919 if (line_out_type == AUTO_PIN_HP_OUT)
3925 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3927 struct alc_spec *spec = codec->spec;
3930 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3931 for (i = 0; i < spec->autocfg.line_outs; i++) {
3932 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3933 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3934 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3938 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3940 struct alc_spec *spec = codec->spec;
3943 pin = spec->autocfg.speaker_pins[0];
3944 if (pin) /* connect to front */
3945 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3946 pin = spec->autocfg.hp_pins[0];
3947 if (pin) /* connect to front */
3948 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3951 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3953 struct alc_spec *spec = codec->spec;
3956 for (i = 0; i < AUTO_PIN_LAST; i++) {
3957 hda_nid_t nid = spec->autocfg.input_pins[i];
3958 if (alc880_is_input_pin(nid)) {
3959 snd_hda_codec_write(codec, nid, 0,
3960 AC_VERB_SET_PIN_WIDGET_CONTROL,
3961 i <= AUTO_PIN_FRONT_MIC ?
3962 PIN_VREF80 : PIN_IN);
3963 if (nid != ALC880_PIN_CD_NID)
3964 snd_hda_codec_write(codec, nid, 0,
3965 AC_VERB_SET_AMP_GAIN_MUTE,
3971 /* parse the BIOS configuration and set up the alc_spec */
3972 /* return 1 if successful, 0 if the proper config is not found,
3973 * or a negative error code
3975 static int alc880_parse_auto_config(struct hda_codec *codec)
3977 struct alc_spec *spec = codec->spec;
3979 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3981 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3985 if (!spec->autocfg.line_outs)
3986 return 0; /* can't find valid BIOS pin config */
3988 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3991 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3994 err = alc880_auto_create_extra_out(spec,
3995 spec->autocfg.speaker_pins[0],
3999 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4003 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4007 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4009 if (spec->autocfg.dig_out_pin)
4010 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4011 if (spec->autocfg.dig_in_pin)
4012 spec->dig_in_nid = ALC880_DIGIN_NID;
4014 if (spec->kctls.list)
4015 add_mixer(spec, spec->kctls.list);
4017 add_verb(spec, alc880_volume_init_verbs);
4019 spec->num_mux_defs = 1;
4020 spec->input_mux = &spec->private_imux;
4022 store_pin_configs(codec);
4026 /* additional initialization for auto-configuration model */
4027 static void alc880_auto_init(struct hda_codec *codec)
4029 struct alc_spec *spec = codec->spec;
4030 alc880_auto_init_multi_out(codec);
4031 alc880_auto_init_extra_out(codec);
4032 alc880_auto_init_analog_input(codec);
4033 if (spec->unsol_event)
4034 alc_inithook(codec);
4038 * OK, here we have finally the patch for ALC880
4041 static void set_capture_mixer(struct alc_spec *spec)
4043 static struct snd_kcontrol_new *caps[3] = {
4048 if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3)
4049 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4052 static int patch_alc880(struct hda_codec *codec)
4054 struct alc_spec *spec;
4058 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4064 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4067 if (board_config < 0) {
4068 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4069 "trying auto-probe from BIOS...\n");
4070 board_config = ALC880_AUTO;
4073 if (board_config == ALC880_AUTO) {
4074 /* automatic parse from the BIOS config */
4075 err = alc880_parse_auto_config(codec);
4081 "hda_codec: Cannot set up configuration "
4082 "from BIOS. Using 3-stack mode...\n");
4083 board_config = ALC880_3ST;
4087 if (board_config != ALC880_AUTO)
4088 setup_preset(spec, &alc880_presets[board_config]);
4090 spec->stream_name_analog = "ALC880 Analog";
4091 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4092 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4093 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4095 spec->stream_name_digital = "ALC880 Digital";
4096 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4097 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4099 if (!spec->adc_nids && spec->input_mux) {
4100 /* check whether NID 0x07 is valid */
4101 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4103 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4104 if (wcap != AC_WID_AUD_IN) {
4105 spec->adc_nids = alc880_adc_nids_alt;
4106 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4108 spec->adc_nids = alc880_adc_nids;
4109 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4112 set_capture_mixer(spec);
4114 spec->vmaster_nid = 0x0c;
4116 codec->patch_ops = alc_patch_ops;
4117 if (board_config == ALC880_AUTO)
4118 spec->init_hook = alc880_auto_init;
4119 #ifdef CONFIG_SND_HDA_POWER_SAVE
4120 if (!spec->loopback.amplist)
4121 spec->loopback.amplist = alc880_loopbacks;
4132 static hda_nid_t alc260_dac_nids[1] = {
4137 static hda_nid_t alc260_adc_nids[1] = {
4142 static hda_nid_t alc260_adc_nids_alt[1] = {
4147 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4148 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4150 static hda_nid_t alc260_dual_adc_nids[2] = {
4155 #define ALC260_DIGOUT_NID 0x03
4156 #define ALC260_DIGIN_NID 0x06
4158 static struct hda_input_mux alc260_capture_source = {
4162 { "Front Mic", 0x1 },
4168 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4169 * headphone jack and the internal CD lines since these are the only pins at
4170 * which audio can appear. For flexibility, also allow the option of
4171 * recording the mixer output on the second ADC (ADC0 doesn't have a
4172 * connection to the mixer output).
4174 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4178 { "Mic/Line", 0x0 },
4180 { "Headphone", 0x2 },
4186 { "Mic/Line", 0x0 },
4188 { "Headphone", 0x2 },
4195 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4196 * the Fujitsu S702x, but jacks are marked differently.
4198 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4205 { "Headphone", 0x5 },
4214 { "Headphone", 0x6 },
4220 * This is just place-holder, so there's something for alc_build_pcms to look
4221 * at when it calculates the maximum number of channels. ALC260 has no mixer
4222 * element which allows changing the channel mode, so the verb list is
4225 static struct hda_channel_mode alc260_modes[1] = {
4230 /* Mixer combinations
4232 * basic: base_output + input + pc_beep + capture
4233 * HP: base_output + input + capture_alt
4234 * HP_3013: hp_3013 + input + capture
4235 * fujitsu: fujitsu + capture
4236 * acer: acer + capture
4239 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4240 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4241 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4242 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4243 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4244 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4245 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4249 static struct snd_kcontrol_new alc260_input_mixer[] = {
4250 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4251 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4252 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4253 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4255 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4256 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4257 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4261 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4262 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4263 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4267 /* update HP, line and mono out pins according to the master switch */
4268 static void alc260_hp_master_update(struct hda_codec *codec,
4269 hda_nid_t hp, hda_nid_t line,
4272 struct alc_spec *spec = codec->spec;
4273 unsigned int val = spec->master_sw ? PIN_HP : 0;
4274 /* change HP and line-out pins */
4275 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4277 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4279 /* mono (speaker) depending on the HP jack sense */
4280 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4281 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4285 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4286 struct snd_ctl_elem_value *ucontrol)
4288 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4289 struct alc_spec *spec = codec->spec;
4290 *ucontrol->value.integer.value = spec->master_sw;
4294 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4295 struct snd_ctl_elem_value *ucontrol)
4297 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4298 struct alc_spec *spec = codec->spec;
4299 int val = !!*ucontrol->value.integer.value;
4300 hda_nid_t hp, line, mono;
4302 if (val == spec->master_sw)
4304 spec->master_sw = val;
4305 hp = (kcontrol->private_value >> 16) & 0xff;
4306 line = (kcontrol->private_value >> 8) & 0xff;
4307 mono = kcontrol->private_value & 0xff;
4308 alc260_hp_master_update(codec, hp, line, mono);
4312 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4314 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4315 .name = "Master Playback Switch",
4316 .info = snd_ctl_boolean_mono_info,
4317 .get = alc260_hp_master_sw_get,
4318 .put = alc260_hp_master_sw_put,
4319 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4321 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4322 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4323 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4324 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4325 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4327 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4331 static struct hda_verb alc260_hp_unsol_verbs[] = {
4332 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4336 static void alc260_hp_automute(struct hda_codec *codec)
4338 struct alc_spec *spec = codec->spec;
4339 unsigned int present;
4341 present = snd_hda_codec_read(codec, 0x10, 0,
4342 AC_VERB_GET_PIN_SENSE, 0);
4343 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4344 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4347 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4349 if ((res >> 26) == ALC880_HP_EVENT)
4350 alc260_hp_automute(codec);
4353 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4355 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4356 .name = "Master Playback Switch",
4357 .info = snd_ctl_boolean_mono_info,
4358 .get = alc260_hp_master_sw_get,
4359 .put = alc260_hp_master_sw_put,
4360 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4362 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4363 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4364 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4365 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4366 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4367 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4368 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4369 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4373 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4374 .ops = &snd_hda_bind_vol,
4376 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4377 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4378 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4383 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4384 .ops = &snd_hda_bind_sw,
4386 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4387 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4392 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4393 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4394 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4395 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4396 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4400 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4401 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4405 static void alc260_hp_3013_automute(struct hda_codec *codec)
4407 struct alc_spec *spec = codec->spec;
4408 unsigned int present;
4410 present = snd_hda_codec_read(codec, 0x15, 0,
4411 AC_VERB_GET_PIN_SENSE, 0);
4412 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4413 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4416 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4419 if ((res >> 26) == ALC880_HP_EVENT)
4420 alc260_hp_3013_automute(codec);
4423 static void alc260_hp_3012_automute(struct hda_codec *codec)
4425 unsigned int present, bits;
4427 present = snd_hda_codec_read(codec, 0x10, 0,
4428 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4430 bits = present ? 0 : PIN_OUT;
4431 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4433 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4435 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4439 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4442 if ((res >> 26) == ALC880_HP_EVENT)
4443 alc260_hp_3012_automute(codec);
4446 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4447 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4449 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4450 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4451 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4452 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4453 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4454 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4455 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4456 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4457 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4458 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4459 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4460 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4461 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4465 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4466 * versions of the ALC260 don't act on requests to enable mic bias from NID
4467 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4468 * datasheet doesn't mention this restriction. At this stage it's not clear
4469 * whether this behaviour is intentional or is a hardware bug in chip
4470 * revisions available in early 2006. Therefore for now allow the
4471 * "Headphone Jack Mode" control to span all choices, but if it turns out
4472 * that the lack of mic bias for this NID is intentional we could change the
4473 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4475 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4476 * don't appear to make the mic bias available from the "line" jack, even
4477 * though the NID used for this jack (0x14) can supply it. The theory is
4478 * that perhaps Acer have included blocking capacitors between the ALC260
4479 * and the output jack. If this turns out to be the case for all such
4480 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4481 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4483 * The C20x Tablet series have a mono internal speaker which is controlled
4484 * via the chip's Mono sum widget and pin complex, so include the necessary
4485 * controls for such models. On models without a "mono speaker" the control
4486 * won't do anything.
4488 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4489 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4490 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4491 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4492 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4494 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4496 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4497 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4499 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4500 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4501 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4502 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4503 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4504 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4505 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4509 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4510 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4512 static struct snd_kcontrol_new alc260_will_mixer[] = {
4513 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4514 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4516 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4517 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4518 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4519 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4520 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4521 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4522 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4523 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4524 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4528 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4529 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4531 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4532 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4533 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4534 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4535 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4536 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4537 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4538 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4539 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4540 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4541 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4546 * initialization verbs
4548 static struct hda_verb alc260_init_verbs[] = {
4549 /* Line In pin widget for input */
4550 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4551 /* CD pin widget for input */
4552 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4553 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4554 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4555 /* Mic2 (front panel) pin widget for input and vref at 80% */
4556 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4557 /* LINE-2 is used for line-out in rear */
4558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4559 /* select line-out */
4560 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4562 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4564 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4566 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4567 /* mute capture amp left and right */
4568 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4569 /* set connection select to line in (default select for this ADC) */
4570 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4571 /* mute capture amp left and right */
4572 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4573 /* set connection select to line in (default select for this ADC) */
4574 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4575 /* set vol=0 Line-Out mixer amp left and right */
4576 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4577 /* unmute pin widget amp left and right (no gain on this amp) */
4578 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4579 /* set vol=0 HP mixer amp left and right */
4580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4581 /* unmute pin widget amp left and right (no gain on this amp) */
4582 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4583 /* set vol=0 Mono mixer amp left and right */
4584 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4585 /* unmute pin widget amp left and right (no gain on this amp) */
4586 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4587 /* unmute LINE-2 out pin */
4588 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4589 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4592 /* mute analog inputs */
4593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4598 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4599 /* mute Front out path */
4600 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4602 /* mute Headphone out path */
4603 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4604 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4605 /* mute Mono out path */
4606 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4607 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4611 #if 0 /* should be identical with alc260_init_verbs? */
4612 static struct hda_verb alc260_hp_init_verbs[] = {
4613 /* Headphone and output */
4614 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4616 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4617 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4618 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4619 /* Mic2 (front panel) pin widget for input and vref at 80% */
4620 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4621 /* Line In pin widget for input */
4622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4623 /* Line-2 pin widget for output */
4624 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4625 /* CD pin widget for input */
4626 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4627 /* unmute amp left and right */
4628 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4629 /* set connection select to line in (default select for this ADC) */
4630 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4631 /* unmute Line-Out mixer amp left and right (volume = 0) */
4632 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4633 /* mute pin widget amp left and right (no gain on this amp) */
4634 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4635 /* unmute HP mixer amp left and right (volume = 0) */
4636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4637 /* mute pin widget amp left and right (no gain on this amp) */
4638 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4639 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4642 /* mute analog inputs */
4643 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4644 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4645 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4648 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4649 /* Unmute Front out path */
4650 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4651 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4652 /* Unmute Headphone out path */
4653 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4655 /* Unmute Mono out path */
4656 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4657 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4662 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4663 /* Line out and output */
4664 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4666 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4667 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4668 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4669 /* Mic2 (front panel) pin widget for input and vref at 80% */
4670 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4671 /* Line In pin widget for input */
4672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4673 /* Headphone pin widget for output */
4674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4675 /* CD pin widget for input */
4676 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4677 /* unmute amp left and right */
4678 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4679 /* set connection select to line in (default select for this ADC) */
4680 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4681 /* unmute Line-Out mixer amp left and right (volume = 0) */
4682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4683 /* mute pin widget amp left and right (no gain on this amp) */
4684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4685 /* unmute HP mixer amp left and right (volume = 0) */
4686 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4687 /* mute pin widget amp left and right (no gain on this amp) */
4688 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4689 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4692 /* mute analog inputs */
4693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4698 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4699 /* Unmute Front out path */
4700 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4701 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4702 /* Unmute Headphone out path */
4703 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4704 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4705 /* Unmute Mono out path */
4706 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4707 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4711 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4712 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4713 * audio = 0x16, internal speaker = 0x10.
4715 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4716 /* Disable all GPIOs */
4717 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4718 /* Internal speaker is connected to headphone pin */
4719 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4720 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4721 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4722 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4723 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4724 /* Ensure all other unused pins are disabled and muted. */
4725 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4727 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4728 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4729 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4730 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4734 /* Disable digital (SPDIF) pins */
4735 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4736 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4738 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4739 * when acting as an output.
4741 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4743 /* Start with output sum widgets muted and their output gains at min */
4744 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4745 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4746 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4747 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4748 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4749 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4750 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4751 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4752 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4754 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4755 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4756 /* Unmute Line1 pin widget output buffer since it starts as an output.
4757 * If the pin mode is changed by the user the pin mode control will
4758 * take care of enabling the pin's input/output buffers as needed.
4759 * Therefore there's no need to enable the input buffer at this
4762 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4763 /* Unmute input buffer of pin widget used for Line-in (no equiv
4766 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4768 /* Mute capture amp left and right */
4769 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4770 /* Set ADC connection select to match default mixer setting - line
4773 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4775 /* Do the same for the second ADC: mute capture input amp and
4776 * set ADC connection to line in (on mic1 pin)
4778 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4779 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4781 /* Mute all inputs to mixer widget (even unconnected ones) */
4782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4786 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4787 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4788 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4789 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4794 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4795 * similar laptops (adapted from Fujitsu init verbs).
4797 static struct hda_verb alc260_acer_init_verbs[] = {
4798 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4799 * the headphone jack. Turn this on and rely on the standard mute
4800 * methods whenever the user wants to turn these outputs off.
4802 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4803 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4804 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4805 /* Internal speaker/Headphone jack is connected to Line-out pin */
4806 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4807 /* Internal microphone/Mic jack is connected to Mic1 pin */
4808 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4809 /* Line In jack is connected to Line1 pin */
4810 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4811 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4812 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4813 /* Ensure all other unused pins are disabled and muted. */
4814 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4815 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4816 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4817 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4818 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4820 /* Disable digital (SPDIF) pins */
4821 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4822 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4824 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4825 * bus when acting as outputs.
4827 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4828 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4830 /* Start with output sum widgets muted and their output gains at min */
4831 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4832 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4833 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4834 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4835 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4836 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4837 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4838 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4839 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4841 /* Unmute Line-out pin widget amp left and right
4842 * (no equiv mixer ctrl)
4844 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4845 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4846 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4847 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4848 * inputs. If the pin mode is changed by the user the pin mode control
4849 * will take care of enabling the pin's input/output buffers as needed.
4850 * Therefore there's no need to enable the input buffer at this
4853 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4854 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4856 /* Mute capture amp left and right */
4857 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4858 /* Set ADC connection select to match default mixer setting - mic
4861 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4863 /* Do similar with the second ADC: mute capture input amp and
4864 * set ADC connection to mic to match ALSA's default state.
4866 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4867 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4869 /* Mute all inputs to mixer widget (even unconnected ones) */
4870 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4871 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4872 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4873 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4874 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4875 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4876 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4877 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4882 static struct hda_verb alc260_will_verbs[] = {
4883 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4884 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4885 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4886 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4887 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4888 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4892 static struct hda_verb alc260_replacer_672v_verbs[] = {
4893 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4894 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4895 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4897 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4898 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4899 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4901 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4905 /* toggle speaker-output according to the hp-jack state */
4906 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4908 unsigned int present;
4910 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4911 present = snd_hda_codec_read(codec, 0x0f, 0,
4912 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4914 snd_hda_codec_write_cache(codec, 0x01, 0,
4915 AC_VERB_SET_GPIO_DATA, 1);
4916 snd_hda_codec_write_cache(codec, 0x0f, 0,
4917 AC_VERB_SET_PIN_WIDGET_CONTROL,
4920 snd_hda_codec_write_cache(codec, 0x01, 0,
4921 AC_VERB_SET_GPIO_DATA, 0);
4922 snd_hda_codec_write_cache(codec, 0x0f, 0,
4923 AC_VERB_SET_PIN_WIDGET_CONTROL,
4928 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4931 if ((res >> 26) == ALC880_HP_EVENT)
4932 alc260_replacer_672v_automute(codec);
4935 static struct hda_verb alc260_hp_dc7600_verbs[] = {
4936 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4937 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4938 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4939 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4940 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4942 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4943 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4944 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4945 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4949 /* Test configuration for debugging, modelled after the ALC880 test
4952 #ifdef CONFIG_SND_DEBUG
4953 static hda_nid_t alc260_test_dac_nids[1] = {
4956 static hda_nid_t alc260_test_adc_nids[2] = {
4959 /* For testing the ALC260, each input MUX needs its own definition since
4960 * the signal assignments are different. This assumes that the first ADC
4963 static struct hda_input_mux alc260_test_capture_sources[2] = {
4967 { "MIC1 pin", 0x0 },
4968 { "MIC2 pin", 0x1 },
4969 { "LINE1 pin", 0x2 },
4970 { "LINE2 pin", 0x3 },
4972 { "LINE-OUT pin", 0x5 },
4973 { "HP-OUT pin", 0x6 },
4979 { "MIC1 pin", 0x0 },
4980 { "MIC2 pin", 0x1 },
4981 { "LINE1 pin", 0x2 },
4982 { "LINE2 pin", 0x3 },
4985 { "LINE-OUT pin", 0x6 },
4986 { "HP-OUT pin", 0x7 },
4990 static struct snd_kcontrol_new alc260_test_mixer[] = {
4991 /* Output driver widgets */
4992 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4993 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4994 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4995 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4996 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4997 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4999 /* Modes for retasking pin widgets
5000 * Note: the ALC260 doesn't seem to act on requests to enable mic
5001 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5002 * mention this restriction. At this stage it's not clear whether
5003 * this behaviour is intentional or is a hardware bug in chip
5004 * revisions available at least up until early 2006. Therefore for
5005 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5006 * choices, but if it turns out that the lack of mic bias for these
5007 * NIDs is intentional we could change their modes from
5008 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5010 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5011 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5012 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5013 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5014 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5015 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5017 /* Loopback mixer controls */
5018 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5019 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5020 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5021 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5022 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5023 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5024 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5025 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5026 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5027 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5028 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5029 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5030 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5031 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5032 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5033 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5035 /* Controls for GPIO pins, assuming they are configured as outputs */
5036 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5037 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5038 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5039 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5041 /* Switches to allow the digital IO pins to be enabled. The datasheet
5042 * is ambigious as to which NID is which; testing on laptops which
5043 * make this output available should provide clarification.
5045 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5046 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5048 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5049 * this output to turn on an external amplifier.
5051 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5052 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5056 static struct hda_verb alc260_test_init_verbs[] = {
5057 /* Enable all GPIOs as outputs with an initial value of 0 */
5058 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5059 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5060 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5062 /* Enable retasking pins as output, initially without power amp */
5063 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5064 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5066 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5067 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5068 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5070 /* Disable digital (SPDIF) pins initially, but users can enable
5071 * them via a mixer switch. In the case of SPDIF-out, this initverb
5072 * payload also sets the generation to 0, output to be in "consumer"
5073 * PCM format, copyright asserted, no pre-emphasis and no validity
5076 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5077 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5079 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5080 * OUT1 sum bus when acting as an output.
5082 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5083 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5084 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5085 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5087 /* Start with output sum widgets muted and their output gains at min */
5088 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5090 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5092 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5093 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5094 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5095 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5096 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5098 /* Unmute retasking pin widget output buffers since the default
5099 * state appears to be output. As the pin mode is changed by the
5100 * user the pin mode control will take care of enabling the pin's
5101 * input/output buffers as needed.
5103 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5107 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5108 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5109 /* Also unmute the mono-out pin widget */
5110 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5112 /* Mute capture amp left and right */
5113 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5114 /* Set ADC connection select to match default mixer setting (mic1
5117 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5119 /* Do the same for the second ADC: mute capture input amp and
5120 * set ADC connection to mic1 pin
5122 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5123 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5125 /* Mute all inputs to mixer widget (even unconnected ones) */
5126 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5133 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5139 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5140 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5142 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5143 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5146 * for BIOS auto-configuration
5149 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5150 const char *pfx, int *vol_bits)
5153 unsigned long vol_val, sw_val;
5157 if (nid >= 0x0f && nid < 0x11) {
5158 nid_vol = nid - 0x7;
5159 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5160 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5161 } else if (nid == 0x11) {
5162 nid_vol = nid - 0x7;
5163 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5164 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5165 } else if (nid >= 0x12 && nid <= 0x15) {
5167 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5168 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5172 if (!(*vol_bits & (1 << nid_vol))) {
5173 /* first control for the volume widget */
5174 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5175 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5178 *vol_bits |= (1 << nid_vol);
5180 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5181 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5187 /* add playback controls from the parsed DAC table */
5188 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5189 const struct auto_pin_cfg *cfg)
5195 spec->multiout.num_dacs = 1;
5196 spec->multiout.dac_nids = spec->private_dac_nids;
5197 spec->multiout.dac_nids[0] = 0x02;
5199 nid = cfg->line_out_pins[0];
5201 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5206 nid = cfg->speaker_pins[0];
5208 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5213 nid = cfg->hp_pins[0];
5215 err = alc260_add_playback_controls(spec, nid, "Headphone",
5223 /* create playback/capture controls for input pins */
5224 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5225 const struct auto_pin_cfg *cfg)
5227 struct hda_input_mux *imux = &spec->private_imux;
5230 for (i = 0; i < AUTO_PIN_LAST; i++) {
5231 if (cfg->input_pins[i] >= 0x12) {
5232 idx = cfg->input_pins[i] - 0x12;
5233 err = new_analog_input(spec, cfg->input_pins[i],
5234 auto_pin_cfg_labels[i], idx,
5238 imux->items[imux->num_items].label =
5239 auto_pin_cfg_labels[i];
5240 imux->items[imux->num_items].index = idx;
5243 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5244 idx = cfg->input_pins[i] - 0x09;
5245 err = new_analog_input(spec, cfg->input_pins[i],
5246 auto_pin_cfg_labels[i], idx,
5250 imux->items[imux->num_items].label =
5251 auto_pin_cfg_labels[i];
5252 imux->items[imux->num_items].index = idx;
5259 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5260 hda_nid_t nid, int pin_type,
5263 alc_set_pin_output(codec, nid, pin_type);
5264 /* need the manual connection? */
5266 int idx = nid - 0x12;
5267 snd_hda_codec_write(codec, idx + 0x0b, 0,
5268 AC_VERB_SET_CONNECT_SEL, sel_idx);
5272 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5274 struct alc_spec *spec = codec->spec;
5277 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5278 nid = spec->autocfg.line_out_pins[0];
5280 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5281 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5284 nid = spec->autocfg.speaker_pins[0];
5286 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5288 nid = spec->autocfg.hp_pins[0];
5290 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5293 #define ALC260_PIN_CD_NID 0x16
5294 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5296 struct alc_spec *spec = codec->spec;
5299 for (i = 0; i < AUTO_PIN_LAST; i++) {
5300 hda_nid_t nid = spec->autocfg.input_pins[i];
5302 snd_hda_codec_write(codec, nid, 0,
5303 AC_VERB_SET_PIN_WIDGET_CONTROL,
5304 i <= AUTO_PIN_FRONT_MIC ?
5305 PIN_VREF80 : PIN_IN);
5306 if (nid != ALC260_PIN_CD_NID)
5307 snd_hda_codec_write(codec, nid, 0,
5308 AC_VERB_SET_AMP_GAIN_MUTE,
5315 * generic initialization of ADC, input mixers and output mixers
5317 static struct hda_verb alc260_volume_init_verbs[] = {
5319 * Unmute ADC0-1 and set the default input to mic-in
5321 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5322 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5323 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5324 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5326 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5328 * Note: PASD motherboards uses the Line In 2 as the input for
5329 * front panel mic (mic 2)
5331 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5332 /* mute analog inputs */
5333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5340 * Set up output mixers (0x08 - 0x0a)
5342 /* set vol=0 to output mixers */
5343 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5344 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5346 /* set up input amps for analog loopback */
5347 /* Amp Indices: DAC = 0, mixer = 1 */
5348 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5349 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5350 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5351 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5352 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5353 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5358 static int alc260_parse_auto_config(struct hda_codec *codec)
5360 struct alc_spec *spec = codec->spec;
5362 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5364 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5368 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5371 if (!spec->kctls.list)
5372 return 0; /* can't find valid BIOS pin config */
5373 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5377 spec->multiout.max_channels = 2;
5379 if (spec->autocfg.dig_out_pin)
5380 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5381 if (spec->kctls.list)
5382 add_mixer(spec, spec->kctls.list);
5384 add_verb(spec, alc260_volume_init_verbs);
5386 spec->num_mux_defs = 1;
5387 spec->input_mux = &spec->private_imux;
5389 store_pin_configs(codec);
5393 /* additional initialization for auto-configuration model */
5394 static void alc260_auto_init(struct hda_codec *codec)
5396 struct alc_spec *spec = codec->spec;
5397 alc260_auto_init_multi_out(codec);
5398 alc260_auto_init_analog_input(codec);
5399 if (spec->unsol_event)
5400 alc_inithook(codec);
5403 #ifdef CONFIG_SND_HDA_POWER_SAVE
5404 static struct hda_amp_list alc260_loopbacks[] = {
5405 { 0x07, HDA_INPUT, 0 },
5406 { 0x07, HDA_INPUT, 1 },
5407 { 0x07, HDA_INPUT, 2 },
5408 { 0x07, HDA_INPUT, 3 },
5409 { 0x07, HDA_INPUT, 4 },
5415 * ALC260 configurations
5417 static const char *alc260_models[ALC260_MODEL_LAST] = {
5418 [ALC260_BASIC] = "basic",
5420 [ALC260_HP_3013] = "hp-3013",
5421 [ALC260_HP_DC7600] = "hp-dc7600",
5422 [ALC260_FUJITSU_S702X] = "fujitsu",
5423 [ALC260_ACER] = "acer",
5424 [ALC260_WILL] = "will",
5425 [ALC260_REPLACER_672V] = "replacer",
5426 #ifdef CONFIG_SND_DEBUG
5427 [ALC260_TEST] = "test",
5429 [ALC260_AUTO] = "auto",
5432 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5433 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5434 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5435 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5436 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5437 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5438 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5439 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5440 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5441 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5442 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5443 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5444 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5445 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5446 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5447 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5448 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5449 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5450 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5454 static struct alc_config_preset alc260_presets[] = {
5456 .mixers = { alc260_base_output_mixer,
5458 alc260_pc_beep_mixer },
5459 .init_verbs = { alc260_init_verbs },
5460 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5461 .dac_nids = alc260_dac_nids,
5462 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5463 .adc_nids = alc260_adc_nids,
5464 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5465 .channel_mode = alc260_modes,
5466 .input_mux = &alc260_capture_source,
5469 .mixers = { alc260_hp_output_mixer,
5470 alc260_input_mixer },
5471 .init_verbs = { alc260_init_verbs,
5472 alc260_hp_unsol_verbs },
5473 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5474 .dac_nids = alc260_dac_nids,
5475 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5476 .adc_nids = alc260_adc_nids_alt,
5477 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5478 .channel_mode = alc260_modes,
5479 .input_mux = &alc260_capture_source,
5480 .unsol_event = alc260_hp_unsol_event,
5481 .init_hook = alc260_hp_automute,
5483 [ALC260_HP_DC7600] = {
5484 .mixers = { alc260_hp_dc7600_mixer,
5485 alc260_input_mixer },
5486 .init_verbs = { alc260_init_verbs,
5487 alc260_hp_dc7600_verbs },
5488 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5489 .dac_nids = alc260_dac_nids,
5490 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5491 .adc_nids = alc260_adc_nids_alt,
5492 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5493 .channel_mode = alc260_modes,
5494 .input_mux = &alc260_capture_source,
5495 .unsol_event = alc260_hp_3012_unsol_event,
5496 .init_hook = alc260_hp_3012_automute,
5498 [ALC260_HP_3013] = {
5499 .mixers = { alc260_hp_3013_mixer,
5500 alc260_input_mixer },
5501 .init_verbs = { alc260_hp_3013_init_verbs,
5502 alc260_hp_3013_unsol_verbs },
5503 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5504 .dac_nids = alc260_dac_nids,
5505 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5506 .adc_nids = alc260_adc_nids_alt,
5507 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5508 .channel_mode = alc260_modes,
5509 .input_mux = &alc260_capture_source,
5510 .unsol_event = alc260_hp_3013_unsol_event,
5511 .init_hook = alc260_hp_3013_automute,
5513 [ALC260_FUJITSU_S702X] = {
5514 .mixers = { alc260_fujitsu_mixer },
5515 .init_verbs = { alc260_fujitsu_init_verbs },
5516 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5517 .dac_nids = alc260_dac_nids,
5518 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5519 .adc_nids = alc260_dual_adc_nids,
5520 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5521 .channel_mode = alc260_modes,
5522 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5523 .input_mux = alc260_fujitsu_capture_sources,
5526 .mixers = { alc260_acer_mixer },
5527 .init_verbs = { alc260_acer_init_verbs },
5528 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5529 .dac_nids = alc260_dac_nids,
5530 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5531 .adc_nids = alc260_dual_adc_nids,
5532 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5533 .channel_mode = alc260_modes,
5534 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5535 .input_mux = alc260_acer_capture_sources,
5538 .mixers = { alc260_will_mixer },
5539 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5540 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5541 .dac_nids = alc260_dac_nids,
5542 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5543 .adc_nids = alc260_adc_nids,
5544 .dig_out_nid = ALC260_DIGOUT_NID,
5545 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5546 .channel_mode = alc260_modes,
5547 .input_mux = &alc260_capture_source,
5549 [ALC260_REPLACER_672V] = {
5550 .mixers = { alc260_replacer_672v_mixer },
5551 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5552 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5553 .dac_nids = alc260_dac_nids,
5554 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5555 .adc_nids = alc260_adc_nids,
5556 .dig_out_nid = ALC260_DIGOUT_NID,
5557 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5558 .channel_mode = alc260_modes,
5559 .input_mux = &alc260_capture_source,
5560 .unsol_event = alc260_replacer_672v_unsol_event,
5561 .init_hook = alc260_replacer_672v_automute,
5563 #ifdef CONFIG_SND_DEBUG
5565 .mixers = { alc260_test_mixer },
5566 .init_verbs = { alc260_test_init_verbs },
5567 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5568 .dac_nids = alc260_test_dac_nids,
5569 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5570 .adc_nids = alc260_test_adc_nids,
5571 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5572 .channel_mode = alc260_modes,
5573 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5574 .input_mux = alc260_test_capture_sources,
5579 static int patch_alc260(struct hda_codec *codec)
5581 struct alc_spec *spec;
5582 int err, board_config;
5584 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5590 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5593 if (board_config < 0) {
5594 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5595 "trying auto-probe from BIOS...\n");
5596 board_config = ALC260_AUTO;
5599 if (board_config == ALC260_AUTO) {
5600 /* automatic parse from the BIOS config */
5601 err = alc260_parse_auto_config(codec);
5607 "hda_codec: Cannot set up configuration "
5608 "from BIOS. Using base mode...\n");
5609 board_config = ALC260_BASIC;
5613 if (board_config != ALC260_AUTO)
5614 setup_preset(spec, &alc260_presets[board_config]);
5616 spec->stream_name_analog = "ALC260 Analog";
5617 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5618 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5620 spec->stream_name_digital = "ALC260 Digital";
5621 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5622 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5624 if (!spec->adc_nids && spec->input_mux) {
5625 /* check whether NID 0x04 is valid */
5626 unsigned int wcap = get_wcaps(codec, 0x04);
5627 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5629 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5630 spec->adc_nids = alc260_adc_nids_alt;
5631 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5633 spec->adc_nids = alc260_adc_nids;
5634 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5637 set_capture_mixer(spec);
5639 spec->vmaster_nid = 0x08;
5641 codec->patch_ops = alc_patch_ops;
5642 if (board_config == ALC260_AUTO)
5643 spec->init_hook = alc260_auto_init;
5644 #ifdef CONFIG_SND_HDA_POWER_SAVE
5645 if (!spec->loopback.amplist)
5646 spec->loopback.amplist = alc260_loopbacks;
5656 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5657 * configuration. Each pin widget can choose any input DACs and a mixer.
5658 * Each ADC is connected from a mixer of all inputs. This makes possible
5659 * 6-channel independent captures.
5661 * In addition, an independent DAC for the multi-playback (not used in this
5664 #define ALC882_DIGOUT_NID 0x06
5665 #define ALC882_DIGIN_NID 0x0a
5667 static struct hda_channel_mode alc882_ch_modes[1] = {
5671 static hda_nid_t alc882_dac_nids[4] = {
5672 /* front, rear, clfe, rear_surr */
5673 0x02, 0x03, 0x04, 0x05
5676 /* identical with ALC880 */
5677 #define alc882_adc_nids alc880_adc_nids
5678 #define alc882_adc_nids_alt alc880_adc_nids_alt
5680 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5681 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5684 /* FIXME: should be a matrix-type input source selection */
5686 static struct hda_input_mux alc882_capture_source = {
5690 { "Front Mic", 0x1 },
5698 static struct hda_verb alc882_3ST_ch2_init[] = {
5699 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5700 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5701 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5702 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5709 static struct hda_verb alc882_3ST_ch6_init[] = {
5710 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5711 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5712 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5713 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5714 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5715 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5719 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5720 { 2, alc882_3ST_ch2_init },
5721 { 6, alc882_3ST_ch6_init },
5727 static struct hda_verb alc882_sixstack_ch6_init[] = {
5728 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5729 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5730 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5731 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5738 static struct hda_verb alc882_sixstack_ch8_init[] = {
5739 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5740 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5741 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5742 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5746 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5747 { 6, alc882_sixstack_ch6_init },
5748 { 8, alc882_sixstack_ch8_init },
5752 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5758 static struct hda_verb alc885_mbp_ch2_init[] = {
5759 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5760 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5761 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5768 static struct hda_verb alc885_mbp_ch6_init[] = {
5769 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5770 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5771 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5772 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5773 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5777 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5778 { 2, alc885_mbp_ch2_init },
5779 { 6, alc885_mbp_ch6_init },
5783 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5784 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5786 static struct snd_kcontrol_new alc882_base_mixer[] = {
5787 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5788 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5789 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5790 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5791 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5795 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5796 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5798 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5799 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5800 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5801 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5803 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5805 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5806 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5807 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5808 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5809 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5813 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5814 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5815 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5816 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5817 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5818 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5819 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5821 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5822 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5823 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5826 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5827 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5828 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5832 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5834 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5836 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5837 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5841 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5842 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5843 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5845 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5846 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5847 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5848 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5850 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5851 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5852 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5853 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5854 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5858 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5859 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5861 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5862 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5863 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5864 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5865 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5868 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5869 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5870 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5871 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5872 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5873 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5874 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5878 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5879 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5880 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5881 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5882 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5883 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5884 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5885 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5886 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5887 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5888 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5889 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5890 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5894 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5896 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5897 .name = "Channel Mode",
5898 .info = alc_ch_mode_info,
5899 .get = alc_ch_mode_get,
5900 .put = alc_ch_mode_put,
5905 static struct hda_verb alc882_init_verbs[] = {
5906 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5909 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5911 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5912 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5913 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5916 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5917 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5919 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5920 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5921 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5923 /* Front Pin: output 0 (0x0c) */
5924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5925 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5926 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5927 /* Rear Pin: output 1 (0x0d) */
5928 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5930 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5931 /* CLFE Pin: output 2 (0x0e) */
5932 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5933 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5934 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5935 /* Side Pin: output 3 (0x0f) */
5936 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5937 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5938 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5939 /* Mic (rear) pin: input vref at 80% */
5940 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5941 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5942 /* Front Mic pin: input vref at 80% */
5943 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5944 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5945 /* Line In pin: input */
5946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5947 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5948 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5949 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5950 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5951 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5952 /* CD pin widget for input */
5953 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5955 /* FIXME: use matrix-type input source selection */
5956 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5957 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5958 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5959 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5960 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5961 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5963 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5964 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5965 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5966 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5972 /* ADC1: mute amp left and right */
5973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5974 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5975 /* ADC2: mute amp left and right */
5976 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5977 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5978 /* ADC3: mute amp left and right */
5979 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5980 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5985 static struct hda_verb alc882_eapd_verbs[] = {
5986 /* change to EAPD mode */
5987 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5988 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5993 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5994 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5995 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5997 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5998 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5999 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6000 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6004 static struct hda_verb alc882_macpro_init_verbs[] = {
6005 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6008 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6009 /* Front Pin: output 0 (0x0c) */
6010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6011 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6013 /* Front Mic pin: input vref at 80% */
6014 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6015 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6016 /* Speaker: output */
6017 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6018 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6019 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6020 /* Headphone output (output 0 - 0x0c) */
6021 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6022 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6023 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6025 /* FIXME: use matrix-type input source selection */
6026 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6027 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6035 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6036 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6042 /* ADC1: mute amp left and right */
6043 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6044 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6045 /* ADC2: mute amp left and right */
6046 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6047 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6048 /* ADC3: mute amp left and right */
6049 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6050 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6055 /* Macbook Pro rev3 */
6056 static struct hda_verb alc885_mbp3_init_verbs[] = {
6057 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6062 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6063 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6065 /* Front Pin: output 0 (0x0c) */
6066 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6067 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6068 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6069 /* HP Pin: output 0 (0x0d) */
6070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6072 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6073 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6074 /* Mic (rear) pin: input vref at 80% */
6075 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6076 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6077 /* Front Mic pin: input vref at 80% */
6078 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6079 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6080 /* Line In pin: use output 1 when in LineOut mode */
6081 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6082 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6083 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6085 /* FIXME: use matrix-type input source selection */
6086 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6087 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6089 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6090 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6091 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6102 /* ADC1: mute amp left and right */
6103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6104 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6105 /* ADC2: mute amp left and right */
6106 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6107 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6108 /* ADC3: mute amp left and right */
6109 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6110 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6115 /* iMac 24 mixer. */
6116 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6117 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6118 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6122 /* iMac 24 init verbs. */
6123 static struct hda_verb alc885_imac24_init_verbs[] = {
6124 /* Internal speakers: output 0 (0x0c) */
6125 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6126 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6127 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6128 /* Internal speakers: output 0 (0x0c) */
6129 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6130 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6131 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6132 /* Headphone: output 0 (0x0c) */
6133 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6134 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6135 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6136 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6137 /* Front Mic: input vref at 80% */
6138 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6139 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6143 /* Toggle speaker-output according to the hp-jack state */
6144 static void alc885_imac24_automute(struct hda_codec *codec)
6146 unsigned int present;
6148 present = snd_hda_codec_read(codec, 0x14, 0,
6149 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6150 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6151 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6152 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6153 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6156 /* Processes unsolicited events. */
6157 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6160 /* Headphone insertion or removal. */
6161 if ((res >> 26) == ALC880_HP_EVENT)
6162 alc885_imac24_automute(codec);
6165 static void alc885_mbp3_automute(struct hda_codec *codec)
6167 unsigned int present;
6169 present = snd_hda_codec_read(codec, 0x15, 0,
6170 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6171 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6172 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6173 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6174 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6177 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6180 /* Headphone insertion or removal. */
6181 if ((res >> 26) == ALC880_HP_EVENT)
6182 alc885_mbp3_automute(codec);
6186 static struct hda_verb alc882_targa_verbs[] = {
6187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6190 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6191 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6193 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6194 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6195 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6197 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6198 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6199 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6200 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6204 /* toggle speaker-output according to the hp-jack state */
6205 static void alc882_targa_automute(struct hda_codec *codec)
6207 unsigned int present;
6209 present = snd_hda_codec_read(codec, 0x14, 0,
6210 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6211 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6212 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6213 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6217 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6219 /* Looks like the unsol event is incompatible with the standard
6220 * definition. 4bit tag is placed at 26 bit!
6222 if (((res >> 26) == ALC880_HP_EVENT)) {
6223 alc882_targa_automute(codec);
6227 static struct hda_verb alc882_asus_a7j_verbs[] = {
6228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6231 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6232 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6233 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6235 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6236 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6237 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6239 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6240 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6241 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6245 static struct hda_verb alc882_asus_a7m_verbs[] = {
6246 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6247 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6250 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6251 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6253 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6254 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6255 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6257 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6258 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6259 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6263 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6265 unsigned int gpiostate, gpiomask, gpiodir;
6267 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6268 AC_VERB_GET_GPIO_DATA, 0);
6271 gpiostate |= (1 << pin);
6273 gpiostate &= ~(1 << pin);
6275 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6276 AC_VERB_GET_GPIO_MASK, 0);
6277 gpiomask |= (1 << pin);
6279 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6280 AC_VERB_GET_GPIO_DIRECTION, 0);
6281 gpiodir |= (1 << pin);
6284 snd_hda_codec_write(codec, codec->afg, 0,
6285 AC_VERB_SET_GPIO_MASK, gpiomask);
6286 snd_hda_codec_write(codec, codec->afg, 0,
6287 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6291 snd_hda_codec_write(codec, codec->afg, 0,
6292 AC_VERB_SET_GPIO_DATA, gpiostate);
6295 /* set up GPIO at initialization */
6296 static void alc885_macpro_init_hook(struct hda_codec *codec)
6298 alc882_gpio_mute(codec, 0, 0);
6299 alc882_gpio_mute(codec, 1, 0);
6302 /* set up GPIO and update auto-muting at initialization */
6303 static void alc885_imac24_init_hook(struct hda_codec *codec)
6305 alc885_macpro_init_hook(codec);
6306 alc885_imac24_automute(codec);
6310 * generic initialization of ADC, input mixers and output mixers
6312 static struct hda_verb alc882_auto_init_verbs[] = {
6314 * Unmute ADC0-2 and set the default input to mic-in
6316 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6318 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6319 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6320 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6321 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6323 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6325 * Note: PASD motherboards uses the Line In 2 as the input for
6326 * front panel mic (mic 2)
6328 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6332 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6333 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6336 * Set up output mixers (0x0c - 0x0f)
6338 /* set vol=0 to output mixers */
6339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6342 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6343 /* set up input amps for analog loopback */
6344 /* Amp Indices: DAC = 0, mixer = 1 */
6345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6349 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6350 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6353 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6354 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6356 /* FIXME: use matrix-type input source selection */
6357 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6358 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6377 #ifdef CONFIG_SND_HDA_POWER_SAVE
6378 #define alc882_loopbacks alc880_loopbacks
6381 /* pcm configuration: identiacal with ALC880 */
6382 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6383 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6384 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6385 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6388 * configuration and preset
6390 static const char *alc882_models[ALC882_MODEL_LAST] = {
6391 [ALC882_3ST_DIG] = "3stack-dig",
6392 [ALC882_6ST_DIG] = "6stack-dig",
6393 [ALC882_ARIMA] = "arima",
6394 [ALC882_W2JC] = "w2jc",
6395 [ALC882_TARGA] = "targa",
6396 [ALC882_ASUS_A7J] = "asus-a7j",
6397 [ALC882_ASUS_A7M] = "asus-a7m",
6398 [ALC885_MACPRO] = "macpro",
6399 [ALC885_MBP3] = "mbp3",
6400 [ALC885_IMAC24] = "imac24",
6401 [ALC882_AUTO] = "auto",
6404 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6405 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6406 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6407 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6408 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6409 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6410 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6411 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6412 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6413 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6414 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6415 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6416 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6420 static struct alc_config_preset alc882_presets[] = {
6421 [ALC882_3ST_DIG] = {
6422 .mixers = { alc882_base_mixer },
6423 .init_verbs = { alc882_init_verbs },
6424 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6425 .dac_nids = alc882_dac_nids,
6426 .dig_out_nid = ALC882_DIGOUT_NID,
6427 .dig_in_nid = ALC882_DIGIN_NID,
6428 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6429 .channel_mode = alc882_ch_modes,
6431 .input_mux = &alc882_capture_source,
6433 [ALC882_6ST_DIG] = {
6434 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6435 .init_verbs = { alc882_init_verbs },
6436 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6437 .dac_nids = alc882_dac_nids,
6438 .dig_out_nid = ALC882_DIGOUT_NID,
6439 .dig_in_nid = ALC882_DIGIN_NID,
6440 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6441 .channel_mode = alc882_sixstack_modes,
6442 .input_mux = &alc882_capture_source,
6445 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6446 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6447 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6448 .dac_nids = alc882_dac_nids,
6449 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6450 .channel_mode = alc882_sixstack_modes,
6451 .input_mux = &alc882_capture_source,
6454 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6455 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6456 alc880_gpio1_init_verbs },
6457 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6458 .dac_nids = alc882_dac_nids,
6459 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6460 .channel_mode = alc880_threestack_modes,
6462 .input_mux = &alc882_capture_source,
6463 .dig_out_nid = ALC882_DIGOUT_NID,
6466 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6467 .init_verbs = { alc885_mbp3_init_verbs,
6468 alc880_gpio1_init_verbs },
6469 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6470 .dac_nids = alc882_dac_nids,
6471 .channel_mode = alc885_mbp_6ch_modes,
6472 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6473 .input_mux = &alc882_capture_source,
6474 .dig_out_nid = ALC882_DIGOUT_NID,
6475 .dig_in_nid = ALC882_DIGIN_NID,
6476 .unsol_event = alc885_mbp3_unsol_event,
6477 .init_hook = alc885_mbp3_automute,
6480 .mixers = { alc882_macpro_mixer },
6481 .init_verbs = { alc882_macpro_init_verbs },
6482 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6483 .dac_nids = alc882_dac_nids,
6484 .dig_out_nid = ALC882_DIGOUT_NID,
6485 .dig_in_nid = ALC882_DIGIN_NID,
6486 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6487 .channel_mode = alc882_ch_modes,
6488 .input_mux = &alc882_capture_source,
6489 .init_hook = alc885_macpro_init_hook,
6492 .mixers = { alc885_imac24_mixer },
6493 .init_verbs = { alc885_imac24_init_verbs },
6494 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6495 .dac_nids = alc882_dac_nids,
6496 .dig_out_nid = ALC882_DIGOUT_NID,
6497 .dig_in_nid = ALC882_DIGIN_NID,
6498 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6499 .channel_mode = alc882_ch_modes,
6500 .input_mux = &alc882_capture_source,
6501 .unsol_event = alc885_imac24_unsol_event,
6502 .init_hook = alc885_imac24_init_hook,
6505 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6506 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6507 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6508 .dac_nids = alc882_dac_nids,
6509 .dig_out_nid = ALC882_DIGOUT_NID,
6510 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6511 .adc_nids = alc882_adc_nids,
6512 .capsrc_nids = alc882_capsrc_nids,
6513 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6514 .channel_mode = alc882_3ST_6ch_modes,
6516 .input_mux = &alc882_capture_source,
6517 .unsol_event = alc882_targa_unsol_event,
6518 .init_hook = alc882_targa_automute,
6520 [ALC882_ASUS_A7J] = {
6521 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6522 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6523 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6524 .dac_nids = alc882_dac_nids,
6525 .dig_out_nid = ALC882_DIGOUT_NID,
6526 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6527 .adc_nids = alc882_adc_nids,
6528 .capsrc_nids = alc882_capsrc_nids,
6529 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6530 .channel_mode = alc882_3ST_6ch_modes,
6532 .input_mux = &alc882_capture_source,
6534 [ALC882_ASUS_A7M] = {
6535 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6536 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6537 alc880_gpio1_init_verbs,
6538 alc882_asus_a7m_verbs },
6539 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6540 .dac_nids = alc882_dac_nids,
6541 .dig_out_nid = ALC882_DIGOUT_NID,
6542 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6543 .channel_mode = alc880_threestack_modes,
6545 .input_mux = &alc882_capture_source,
6554 PINFIX_ABIT_AW9D_MAX
6557 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6558 { 0x15, 0x01080104 }, /* side */
6559 { 0x16, 0x01011012 }, /* rear */
6560 { 0x17, 0x01016011 }, /* clfe */
6564 static const struct alc_pincfg *alc882_pin_fixes[] = {
6565 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6568 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6569 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6574 * BIOS auto configuration
6576 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6577 hda_nid_t nid, int pin_type,
6581 struct alc_spec *spec = codec->spec;
6584 alc_set_pin_output(codec, nid, pin_type);
6585 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6588 idx = spec->multiout.dac_nids[dac_idx] - 2;
6589 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6593 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6595 struct alc_spec *spec = codec->spec;
6598 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6599 for (i = 0; i <= HDA_SIDE; i++) {
6600 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6601 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6603 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6608 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6610 struct alc_spec *spec = codec->spec;
6613 pin = spec->autocfg.hp_pins[0];
6614 if (pin) /* connect to front */
6616 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6617 pin = spec->autocfg.speaker_pins[0];
6619 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6622 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6623 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6625 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6627 struct alc_spec *spec = codec->spec;
6630 for (i = 0; i < AUTO_PIN_LAST; i++) {
6631 hda_nid_t nid = spec->autocfg.input_pins[i];
6636 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6637 unsigned int pincap;
6638 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6639 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6643 snd_hda_codec_write(codec, nid, 0,
6644 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6645 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6646 snd_hda_codec_write(codec, nid, 0,
6647 AC_VERB_SET_AMP_GAIN_MUTE,
6652 static void alc882_auto_init_input_src(struct hda_codec *codec)
6654 struct alc_spec *spec = codec->spec;
6655 const struct hda_input_mux *imux = spec->input_mux;
6658 for (c = 0; c < spec->num_adc_nids; c++) {
6659 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6660 hda_nid_t nid = spec->capsrc_nids[c];
6661 int conns, mute, idx, item;
6663 conns = snd_hda_get_connections(codec, nid, conn_list,
6664 ARRAY_SIZE(conn_list));
6667 for (idx = 0; idx < conns; idx++) {
6668 /* if the current connection is the selected one,
6669 * unmute it as default - otherwise mute it
6671 mute = AMP_IN_MUTE(idx);
6672 for (item = 0; item < imux->num_items; item++) {
6673 if (imux->items[item].index == idx) {
6674 if (spec->cur_mux[c] == item)
6675 mute = AMP_IN_UNMUTE(idx);
6679 snd_hda_codec_write(codec, nid, 0,
6680 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6685 /* add mic boosts if needed */
6686 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6688 struct alc_spec *spec = codec->spec;
6692 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6693 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6694 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6696 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6700 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6701 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6702 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6704 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6711 /* almost identical with ALC880 parser... */
6712 static int alc882_parse_auto_config(struct hda_codec *codec)
6714 struct alc_spec *spec = codec->spec;
6715 int err = alc880_parse_auto_config(codec);
6720 return 0; /* no config found */
6722 err = alc_auto_add_mic_boost(codec);
6726 /* hack - override the init verbs */
6727 spec->init_verbs[0] = alc882_auto_init_verbs;
6729 return 1; /* config found */
6732 /* additional initialization for auto-configuration model */
6733 static void alc882_auto_init(struct hda_codec *codec)
6735 struct alc_spec *spec = codec->spec;
6736 alc882_auto_init_multi_out(codec);
6737 alc882_auto_init_hp_out(codec);
6738 alc882_auto_init_analog_input(codec);
6739 alc882_auto_init_input_src(codec);
6740 if (spec->unsol_event)
6741 alc_inithook(codec);
6744 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6746 static int patch_alc882(struct hda_codec *codec)
6748 struct alc_spec *spec;
6749 int err, board_config;
6751 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6757 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6761 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6762 /* Pick up systems that don't supply PCI SSID */
6763 switch (codec->subsystem_id) {
6764 case 0x106b0c00: /* Mac Pro */
6765 board_config = ALC885_MACPRO;
6767 case 0x106b1000: /* iMac 24 */
6768 case 0x106b2800: /* AppleTV */
6769 board_config = ALC885_IMAC24;
6771 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6772 case 0x106b00a4: /* MacbookPro4,1 */
6773 case 0x106b2c00: /* Macbook Pro rev3 */
6774 case 0x106b3600: /* Macbook 3.1 */
6775 board_config = ALC885_MBP3;
6778 /* ALC889A is handled better as ALC888-compatible */
6779 if (codec->revision_id == 0x100101 ||
6780 codec->revision_id == 0x100103) {
6782 return patch_alc883(codec);
6784 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6785 "trying auto-probe from BIOS...\n");
6786 board_config = ALC882_AUTO;
6790 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6792 if (board_config == ALC882_AUTO) {
6793 /* automatic parse from the BIOS config */
6794 err = alc882_parse_auto_config(codec);
6800 "hda_codec: Cannot set up configuration "
6801 "from BIOS. Using base mode...\n");
6802 board_config = ALC882_3ST_DIG;
6806 if (board_config != ALC882_AUTO)
6807 setup_preset(spec, &alc882_presets[board_config]);
6809 if (codec->vendor_id == 0x10ec0885) {
6810 spec->stream_name_analog = "ALC885 Analog";
6811 spec->stream_name_digital = "ALC885 Digital";
6813 spec->stream_name_analog = "ALC882 Analog";
6814 spec->stream_name_digital = "ALC882 Digital";
6817 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6818 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6819 /* FIXME: setup DAC5 */
6820 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6821 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6823 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6824 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6826 spec->is_mix_capture = 1; /* matrix-style capture */
6827 if (!spec->adc_nids && spec->input_mux) {
6828 /* check whether NID 0x07 is valid */
6829 unsigned int wcap = get_wcaps(codec, 0x07);
6831 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6832 if (wcap != AC_WID_AUD_IN) {
6833 spec->adc_nids = alc882_adc_nids_alt;
6834 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6835 spec->capsrc_nids = alc882_capsrc_nids_alt;
6837 spec->adc_nids = alc882_adc_nids;
6838 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6839 spec->capsrc_nids = alc882_capsrc_nids;
6842 set_capture_mixer(spec);
6844 spec->vmaster_nid = 0x0c;
6846 codec->patch_ops = alc_patch_ops;
6847 if (board_config == ALC882_AUTO)
6848 spec->init_hook = alc882_auto_init;
6849 #ifdef CONFIG_SND_HDA_POWER_SAVE
6850 if (!spec->loopback.amplist)
6851 spec->loopback.amplist = alc882_loopbacks;
6860 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6861 * configuration. Each pin widget can choose any input DACs and a mixer.
6862 * Each ADC is connected from a mixer of all inputs. This makes possible
6863 * 6-channel independent captures.
6865 * In addition, an independent DAC for the multi-playback (not used in this
6868 #define ALC883_DIGOUT_NID 0x06
6869 #define ALC883_DIGIN_NID 0x0a
6871 static hda_nid_t alc883_dac_nids[4] = {
6872 /* front, rear, clfe, rear_surr */
6873 0x02, 0x03, 0x04, 0x05
6876 static hda_nid_t alc883_adc_nids[2] = {
6881 static hda_nid_t alc883_adc_nids_alt[1] = {
6886 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6889 /* FIXME: should be a matrix-type input source selection */
6891 static struct hda_input_mux alc883_capture_source = {
6895 { "Front Mic", 0x1 },
6901 static struct hda_input_mux alc883_3stack_6ch_intel = {
6905 { "Front Mic", 0x0 },
6911 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6919 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6929 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6937 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6941 { "Front Mic", 0x1 },
6946 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6957 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6964 static struct hda_verb alc883_3ST_ch2_init[] = {
6965 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6966 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6967 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6968 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6975 static struct hda_verb alc883_3ST_ch4_init[] = {
6976 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6977 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6978 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6979 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6980 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6987 static struct hda_verb alc883_3ST_ch6_init[] = {
6988 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6989 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6990 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6991 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6992 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6993 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6997 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6998 { 2, alc883_3ST_ch2_init },
6999 { 4, alc883_3ST_ch4_init },
7000 { 6, alc883_3ST_ch6_init },
7006 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7007 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7008 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7009 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7010 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7017 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7018 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7019 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7020 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7021 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7022 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7029 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7030 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7031 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7032 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7033 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7034 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7035 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7039 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7040 { 2, alc883_3ST_ch2_intel_init },
7041 { 4, alc883_3ST_ch4_intel_init },
7042 { 6, alc883_3ST_ch6_intel_init },
7048 static struct hda_verb alc883_sixstack_ch6_init[] = {
7049 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7050 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7051 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7052 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7059 static struct hda_verb alc883_sixstack_ch8_init[] = {
7060 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7061 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7062 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7063 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7067 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7068 { 6, alc883_sixstack_ch6_init },
7069 { 8, alc883_sixstack_ch8_init },
7072 static struct hda_verb alc883_medion_eapd_verbs[] = {
7073 /* eanable EAPD on medion laptop */
7074 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7075 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7079 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7080 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7083 static struct snd_kcontrol_new alc883_base_mixer[] = {
7084 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7085 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7086 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7087 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7088 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7089 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7090 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7091 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7092 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7093 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7095 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7096 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7098 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7100 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7102 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7104 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7105 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7106 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7110 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7111 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7112 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7113 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7114 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7115 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7116 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7121 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7122 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7123 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7127 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7128 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7129 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7130 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7131 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7133 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7135 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7136 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7137 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7141 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7142 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7143 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7144 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7145 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7147 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7149 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7150 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7151 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7155 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7156 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7157 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7159 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7160 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7161 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7162 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7167 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7168 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7169 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7170 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7174 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7176 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7177 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7178 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7179 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7180 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7181 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7182 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7184 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7185 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7186 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7187 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7189 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7191 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7192 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7193 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7194 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7195 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7199 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7200 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7201 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7202 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7203 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7204 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7206 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7207 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7208 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7210 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7211 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7212 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7213 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7217 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7218 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7219 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7220 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7221 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7225 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7226 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7227 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7228 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7229 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7230 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7231 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7232 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7233 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7234 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7235 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7236 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7238 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7239 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7240 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7241 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7242 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7243 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7244 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7245 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7246 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7250 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7253 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7254 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7255 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7256 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7257 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7258 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7259 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7260 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7261 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7262 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7263 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7270 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7271 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7273 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7274 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7275 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7276 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7277 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7278 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7279 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7280 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7281 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7285 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7286 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7287 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7288 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7289 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7291 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7292 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7293 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7297 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7298 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7299 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7300 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7301 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7302 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7305 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7306 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7310 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7313 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7314 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7315 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7323 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7324 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7325 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7326 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7327 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7328 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7329 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7330 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7335 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7336 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7337 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7338 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7339 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7340 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7341 0x0d, 1, 0x0, HDA_OUTPUT),
7342 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7343 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7344 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7345 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7346 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7348 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7349 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7350 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7351 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7352 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7357 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7358 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7362 static struct hda_bind_ctls alc883_bind_cap_vol = {
7363 .ops = &snd_hda_bind_vol,
7365 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7366 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7371 static struct hda_bind_ctls alc883_bind_cap_switch = {
7372 .ops = &snd_hda_bind_sw,
7374 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7375 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7380 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7381 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7382 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7383 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7384 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7385 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7387 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7392 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7393 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7394 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7396 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7397 /* .name = "Capture Source", */
7398 .name = "Input Source",
7400 .info = alc_mux_enum_info,
7401 .get = alc_mux_enum_get,
7402 .put = alc_mux_enum_put,
7407 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7409 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7410 .name = "Channel Mode",
7411 .info = alc_ch_mode_info,
7412 .get = alc_ch_mode_get,
7413 .put = alc_ch_mode_put,
7418 static struct hda_verb alc883_init_verbs[] = {
7419 /* ADC1: mute amp left and right */
7420 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7421 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7422 /* ADC2: mute amp left and right */
7423 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7424 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7425 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7430 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7432 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7438 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7439 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7440 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7442 /* mute analog input loopbacks */
7443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7449 /* Front Pin: output 0 (0x0c) */
7450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7452 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7453 /* Rear Pin: output 1 (0x0d) */
7454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7456 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7457 /* CLFE Pin: output 2 (0x0e) */
7458 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7459 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7460 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7461 /* Side Pin: output 3 (0x0f) */
7462 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7463 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7464 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7465 /* Mic (rear) pin: input vref at 80% */
7466 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7467 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7468 /* Front Mic pin: input vref at 80% */
7469 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7470 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7471 /* Line In pin: input */
7472 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7473 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7474 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7476 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7477 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7478 /* CD pin widget for input */
7479 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7481 /* FIXME: use matrix-type input source selection */
7482 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7496 /* toggle speaker-output according to the hp-jack state */
7497 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7499 unsigned int present;
7501 present = snd_hda_codec_read(codec, 0x15, 0,
7502 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7503 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7504 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7505 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7506 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7509 /* auto-toggle front mic */
7511 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7513 unsigned int present;
7516 present = snd_hda_codec_read(codec, 0x18, 0,
7517 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7518 bits = present ? HDA_AMP_MUTE : 0;
7519 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7523 static void alc883_mitac_automute(struct hda_codec *codec)
7525 alc883_mitac_hp_automute(codec);
7526 /* alc883_mitac_mic_automute(codec); */
7529 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7532 switch (res >> 26) {
7533 case ALC880_HP_EVENT:
7534 alc883_mitac_hp_automute(codec);
7536 case ALC880_MIC_EVENT:
7537 /* alc883_mitac_mic_automute(codec); */
7542 static struct hda_verb alc883_mitac_verbs[] = {
7544 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7547 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7548 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7550 /* enable unsolicited event */
7551 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7552 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7557 static struct hda_verb alc883_clevo_m720_verbs[] = {
7559 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7560 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7562 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7565 /* enable unsolicited event */
7566 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7567 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7572 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7574 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7575 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7577 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7580 /* enable unsolicited event */
7581 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7586 static struct hda_verb alc883_tagra_verbs[] = {
7587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7590 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7591 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7593 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7594 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7595 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7597 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7598 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7599 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7600 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7605 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7607 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7608 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7612 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7613 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7614 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7615 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7620 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7624 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7625 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7629 static struct hda_verb alc883_haier_w66_verbs[] = {
7630 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7631 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7635 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7636 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7637 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7638 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7642 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7649 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7650 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7654 static struct hda_verb alc888_3st_hp_verbs[] = {
7655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7656 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7657 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7661 static struct hda_verb alc888_6st_dell_verbs[] = {
7662 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7666 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7667 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7668 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7669 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7670 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7674 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7675 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7676 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7677 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7678 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7682 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7683 { 2, alc888_3st_hp_2ch_init },
7684 { 6, alc888_3st_hp_6ch_init },
7687 /* toggle front-jack and RCA according to the hp-jack state */
7688 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7690 unsigned int present;
7692 present = snd_hda_codec_read(codec, 0x1b, 0,
7693 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7694 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7695 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7696 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7697 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7700 /* toggle RCA according to the front-jack state */
7701 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7703 unsigned int present;
7705 present = snd_hda_codec_read(codec, 0x14, 0,
7706 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7707 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7708 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7711 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7714 if ((res >> 26) == ALC880_HP_EVENT)
7715 alc888_lenovo_ms7195_front_automute(codec);
7716 if ((res >> 26) == ALC880_FRONT_EVENT)
7717 alc888_lenovo_ms7195_rca_automute(codec);
7720 static struct hda_verb alc883_medion_md2_verbs[] = {
7721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7724 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7726 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7730 /* toggle speaker-output according to the hp-jack state */
7731 static void alc883_medion_md2_automute(struct hda_codec *codec)
7733 unsigned int present;
7735 present = snd_hda_codec_read(codec, 0x14, 0,
7736 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7737 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7738 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7741 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7744 if ((res >> 26) == ALC880_HP_EVENT)
7745 alc883_medion_md2_automute(codec);
7748 /* toggle speaker-output according to the hp-jack state */
7749 static void alc883_tagra_automute(struct hda_codec *codec)
7751 unsigned int present;
7754 present = snd_hda_codec_read(codec, 0x14, 0,
7755 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7756 bits = present ? HDA_AMP_MUTE : 0;
7757 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7758 HDA_AMP_MUTE, bits);
7759 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7763 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7765 if ((res >> 26) == ALC880_HP_EVENT)
7766 alc883_tagra_automute(codec);
7769 /* toggle speaker-output according to the hp-jack state */
7770 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7772 unsigned int present;
7775 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7776 & AC_PINSENSE_PRESENCE;
7777 bits = present ? HDA_AMP_MUTE : 0;
7778 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7779 HDA_AMP_MUTE, bits);
7782 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7784 unsigned int present;
7786 present = snd_hda_codec_read(codec, 0x18, 0,
7787 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7788 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7789 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7792 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7794 alc883_clevo_m720_hp_automute(codec);
7795 alc883_clevo_m720_mic_automute(codec);
7798 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7801 switch (res >> 26) {
7802 case ALC880_HP_EVENT:
7803 alc883_clevo_m720_hp_automute(codec);
7805 case ALC880_MIC_EVENT:
7806 alc883_clevo_m720_mic_automute(codec);
7811 /* toggle speaker-output according to the hp-jack state */
7812 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7814 unsigned int present;
7817 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7818 & AC_PINSENSE_PRESENCE;
7819 bits = present ? HDA_AMP_MUTE : 0;
7820 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7821 HDA_AMP_MUTE, bits);
7824 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7827 if ((res >> 26) == ALC880_HP_EVENT)
7828 alc883_2ch_fujitsu_pi2515_automute(codec);
7831 static void alc883_haier_w66_automute(struct hda_codec *codec)
7833 unsigned int present;
7836 present = snd_hda_codec_read(codec, 0x1b, 0,
7837 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7838 bits = present ? 0x80 : 0;
7839 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7843 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7846 if ((res >> 26) == ALC880_HP_EVENT)
7847 alc883_haier_w66_automute(codec);
7850 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7852 unsigned int present;
7855 present = snd_hda_codec_read(codec, 0x14, 0,
7856 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7857 bits = present ? HDA_AMP_MUTE : 0;
7858 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7859 HDA_AMP_MUTE, bits);
7862 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7864 unsigned int present;
7867 present = snd_hda_codec_read(codec, 0x1b, 0,
7868 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7869 bits = present ? HDA_AMP_MUTE : 0;
7870 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7871 HDA_AMP_MUTE, bits);
7872 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7873 HDA_AMP_MUTE, bits);
7876 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7879 if ((res >> 26) == ALC880_HP_EVENT)
7880 alc883_lenovo_101e_all_automute(codec);
7881 if ((res >> 26) == ALC880_FRONT_EVENT)
7882 alc883_lenovo_101e_ispeaker_automute(codec);
7885 /* toggle speaker-output according to the hp-jack state */
7886 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7888 unsigned int present;
7890 present = snd_hda_codec_read(codec, 0x14, 0,
7891 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7892 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7893 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7894 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7895 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7898 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7901 if ((res >> 26) == ALC880_HP_EVENT)
7902 alc883_acer_aspire_automute(codec);
7905 static struct hda_verb alc883_acer_eapd_verbs[] = {
7906 /* HP Pin: output 0 (0x0c) */
7907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7908 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7909 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7910 /* Front Pin: output 0 (0x0c) */
7911 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7912 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7913 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7914 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7915 /* eanable EAPD on medion laptop */
7916 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7917 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7918 /* enable unsolicited event */
7919 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7923 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7925 unsigned int present;
7927 present = snd_hda_codec_read(codec, 0x1b, 0,
7928 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7929 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7930 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7931 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7932 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7933 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7934 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7935 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7936 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7939 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7942 switch (res >> 26) {
7943 case ALC880_HP_EVENT:
7944 printk("hp_event\n");
7945 alc888_6st_dell_front_automute(codec);
7950 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
7953 unsigned int present;
7955 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
7956 present = snd_hda_codec_read(codec, 0x1b, 0,
7957 AC_VERB_GET_PIN_SENSE, 0);
7958 present = (present & 0x80000000) != 0;
7960 /* mute internal speaker */
7961 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7962 HDA_AMP_MUTE, HDA_AMP_MUTE);
7963 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7964 HDA_AMP_MUTE, HDA_AMP_MUTE);
7965 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7966 HDA_AMP_MUTE, HDA_AMP_MUTE);
7967 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7968 HDA_AMP_MUTE, HDA_AMP_MUTE);
7969 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7970 HDA_AMP_MUTE, HDA_AMP_MUTE);
7972 /* unmute internal speaker if necessary */
7973 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7974 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7975 HDA_AMP_MUTE, mute);
7976 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7977 HDA_AMP_MUTE, mute);
7978 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7979 HDA_AMP_MUTE, mute);
7980 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7981 HDA_AMP_MUTE, mute);
7982 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7983 HDA_AMP_MUTE, mute);
7987 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
7990 if ((res >> 26) == ALC880_HP_EVENT)
7991 alc888_lenovo_sky_front_automute(codec);
7995 * generic initialization of ADC, input mixers and output mixers
7997 static struct hda_verb alc883_auto_init_verbs[] = {
7999 * Unmute ADC0-2 and set the default input to mic-in
8001 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8002 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8003 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8004 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8006 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8008 * Note: PASD motherboards uses the Line In 2 as the input for
8009 * front panel mic (mic 2)
8011 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8019 * Set up output mixers (0x0c - 0x0f)
8021 /* set vol=0 to output mixers */
8022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8023 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8025 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8026 /* set up input amps for analog loopback */
8027 /* Amp Indices: DAC = 0, mixer = 1 */
8028 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8030 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8031 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8032 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8035 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8036 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8037 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8039 /* FIXME: use matrix-type input source selection */
8040 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8042 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8043 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8044 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8045 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8046 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8049 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8050 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8051 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8057 static struct hda_verb alc888_asus_m90v_verbs[] = {
8058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8059 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8061 /* enable unsolicited event */
8062 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8063 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8067 static void alc883_nb_mic_automute(struct hda_codec *codec)
8069 unsigned int present;
8071 present = snd_hda_codec_read(codec, 0x18, 0,
8072 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8073 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8074 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8075 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8076 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8079 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8081 unsigned int present;
8084 present = snd_hda_codec_read(codec, 0x1b, 0,
8085 AC_VERB_GET_PIN_SENSE, 0)
8086 & AC_PINSENSE_PRESENCE;
8087 bits = present ? 0 : PIN_OUT;
8088 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8090 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8092 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8096 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8099 switch (res >> 26) {
8100 case ALC880_HP_EVENT:
8101 alc883_M90V_speaker_automute(codec);
8103 case ALC880_MIC_EVENT:
8104 alc883_nb_mic_automute(codec);
8109 static void alc883_mode2_inithook(struct hda_codec *codec)
8111 alc883_M90V_speaker_automute(codec);
8112 alc883_nb_mic_automute(codec);
8115 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8116 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8117 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8119 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8120 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8121 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8122 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8123 /* enable unsolicited event */
8124 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8128 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8130 unsigned int present;
8133 present = snd_hda_codec_read(codec, 0x14, 0,
8134 AC_VERB_GET_PIN_SENSE, 0)
8135 & AC_PINSENSE_PRESENCE;
8136 bits = present ? 0 : PIN_OUT;
8137 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8141 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8144 switch (res >> 26) {
8145 case ALC880_HP_EVENT:
8146 alc883_eee1601_speaker_automute(codec);
8151 static void alc883_eee1601_inithook(struct hda_codec *codec)
8153 alc883_eee1601_speaker_automute(codec);
8156 #ifdef CONFIG_SND_HDA_POWER_SAVE
8157 #define alc883_loopbacks alc880_loopbacks
8160 /* pcm configuration: identiacal with ALC880 */
8161 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8162 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8163 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8164 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8165 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8168 * configuration and preset
8170 static const char *alc883_models[ALC883_MODEL_LAST] = {
8171 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8172 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8173 [ALC883_3ST_6ch] = "3stack-6ch",
8174 [ALC883_6ST_DIG] = "6stack-dig",
8175 [ALC883_TARGA_DIG] = "targa-dig",
8176 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8177 [ALC883_ACER] = "acer",
8178 [ALC883_ACER_ASPIRE] = "acer-aspire",
8179 [ALC883_MEDION] = "medion",
8180 [ALC883_MEDION_MD2] = "medion-md2",
8181 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8182 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8183 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8184 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8185 [ALC888_LENOVO_SKY] = "lenovo-sky",
8186 [ALC883_HAIER_W66] = "haier-w66",
8187 [ALC888_3ST_HP] = "3stack-hp",
8188 [ALC888_6ST_DELL] = "6stack-dell",
8189 [ALC883_MITAC] = "mitac",
8190 [ALC883_CLEVO_M720] = "clevo-m720",
8191 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8192 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8193 [ALC883_AUTO] = "auto",
8196 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8197 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8198 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8199 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8200 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8201 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8202 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8203 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8204 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8205 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8206 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8207 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8208 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8209 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8210 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8211 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8212 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8213 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8214 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8215 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8216 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8217 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8218 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8219 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8220 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8221 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8222 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8223 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8224 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8225 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8226 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8227 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8228 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8229 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8230 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8231 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8232 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8233 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8234 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8235 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8236 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8237 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8238 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8239 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8240 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8241 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8242 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8243 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8244 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8245 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8246 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8247 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8248 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8249 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8250 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8251 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8252 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8253 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8254 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8255 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8256 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8257 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8261 static struct alc_config_preset alc883_presets[] = {
8262 [ALC883_3ST_2ch_DIG] = {
8263 .mixers = { alc883_3ST_2ch_mixer },
8264 .init_verbs = { alc883_init_verbs },
8265 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8266 .dac_nids = alc883_dac_nids,
8267 .dig_out_nid = ALC883_DIGOUT_NID,
8268 .dig_in_nid = ALC883_DIGIN_NID,
8269 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8270 .channel_mode = alc883_3ST_2ch_modes,
8271 .input_mux = &alc883_capture_source,
8273 [ALC883_3ST_6ch_DIG] = {
8274 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8275 .init_verbs = { alc883_init_verbs },
8276 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8277 .dac_nids = alc883_dac_nids,
8278 .dig_out_nid = ALC883_DIGOUT_NID,
8279 .dig_in_nid = ALC883_DIGIN_NID,
8280 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8281 .channel_mode = alc883_3ST_6ch_modes,
8283 .input_mux = &alc883_capture_source,
8285 [ALC883_3ST_6ch] = {
8286 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8287 .init_verbs = { alc883_init_verbs },
8288 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8289 .dac_nids = alc883_dac_nids,
8290 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8291 .channel_mode = alc883_3ST_6ch_modes,
8293 .input_mux = &alc883_capture_source,
8295 [ALC883_3ST_6ch_INTEL] = {
8296 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8297 .init_verbs = { alc883_init_verbs },
8298 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8299 .dac_nids = alc883_dac_nids,
8300 .dig_out_nid = ALC883_DIGOUT_NID,
8301 .dig_in_nid = ALC883_DIGIN_NID,
8302 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8303 .channel_mode = alc883_3ST_6ch_intel_modes,
8305 .input_mux = &alc883_3stack_6ch_intel,
8307 [ALC883_6ST_DIG] = {
8308 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8309 .init_verbs = { alc883_init_verbs },
8310 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8311 .dac_nids = alc883_dac_nids,
8312 .dig_out_nid = ALC883_DIGOUT_NID,
8313 .dig_in_nid = ALC883_DIGIN_NID,
8314 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8315 .channel_mode = alc883_sixstack_modes,
8316 .input_mux = &alc883_capture_source,
8318 [ALC883_TARGA_DIG] = {
8319 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8320 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8321 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8322 .dac_nids = alc883_dac_nids,
8323 .dig_out_nid = ALC883_DIGOUT_NID,
8324 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8325 .channel_mode = alc883_3ST_6ch_modes,
8327 .input_mux = &alc883_capture_source,
8328 .unsol_event = alc883_tagra_unsol_event,
8329 .init_hook = alc883_tagra_automute,
8331 [ALC883_TARGA_2ch_DIG] = {
8332 .mixers = { alc883_tagra_2ch_mixer},
8333 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8334 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8335 .dac_nids = alc883_dac_nids,
8336 .adc_nids = alc883_adc_nids_alt,
8337 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8338 .dig_out_nid = ALC883_DIGOUT_NID,
8339 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8340 .channel_mode = alc883_3ST_2ch_modes,
8341 .input_mux = &alc883_capture_source,
8342 .unsol_event = alc883_tagra_unsol_event,
8343 .init_hook = alc883_tagra_automute,
8346 .mixers = { alc883_base_mixer },
8347 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8348 * and the headphone jack. Turn this on and rely on the
8349 * standard mute methods whenever the user wants to turn
8350 * these outputs off.
8352 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8353 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8354 .dac_nids = alc883_dac_nids,
8355 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8356 .channel_mode = alc883_3ST_2ch_modes,
8357 .input_mux = &alc883_capture_source,
8359 [ALC883_ACER_ASPIRE] = {
8360 .mixers = { alc883_acer_aspire_mixer },
8361 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8362 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8363 .dac_nids = alc883_dac_nids,
8364 .dig_out_nid = ALC883_DIGOUT_NID,
8365 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8366 .channel_mode = alc883_3ST_2ch_modes,
8367 .input_mux = &alc883_capture_source,
8368 .unsol_event = alc883_acer_aspire_unsol_event,
8369 .init_hook = alc883_acer_aspire_automute,
8372 .mixers = { alc883_fivestack_mixer,
8373 alc883_chmode_mixer },
8374 .init_verbs = { alc883_init_verbs,
8375 alc883_medion_eapd_verbs },
8376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8377 .dac_nids = alc883_dac_nids,
8378 .adc_nids = alc883_adc_nids_alt,
8379 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8380 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8381 .channel_mode = alc883_sixstack_modes,
8382 .input_mux = &alc883_capture_source,
8384 [ALC883_MEDION_MD2] = {
8385 .mixers = { alc883_medion_md2_mixer},
8386 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8387 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8388 .dac_nids = alc883_dac_nids,
8389 .dig_out_nid = ALC883_DIGOUT_NID,
8390 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8391 .channel_mode = alc883_3ST_2ch_modes,
8392 .input_mux = &alc883_capture_source,
8393 .unsol_event = alc883_medion_md2_unsol_event,
8394 .init_hook = alc883_medion_md2_automute,
8396 [ALC883_LAPTOP_EAPD] = {
8397 .mixers = { alc883_base_mixer },
8398 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8399 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8400 .dac_nids = alc883_dac_nids,
8401 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8402 .channel_mode = alc883_3ST_2ch_modes,
8403 .input_mux = &alc883_capture_source,
8405 [ALC883_CLEVO_M720] = {
8406 .mixers = { alc883_clevo_m720_mixer },
8407 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8408 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8409 .dac_nids = alc883_dac_nids,
8410 .dig_out_nid = ALC883_DIGOUT_NID,
8411 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8412 .channel_mode = alc883_3ST_2ch_modes,
8413 .input_mux = &alc883_capture_source,
8414 .unsol_event = alc883_clevo_m720_unsol_event,
8415 .init_hook = alc883_clevo_m720_automute,
8417 [ALC883_LENOVO_101E_2ch] = {
8418 .mixers = { alc883_lenovo_101e_2ch_mixer},
8419 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8420 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8421 .dac_nids = alc883_dac_nids,
8422 .adc_nids = alc883_adc_nids_alt,
8423 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8424 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8425 .channel_mode = alc883_3ST_2ch_modes,
8426 .input_mux = &alc883_lenovo_101e_capture_source,
8427 .unsol_event = alc883_lenovo_101e_unsol_event,
8428 .init_hook = alc883_lenovo_101e_all_automute,
8430 [ALC883_LENOVO_NB0763] = {
8431 .mixers = { alc883_lenovo_nb0763_mixer },
8432 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8434 .dac_nids = alc883_dac_nids,
8435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8436 .channel_mode = alc883_3ST_2ch_modes,
8438 .input_mux = &alc883_lenovo_nb0763_capture_source,
8439 .unsol_event = alc883_medion_md2_unsol_event,
8440 .init_hook = alc883_medion_md2_automute,
8442 [ALC888_LENOVO_MS7195_DIG] = {
8443 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8444 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8445 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8446 .dac_nids = alc883_dac_nids,
8447 .dig_out_nid = ALC883_DIGOUT_NID,
8448 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8449 .channel_mode = alc883_3ST_6ch_modes,
8451 .input_mux = &alc883_capture_source,
8452 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8453 .init_hook = alc888_lenovo_ms7195_front_automute,
8455 [ALC883_HAIER_W66] = {
8456 .mixers = { alc883_tagra_2ch_mixer},
8457 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8458 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8459 .dac_nids = alc883_dac_nids,
8460 .dig_out_nid = ALC883_DIGOUT_NID,
8461 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8462 .channel_mode = alc883_3ST_2ch_modes,
8463 .input_mux = &alc883_capture_source,
8464 .unsol_event = alc883_haier_w66_unsol_event,
8465 .init_hook = alc883_haier_w66_automute,
8468 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8469 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8470 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8471 .dac_nids = alc883_dac_nids,
8472 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8473 .channel_mode = alc888_3st_hp_modes,
8475 .input_mux = &alc883_capture_source,
8477 [ALC888_6ST_DELL] = {
8478 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8479 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8480 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8481 .dac_nids = alc883_dac_nids,
8482 .dig_out_nid = ALC883_DIGOUT_NID,
8483 .dig_in_nid = ALC883_DIGIN_NID,
8484 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8485 .channel_mode = alc883_sixstack_modes,
8486 .input_mux = &alc883_capture_source,
8487 .unsol_event = alc888_6st_dell_unsol_event,
8488 .init_hook = alc888_6st_dell_front_automute,
8491 .mixers = { alc883_mitac_mixer },
8492 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8493 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8494 .dac_nids = alc883_dac_nids,
8495 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8496 .channel_mode = alc883_3ST_2ch_modes,
8497 .input_mux = &alc883_capture_source,
8498 .unsol_event = alc883_mitac_unsol_event,
8499 .init_hook = alc883_mitac_automute,
8501 [ALC883_FUJITSU_PI2515] = {
8502 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8503 .init_verbs = { alc883_init_verbs,
8504 alc883_2ch_fujitsu_pi2515_verbs},
8505 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8506 .dac_nids = alc883_dac_nids,
8507 .dig_out_nid = ALC883_DIGOUT_NID,
8508 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8509 .channel_mode = alc883_3ST_2ch_modes,
8510 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8511 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8512 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8514 [ALC888_LENOVO_SKY] = {
8515 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8516 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8517 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8518 .dac_nids = alc883_dac_nids,
8519 .dig_out_nid = ALC883_DIGOUT_NID,
8520 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8521 .channel_mode = alc883_sixstack_modes,
8523 .input_mux = &alc883_lenovo_sky_capture_source,
8524 .unsol_event = alc883_lenovo_sky_unsol_event,
8525 .init_hook = alc888_lenovo_sky_front_automute,
8527 [ALC888_ASUS_M90V] = {
8528 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8529 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8530 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8531 .dac_nids = alc883_dac_nids,
8532 .dig_out_nid = ALC883_DIGOUT_NID,
8533 .dig_in_nid = ALC883_DIGIN_NID,
8534 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8535 .channel_mode = alc883_3ST_6ch_modes,
8537 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8538 .unsol_event = alc883_mode2_unsol_event,
8539 .init_hook = alc883_mode2_inithook,
8541 [ALC888_ASUS_EEE1601] = {
8542 .mixers = { alc883_asus_eee1601_mixer },
8543 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8544 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8545 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8546 .dac_nids = alc883_dac_nids,
8547 .dig_out_nid = ALC883_DIGOUT_NID,
8548 .dig_in_nid = ALC883_DIGIN_NID,
8549 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8550 .channel_mode = alc883_3ST_2ch_modes,
8552 .input_mux = &alc883_asus_eee1601_capture_source,
8553 .unsol_event = alc883_eee1601_unsol_event,
8554 .init_hook = alc883_eee1601_inithook,
8560 * BIOS auto configuration
8562 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8563 hda_nid_t nid, int pin_type,
8567 struct alc_spec *spec = codec->spec;
8570 alc_set_pin_output(codec, nid, pin_type);
8571 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8574 idx = spec->multiout.dac_nids[dac_idx] - 2;
8575 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8579 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8581 struct alc_spec *spec = codec->spec;
8584 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8585 for (i = 0; i <= HDA_SIDE; i++) {
8586 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8587 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8589 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8594 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8596 struct alc_spec *spec = codec->spec;
8599 pin = spec->autocfg.hp_pins[0];
8600 if (pin) /* connect to front */
8602 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8603 pin = spec->autocfg.speaker_pins[0];
8605 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8608 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8609 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8611 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8613 struct alc_spec *spec = codec->spec;
8616 for (i = 0; i < AUTO_PIN_LAST; i++) {
8617 hda_nid_t nid = spec->autocfg.input_pins[i];
8618 if (alc883_is_input_pin(nid)) {
8619 snd_hda_codec_write(codec, nid, 0,
8620 AC_VERB_SET_PIN_WIDGET_CONTROL,
8621 (i <= AUTO_PIN_FRONT_MIC ?
8622 PIN_VREF80 : PIN_IN));
8623 if (nid != ALC883_PIN_CD_NID)
8624 snd_hda_codec_write(codec, nid, 0,
8625 AC_VERB_SET_AMP_GAIN_MUTE,
8631 #define alc883_auto_init_input_src alc882_auto_init_input_src
8633 /* almost identical with ALC880 parser... */
8634 static int alc883_parse_auto_config(struct hda_codec *codec)
8636 struct alc_spec *spec = codec->spec;
8637 int err = alc880_parse_auto_config(codec);
8642 return 0; /* no config found */
8644 err = alc_auto_add_mic_boost(codec);
8648 /* hack - override the init verbs */
8649 spec->init_verbs[0] = alc883_auto_init_verbs;
8651 return 1; /* config found */
8654 /* additional initialization for auto-configuration model */
8655 static void alc883_auto_init(struct hda_codec *codec)
8657 struct alc_spec *spec = codec->spec;
8658 alc883_auto_init_multi_out(codec);
8659 alc883_auto_init_hp_out(codec);
8660 alc883_auto_init_analog_input(codec);
8661 alc883_auto_init_input_src(codec);
8662 if (spec->unsol_event)
8663 alc_inithook(codec);
8666 static int patch_alc883(struct hda_codec *codec)
8668 struct alc_spec *spec;
8669 int err, board_config;
8671 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8677 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8679 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8682 if (board_config < 0) {
8683 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8684 "trying auto-probe from BIOS...\n");
8685 board_config = ALC883_AUTO;
8688 if (board_config == ALC883_AUTO) {
8689 /* automatic parse from the BIOS config */
8690 err = alc883_parse_auto_config(codec);
8696 "hda_codec: Cannot set up configuration "
8697 "from BIOS. Using base mode...\n");
8698 board_config = ALC883_3ST_2ch_DIG;
8702 if (board_config != ALC883_AUTO)
8703 setup_preset(spec, &alc883_presets[board_config]);
8705 switch (codec->vendor_id) {
8707 if (codec->revision_id == 0x100101) {
8708 spec->stream_name_analog = "ALC1200 Analog";
8709 spec->stream_name_digital = "ALC1200 Digital";
8711 spec->stream_name_analog = "ALC888 Analog";
8712 spec->stream_name_digital = "ALC888 Digital";
8716 spec->stream_name_analog = "ALC889 Analog";
8717 spec->stream_name_digital = "ALC889 Digital";
8720 spec->stream_name_analog = "ALC883 Analog";
8721 spec->stream_name_digital = "ALC883 Digital";
8725 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8726 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8727 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8729 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8730 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8732 if (!spec->num_adc_nids) {
8733 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8734 spec->adc_nids = alc883_adc_nids;
8736 if (!spec->capsrc_nids)
8737 spec->capsrc_nids = alc883_capsrc_nids;
8738 spec->is_mix_capture = 1; /* matrix-style capture */
8739 if (!spec->cap_mixer)
8740 set_capture_mixer(spec);
8742 spec->vmaster_nid = 0x0c;
8744 codec->patch_ops = alc_patch_ops;
8745 if (board_config == ALC883_AUTO)
8746 spec->init_hook = alc883_auto_init;
8748 #ifdef CONFIG_SND_HDA_POWER_SAVE
8749 if (!spec->loopback.amplist)
8750 spec->loopback.amplist = alc883_loopbacks;
8760 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8761 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8763 #define alc262_dac_nids alc260_dac_nids
8764 #define alc262_adc_nids alc882_adc_nids
8765 #define alc262_adc_nids_alt alc882_adc_nids_alt
8766 #define alc262_capsrc_nids alc882_capsrc_nids
8767 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8769 #define alc262_modes alc260_modes
8770 #define alc262_capture_source alc882_capture_source
8772 static hda_nid_t alc262_dmic_adc_nids[1] = {
8777 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8779 static struct snd_kcontrol_new alc262_base_mixer[] = {
8780 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8781 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8782 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8783 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8784 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8785 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8786 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8787 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8788 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8789 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8790 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8791 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8792 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8793 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8794 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8796 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8797 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8801 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8802 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8803 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8804 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8805 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8806 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8807 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8810 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8811 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8812 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8813 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8814 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8815 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8816 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8821 /* update HP, line and mono-out pins according to the master switch */
8822 static void alc262_hp_master_update(struct hda_codec *codec)
8824 struct alc_spec *spec = codec->spec;
8825 int val = spec->master_sw;
8828 snd_hda_codec_write_cache(codec, 0x1b, 0,
8829 AC_VERB_SET_PIN_WIDGET_CONTROL,
8831 snd_hda_codec_write_cache(codec, 0x15, 0,
8832 AC_VERB_SET_PIN_WIDGET_CONTROL,
8834 /* mono (speaker) depending on the HP jack sense */
8835 val = val && !spec->jack_present;
8836 snd_hda_codec_write_cache(codec, 0x16, 0,
8837 AC_VERB_SET_PIN_WIDGET_CONTROL,
8841 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8843 struct alc_spec *spec = codec->spec;
8844 unsigned int presence;
8845 presence = snd_hda_codec_read(codec, 0x1b, 0,
8846 AC_VERB_GET_PIN_SENSE, 0);
8847 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8848 alc262_hp_master_update(codec);
8851 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8853 if ((res >> 26) != ALC880_HP_EVENT)
8855 alc262_hp_bpc_automute(codec);
8858 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8860 struct alc_spec *spec = codec->spec;
8861 unsigned int presence;
8862 presence = snd_hda_codec_read(codec, 0x15, 0,
8863 AC_VERB_GET_PIN_SENSE, 0);
8864 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8865 alc262_hp_master_update(codec);
8868 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8871 if ((res >> 26) != ALC880_HP_EVENT)
8873 alc262_hp_wildwest_automute(codec);
8876 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8877 struct snd_ctl_elem_value *ucontrol)
8879 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8880 struct alc_spec *spec = codec->spec;
8881 *ucontrol->value.integer.value = spec->master_sw;
8885 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8886 struct snd_ctl_elem_value *ucontrol)
8888 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8889 struct alc_spec *spec = codec->spec;
8890 int val = !!*ucontrol->value.integer.value;
8892 if (val == spec->master_sw)
8894 spec->master_sw = val;
8895 alc262_hp_master_update(codec);
8899 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8901 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8902 .name = "Master Playback Switch",
8903 .info = snd_ctl_boolean_mono_info,
8904 .get = alc262_hp_master_sw_get,
8905 .put = alc262_hp_master_sw_put,
8907 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8908 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8910 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8912 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8914 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8915 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8916 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8917 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8918 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8919 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8920 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8921 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8922 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8923 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8924 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8925 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8926 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8927 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8931 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8933 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8934 .name = "Master Playback Switch",
8935 .info = snd_ctl_boolean_mono_info,
8936 .get = alc262_hp_master_sw_get,
8937 .put = alc262_hp_master_sw_put,
8939 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8940 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8941 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8942 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8943 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8945 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8947 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8948 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8949 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8950 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8951 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8952 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8953 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8954 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8955 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8959 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8960 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8961 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8962 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8966 /* mute/unmute internal speaker according to the hp jack and mute state */
8967 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8969 struct alc_spec *spec = codec->spec;
8971 if (force || !spec->sense_updated) {
8972 unsigned int present;
8973 present = snd_hda_codec_read(codec, 0x15, 0,
8974 AC_VERB_GET_PIN_SENSE, 0);
8975 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8976 spec->sense_updated = 1;
8978 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8979 spec->jack_present ? HDA_AMP_MUTE : 0);
8982 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8985 if ((res >> 26) != ALC880_HP_EVENT)
8987 alc262_hp_t5735_automute(codec, 1);
8990 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8992 alc262_hp_t5735_automute(codec, 1);
8995 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8996 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8997 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8998 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9001 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9002 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9006 static struct hda_verb alc262_hp_t5735_verbs[] = {
9007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9010 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9014 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9015 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9017 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9018 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9019 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9020 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9024 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9025 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9026 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9027 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9028 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9029 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9030 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9034 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9038 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9045 /* bind hp and internal speaker mute (with plug check) */
9046 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9047 struct snd_ctl_elem_value *ucontrol)
9049 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9050 long *valp = ucontrol->value.integer.value;
9053 /* change hp mute */
9054 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9056 valp[0] ? 0 : HDA_AMP_MUTE);
9057 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9059 valp[1] ? 0 : HDA_AMP_MUTE);
9061 /* change speaker according to HP jack state */
9062 struct alc_spec *spec = codec->spec;
9064 if (spec->jack_present)
9065 mute = HDA_AMP_MUTE;
9067 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9069 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9070 HDA_AMP_MUTE, mute);
9075 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9076 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9078 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9079 .name = "Master Playback Switch",
9080 .info = snd_hda_mixer_amp_switch_info,
9081 .get = snd_hda_mixer_amp_switch_get,
9082 .put = alc262_sony_master_sw_put,
9083 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9085 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9086 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9087 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9088 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9092 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9093 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9094 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9095 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9098 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9099 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9103 #define alc262_capture_mixer alc882_capture_mixer
9104 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9107 * generic initialization of ADC, input mixers and output mixers
9109 static struct hda_verb alc262_init_verbs[] = {
9111 * Unmute ADC0-2 and set the default input to mic-in
9113 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9115 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9116 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9117 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9118 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9120 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9122 * Note: PASD motherboards uses the Line In 2 as the input for
9123 * front panel mic (mic 2)
9125 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9133 * Set up output mixers (0x0c - 0x0e)
9135 /* set vol=0 to output mixers */
9136 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9139 /* set up input amps for analog loopback */
9140 /* Amp Indices: DAC = 0, mixer = 1 */
9141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9142 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9143 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9149 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9150 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9151 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9152 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9153 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9157 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9158 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9159 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9161 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9162 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9164 /* FIXME: use matrix-type input source selection */
9165 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9166 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9167 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9168 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9169 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9172 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9185 static struct hda_verb alc262_eapd_verbs[] = {
9186 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9187 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9191 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9192 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9193 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9197 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9198 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9199 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9200 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9202 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9203 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9207 static struct hda_verb alc262_sony_unsol_verbs[] = {
9208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9209 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9210 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9212 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9217 static struct hda_input_mux alc262_dmic_capture_source = {
9220 { "Int DMic", 0x9 },
9225 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9226 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9227 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9228 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9234 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9235 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9238 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9239 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9240 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9241 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9242 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9246 static void alc262_dmic_automute(struct hda_codec *codec)
9248 unsigned int present;
9250 present = snd_hda_codec_read(codec, 0x18, 0,
9251 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9252 snd_hda_codec_write(codec, 0x22, 0,
9253 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9256 /* toggle speaker-output according to the hp-jack state */
9257 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9259 unsigned int present;
9262 present = snd_hda_codec_read(codec, 0x15, 0,
9263 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9264 bits = present ? 0 : PIN_OUT;
9265 snd_hda_codec_write(codec, 0x14, 0,
9266 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9271 /* unsolicited event for HP jack sensing */
9272 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9275 if ((res >> 26) == ALC880_HP_EVENT)
9276 alc262_toshiba_s06_speaker_automute(codec);
9277 if ((res >> 26) == ALC880_MIC_EVENT)
9278 alc262_dmic_automute(codec);
9282 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9284 alc262_toshiba_s06_speaker_automute(codec);
9285 alc262_dmic_automute(codec);
9288 /* mute/unmute internal speaker according to the hp jack and mute state */
9289 static void alc262_hippo_automute(struct hda_codec *codec)
9291 struct alc_spec *spec = codec->spec;
9293 unsigned int present;
9295 /* need to execute and sync at first */
9296 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9297 present = snd_hda_codec_read(codec, 0x15, 0,
9298 AC_VERB_GET_PIN_SENSE, 0);
9299 spec->jack_present = (present & 0x80000000) != 0;
9300 if (spec->jack_present) {
9301 /* mute internal speaker */
9302 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9303 HDA_AMP_MUTE, HDA_AMP_MUTE);
9305 /* unmute internal speaker if necessary */
9306 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9307 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9308 HDA_AMP_MUTE, mute);
9312 /* unsolicited event for HP jack sensing */
9313 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9316 if ((res >> 26) != ALC880_HP_EVENT)
9318 alc262_hippo_automute(codec);
9321 static void alc262_hippo1_automute(struct hda_codec *codec)
9324 unsigned int present;
9326 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9327 present = snd_hda_codec_read(codec, 0x1b, 0,
9328 AC_VERB_GET_PIN_SENSE, 0);
9329 present = (present & 0x80000000) != 0;
9331 /* mute internal speaker */
9332 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9333 HDA_AMP_MUTE, HDA_AMP_MUTE);
9335 /* unmute internal speaker if necessary */
9336 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9337 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9338 HDA_AMP_MUTE, mute);
9342 /* unsolicited event for HP jack sensing */
9343 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9346 if ((res >> 26) != ALC880_HP_EVENT)
9348 alc262_hippo1_automute(codec);
9354 * 0x16 = internal speaker
9355 * 0x18 = external mic
9358 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9359 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9360 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9364 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9366 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9367 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9371 static struct hda_verb alc262_nec_verbs[] = {
9372 /* Unmute Speaker */
9373 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9376 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9377 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9379 /* External mic to headphone */
9380 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9381 /* External mic to speaker */
9382 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9388 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9389 * 0x1b = port replicator headphone out
9392 #define ALC_HP_EVENT 0x37
9394 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9395 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9396 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9397 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9398 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9402 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9403 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9404 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9408 static struct hda_input_mux alc262_fujitsu_capture_source = {
9417 static struct hda_input_mux alc262_HP_capture_source = {
9421 { "Front Mic", 0x1 },
9428 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9432 { "Front Mic", 0x2 },
9438 /* mute/unmute internal speaker according to the hp jacks and mute state */
9439 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9441 struct alc_spec *spec = codec->spec;
9444 if (force || !spec->sense_updated) {
9445 unsigned int present;
9446 /* need to execute and sync at first */
9447 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9448 /* check laptop HP jack */
9449 present = snd_hda_codec_read(codec, 0x14, 0,
9450 AC_VERB_GET_PIN_SENSE, 0);
9451 /* need to execute and sync at first */
9452 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9453 /* check docking HP jack */
9454 present |= snd_hda_codec_read(codec, 0x1b, 0,
9455 AC_VERB_GET_PIN_SENSE, 0);
9456 if (present & AC_PINSENSE_PRESENCE)
9457 spec->jack_present = 1;
9459 spec->jack_present = 0;
9460 spec->sense_updated = 1;
9462 /* unmute internal speaker only if both HPs are unplugged and
9463 * master switch is on
9465 if (spec->jack_present)
9466 mute = HDA_AMP_MUTE;
9468 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9469 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9470 HDA_AMP_MUTE, mute);
9473 /* unsolicited event for HP jack sensing */
9474 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9477 if ((res >> 26) != ALC_HP_EVENT)
9479 alc262_fujitsu_automute(codec, 1);
9482 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9484 alc262_fujitsu_automute(codec, 1);
9487 /* bind volumes of both NID 0x0c and 0x0d */
9488 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9489 .ops = &snd_hda_bind_vol,
9491 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9492 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9497 /* mute/unmute internal speaker according to the hp jack and mute state */
9498 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9500 struct alc_spec *spec = codec->spec;
9503 if (force || !spec->sense_updated) {
9504 unsigned int present_int_hp;
9505 /* need to execute and sync at first */
9506 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9507 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9508 AC_VERB_GET_PIN_SENSE, 0);
9509 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9510 spec->sense_updated = 1;
9512 if (spec->jack_present) {
9513 /* mute internal speaker */
9514 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9515 HDA_AMP_MUTE, HDA_AMP_MUTE);
9516 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9517 HDA_AMP_MUTE, HDA_AMP_MUTE);
9519 /* unmute internal speaker if necessary */
9520 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9521 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9522 HDA_AMP_MUTE, mute);
9523 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9524 HDA_AMP_MUTE, mute);
9528 /* unsolicited event for HP jack sensing */
9529 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9532 if ((res >> 26) != ALC_HP_EVENT)
9534 alc262_lenovo_3000_automute(codec, 1);
9537 /* bind hp and internal speaker mute (with plug check) */
9538 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9539 struct snd_ctl_elem_value *ucontrol)
9541 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9542 long *valp = ucontrol->value.integer.value;
9545 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9547 valp ? 0 : HDA_AMP_MUTE);
9548 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9550 valp ? 0 : HDA_AMP_MUTE);
9553 alc262_fujitsu_automute(codec, 0);
9557 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9558 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9561 .name = "Master Playback Switch",
9562 .info = snd_hda_mixer_amp_switch_info,
9563 .get = snd_hda_mixer_amp_switch_get,
9564 .put = alc262_fujitsu_master_sw_put,
9565 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9567 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9568 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9569 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9570 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9571 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9574 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9575 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9576 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9580 /* bind hp and internal speaker mute (with plug check) */
9581 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9582 struct snd_ctl_elem_value *ucontrol)
9584 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9585 long *valp = ucontrol->value.integer.value;
9588 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9590 valp ? 0 : HDA_AMP_MUTE);
9593 alc262_lenovo_3000_automute(codec, 0);
9597 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9598 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9600 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9601 .name = "Master Playback Switch",
9602 .info = snd_hda_mixer_amp_switch_info,
9603 .get = snd_hda_mixer_amp_switch_get,
9604 .put = alc262_lenovo_3000_master_sw_put,
9605 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9607 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9608 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9609 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9611 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9612 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9613 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9614 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9618 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9619 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9622 .name = "Master Playback Switch",
9623 .info = snd_hda_mixer_amp_switch_info,
9624 .get = snd_hda_mixer_amp_switch_get,
9625 .put = alc262_sony_master_sw_put,
9626 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9630 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9631 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9632 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9633 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9637 /* additional init verbs for Benq laptops */
9638 static struct hda_verb alc262_EAPD_verbs[] = {
9639 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9640 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9644 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9645 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9646 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9648 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9649 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9653 /* Samsung Q1 Ultra Vista model setup */
9654 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9655 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9656 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9659 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9660 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9664 static struct hda_verb alc262_ultra_verbs[] = {
9666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9670 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9671 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9672 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9673 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9678 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9679 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9681 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9682 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9683 /* ADC, choose mic */
9684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9685 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9686 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9687 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9688 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9689 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9690 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9691 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9692 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9693 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9697 /* mute/unmute internal speaker according to the hp jack and mute state */
9698 static void alc262_ultra_automute(struct hda_codec *codec)
9700 struct alc_spec *spec = codec->spec;
9704 /* auto-mute only when HP is used as HP */
9705 if (!spec->cur_mux[0]) {
9706 unsigned int present;
9707 /* need to execute and sync at first */
9708 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9709 present = snd_hda_codec_read(codec, 0x15, 0,
9710 AC_VERB_GET_PIN_SENSE, 0);
9711 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9712 if (spec->jack_present)
9713 mute = HDA_AMP_MUTE;
9715 /* mute/unmute internal speaker */
9716 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9717 HDA_AMP_MUTE, mute);
9718 /* mute/unmute HP */
9719 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9720 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9723 /* unsolicited event for HP jack sensing */
9724 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9727 if ((res >> 26) != ALC880_HP_EVENT)
9729 alc262_ultra_automute(codec);
9732 static struct hda_input_mux alc262_ultra_capture_source = {
9736 { "Headphone", 0x7 },
9740 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9741 struct snd_ctl_elem_value *ucontrol)
9743 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9744 struct alc_spec *spec = codec->spec;
9747 ret = alc_mux_enum_put(kcontrol, ucontrol);
9750 /* reprogram the HP pin as mic or HP according to the input source */
9751 snd_hda_codec_write_cache(codec, 0x15, 0,
9752 AC_VERB_SET_PIN_WIDGET_CONTROL,
9753 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9754 alc262_ultra_automute(codec); /* mute/unmute HP */
9758 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9759 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9760 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9762 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9763 .name = "Capture Source",
9764 .info = alc_mux_enum_info,
9765 .get = alc_mux_enum_get,
9766 .put = alc262_ultra_mux_enum_put,
9771 /* add playback controls from the parsed DAC table */
9772 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9773 const struct auto_pin_cfg *cfg)
9778 spec->multiout.num_dacs = 1; /* only use one dac */
9779 spec->multiout.dac_nids = spec->private_dac_nids;
9780 spec->multiout.dac_nids[0] = 2;
9782 nid = cfg->line_out_pins[0];
9784 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9785 "Front Playback Volume",
9786 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9789 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9790 "Front Playback Switch",
9791 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9796 nid = cfg->speaker_pins[0];
9799 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9800 "Speaker Playback Volume",
9801 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9805 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9806 "Speaker Playback Switch",
9807 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9812 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9813 "Speaker Playback Switch",
9814 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9820 nid = cfg->hp_pins[0];
9822 /* spec->multiout.hp_nid = 2; */
9824 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9825 "Headphone Playback Volume",
9826 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9830 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9831 "Headphone Playback Switch",
9832 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9837 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9838 "Headphone Playback Switch",
9839 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9848 /* identical with ALC880 */
9849 #define alc262_auto_create_analog_input_ctls \
9850 alc880_auto_create_analog_input_ctls
9853 * generic initialization of ADC, input mixers and output mixers
9855 static struct hda_verb alc262_volume_init_verbs[] = {
9857 * Unmute ADC0-2 and set the default input to mic-in
9859 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9861 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9862 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9863 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9864 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9866 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9868 * Note: PASD motherboards uses the Line In 2 as the input for
9869 * front panel mic (mic 2)
9871 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9872 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9873 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9874 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9875 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9876 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9879 * Set up output mixers (0x0c - 0x0f)
9881 /* set vol=0 to output mixers */
9882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9884 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9886 /* set up input amps for analog loopback */
9887 /* Amp Indices: DAC = 0, mixer = 1 */
9888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9891 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9893 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9895 /* FIXME: use matrix-type input source selection */
9896 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9897 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9898 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9899 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9900 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9901 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9903 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9904 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9905 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9906 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9916 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9918 * Unmute ADC0-2 and set the default input to mic-in
9920 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9921 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9922 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9923 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9924 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9925 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9927 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9929 * Note: PASD motherboards uses the Line In 2 as the input for
9930 * front panel mic (mic 2)
9932 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9942 * Set up output mixers (0x0c - 0x0e)
9944 /* set vol=0 to output mixers */
9945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9947 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9949 /* set up input amps for analog loopback */
9950 /* Amp Indices: DAC = 0, mixer = 1 */
9951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9954 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9956 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9958 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9960 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9962 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9963 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9965 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9966 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9968 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9969 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9970 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9971 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9972 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9974 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9975 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9976 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9977 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9978 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9979 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9982 /* FIXME: use matrix-type input source selection */
9983 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9984 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9987 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9988 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9990 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9991 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9992 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9997 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9998 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10000 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10005 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10007 * Unmute ADC0-2 and set the default input to mic-in
10009 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10010 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10011 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10012 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10013 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10014 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10016 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10018 * Note: PASD motherboards uses the Line In 2 as the input for front
10019 * panel mic (mic 2)
10021 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10031 * Set up output mixers (0x0c - 0x0e)
10033 /* set vol=0 to output mixers */
10034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10035 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10036 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10038 /* set up input amps for analog loopback */
10039 /* Amp Indices: DAC = 0, mixer = 1 */
10040 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10041 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10042 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10044 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10048 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10049 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10050 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10051 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10052 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10053 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10054 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10056 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10059 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10060 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10062 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10063 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10065 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10066 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10067 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10069 /* FIXME: use matrix-type input source selection */
10070 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10071 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10075 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10076 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10077 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10080 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10081 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10082 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10083 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10085 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10086 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10093 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10096 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10101 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10103 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10104 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10105 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10107 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10108 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10109 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10110 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10113 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10114 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10119 #ifdef CONFIG_SND_HDA_POWER_SAVE
10120 #define alc262_loopbacks alc880_loopbacks
10123 /* pcm configuration: identiacal with ALC880 */
10124 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10125 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10126 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10127 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10130 * BIOS auto configuration
10132 static int alc262_parse_auto_config(struct hda_codec *codec)
10134 struct alc_spec *spec = codec->spec;
10136 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10138 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10142 if (!spec->autocfg.line_outs)
10143 return 0; /* can't find valid BIOS pin config */
10144 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10147 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10151 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10153 if (spec->autocfg.dig_out_pin)
10154 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10155 if (spec->autocfg.dig_in_pin)
10156 spec->dig_in_nid = ALC262_DIGIN_NID;
10158 if (spec->kctls.list)
10159 add_mixer(spec, spec->kctls.list);
10161 add_verb(spec, alc262_volume_init_verbs);
10162 spec->num_mux_defs = 1;
10163 spec->input_mux = &spec->private_imux;
10165 err = alc_auto_add_mic_boost(codec);
10169 store_pin_configs(codec);
10173 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10174 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10175 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10176 #define alc262_auto_init_input_src alc882_auto_init_input_src
10179 /* init callback for auto-configuration model -- overriding the default init */
10180 static void alc262_auto_init(struct hda_codec *codec)
10182 struct alc_spec *spec = codec->spec;
10183 alc262_auto_init_multi_out(codec);
10184 alc262_auto_init_hp_out(codec);
10185 alc262_auto_init_analog_input(codec);
10186 alc262_auto_init_input_src(codec);
10187 if (spec->unsol_event)
10188 alc_inithook(codec);
10192 * configuration and preset
10194 static const char *alc262_models[ALC262_MODEL_LAST] = {
10195 [ALC262_BASIC] = "basic",
10196 [ALC262_HIPPO] = "hippo",
10197 [ALC262_HIPPO_1] = "hippo_1",
10198 [ALC262_FUJITSU] = "fujitsu",
10199 [ALC262_HP_BPC] = "hp-bpc",
10200 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10201 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10202 [ALC262_HP_RP5700] = "hp-rp5700",
10203 [ALC262_BENQ_ED8] = "benq",
10204 [ALC262_BENQ_T31] = "benq-t31",
10205 [ALC262_SONY_ASSAMD] = "sony-assamd",
10206 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10207 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10208 [ALC262_ULTRA] = "ultra",
10209 [ALC262_LENOVO_3000] = "lenovo-3000",
10210 [ALC262_NEC] = "nec",
10211 [ALC262_AUTO] = "auto",
10214 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10215 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10216 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10217 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10218 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10219 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10220 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10221 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10222 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10223 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10224 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10225 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10226 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10227 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10228 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10229 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10230 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10231 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10232 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10233 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10234 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10235 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10236 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10237 ALC262_HP_TC_T5735),
10238 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10239 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10240 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10241 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10242 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10243 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10244 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10245 ALC262_TOSHIBA_RX1),
10246 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10247 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10248 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10249 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10250 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10251 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10252 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10253 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10254 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10258 static struct alc_config_preset alc262_presets[] = {
10260 .mixers = { alc262_base_mixer },
10261 .init_verbs = { alc262_init_verbs },
10262 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10263 .dac_nids = alc262_dac_nids,
10265 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10266 .channel_mode = alc262_modes,
10267 .input_mux = &alc262_capture_source,
10270 .mixers = { alc262_base_mixer },
10271 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10272 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10273 .dac_nids = alc262_dac_nids,
10275 .dig_out_nid = ALC262_DIGOUT_NID,
10276 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10277 .channel_mode = alc262_modes,
10278 .input_mux = &alc262_capture_source,
10279 .unsol_event = alc262_hippo_unsol_event,
10280 .init_hook = alc262_hippo_automute,
10282 [ALC262_HIPPO_1] = {
10283 .mixers = { alc262_hippo1_mixer },
10284 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10285 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10286 .dac_nids = alc262_dac_nids,
10288 .dig_out_nid = ALC262_DIGOUT_NID,
10289 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10290 .channel_mode = alc262_modes,
10291 .input_mux = &alc262_capture_source,
10292 .unsol_event = alc262_hippo1_unsol_event,
10293 .init_hook = alc262_hippo1_automute,
10295 [ALC262_FUJITSU] = {
10296 .mixers = { alc262_fujitsu_mixer },
10297 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10298 alc262_fujitsu_unsol_verbs },
10299 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10300 .dac_nids = alc262_dac_nids,
10302 .dig_out_nid = ALC262_DIGOUT_NID,
10303 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10304 .channel_mode = alc262_modes,
10305 .input_mux = &alc262_fujitsu_capture_source,
10306 .unsol_event = alc262_fujitsu_unsol_event,
10307 .init_hook = alc262_fujitsu_init_hook,
10309 [ALC262_HP_BPC] = {
10310 .mixers = { alc262_HP_BPC_mixer },
10311 .init_verbs = { alc262_HP_BPC_init_verbs },
10312 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10313 .dac_nids = alc262_dac_nids,
10315 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10316 .channel_mode = alc262_modes,
10317 .input_mux = &alc262_HP_capture_source,
10318 .unsol_event = alc262_hp_bpc_unsol_event,
10319 .init_hook = alc262_hp_bpc_automute,
10321 [ALC262_HP_BPC_D7000_WF] = {
10322 .mixers = { alc262_HP_BPC_WildWest_mixer },
10323 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10324 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10325 .dac_nids = alc262_dac_nids,
10327 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10328 .channel_mode = alc262_modes,
10329 .input_mux = &alc262_HP_D7000_capture_source,
10330 .unsol_event = alc262_hp_wildwest_unsol_event,
10331 .init_hook = alc262_hp_wildwest_automute,
10333 [ALC262_HP_BPC_D7000_WL] = {
10334 .mixers = { alc262_HP_BPC_WildWest_mixer,
10335 alc262_HP_BPC_WildWest_option_mixer },
10336 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10337 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10338 .dac_nids = alc262_dac_nids,
10340 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10341 .channel_mode = alc262_modes,
10342 .input_mux = &alc262_HP_D7000_capture_source,
10343 .unsol_event = alc262_hp_wildwest_unsol_event,
10344 .init_hook = alc262_hp_wildwest_automute,
10346 [ALC262_HP_TC_T5735] = {
10347 .mixers = { alc262_hp_t5735_mixer },
10348 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10349 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10350 .dac_nids = alc262_dac_nids,
10352 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10353 .channel_mode = alc262_modes,
10354 .input_mux = &alc262_capture_source,
10355 .unsol_event = alc262_hp_t5735_unsol_event,
10356 .init_hook = alc262_hp_t5735_init_hook,
10358 [ALC262_HP_RP5700] = {
10359 .mixers = { alc262_hp_rp5700_mixer },
10360 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10361 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10362 .dac_nids = alc262_dac_nids,
10363 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10364 .channel_mode = alc262_modes,
10365 .input_mux = &alc262_hp_rp5700_capture_source,
10367 [ALC262_BENQ_ED8] = {
10368 .mixers = { alc262_base_mixer },
10369 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10370 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10371 .dac_nids = alc262_dac_nids,
10373 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10374 .channel_mode = alc262_modes,
10375 .input_mux = &alc262_capture_source,
10377 [ALC262_SONY_ASSAMD] = {
10378 .mixers = { alc262_sony_mixer },
10379 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10380 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10381 .dac_nids = alc262_dac_nids,
10383 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10384 .channel_mode = alc262_modes,
10385 .input_mux = &alc262_capture_source,
10386 .unsol_event = alc262_hippo_unsol_event,
10387 .init_hook = alc262_hippo_automute,
10389 [ALC262_BENQ_T31] = {
10390 .mixers = { alc262_benq_t31_mixer },
10391 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10392 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10393 .dac_nids = alc262_dac_nids,
10395 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10396 .channel_mode = alc262_modes,
10397 .input_mux = &alc262_capture_source,
10398 .unsol_event = alc262_hippo_unsol_event,
10399 .init_hook = alc262_hippo_automute,
10402 .mixers = { alc262_ultra_mixer },
10403 .cap_mixer = alc262_ultra_capture_mixer,
10404 .init_verbs = { alc262_ultra_verbs },
10405 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10406 .dac_nids = alc262_dac_nids,
10407 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10408 .channel_mode = alc262_modes,
10409 .input_mux = &alc262_ultra_capture_source,
10410 .adc_nids = alc262_adc_nids, /* ADC0 */
10411 .capsrc_nids = alc262_capsrc_nids,
10412 .num_adc_nids = 1, /* single ADC */
10413 .unsol_event = alc262_ultra_unsol_event,
10414 .init_hook = alc262_ultra_automute,
10416 [ALC262_LENOVO_3000] = {
10417 .mixers = { alc262_lenovo_3000_mixer },
10418 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10419 alc262_lenovo_3000_unsol_verbs },
10420 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10421 .dac_nids = alc262_dac_nids,
10423 .dig_out_nid = ALC262_DIGOUT_NID,
10424 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10425 .channel_mode = alc262_modes,
10426 .input_mux = &alc262_fujitsu_capture_source,
10427 .unsol_event = alc262_lenovo_3000_unsol_event,
10430 .mixers = { alc262_nec_mixer },
10431 .init_verbs = { alc262_nec_verbs },
10432 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10433 .dac_nids = alc262_dac_nids,
10435 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10436 .channel_mode = alc262_modes,
10437 .input_mux = &alc262_capture_source,
10439 [ALC262_TOSHIBA_S06] = {
10440 .mixers = { alc262_toshiba_s06_mixer },
10441 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10442 alc262_eapd_verbs },
10443 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10444 .capsrc_nids = alc262_dmic_capsrc_nids,
10445 .dac_nids = alc262_dac_nids,
10446 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10447 .dig_out_nid = ALC262_DIGOUT_NID,
10448 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10449 .channel_mode = alc262_modes,
10450 .input_mux = &alc262_dmic_capture_source,
10451 .unsol_event = alc262_toshiba_s06_unsol_event,
10452 .init_hook = alc262_toshiba_s06_init_hook,
10454 [ALC262_TOSHIBA_RX1] = {
10455 .mixers = { alc262_toshiba_rx1_mixer },
10456 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10457 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10458 .dac_nids = alc262_dac_nids,
10460 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10461 .channel_mode = alc262_modes,
10462 .input_mux = &alc262_capture_source,
10463 .unsol_event = alc262_hippo_unsol_event,
10464 .init_hook = alc262_hippo_automute,
10468 static int patch_alc262(struct hda_codec *codec)
10470 struct alc_spec *spec;
10474 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10478 codec->spec = spec;
10480 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10485 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10486 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10487 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10488 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10492 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10494 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10498 if (board_config < 0) {
10499 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10500 "trying auto-probe from BIOS...\n");
10501 board_config = ALC262_AUTO;
10504 if (board_config == ALC262_AUTO) {
10505 /* automatic parse from the BIOS config */
10506 err = alc262_parse_auto_config(codec);
10512 "hda_codec: Cannot set up configuration "
10513 "from BIOS. Using base mode...\n");
10514 board_config = ALC262_BASIC;
10518 if (board_config != ALC262_AUTO)
10519 setup_preset(spec, &alc262_presets[board_config]);
10521 spec->stream_name_analog = "ALC262 Analog";
10522 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10523 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10525 spec->stream_name_digital = "ALC262 Digital";
10526 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10527 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10529 spec->is_mix_capture = 1;
10530 if (!spec->adc_nids && spec->input_mux) {
10531 /* check whether NID 0x07 is valid */
10532 unsigned int wcap = get_wcaps(codec, 0x07);
10535 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10536 if (wcap != AC_WID_AUD_IN) {
10537 spec->adc_nids = alc262_adc_nids_alt;
10538 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10539 spec->capsrc_nids = alc262_capsrc_nids_alt;
10541 spec->adc_nids = alc262_adc_nids;
10542 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10543 spec->capsrc_nids = alc262_capsrc_nids;
10546 if (!spec->cap_mixer)
10547 set_capture_mixer(spec);
10549 spec->vmaster_nid = 0x0c;
10551 codec->patch_ops = alc_patch_ops;
10552 if (board_config == ALC262_AUTO)
10553 spec->init_hook = alc262_auto_init;
10554 #ifdef CONFIG_SND_HDA_POWER_SAVE
10555 if (!spec->loopback.amplist)
10556 spec->loopback.amplist = alc262_loopbacks;
10563 * ALC268 channel source setting (2 channel)
10565 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10566 #define alc268_modes alc260_modes
10568 static hda_nid_t alc268_dac_nids[2] = {
10573 static hda_nid_t alc268_adc_nids[2] = {
10578 static hda_nid_t alc268_adc_nids_alt[1] = {
10583 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10585 static struct snd_kcontrol_new alc268_base_mixer[] = {
10586 /* output mixer control */
10587 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10588 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10589 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10591 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10592 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10593 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10597 /* bind Beep switches of both NID 0x0f and 0x10 */
10598 static struct hda_bind_ctls alc268_bind_beep_sw = {
10599 .ops = &snd_hda_bind_sw,
10601 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10602 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10607 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10608 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10609 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10613 static struct hda_verb alc268_eapd_verbs[] = {
10614 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10615 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10619 /* Toshiba specific */
10620 #define alc268_toshiba_automute alc262_hippo_automute
10622 static struct hda_verb alc268_toshiba_verbs[] = {
10623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10627 static struct hda_input_mux alc268_acer_lc_capture_source = {
10635 /* Acer specific */
10636 /* bind volumes of both NID 0x02 and 0x03 */
10637 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10638 .ops = &snd_hda_bind_vol,
10640 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10641 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10646 /* mute/unmute internal speaker according to the hp jack and mute state */
10647 static void alc268_acer_automute(struct hda_codec *codec, int force)
10649 struct alc_spec *spec = codec->spec;
10652 if (force || !spec->sense_updated) {
10653 unsigned int present;
10654 present = snd_hda_codec_read(codec, 0x14, 0,
10655 AC_VERB_GET_PIN_SENSE, 0);
10656 spec->jack_present = (present & 0x80000000) != 0;
10657 spec->sense_updated = 1;
10659 if (spec->jack_present)
10660 mute = HDA_AMP_MUTE; /* mute internal speaker */
10661 else /* unmute internal speaker if necessary */
10662 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10663 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10664 HDA_AMP_MUTE, mute);
10668 /* bind hp and internal speaker mute (with plug check) */
10669 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10670 struct snd_ctl_elem_value *ucontrol)
10672 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10673 long *valp = ucontrol->value.integer.value;
10676 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10678 valp[0] ? 0 : HDA_AMP_MUTE);
10679 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10681 valp[1] ? 0 : HDA_AMP_MUTE);
10683 alc268_acer_automute(codec, 0);
10687 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10688 /* output mixer control */
10689 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10691 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10692 .name = "Master Playback Switch",
10693 .info = snd_hda_mixer_amp_switch_info,
10694 .get = snd_hda_mixer_amp_switch_get,
10695 .put = alc268_acer_master_sw_put,
10696 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10698 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10702 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10703 /* output mixer control */
10704 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10706 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10707 .name = "Master Playback Switch",
10708 .info = snd_hda_mixer_amp_switch_info,
10709 .get = snd_hda_mixer_amp_switch_get,
10710 .put = alc268_acer_master_sw_put,
10711 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10713 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10714 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10715 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10719 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
10720 /* output mixer control */
10721 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10723 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10724 .name = "Master Playback Switch",
10725 .info = snd_hda_mixer_amp_switch_info,
10726 .get = snd_hda_mixer_amp_switch_get,
10727 .put = alc268_acer_master_sw_put,
10728 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10730 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10731 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10735 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10736 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10738 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10739 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10740 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10741 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10745 static struct hda_verb alc268_acer_verbs[] = {
10746 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10747 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10748 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10752 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10756 /* unsolicited event for HP jack sensing */
10757 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10760 if ((res >> 26) != ALC880_HP_EVENT)
10762 alc268_toshiba_automute(codec);
10765 static void alc268_acer_unsol_event(struct hda_codec *codec,
10768 if ((res >> 26) != ALC880_HP_EVENT)
10770 alc268_acer_automute(codec, 1);
10773 static void alc268_acer_init_hook(struct hda_codec *codec)
10775 alc268_acer_automute(codec, 1);
10778 /* toggle speaker-output according to the hp-jack state */
10779 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10781 unsigned int present;
10782 unsigned char bits;
10784 present = snd_hda_codec_read(codec, 0x15, 0,
10785 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10786 bits = present ? AMP_IN_MUTE(0) : 0;
10787 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10788 AMP_IN_MUTE(0), bits);
10789 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10790 AMP_IN_MUTE(0), bits);
10794 static void alc268_acer_mic_automute(struct hda_codec *codec)
10796 unsigned int present;
10798 present = snd_hda_codec_read(codec, 0x18, 0,
10799 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10800 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
10801 present ? 0x0 : 0x6);
10804 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
10807 if ((res >> 26) == ALC880_HP_EVENT)
10808 alc268_aspire_one_speaker_automute(codec);
10809 if ((res >> 26) == ALC880_MIC_EVENT)
10810 alc268_acer_mic_automute(codec);
10813 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
10815 alc268_aspire_one_speaker_automute(codec);
10816 alc268_acer_mic_automute(codec);
10819 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10820 /* output mixer control */
10821 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10822 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10823 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10824 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10825 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10826 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10830 static struct hda_verb alc268_dell_verbs[] = {
10831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10833 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10837 /* mute/unmute internal speaker according to the hp jack and mute state */
10838 static void alc268_dell_automute(struct hda_codec *codec)
10840 unsigned int present;
10843 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10844 if (present & 0x80000000)
10845 mute = HDA_AMP_MUTE;
10847 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10848 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10849 HDA_AMP_MUTE, mute);
10852 static void alc268_dell_unsol_event(struct hda_codec *codec,
10855 if ((res >> 26) != ALC880_HP_EVENT)
10857 alc268_dell_automute(codec);
10860 #define alc268_dell_init_hook alc268_dell_automute
10862 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10863 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10864 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10865 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10867 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10868 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10869 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10870 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10874 static struct hda_verb alc267_quanta_il1_verbs[] = {
10875 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10876 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10880 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10882 unsigned int present;
10884 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10885 & AC_PINSENSE_PRESENCE;
10886 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10887 present ? 0 : PIN_OUT);
10890 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10892 unsigned int present;
10894 present = snd_hda_codec_read(codec, 0x18, 0,
10895 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10896 snd_hda_codec_write(codec, 0x23, 0,
10897 AC_VERB_SET_CONNECT_SEL,
10898 present ? 0x00 : 0x01);
10901 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10903 alc267_quanta_il1_hp_automute(codec);
10904 alc267_quanta_il1_mic_automute(codec);
10907 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10910 switch (res >> 26) {
10911 case ALC880_HP_EVENT:
10912 alc267_quanta_il1_hp_automute(codec);
10914 case ALC880_MIC_EVENT:
10915 alc267_quanta_il1_mic_automute(codec);
10921 * generic initialization of ADC, input mixers and output mixers
10923 static struct hda_verb alc268_base_init_verbs[] = {
10924 /* Unmute DAC0-1 and set vol = 0 */
10925 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10926 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10927 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10928 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10929 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10930 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10933 * Set up output mixers (0x0c - 0x0e)
10935 /* set vol=0 to output mixers */
10936 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10937 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10938 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10939 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10941 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10942 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10944 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10945 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10946 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10947 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10948 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10949 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10950 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10951 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10953 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10955 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10956 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10957 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10958 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10959 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10961 /* set PCBEEP vol = 0, mute connections */
10962 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10963 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10964 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10966 /* Unmute Selector 23h,24h and set the default input to mic-in */
10968 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10969 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10970 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10977 * generic initialization of ADC, input mixers and output mixers
10979 static struct hda_verb alc268_volume_init_verbs[] = {
10980 /* set output DAC */
10981 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10982 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10983 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10984 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10986 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10987 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10988 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10989 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10990 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10992 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10993 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10994 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10995 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10996 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10998 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10999 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11000 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11001 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11003 /* set PCBEEP vol = 0, mute connections */
11004 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11005 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11006 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11011 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11012 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11013 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11015 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11016 /* The multiple "Capture Source" controls confuse alsamixer
11017 * So call somewhat different..
11019 /* .name = "Capture Source", */
11020 .name = "Input Source",
11022 .info = alc_mux_enum_info,
11023 .get = alc_mux_enum_get,
11024 .put = alc_mux_enum_put,
11029 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11030 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11031 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11032 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11033 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11035 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11036 /* The multiple "Capture Source" controls confuse alsamixer
11037 * So call somewhat different..
11039 /* .name = "Capture Source", */
11040 .name = "Input Source",
11042 .info = alc_mux_enum_info,
11043 .get = alc_mux_enum_get,
11044 .put = alc_mux_enum_put,
11049 static struct hda_input_mux alc268_capture_source = {
11053 { "Front Mic", 0x1 },
11059 static struct hda_input_mux alc268_acer_capture_source = {
11063 { "Internal Mic", 0x1 },
11068 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11072 { "Internal Mic", 0x6 },
11077 #ifdef CONFIG_SND_DEBUG
11078 static struct snd_kcontrol_new alc268_test_mixer[] = {
11079 /* Volume widgets */
11080 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11081 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11082 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11083 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11084 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11085 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11086 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11087 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11088 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11089 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11090 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11091 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11092 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11093 /* The below appears problematic on some hardwares */
11094 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11095 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11096 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11097 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11098 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11100 /* Modes for retasking pin widgets */
11101 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11102 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11103 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11104 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11106 /* Controls for GPIO pins, assuming they are configured as outputs */
11107 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11108 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11109 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11110 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11112 /* Switches to allow the digital SPDIF output pin to be enabled.
11113 * The ALC268 does not have an SPDIF input.
11115 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11117 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11118 * this output to turn on an external amplifier.
11120 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11121 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11127 /* create input playback/capture controls for the given pin */
11128 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11129 const char *ctlname, int idx)
11134 sprintf(name, "%s Playback Volume", ctlname);
11136 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11137 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11141 } else if (nid == 0x15) {
11142 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11143 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11149 sprintf(name, "%s Playback Switch", ctlname);
11150 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11151 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11157 /* add playback controls from the parsed DAC table */
11158 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11159 const struct auto_pin_cfg *cfg)
11164 spec->multiout.num_dacs = 2; /* only use one dac */
11165 spec->multiout.dac_nids = spec->private_dac_nids;
11166 spec->multiout.dac_nids[0] = 2;
11167 spec->multiout.dac_nids[1] = 3;
11169 nid = cfg->line_out_pins[0];
11171 alc268_new_analog_output(spec, nid, "Front", 0);
11173 nid = cfg->speaker_pins[0];
11175 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11176 "Speaker Playback Volume",
11177 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11181 nid = cfg->hp_pins[0];
11183 alc268_new_analog_output(spec, nid, "Headphone", 0);
11185 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11187 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11188 "Mono Playback Switch",
11189 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11196 /* create playback/capture controls for input pins */
11197 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11198 const struct auto_pin_cfg *cfg)
11200 struct hda_input_mux *imux = &spec->private_imux;
11203 for (i = 0; i < AUTO_PIN_LAST; i++) {
11204 switch(cfg->input_pins[i]) {
11206 idx1 = 0; /* Mic 1 */
11209 idx1 = 1; /* Mic 2 */
11212 idx1 = 2; /* Line In */
11219 idx1 = 6; /* digital mics */
11224 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11225 imux->items[imux->num_items].index = idx1;
11231 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11233 struct alc_spec *spec = codec->spec;
11234 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11235 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11236 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11237 unsigned int dac_vol1, dac_vol2;
11240 snd_hda_codec_write(codec, speaker_nid, 0,
11241 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11242 snd_hda_codec_write(codec, 0x0f, 0,
11243 AC_VERB_SET_AMP_GAIN_MUTE,
11245 snd_hda_codec_write(codec, 0x10, 0,
11246 AC_VERB_SET_AMP_GAIN_MUTE,
11249 snd_hda_codec_write(codec, 0x0f, 0,
11250 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11251 snd_hda_codec_write(codec, 0x10, 0,
11252 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11255 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11256 if (line_nid == 0x14)
11257 dac_vol2 = AMP_OUT_ZERO;
11258 else if (line_nid == 0x15)
11259 dac_vol1 = AMP_OUT_ZERO;
11260 if (hp_nid == 0x14)
11261 dac_vol2 = AMP_OUT_ZERO;
11262 else if (hp_nid == 0x15)
11263 dac_vol1 = AMP_OUT_ZERO;
11264 if (line_nid != 0x16 || hp_nid != 0x16 ||
11265 spec->autocfg.line_out_pins[1] != 0x16 ||
11266 spec->autocfg.line_out_pins[2] != 0x16)
11267 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11269 snd_hda_codec_write(codec, 0x02, 0,
11270 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11271 snd_hda_codec_write(codec, 0x03, 0,
11272 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11275 /* pcm configuration: identiacal with ALC880 */
11276 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11277 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11278 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11279 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11282 * BIOS auto configuration
11284 static int alc268_parse_auto_config(struct hda_codec *codec)
11286 struct alc_spec *spec = codec->spec;
11288 static hda_nid_t alc268_ignore[] = { 0 };
11290 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11294 if (!spec->autocfg.line_outs)
11295 return 0; /* can't find valid BIOS pin config */
11297 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11300 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11304 spec->multiout.max_channels = 2;
11306 /* digital only support output */
11307 if (spec->autocfg.dig_out_pin)
11308 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11310 if (spec->kctls.list)
11311 add_mixer(spec, spec->kctls.list);
11313 if (spec->autocfg.speaker_pins[0] != 0x1d)
11314 add_mixer(spec, alc268_beep_mixer);
11316 add_verb(spec, alc268_volume_init_verbs);
11317 spec->num_mux_defs = 1;
11318 spec->input_mux = &spec->private_imux;
11320 err = alc_auto_add_mic_boost(codec);
11324 store_pin_configs(codec);
11328 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11329 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11330 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11332 /* init callback for auto-configuration model -- overriding the default init */
11333 static void alc268_auto_init(struct hda_codec *codec)
11335 struct alc_spec *spec = codec->spec;
11336 alc268_auto_init_multi_out(codec);
11337 alc268_auto_init_hp_out(codec);
11338 alc268_auto_init_mono_speaker_out(codec);
11339 alc268_auto_init_analog_input(codec);
11340 if (spec->unsol_event)
11341 alc_inithook(codec);
11345 * configuration and preset
11347 static const char *alc268_models[ALC268_MODEL_LAST] = {
11348 [ALC267_QUANTA_IL1] = "quanta-il1",
11349 [ALC268_3ST] = "3stack",
11350 [ALC268_TOSHIBA] = "toshiba",
11351 [ALC268_ACER] = "acer",
11352 [ALC268_ACER_DMIC] = "acer-dmic",
11353 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11354 [ALC268_DELL] = "dell",
11355 [ALC268_ZEPTO] = "zepto",
11356 #ifdef CONFIG_SND_DEBUG
11357 [ALC268_TEST] = "test",
11359 [ALC268_AUTO] = "auto",
11362 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11363 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11364 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11365 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11366 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11367 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11368 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11369 ALC268_ACER_ASPIRE_ONE),
11370 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11371 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11372 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11373 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11374 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11375 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11376 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11377 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11378 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11379 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11383 static struct alc_config_preset alc268_presets[] = {
11384 [ALC267_QUANTA_IL1] = {
11385 .mixers = { alc267_quanta_il1_mixer },
11386 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11387 alc267_quanta_il1_verbs },
11388 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11389 .dac_nids = alc268_dac_nids,
11390 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11391 .adc_nids = alc268_adc_nids_alt,
11393 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11394 .channel_mode = alc268_modes,
11395 .input_mux = &alc268_capture_source,
11396 .unsol_event = alc267_quanta_il1_unsol_event,
11397 .init_hook = alc267_quanta_il1_automute,
11400 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11401 alc268_beep_mixer },
11402 .init_verbs = { alc268_base_init_verbs },
11403 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11404 .dac_nids = alc268_dac_nids,
11405 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11406 .adc_nids = alc268_adc_nids_alt,
11407 .capsrc_nids = alc268_capsrc_nids,
11409 .dig_out_nid = ALC268_DIGOUT_NID,
11410 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11411 .channel_mode = alc268_modes,
11412 .input_mux = &alc268_capture_source,
11414 [ALC268_TOSHIBA] = {
11415 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11416 alc268_beep_mixer },
11417 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11418 alc268_toshiba_verbs },
11419 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11420 .dac_nids = alc268_dac_nids,
11421 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11422 .adc_nids = alc268_adc_nids_alt,
11423 .capsrc_nids = alc268_capsrc_nids,
11425 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11426 .channel_mode = alc268_modes,
11427 .input_mux = &alc268_capture_source,
11428 .unsol_event = alc268_toshiba_unsol_event,
11429 .init_hook = alc268_toshiba_automute,
11432 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11433 alc268_beep_mixer },
11434 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11435 alc268_acer_verbs },
11436 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11437 .dac_nids = alc268_dac_nids,
11438 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11439 .adc_nids = alc268_adc_nids_alt,
11440 .capsrc_nids = alc268_capsrc_nids,
11442 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11443 .channel_mode = alc268_modes,
11444 .input_mux = &alc268_acer_capture_source,
11445 .unsol_event = alc268_acer_unsol_event,
11446 .init_hook = alc268_acer_init_hook,
11448 [ALC268_ACER_DMIC] = {
11449 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11450 alc268_beep_mixer },
11451 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11452 alc268_acer_verbs },
11453 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11454 .dac_nids = alc268_dac_nids,
11455 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11456 .adc_nids = alc268_adc_nids_alt,
11457 .capsrc_nids = alc268_capsrc_nids,
11459 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11460 .channel_mode = alc268_modes,
11461 .input_mux = &alc268_acer_dmic_capture_source,
11462 .unsol_event = alc268_acer_unsol_event,
11463 .init_hook = alc268_acer_init_hook,
11465 [ALC268_ACER_ASPIRE_ONE] = {
11466 .mixers = { alc268_acer_aspire_one_mixer,
11467 alc268_capture_alt_mixer },
11468 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11469 alc268_acer_aspire_one_verbs },
11470 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11471 .dac_nids = alc268_dac_nids,
11472 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11473 .adc_nids = alc268_adc_nids_alt,
11474 .capsrc_nids = alc268_capsrc_nids,
11476 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11477 .channel_mode = alc268_modes,
11478 .input_mux = &alc268_acer_lc_capture_source,
11479 .unsol_event = alc268_acer_lc_unsol_event,
11480 .init_hook = alc268_acer_lc_init_hook,
11483 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11484 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11485 alc268_dell_verbs },
11486 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11487 .dac_nids = alc268_dac_nids,
11489 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11490 .channel_mode = alc268_modes,
11491 .unsol_event = alc268_dell_unsol_event,
11492 .init_hook = alc268_dell_init_hook,
11493 .input_mux = &alc268_capture_source,
11496 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11497 alc268_beep_mixer },
11498 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11499 alc268_toshiba_verbs },
11500 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11501 .dac_nids = alc268_dac_nids,
11502 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11503 .adc_nids = alc268_adc_nids_alt,
11504 .capsrc_nids = alc268_capsrc_nids,
11506 .dig_out_nid = ALC268_DIGOUT_NID,
11507 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11508 .channel_mode = alc268_modes,
11509 .input_mux = &alc268_capture_source,
11510 .unsol_event = alc268_toshiba_unsol_event,
11511 .init_hook = alc268_toshiba_automute
11513 #ifdef CONFIG_SND_DEBUG
11515 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11516 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11517 alc268_volume_init_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,
11522 .capsrc_nids = alc268_capsrc_nids,
11524 .dig_out_nid = ALC268_DIGOUT_NID,
11525 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11526 .channel_mode = alc268_modes,
11527 .input_mux = &alc268_capture_source,
11532 static int patch_alc268(struct hda_codec *codec)
11534 struct alc_spec *spec;
11538 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11542 codec->spec = spec;
11544 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11548 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11549 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11550 "trying auto-probe from BIOS...\n");
11551 board_config = ALC268_AUTO;
11554 if (board_config == ALC268_AUTO) {
11555 /* automatic parse from the BIOS config */
11556 err = alc268_parse_auto_config(codec);
11562 "hda_codec: Cannot set up configuration "
11563 "from BIOS. Using base mode...\n");
11564 board_config = ALC268_3ST;
11568 if (board_config != ALC268_AUTO)
11569 setup_preset(spec, &alc268_presets[board_config]);
11571 if (codec->vendor_id == 0x10ec0267) {
11572 spec->stream_name_analog = "ALC267 Analog";
11573 spec->stream_name_digital = "ALC267 Digital";
11575 spec->stream_name_analog = "ALC268 Analog";
11576 spec->stream_name_digital = "ALC268 Digital";
11579 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11580 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11581 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11583 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11585 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11586 /* override the amp caps for beep generator */
11587 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11588 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11589 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11590 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11591 (0 << AC_AMPCAP_MUTE_SHIFT));
11593 if (!spec->adc_nids && spec->input_mux) {
11594 /* check whether NID 0x07 is valid */
11595 unsigned int wcap = get_wcaps(codec, 0x07);
11599 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11600 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11601 spec->adc_nids = alc268_adc_nids_alt;
11602 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11603 add_mixer(spec, alc268_capture_alt_mixer);
11605 spec->adc_nids = alc268_adc_nids;
11606 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11607 add_mixer(spec, alc268_capture_mixer);
11609 spec->capsrc_nids = alc268_capsrc_nids;
11610 /* set default input source */
11611 for (i = 0; i < spec->num_adc_nids; i++)
11612 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11613 0, AC_VERB_SET_CONNECT_SEL,
11614 spec->input_mux->items[0].index);
11617 spec->vmaster_nid = 0x02;
11619 codec->patch_ops = alc_patch_ops;
11620 if (board_config == ALC268_AUTO)
11621 spec->init_hook = alc268_auto_init;
11627 * ALC269 channel source setting (2 channel)
11629 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11631 #define alc269_dac_nids alc260_dac_nids
11633 static hda_nid_t alc269_adc_nids[1] = {
11638 static hda_nid_t alc269_capsrc_nids[1] = {
11642 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11646 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11654 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11662 #define alc269_modes alc260_modes
11663 #define alc269_capture_source alc880_lg_lw_capture_source
11665 static struct snd_kcontrol_new alc269_base_mixer[] = {
11666 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11667 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11668 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11669 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11672 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11673 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11674 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11675 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11677 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11679 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11683 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11684 /* output mixer control */
11685 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11687 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11688 .name = "Master Playback Switch",
11689 .info = snd_hda_mixer_amp_switch_info,
11690 .get = snd_hda_mixer_amp_switch_get,
11691 .put = alc268_acer_master_sw_put,
11692 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11696 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11697 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11698 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11699 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11700 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11701 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11705 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
11706 /* output mixer control */
11707 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11709 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11710 .name = "Master Playback Switch",
11711 .info = snd_hda_mixer_amp_switch_info,
11712 .get = snd_hda_mixer_amp_switch_get,
11713 .put = alc268_acer_master_sw_put,
11714 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11717 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11718 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11719 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11720 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11721 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11722 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
11723 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
11724 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
11725 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11726 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11730 /* bind volumes of both NID 0x0c and 0x0d */
11731 static struct hda_bind_ctls alc269_epc_bind_vol = {
11732 .ops = &snd_hda_bind_vol,
11734 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11735 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11740 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11741 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11742 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11743 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11747 /* capture mixer elements */
11748 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11749 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11750 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11751 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11756 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
11757 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11759 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
11764 static struct snd_kcontrol_new alc269_beep_mixer[] = {
11765 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11766 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11770 static struct hda_verb alc269_quanta_fl1_verbs[] = {
11771 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11772 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11774 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11775 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11776 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11780 static struct hda_verb alc269_lifebook_verbs[] = {
11781 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11782 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
11783 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11784 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11785 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11786 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11787 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11788 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11789 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11790 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11794 /* toggle speaker-output according to the hp-jack state */
11795 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11797 unsigned int present;
11798 unsigned char bits;
11800 present = snd_hda_codec_read(codec, 0x15, 0,
11801 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11802 bits = present ? AMP_IN_MUTE(0) : 0;
11803 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11804 AMP_IN_MUTE(0), bits);
11805 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11806 AMP_IN_MUTE(0), bits);
11808 snd_hda_codec_write(codec, 0x20, 0,
11809 AC_VERB_SET_COEF_INDEX, 0x0c);
11810 snd_hda_codec_write(codec, 0x20, 0,
11811 AC_VERB_SET_PROC_COEF, 0x680);
11813 snd_hda_codec_write(codec, 0x20, 0,
11814 AC_VERB_SET_COEF_INDEX, 0x0c);
11815 snd_hda_codec_write(codec, 0x20, 0,
11816 AC_VERB_SET_PROC_COEF, 0x480);
11819 /* toggle speaker-output according to the hp-jacks state */
11820 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
11822 unsigned int present;
11823 unsigned char bits;
11825 /* Check laptop headphone socket */
11826 present = snd_hda_codec_read(codec, 0x15, 0,
11827 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11829 /* Check port replicator headphone socket */
11830 present |= snd_hda_codec_read(codec, 0x1a, 0,
11831 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11833 bits = present ? AMP_IN_MUTE(0) : 0;
11834 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11835 AMP_IN_MUTE(0), bits);
11836 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11837 AMP_IN_MUTE(0), bits);
11839 snd_hda_codec_write(codec, 0x20, 0,
11840 AC_VERB_SET_COEF_INDEX, 0x0c);
11841 snd_hda_codec_write(codec, 0x20, 0,
11842 AC_VERB_SET_PROC_COEF, 0x680);
11844 snd_hda_codec_write(codec, 0x20, 0,
11845 AC_VERB_SET_COEF_INDEX, 0x0c);
11846 snd_hda_codec_write(codec, 0x20, 0,
11847 AC_VERB_SET_PROC_COEF, 0x480);
11850 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11852 unsigned int present;
11854 present = snd_hda_codec_read(codec, 0x18, 0,
11855 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11856 snd_hda_codec_write(codec, 0x23, 0,
11857 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11860 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
11862 unsigned int present_laptop;
11863 unsigned int present_dock;
11865 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
11866 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11868 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
11869 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11871 /* Laptop mic port overrides dock mic port, design decision */
11873 snd_hda_codec_write(codec, 0x23, 0,
11874 AC_VERB_SET_CONNECT_SEL, 0x3);
11875 if (present_laptop)
11876 snd_hda_codec_write(codec, 0x23, 0,
11877 AC_VERB_SET_CONNECT_SEL, 0x0);
11878 if (!present_dock && !present_laptop)
11879 snd_hda_codec_write(codec, 0x23, 0,
11880 AC_VERB_SET_CONNECT_SEL, 0x1);
11883 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11886 if ((res >> 26) == ALC880_HP_EVENT)
11887 alc269_quanta_fl1_speaker_automute(codec);
11888 if ((res >> 26) == ALC880_MIC_EVENT)
11889 alc269_quanta_fl1_mic_automute(codec);
11892 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
11895 if ((res >> 26) == ALC880_HP_EVENT)
11896 alc269_lifebook_speaker_automute(codec);
11897 if ((res >> 26) == ALC880_MIC_EVENT)
11898 alc269_lifebook_mic_autoswitch(codec);
11901 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
11903 alc269_quanta_fl1_speaker_automute(codec);
11904 alc269_quanta_fl1_mic_automute(codec);
11907 static void alc269_lifebook_init_hook(struct hda_codec *codec)
11909 alc269_lifebook_speaker_automute(codec);
11910 alc269_lifebook_mic_autoswitch(codec);
11913 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11914 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11915 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
11916 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
11918 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11919 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11920 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11924 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11925 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11926 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
11927 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11928 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
11929 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11930 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11934 /* toggle speaker-output according to the hp-jack state */
11935 static void alc269_speaker_automute(struct hda_codec *codec)
11937 unsigned int present;
11938 unsigned char bits;
11940 present = snd_hda_codec_read(codec, 0x15, 0,
11941 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11942 bits = present ? AMP_IN_MUTE(0) : 0;
11943 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11944 AMP_IN_MUTE(0), bits);
11945 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11946 AMP_IN_MUTE(0), bits);
11949 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11951 unsigned int present;
11953 present = snd_hda_codec_read(codec, 0x18, 0,
11954 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11955 snd_hda_codec_write(codec, 0x23, 0,
11956 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
11959 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11961 unsigned int present;
11963 present = snd_hda_codec_read(codec, 0x18, 0,
11964 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11965 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11966 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11967 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11968 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11971 /* unsolicited event for HP jack sensing */
11972 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11975 if ((res >> 26) == ALC880_HP_EVENT)
11976 alc269_speaker_automute(codec);
11978 if ((res >> 26) == ALC880_MIC_EVENT)
11979 alc269_eeepc_dmic_automute(codec);
11982 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11984 alc269_speaker_automute(codec);
11985 alc269_eeepc_dmic_automute(codec);
11988 /* unsolicited event for HP jack sensing */
11989 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
11992 if ((res >> 26) == ALC880_HP_EVENT)
11993 alc269_speaker_automute(codec);
11995 if ((res >> 26) == ALC880_MIC_EVENT)
11996 alc269_eeepc_amic_automute(codec);
11999 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12001 alc269_speaker_automute(codec);
12002 alc269_eeepc_amic_automute(codec);
12006 * generic initialization of ADC, input mixers and output mixers
12008 static struct hda_verb alc269_init_verbs[] = {
12010 * Unmute ADC0 and set the default input to mic-in
12012 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12014 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12015 * analog-loopback mixer widget
12016 * Note: PASD motherboards uses the Line In 2 as the input for
12017 * front panel mic (mic 2)
12019 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12027 * Set up output mixers (0x0c - 0x0e)
12029 /* set vol=0 to output mixers */
12030 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12031 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12033 /* set up input amps for analog loopback */
12034 /* Amp Indices: DAC = 0, mixer = 1 */
12035 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12036 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12037 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12038 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12039 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12040 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12042 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12043 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12044 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12045 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12046 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12047 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12052 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12054 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12056 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12058 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12059 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12061 /* FIXME: use matrix-type input source selection */
12062 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12063 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12070 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12071 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12075 /* add playback controls from the parsed DAC table */
12076 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12077 const struct auto_pin_cfg *cfg)
12082 spec->multiout.num_dacs = 1; /* only use one dac */
12083 spec->multiout.dac_nids = spec->private_dac_nids;
12084 spec->multiout.dac_nids[0] = 2;
12086 nid = cfg->line_out_pins[0];
12088 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12089 "Front Playback Volume",
12090 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12093 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12094 "Front Playback Switch",
12095 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12100 nid = cfg->speaker_pins[0];
12102 if (!cfg->line_out_pins[0]) {
12103 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12104 "Speaker Playback Volume",
12105 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12111 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12112 "Speaker Playback Switch",
12113 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12118 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12119 "Speaker Playback Switch",
12120 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12126 nid = cfg->hp_pins[0];
12128 /* spec->multiout.hp_nid = 2; */
12129 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12130 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12131 "Headphone Playback Volume",
12132 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12138 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12139 "Headphone Playback Switch",
12140 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12145 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12146 "Headphone Playback Switch",
12147 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12156 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12157 const struct auto_pin_cfg *cfg)
12161 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12164 /* digital-mic input pin is excluded in alc880_auto_create..()
12165 * because it's under 0x18
12167 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12168 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12169 struct hda_input_mux *imux = &spec->private_imux;
12170 imux->items[imux->num_items].label = "Int Mic";
12171 imux->items[imux->num_items].index = 0x05;
12177 #ifdef CONFIG_SND_HDA_POWER_SAVE
12178 #define alc269_loopbacks alc880_loopbacks
12181 /* pcm configuration: identiacal with ALC880 */
12182 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12183 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12184 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12185 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12188 * BIOS auto configuration
12190 static int alc269_parse_auto_config(struct hda_codec *codec)
12192 struct alc_spec *spec = codec->spec;
12194 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12196 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12201 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12204 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12208 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12210 if (spec->autocfg.dig_out_pin)
12211 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12213 if (spec->kctls.list)
12214 add_mixer(spec, spec->kctls.list);
12216 /* create a beep mixer control if the pin 0x1d isn't assigned */
12217 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12218 if (spec->autocfg.input_pins[i] == 0x1d)
12220 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12221 add_mixer(spec, alc269_beep_mixer);
12223 add_verb(spec, alc269_init_verbs);
12224 spec->num_mux_defs = 1;
12225 spec->input_mux = &spec->private_imux;
12226 /* set default input source */
12227 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12228 0, AC_VERB_SET_CONNECT_SEL,
12229 spec->input_mux->items[0].index);
12231 err = alc_auto_add_mic_boost(codec);
12235 if (!spec->cap_mixer)
12236 set_capture_mixer(spec);
12238 store_pin_configs(codec);
12242 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12243 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12244 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12247 /* init callback for auto-configuration model -- overriding the default init */
12248 static void alc269_auto_init(struct hda_codec *codec)
12250 struct alc_spec *spec = codec->spec;
12251 alc269_auto_init_multi_out(codec);
12252 alc269_auto_init_hp_out(codec);
12253 alc269_auto_init_analog_input(codec);
12254 if (spec->unsol_event)
12255 alc_inithook(codec);
12259 * configuration and preset
12261 static const char *alc269_models[ALC269_MODEL_LAST] = {
12262 [ALC269_BASIC] = "basic",
12263 [ALC269_QUANTA_FL1] = "quanta",
12264 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12265 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12266 [ALC269_FUJITSU] = "fujitsu",
12267 [ALC269_LIFEBOOK] = "lifebook"
12270 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12271 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12272 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12273 ALC269_ASUS_EEEPC_P703),
12274 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12275 ALC269_ASUS_EEEPC_P901),
12276 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12277 ALC269_ASUS_EEEPC_P901),
12278 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12279 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12283 static struct alc_config_preset alc269_presets[] = {
12285 .mixers = { alc269_base_mixer },
12286 .init_verbs = { alc269_init_verbs },
12287 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12288 .dac_nids = alc269_dac_nids,
12290 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12291 .channel_mode = alc269_modes,
12292 .input_mux = &alc269_capture_source,
12294 [ALC269_QUANTA_FL1] = {
12295 .mixers = { alc269_quanta_fl1_mixer },
12296 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_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,
12303 .unsol_event = alc269_quanta_fl1_unsol_event,
12304 .init_hook = alc269_quanta_fl1_init_hook,
12306 [ALC269_ASUS_EEEPC_P703] = {
12307 .mixers = { alc269_eeepc_mixer },
12308 .cap_mixer = alc269_epc_capture_mixer,
12309 .init_verbs = { alc269_init_verbs,
12310 alc269_eeepc_amic_init_verbs },
12311 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12312 .dac_nids = alc269_dac_nids,
12314 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12315 .channel_mode = alc269_modes,
12316 .input_mux = &alc269_eeepc_amic_capture_source,
12317 .unsol_event = alc269_eeepc_amic_unsol_event,
12318 .init_hook = alc269_eeepc_amic_inithook,
12320 [ALC269_ASUS_EEEPC_P901] = {
12321 .mixers = { alc269_eeepc_mixer },
12322 .cap_mixer = alc269_epc_capture_mixer,
12323 .init_verbs = { alc269_init_verbs,
12324 alc269_eeepc_dmic_init_verbs },
12325 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12326 .dac_nids = alc269_dac_nids,
12328 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12329 .channel_mode = alc269_modes,
12330 .input_mux = &alc269_eeepc_dmic_capture_source,
12331 .unsol_event = alc269_eeepc_dmic_unsol_event,
12332 .init_hook = alc269_eeepc_dmic_inithook,
12334 [ALC269_FUJITSU] = {
12335 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12336 .cap_mixer = alc269_epc_capture_mixer,
12337 .init_verbs = { alc269_init_verbs,
12338 alc269_eeepc_dmic_init_verbs },
12339 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12340 .dac_nids = alc269_dac_nids,
12342 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12343 .channel_mode = alc269_modes,
12344 .input_mux = &alc269_eeepc_dmic_capture_source,
12345 .unsol_event = alc269_eeepc_dmic_unsol_event,
12346 .init_hook = alc269_eeepc_dmic_inithook,
12348 [ALC269_LIFEBOOK] = {
12349 .mixers = { alc269_lifebook_mixer },
12350 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12351 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12352 .dac_nids = alc269_dac_nids,
12354 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12355 .channel_mode = alc269_modes,
12356 .input_mux = &alc269_capture_source,
12357 .unsol_event = alc269_lifebook_unsol_event,
12358 .init_hook = alc269_lifebook_init_hook,
12362 static int patch_alc269(struct hda_codec *codec)
12364 struct alc_spec *spec;
12368 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12372 codec->spec = spec;
12374 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12376 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12380 if (board_config < 0) {
12381 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12382 "trying auto-probe from BIOS...\n");
12383 board_config = ALC269_AUTO;
12386 if (board_config == ALC269_AUTO) {
12387 /* automatic parse from the BIOS config */
12388 err = alc269_parse_auto_config(codec);
12394 "hda_codec: Cannot set up configuration "
12395 "from BIOS. Using base mode...\n");
12396 board_config = ALC269_BASIC;
12400 if (board_config != ALC269_AUTO)
12401 setup_preset(spec, &alc269_presets[board_config]);
12403 spec->stream_name_analog = "ALC269 Analog";
12404 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12405 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12407 spec->stream_name_digital = "ALC269 Digital";
12408 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12409 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12411 spec->adc_nids = alc269_adc_nids;
12412 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12413 spec->capsrc_nids = alc269_capsrc_nids;
12414 if (!spec->cap_mixer)
12415 set_capture_mixer(spec);
12417 codec->patch_ops = alc_patch_ops;
12418 if (board_config == ALC269_AUTO)
12419 spec->init_hook = alc269_auto_init;
12420 #ifdef CONFIG_SND_HDA_POWER_SAVE
12421 if (!spec->loopback.amplist)
12422 spec->loopback.amplist = alc269_loopbacks;
12429 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12433 * set the path ways for 2 channel output
12434 * need to set the codec line out and mic 1 pin widgets to inputs
12436 static struct hda_verb alc861_threestack_ch2_init[] = {
12437 /* set pin widget 1Ah (line in) for input */
12438 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12439 /* set pin widget 18h (mic1/2) for input, for mic also enable
12442 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12444 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12446 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12447 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12453 * need to set the codec line out and mic 1 pin widgets to outputs
12455 static struct hda_verb alc861_threestack_ch6_init[] = {
12456 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12457 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12458 /* set pin widget 18h (mic1) for output (CLFE)*/
12459 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12461 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12462 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12464 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12466 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12467 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12472 static struct hda_channel_mode alc861_threestack_modes[2] = {
12473 { 2, alc861_threestack_ch2_init },
12474 { 6, alc861_threestack_ch6_init },
12476 /* Set mic1 as input and unmute the mixer */
12477 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12478 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12479 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12482 /* Set mic1 as output and mute mixer */
12483 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12484 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12485 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12489 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12490 { 2, alc861_uniwill_m31_ch2_init },
12491 { 4, alc861_uniwill_m31_ch4_init },
12494 /* Set mic1 and line-in as input and unmute the mixer */
12495 static struct hda_verb alc861_asus_ch2_init[] = {
12496 /* set pin widget 1Ah (line in) for input */
12497 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12498 /* set pin widget 18h (mic1/2) for input, for mic also enable
12501 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12503 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12505 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12506 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12510 /* Set mic1 nad line-in as output and mute mixer */
12511 static struct hda_verb alc861_asus_ch6_init[] = {
12512 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12513 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12514 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12515 /* set pin widget 18h (mic1) for output (CLFE)*/
12516 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12517 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12518 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12519 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12521 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12523 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12524 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12529 static struct hda_channel_mode alc861_asus_modes[2] = {
12530 { 2, alc861_asus_ch2_init },
12531 { 6, alc861_asus_ch6_init },
12536 static struct snd_kcontrol_new alc861_base_mixer[] = {
12537 /* output mixer control */
12538 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12539 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12540 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12541 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12542 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12544 /*Input mixer control */
12545 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12546 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12547 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12548 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12549 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12550 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12552 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12553 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12554 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12559 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12560 /* output mixer control */
12561 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12562 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12563 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12564 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12565 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12567 /* Input mixer control */
12568 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12569 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12570 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12571 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12572 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12573 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12575 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12576 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12580 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12581 .name = "Channel Mode",
12582 .info = alc_ch_mode_info,
12583 .get = alc_ch_mode_get,
12584 .put = alc_ch_mode_put,
12585 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12590 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12591 /* output mixer control */
12592 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12594 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12599 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12600 /* output mixer control */
12601 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12602 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12603 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12604 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12605 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12607 /* Input mixer control */
12608 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12609 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12610 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12611 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12612 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12613 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12615 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12616 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12617 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12620 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12621 .name = "Channel Mode",
12622 .info = alc_ch_mode_info,
12623 .get = alc_ch_mode_get,
12624 .put = alc_ch_mode_put,
12625 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12630 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12631 /* output mixer control */
12632 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12633 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12634 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12635 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12636 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12638 /* Input mixer control */
12639 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12640 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12641 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12642 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12643 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12644 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12646 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12647 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12651 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12652 .name = "Channel Mode",
12653 .info = alc_ch_mode_info,
12654 .get = alc_ch_mode_get,
12655 .put = alc_ch_mode_put,
12656 .private_value = ARRAY_SIZE(alc861_asus_modes),
12661 /* additional mixer */
12662 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12663 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12664 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12665 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12666 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12671 * generic initialization of ADC, input mixers and output mixers
12673 static struct hda_verb alc861_base_init_verbs[] = {
12675 * Unmute ADC0 and set the default input to mic-in
12677 /* port-A for surround (rear panel) */
12678 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12679 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
12680 /* port-B for mic-in (rear panel) with vref */
12681 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12682 /* port-C for line-in (rear panel) */
12683 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12684 /* port-D for Front */
12685 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12686 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12687 /* port-E for HP out (front panel) */
12688 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12689 /* route front PCM to HP */
12690 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12691 /* port-F for mic-in (front panel) with vref */
12692 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12693 /* port-G for CLFE (rear panel) */
12694 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12695 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12696 /* port-H for side (rear panel) */
12697 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12698 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
12700 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12701 /* route front mic to ADC1*/
12702 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12703 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12705 /* Unmute DAC0~3 & spdif out*/
12706 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12707 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12708 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12709 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12712 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12713 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12714 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12715 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12716 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12718 /* Unmute Stereo Mixer 15 */
12719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12721 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12724 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12725 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12726 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12727 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12729 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12731 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12732 /* hp used DAC 3 (Front) */
12733 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12734 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12739 static struct hda_verb alc861_threestack_init_verbs[] = {
12741 * Unmute ADC0 and set the default input to mic-in
12743 /* port-A for surround (rear panel) */
12744 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12745 /* port-B for mic-in (rear panel) with vref */
12746 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12747 /* port-C for line-in (rear panel) */
12748 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12749 /* port-D for Front */
12750 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12751 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12752 /* port-E for HP out (front panel) */
12753 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12754 /* route front PCM to HP */
12755 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12756 /* port-F for mic-in (front panel) with vref */
12757 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12758 /* port-G for CLFE (rear panel) */
12759 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12760 /* port-H for side (rear panel) */
12761 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12763 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12764 /* route front mic to ADC1*/
12765 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12766 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12767 /* Unmute DAC0~3 & spdif out*/
12768 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12769 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12770 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12771 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12774 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12775 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12776 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12777 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12778 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12780 /* Unmute Stereo Mixer 15 */
12781 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12782 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12783 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12787 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12788 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12789 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12790 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12791 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12792 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12793 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12794 /* hp used DAC 3 (Front) */
12795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12800 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
12802 * Unmute ADC0 and set the default input to mic-in
12804 /* port-A for surround (rear panel) */
12805 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12806 /* port-B for mic-in (rear panel) with vref */
12807 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12808 /* port-C for line-in (rear panel) */
12809 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12810 /* port-D for Front */
12811 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12812 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12813 /* port-E for HP out (front panel) */
12814 /* this has to be set to VREF80 */
12815 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12816 /* route front PCM to HP */
12817 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12818 /* port-F for mic-in (front panel) with vref */
12819 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12820 /* port-G for CLFE (rear panel) */
12821 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12822 /* port-H for side (rear panel) */
12823 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12825 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12826 /* route front mic to ADC1*/
12827 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12828 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12829 /* Unmute DAC0~3 & spdif out*/
12830 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12831 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12832 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12833 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12834 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12836 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12837 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12838 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12839 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12840 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12842 /* Unmute Stereo Mixer 15 */
12843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12845 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12846 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12848 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12849 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12850 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12851 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12852 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12853 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12854 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12855 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12856 /* hp used DAC 3 (Front) */
12857 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12858 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12862 static struct hda_verb alc861_asus_init_verbs[] = {
12864 * Unmute ADC0 and set the default input to mic-in
12866 /* port-A for surround (rear panel)
12867 * according to codec#0 this is the HP jack
12869 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12870 /* route front PCM to HP */
12871 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12872 /* port-B for mic-in (rear panel) with vref */
12873 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12874 /* port-C for line-in (rear panel) */
12875 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12876 /* port-D for Front */
12877 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12878 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12879 /* port-E for HP out (front panel) */
12880 /* this has to be set to VREF80 */
12881 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12882 /* route front PCM to HP */
12883 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12884 /* port-F for mic-in (front panel) with vref */
12885 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12886 /* port-G for CLFE (rear panel) */
12887 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12888 /* port-H for side (rear panel) */
12889 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12891 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12892 /* route front mic to ADC1*/
12893 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12894 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12895 /* Unmute DAC0~3 & spdif out*/
12896 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12897 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12898 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12899 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12901 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12902 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12903 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12904 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12905 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12907 /* Unmute Stereo Mixer 15 */
12908 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12909 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12910 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12911 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12913 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12914 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12915 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12916 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12917 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12918 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12919 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12920 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12921 /* hp used DAC 3 (Front) */
12922 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12923 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12927 /* additional init verbs for ASUS laptops */
12928 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
12929 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
12930 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
12935 * generic initialization of ADC, input mixers and output mixers
12937 static struct hda_verb alc861_auto_init_verbs[] = {
12939 * Unmute ADC0 and set the default input to mic-in
12941 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12942 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12944 /* Unmute DAC0~3 & spdif out*/
12945 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12946 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12947 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12948 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12949 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12951 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12952 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12953 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12954 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12955 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12957 /* Unmute Stereo Mixer 15 */
12958 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12959 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12960 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12961 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
12963 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12964 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12965 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12966 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12967 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12968 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12969 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12970 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12972 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12973 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12974 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12975 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12976 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12977 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12978 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12979 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12981 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
12986 static struct hda_verb alc861_toshiba_init_verbs[] = {
12987 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12992 /* toggle speaker-output according to the hp-jack state */
12993 static void alc861_toshiba_automute(struct hda_codec *codec)
12995 unsigned int present;
12997 present = snd_hda_codec_read(codec, 0x0f, 0,
12998 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12999 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13000 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13001 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13002 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13005 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13008 if ((res >> 26) == ALC880_HP_EVENT)
13009 alc861_toshiba_automute(codec);
13012 /* pcm configuration: identiacal with ALC880 */
13013 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13014 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13015 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13016 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13019 #define ALC861_DIGOUT_NID 0x07
13021 static struct hda_channel_mode alc861_8ch_modes[1] = {
13025 static hda_nid_t alc861_dac_nids[4] = {
13026 /* front, surround, clfe, side */
13027 0x03, 0x06, 0x05, 0x04
13030 static hda_nid_t alc660_dac_nids[3] = {
13031 /* front, clfe, surround */
13035 static hda_nid_t alc861_adc_nids[1] = {
13040 static struct hda_input_mux alc861_capture_source = {
13044 { "Front Mic", 0x3 },
13051 /* fill in the dac_nids table from the parsed pin configuration */
13052 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13053 const struct auto_pin_cfg *cfg)
13058 spec->multiout.dac_nids = spec->private_dac_nids;
13059 for (i = 0; i < cfg->line_outs; i++) {
13060 nid = cfg->line_out_pins[i];
13062 if (i >= ARRAY_SIZE(alc861_dac_nids))
13064 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13067 spec->multiout.num_dacs = cfg->line_outs;
13071 /* add playback controls from the parsed DAC table */
13072 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13073 const struct auto_pin_cfg *cfg)
13076 static const char *chname[4] = {
13077 "Front", "Surround", NULL /*CLFE*/, "Side"
13082 for (i = 0; i < cfg->line_outs; i++) {
13083 nid = spec->multiout.dac_nids[i];
13088 err = add_control(spec, ALC_CTL_BIND_MUTE,
13089 "Center Playback Switch",
13090 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13094 err = add_control(spec, ALC_CTL_BIND_MUTE,
13095 "LFE Playback Switch",
13096 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13101 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13103 if (nid == alc861_dac_nids[idx])
13105 sprintf(name, "%s Playback Switch", chname[idx]);
13106 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13107 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13116 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13124 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13126 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13127 "Headphone Playback Switch",
13128 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13131 spec->multiout.hp_nid = nid;
13136 /* create playback/capture controls for input pins */
13137 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13138 const struct auto_pin_cfg *cfg)
13140 struct hda_input_mux *imux = &spec->private_imux;
13141 int i, err, idx, idx1;
13143 for (i = 0; i < AUTO_PIN_LAST; i++) {
13144 switch (cfg->input_pins[i]) {
13147 idx = 2; /* Line In */
13151 idx = 2; /* Line In */
13155 idx = 1; /* Mic In */
13159 idx = 1; /* Mic In */
13169 err = new_analog_input(spec, cfg->input_pins[i],
13170 auto_pin_cfg_labels[i], idx, 0x15);
13174 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13175 imux->items[imux->num_items].index = idx1;
13181 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13183 int pin_type, int dac_idx)
13185 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13187 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13191 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13193 struct alc_spec *spec = codec->spec;
13196 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13197 for (i = 0; i < spec->autocfg.line_outs; i++) {
13198 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13199 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13201 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13202 spec->multiout.dac_nids[i]);
13206 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13208 struct alc_spec *spec = codec->spec;
13211 pin = spec->autocfg.hp_pins[0];
13212 if (pin) /* connect to front */
13213 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13214 spec->multiout.dac_nids[0]);
13215 pin = spec->autocfg.speaker_pins[0];
13217 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13220 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13222 struct alc_spec *spec = codec->spec;
13225 for (i = 0; i < AUTO_PIN_LAST; i++) {
13226 hda_nid_t nid = spec->autocfg.input_pins[i];
13227 if (nid >= 0x0c && nid <= 0x11) {
13228 snd_hda_codec_write(codec, nid, 0,
13229 AC_VERB_SET_PIN_WIDGET_CONTROL,
13230 i <= AUTO_PIN_FRONT_MIC ?
13231 PIN_VREF80 : PIN_IN);
13236 /* parse the BIOS configuration and set up the alc_spec */
13237 /* return 1 if successful, 0 if the proper config is not found,
13238 * or a negative error code
13240 static int alc861_parse_auto_config(struct hda_codec *codec)
13242 struct alc_spec *spec = codec->spec;
13244 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13246 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13250 if (!spec->autocfg.line_outs)
13251 return 0; /* can't find valid BIOS pin config */
13253 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13256 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13259 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13262 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13266 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13268 if (spec->autocfg.dig_out_pin)
13269 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13271 if (spec->kctls.list)
13272 add_mixer(spec, spec->kctls.list);
13274 add_verb(spec, alc861_auto_init_verbs);
13276 spec->num_mux_defs = 1;
13277 spec->input_mux = &spec->private_imux;
13279 spec->adc_nids = alc861_adc_nids;
13280 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13281 set_capture_mixer(spec);
13283 store_pin_configs(codec);
13287 /* additional initialization for auto-configuration model */
13288 static void alc861_auto_init(struct hda_codec *codec)
13290 struct alc_spec *spec = codec->spec;
13291 alc861_auto_init_multi_out(codec);
13292 alc861_auto_init_hp_out(codec);
13293 alc861_auto_init_analog_input(codec);
13294 if (spec->unsol_event)
13295 alc_inithook(codec);
13298 #ifdef CONFIG_SND_HDA_POWER_SAVE
13299 static struct hda_amp_list alc861_loopbacks[] = {
13300 { 0x15, HDA_INPUT, 0 },
13301 { 0x15, HDA_INPUT, 1 },
13302 { 0x15, HDA_INPUT, 2 },
13303 { 0x15, HDA_INPUT, 3 },
13310 * configuration and preset
13312 static const char *alc861_models[ALC861_MODEL_LAST] = {
13313 [ALC861_3ST] = "3stack",
13314 [ALC660_3ST] = "3stack-660",
13315 [ALC861_3ST_DIG] = "3stack-dig",
13316 [ALC861_6ST_DIG] = "6stack-dig",
13317 [ALC861_UNIWILL_M31] = "uniwill-m31",
13318 [ALC861_TOSHIBA] = "toshiba",
13319 [ALC861_ASUS] = "asus",
13320 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13321 [ALC861_AUTO] = "auto",
13324 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13325 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13326 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13327 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13328 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13329 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13330 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13331 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13332 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13333 * Any other models that need this preset?
13335 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13336 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13337 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13338 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13339 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13340 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13341 /* FIXME: the below seems conflict */
13342 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13343 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13344 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13348 static struct alc_config_preset alc861_presets[] = {
13350 .mixers = { alc861_3ST_mixer },
13351 .init_verbs = { alc861_threestack_init_verbs },
13352 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13353 .dac_nids = alc861_dac_nids,
13354 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13355 .channel_mode = alc861_threestack_modes,
13357 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13358 .adc_nids = alc861_adc_nids,
13359 .input_mux = &alc861_capture_source,
13361 [ALC861_3ST_DIG] = {
13362 .mixers = { alc861_base_mixer },
13363 .init_verbs = { alc861_threestack_init_verbs },
13364 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13365 .dac_nids = alc861_dac_nids,
13366 .dig_out_nid = ALC861_DIGOUT_NID,
13367 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13368 .channel_mode = alc861_threestack_modes,
13370 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13371 .adc_nids = alc861_adc_nids,
13372 .input_mux = &alc861_capture_source,
13374 [ALC861_6ST_DIG] = {
13375 .mixers = { alc861_base_mixer },
13376 .init_verbs = { alc861_base_init_verbs },
13377 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13378 .dac_nids = alc861_dac_nids,
13379 .dig_out_nid = ALC861_DIGOUT_NID,
13380 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13381 .channel_mode = alc861_8ch_modes,
13382 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13383 .adc_nids = alc861_adc_nids,
13384 .input_mux = &alc861_capture_source,
13387 .mixers = { alc861_3ST_mixer },
13388 .init_verbs = { alc861_threestack_init_verbs },
13389 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13390 .dac_nids = alc660_dac_nids,
13391 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13392 .channel_mode = alc861_threestack_modes,
13394 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13395 .adc_nids = alc861_adc_nids,
13396 .input_mux = &alc861_capture_source,
13398 [ALC861_UNIWILL_M31] = {
13399 .mixers = { alc861_uniwill_m31_mixer },
13400 .init_verbs = { alc861_uniwill_m31_init_verbs },
13401 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13402 .dac_nids = alc861_dac_nids,
13403 .dig_out_nid = ALC861_DIGOUT_NID,
13404 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13405 .channel_mode = alc861_uniwill_m31_modes,
13407 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13408 .adc_nids = alc861_adc_nids,
13409 .input_mux = &alc861_capture_source,
13411 [ALC861_TOSHIBA] = {
13412 .mixers = { alc861_toshiba_mixer },
13413 .init_verbs = { alc861_base_init_verbs,
13414 alc861_toshiba_init_verbs },
13415 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13416 .dac_nids = alc861_dac_nids,
13417 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13418 .channel_mode = alc883_3ST_2ch_modes,
13419 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13420 .adc_nids = alc861_adc_nids,
13421 .input_mux = &alc861_capture_source,
13422 .unsol_event = alc861_toshiba_unsol_event,
13423 .init_hook = alc861_toshiba_automute,
13426 .mixers = { alc861_asus_mixer },
13427 .init_verbs = { alc861_asus_init_verbs },
13428 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13429 .dac_nids = alc861_dac_nids,
13430 .dig_out_nid = ALC861_DIGOUT_NID,
13431 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13432 .channel_mode = alc861_asus_modes,
13435 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13436 .adc_nids = alc861_adc_nids,
13437 .input_mux = &alc861_capture_source,
13439 [ALC861_ASUS_LAPTOP] = {
13440 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13441 .init_verbs = { alc861_asus_init_verbs,
13442 alc861_asus_laptop_init_verbs },
13443 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13444 .dac_nids = alc861_dac_nids,
13445 .dig_out_nid = ALC861_DIGOUT_NID,
13446 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13447 .channel_mode = alc883_3ST_2ch_modes,
13449 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13450 .adc_nids = alc861_adc_nids,
13451 .input_mux = &alc861_capture_source,
13456 static int patch_alc861(struct hda_codec *codec)
13458 struct alc_spec *spec;
13462 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13466 codec->spec = spec;
13468 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13472 if (board_config < 0) {
13473 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13474 "trying auto-probe from BIOS...\n");
13475 board_config = ALC861_AUTO;
13478 if (board_config == ALC861_AUTO) {
13479 /* automatic parse from the BIOS config */
13480 err = alc861_parse_auto_config(codec);
13486 "hda_codec: Cannot set up configuration "
13487 "from BIOS. Using base mode...\n");
13488 board_config = ALC861_3ST_DIG;
13492 if (board_config != ALC861_AUTO)
13493 setup_preset(spec, &alc861_presets[board_config]);
13495 spec->stream_name_analog = "ALC861 Analog";
13496 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13497 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13499 spec->stream_name_digital = "ALC861 Digital";
13500 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13501 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13503 spec->vmaster_nid = 0x03;
13505 codec->patch_ops = alc_patch_ops;
13506 if (board_config == ALC861_AUTO)
13507 spec->init_hook = alc861_auto_init;
13508 #ifdef CONFIG_SND_HDA_POWER_SAVE
13509 if (!spec->loopback.amplist)
13510 spec->loopback.amplist = alc861_loopbacks;
13517 * ALC861-VD support
13521 * In addition, an independent DAC
13523 #define ALC861VD_DIGOUT_NID 0x06
13525 static hda_nid_t alc861vd_dac_nids[4] = {
13526 /* front, surr, clfe, side surr */
13527 0x02, 0x03, 0x04, 0x05
13530 /* dac_nids for ALC660vd are in a different order - according to
13531 * Realtek's driver.
13532 * This should probably tesult in a different mixer for 6stack models
13533 * of ALC660vd codecs, but for now there is only 3stack mixer
13534 * - and it is the same as in 861vd.
13535 * adc_nids in ALC660vd are (is) the same as in 861vd
13537 static hda_nid_t alc660vd_dac_nids[3] = {
13538 /* front, rear, clfe, rear_surr */
13542 static hda_nid_t alc861vd_adc_nids[1] = {
13547 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13550 /* FIXME: should be a matrix-type input source selection */
13551 static struct hda_input_mux alc861vd_capture_source = {
13555 { "Front Mic", 0x1 },
13561 static struct hda_input_mux alc861vd_dallas_capture_source = {
13564 { "Ext Mic", 0x0 },
13565 { "Int Mic", 0x1 },
13569 static struct hda_input_mux alc861vd_hp_capture_source = {
13572 { "Front Mic", 0x0 },
13573 { "ATAPI Mic", 0x1 },
13580 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13587 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13588 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13589 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13590 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13591 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13598 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13599 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13600 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13601 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13602 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13606 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13607 { 6, alc861vd_6stack_ch6_init },
13608 { 8, alc861vd_6stack_ch8_init },
13611 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13613 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13614 .name = "Channel Mode",
13615 .info = alc_ch_mode_info,
13616 .get = alc_ch_mode_get,
13617 .put = alc_ch_mode_put,
13622 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13623 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13625 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13626 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13627 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13629 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13630 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13632 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13634 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13636 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13637 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13639 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13640 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13642 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13648 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13649 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13650 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13652 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13653 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13658 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13659 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13664 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13665 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13666 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13670 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13674 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13675 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13678 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13679 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13681 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13682 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13684 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13685 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13690 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
13691 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13692 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13693 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13695 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13697 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13698 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13699 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13701 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13702 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13703 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13705 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13706 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13711 /* Pin assignment: Speaker=0x14, HP = 0x15,
13712 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
13714 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
13715 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13716 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
13717 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13718 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13719 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13720 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13721 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13722 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13723 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13724 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13725 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
13726 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
13730 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
13731 * Front Mic=0x18, ATAPI Mic = 0x19,
13733 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
13734 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13735 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13736 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13737 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13738 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13739 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13740 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13741 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13747 * generic initialization of ADC, input mixers and output mixers
13749 static struct hda_verb alc861vd_volume_init_verbs[] = {
13751 * Unmute ADC0 and set the default input to mic-in
13753 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13754 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13756 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13757 * the analog-loopback mixer widget
13759 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13761 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13762 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13766 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13767 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13773 * Set up output mixers (0x02 - 0x05)
13775 /* set vol=0 to output mixers */
13776 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13777 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13778 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13779 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13781 /* set up input amps for analog loopback */
13782 /* Amp Indices: DAC = 0, mixer = 1 */
13783 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13784 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13785 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13786 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13787 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13788 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13789 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13790 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13796 * 3-stack pin configuration:
13797 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13799 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13801 * Set pin mode and muting
13803 /* set front pin widgets 0x14 for output */
13804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13806 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13808 /* Mic (rear) pin: input vref at 80% */
13809 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13811 /* Front Mic pin: input vref at 80% */
13812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13814 /* Line In pin: input */
13815 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13817 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13818 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13819 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13820 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13821 /* CD pin widget for input */
13822 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13828 * 6-stack pin configuration:
13830 static struct hda_verb alc861vd_6stack_init_verbs[] = {
13832 * Set pin mode and muting
13834 /* set front pin widgets 0x14 for output */
13835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13837 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13839 /* Rear Pin: output 1 (0x0d) */
13840 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13841 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13843 /* CLFE Pin: output 2 (0x0e) */
13844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13846 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13847 /* Side Pin: output 3 (0x0f) */
13848 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13849 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13850 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13852 /* Mic (rear) pin: input vref at 80% */
13853 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13854 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13855 /* Front Mic pin: input vref at 80% */
13856 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13857 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13858 /* Line In pin: input */
13859 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13860 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13861 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13862 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13863 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13864 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13865 /* CD pin widget for input */
13866 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13871 static struct hda_verb alc861vd_eapd_verbs[] = {
13872 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13876 static struct hda_verb alc660vd_eapd_verbs[] = {
13877 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13878 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13882 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13883 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13885 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13886 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13887 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13891 /* toggle speaker-output according to the hp-jack state */
13892 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
13894 unsigned int present;
13895 unsigned char bits;
13897 present = snd_hda_codec_read(codec, 0x1b, 0,
13898 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13899 bits = present ? HDA_AMP_MUTE : 0;
13900 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13901 HDA_AMP_MUTE, bits);
13904 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
13906 unsigned int present;
13907 unsigned char bits;
13909 present = snd_hda_codec_read(codec, 0x18, 0,
13910 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13911 bits = present ? HDA_AMP_MUTE : 0;
13912 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
13913 HDA_AMP_MUTE, bits);
13916 static void alc861vd_lenovo_automute(struct hda_codec *codec)
13918 alc861vd_lenovo_hp_automute(codec);
13919 alc861vd_lenovo_mic_automute(codec);
13922 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
13925 switch (res >> 26) {
13926 case ALC880_HP_EVENT:
13927 alc861vd_lenovo_hp_automute(codec);
13929 case ALC880_MIC_EVENT:
13930 alc861vd_lenovo_mic_automute(codec);
13935 static struct hda_verb alc861vd_dallas_verbs[] = {
13936 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13937 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13938 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13939 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13941 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13942 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13943 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13944 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13946 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13947 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13948 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13950 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13951 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13953 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13954 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13955 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13956 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13957 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13959 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13960 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13961 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13962 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13963 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13965 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13966 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13973 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13974 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13980 /* toggle speaker-output according to the hp-jack state */
13981 static void alc861vd_dallas_automute(struct hda_codec *codec)
13983 unsigned int present;
13985 present = snd_hda_codec_read(codec, 0x15, 0,
13986 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13987 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13988 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13991 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
13993 if ((res >> 26) == ALC880_HP_EVENT)
13994 alc861vd_dallas_automute(codec);
13997 #ifdef CONFIG_SND_HDA_POWER_SAVE
13998 #define alc861vd_loopbacks alc880_loopbacks
14001 /* pcm configuration: identiacal with ALC880 */
14002 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14003 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14004 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14005 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14008 * configuration and preset
14010 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14011 [ALC660VD_3ST] = "3stack-660",
14012 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14013 [ALC660VD_ASUS_V1S] = "asus-v1s",
14014 [ALC861VD_3ST] = "3stack",
14015 [ALC861VD_3ST_DIG] = "3stack-digout",
14016 [ALC861VD_6ST_DIG] = "6stack-digout",
14017 [ALC861VD_LENOVO] = "lenovo",
14018 [ALC861VD_DALLAS] = "dallas",
14019 [ALC861VD_HP] = "hp",
14020 [ALC861VD_AUTO] = "auto",
14023 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14024 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14025 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14026 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14027 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14028 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14029 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14030 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14031 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14032 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14033 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14034 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14035 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14036 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14037 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14038 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14039 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14040 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14044 static struct alc_config_preset alc861vd_presets[] = {
14046 .mixers = { alc861vd_3st_mixer },
14047 .init_verbs = { alc861vd_volume_init_verbs,
14048 alc861vd_3stack_init_verbs },
14049 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14050 .dac_nids = alc660vd_dac_nids,
14051 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14052 .channel_mode = alc861vd_3stack_2ch_modes,
14053 .input_mux = &alc861vd_capture_source,
14055 [ALC660VD_3ST_DIG] = {
14056 .mixers = { alc861vd_3st_mixer },
14057 .init_verbs = { alc861vd_volume_init_verbs,
14058 alc861vd_3stack_init_verbs },
14059 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14060 .dac_nids = alc660vd_dac_nids,
14061 .dig_out_nid = ALC861VD_DIGOUT_NID,
14062 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14063 .channel_mode = alc861vd_3stack_2ch_modes,
14064 .input_mux = &alc861vd_capture_source,
14067 .mixers = { alc861vd_3st_mixer },
14068 .init_verbs = { alc861vd_volume_init_verbs,
14069 alc861vd_3stack_init_verbs },
14070 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14071 .dac_nids = alc861vd_dac_nids,
14072 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14073 .channel_mode = alc861vd_3stack_2ch_modes,
14074 .input_mux = &alc861vd_capture_source,
14076 [ALC861VD_3ST_DIG] = {
14077 .mixers = { alc861vd_3st_mixer },
14078 .init_verbs = { alc861vd_volume_init_verbs,
14079 alc861vd_3stack_init_verbs },
14080 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14081 .dac_nids = alc861vd_dac_nids,
14082 .dig_out_nid = ALC861VD_DIGOUT_NID,
14083 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14084 .channel_mode = alc861vd_3stack_2ch_modes,
14085 .input_mux = &alc861vd_capture_source,
14087 [ALC861VD_6ST_DIG] = {
14088 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14089 .init_verbs = { alc861vd_volume_init_verbs,
14090 alc861vd_6stack_init_verbs },
14091 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14092 .dac_nids = alc861vd_dac_nids,
14093 .dig_out_nid = ALC861VD_DIGOUT_NID,
14094 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14095 .channel_mode = alc861vd_6stack_modes,
14096 .input_mux = &alc861vd_capture_source,
14098 [ALC861VD_LENOVO] = {
14099 .mixers = { alc861vd_lenovo_mixer },
14100 .init_verbs = { alc861vd_volume_init_verbs,
14101 alc861vd_3stack_init_verbs,
14102 alc861vd_eapd_verbs,
14103 alc861vd_lenovo_unsol_verbs },
14104 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14105 .dac_nids = alc660vd_dac_nids,
14106 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14107 .channel_mode = alc861vd_3stack_2ch_modes,
14108 .input_mux = &alc861vd_capture_source,
14109 .unsol_event = alc861vd_lenovo_unsol_event,
14110 .init_hook = alc861vd_lenovo_automute,
14112 [ALC861VD_DALLAS] = {
14113 .mixers = { alc861vd_dallas_mixer },
14114 .init_verbs = { alc861vd_dallas_verbs },
14115 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14116 .dac_nids = alc861vd_dac_nids,
14117 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14118 .channel_mode = alc861vd_3stack_2ch_modes,
14119 .input_mux = &alc861vd_dallas_capture_source,
14120 .unsol_event = alc861vd_dallas_unsol_event,
14121 .init_hook = alc861vd_dallas_automute,
14124 .mixers = { alc861vd_hp_mixer },
14125 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14126 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14127 .dac_nids = alc861vd_dac_nids,
14128 .dig_out_nid = ALC861VD_DIGOUT_NID,
14129 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14130 .channel_mode = alc861vd_3stack_2ch_modes,
14131 .input_mux = &alc861vd_hp_capture_source,
14132 .unsol_event = alc861vd_dallas_unsol_event,
14133 .init_hook = alc861vd_dallas_automute,
14135 [ALC660VD_ASUS_V1S] = {
14136 .mixers = { alc861vd_lenovo_mixer },
14137 .init_verbs = { alc861vd_volume_init_verbs,
14138 alc861vd_3stack_init_verbs,
14139 alc861vd_eapd_verbs,
14140 alc861vd_lenovo_unsol_verbs },
14141 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14142 .dac_nids = alc660vd_dac_nids,
14143 .dig_out_nid = ALC861VD_DIGOUT_NID,
14144 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14145 .channel_mode = alc861vd_3stack_2ch_modes,
14146 .input_mux = &alc861vd_capture_source,
14147 .unsol_event = alc861vd_lenovo_unsol_event,
14148 .init_hook = alc861vd_lenovo_automute,
14153 * BIOS auto configuration
14155 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14156 hda_nid_t nid, int pin_type, int dac_idx)
14158 alc_set_pin_output(codec, nid, pin_type);
14161 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14163 struct alc_spec *spec = codec->spec;
14166 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14167 for (i = 0; i <= HDA_SIDE; i++) {
14168 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14169 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14171 alc861vd_auto_set_output_and_unmute(codec, nid,
14177 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14179 struct alc_spec *spec = codec->spec;
14182 pin = spec->autocfg.hp_pins[0];
14183 if (pin) /* connect to front and use dac 0 */
14184 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14185 pin = spec->autocfg.speaker_pins[0];
14187 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14190 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14191 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14193 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14195 struct alc_spec *spec = codec->spec;
14198 for (i = 0; i < AUTO_PIN_LAST; i++) {
14199 hda_nid_t nid = spec->autocfg.input_pins[i];
14200 if (alc861vd_is_input_pin(nid)) {
14201 snd_hda_codec_write(codec, nid, 0,
14202 AC_VERB_SET_PIN_WIDGET_CONTROL,
14203 i <= AUTO_PIN_FRONT_MIC ?
14204 PIN_VREF80 : PIN_IN);
14205 if (nid != ALC861VD_PIN_CD_NID)
14206 snd_hda_codec_write(codec, nid, 0,
14207 AC_VERB_SET_AMP_GAIN_MUTE,
14213 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14215 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14216 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14218 /* add playback controls from the parsed DAC table */
14219 /* Based on ALC880 version. But ALC861VD has separate,
14220 * different NIDs for mute/unmute switch and volume control */
14221 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14222 const struct auto_pin_cfg *cfg)
14225 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14226 hda_nid_t nid_v, nid_s;
14229 for (i = 0; i < cfg->line_outs; i++) {
14230 if (!spec->multiout.dac_nids[i])
14232 nid_v = alc861vd_idx_to_mixer_vol(
14234 spec->multiout.dac_nids[i]));
14235 nid_s = alc861vd_idx_to_mixer_switch(
14237 spec->multiout.dac_nids[i]));
14241 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14242 "Center Playback Volume",
14243 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14247 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14248 "LFE Playback Volume",
14249 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14253 err = add_control(spec, ALC_CTL_BIND_MUTE,
14254 "Center Playback Switch",
14255 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14259 err = add_control(spec, ALC_CTL_BIND_MUTE,
14260 "LFE Playback Switch",
14261 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14266 sprintf(name, "%s Playback Volume", chname[i]);
14267 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14268 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14272 sprintf(name, "%s Playback Switch", chname[i]);
14273 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14274 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14283 /* add playback controls for speaker and HP outputs */
14284 /* Based on ALC880 version. But ALC861VD has separate,
14285 * different NIDs for mute/unmute switch and volume control */
14286 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14287 hda_nid_t pin, const char *pfx)
14289 hda_nid_t nid_v, nid_s;
14296 if (alc880_is_fixed_pin(pin)) {
14297 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14298 /* specify the DAC as the extra output */
14299 if (!spec->multiout.hp_nid)
14300 spec->multiout.hp_nid = nid_v;
14302 spec->multiout.extra_out_nid[0] = nid_v;
14303 /* control HP volume/switch on the output mixer amp */
14304 nid_v = alc861vd_idx_to_mixer_vol(
14305 alc880_fixed_pin_idx(pin));
14306 nid_s = alc861vd_idx_to_mixer_switch(
14307 alc880_fixed_pin_idx(pin));
14309 sprintf(name, "%s Playback Volume", pfx);
14310 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14311 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14314 sprintf(name, "%s Playback Switch", pfx);
14315 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14316 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14319 } else if (alc880_is_multi_pin(pin)) {
14320 /* set manual connection */
14321 /* we have only a switch on HP-out PIN */
14322 sprintf(name, "%s Playback Switch", pfx);
14323 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14324 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14331 /* parse the BIOS configuration and set up the alc_spec
14332 * return 1 if successful, 0 if the proper config is not found,
14333 * or a negative error code
14334 * Based on ALC880 version - had to change it to override
14335 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14336 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14338 struct alc_spec *spec = codec->spec;
14340 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14342 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14346 if (!spec->autocfg.line_outs)
14347 return 0; /* can't find valid BIOS pin config */
14349 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14352 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14355 err = alc861vd_auto_create_extra_out(spec,
14356 spec->autocfg.speaker_pins[0],
14360 err = alc861vd_auto_create_extra_out(spec,
14361 spec->autocfg.hp_pins[0],
14365 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14369 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14371 if (spec->autocfg.dig_out_pin)
14372 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14374 if (spec->kctls.list)
14375 add_mixer(spec, spec->kctls.list);
14377 add_verb(spec, alc861vd_volume_init_verbs);
14379 spec->num_mux_defs = 1;
14380 spec->input_mux = &spec->private_imux;
14382 err = alc_auto_add_mic_boost(codec);
14386 store_pin_configs(codec);
14390 /* additional initialization for auto-configuration model */
14391 static void alc861vd_auto_init(struct hda_codec *codec)
14393 struct alc_spec *spec = codec->spec;
14394 alc861vd_auto_init_multi_out(codec);
14395 alc861vd_auto_init_hp_out(codec);
14396 alc861vd_auto_init_analog_input(codec);
14397 alc861vd_auto_init_input_src(codec);
14398 if (spec->unsol_event)
14399 alc_inithook(codec);
14402 static int patch_alc861vd(struct hda_codec *codec)
14404 struct alc_spec *spec;
14405 int err, board_config;
14407 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14411 codec->spec = spec;
14413 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14417 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14418 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14419 "ALC861VD, trying auto-probe from BIOS...\n");
14420 board_config = ALC861VD_AUTO;
14423 if (board_config == ALC861VD_AUTO) {
14424 /* automatic parse from the BIOS config */
14425 err = alc861vd_parse_auto_config(codec);
14431 "hda_codec: Cannot set up configuration "
14432 "from BIOS. Using base mode...\n");
14433 board_config = ALC861VD_3ST;
14437 if (board_config != ALC861VD_AUTO)
14438 setup_preset(spec, &alc861vd_presets[board_config]);
14440 if (codec->vendor_id == 0x10ec0660) {
14441 spec->stream_name_analog = "ALC660-VD Analog";
14442 spec->stream_name_digital = "ALC660-VD Digital";
14443 /* always turn on EAPD */
14444 add_verb(spec, alc660vd_eapd_verbs);
14446 spec->stream_name_analog = "ALC861VD Analog";
14447 spec->stream_name_digital = "ALC861VD Digital";
14450 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14451 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14453 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14454 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14456 spec->adc_nids = alc861vd_adc_nids;
14457 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14458 spec->capsrc_nids = alc861vd_capsrc_nids;
14459 spec->is_mix_capture = 1;
14461 set_capture_mixer(spec);
14463 spec->vmaster_nid = 0x02;
14465 codec->patch_ops = alc_patch_ops;
14467 if (board_config == ALC861VD_AUTO)
14468 spec->init_hook = alc861vd_auto_init;
14469 #ifdef CONFIG_SND_HDA_POWER_SAVE
14470 if (!spec->loopback.amplist)
14471 spec->loopback.amplist = alc861vd_loopbacks;
14480 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14481 * configuration. Each pin widget can choose any input DACs and a mixer.
14482 * Each ADC is connected from a mixer of all inputs. This makes possible
14483 * 6-channel independent captures.
14485 * In addition, an independent DAC for the multi-playback (not used in this
14488 #define ALC662_DIGOUT_NID 0x06
14489 #define ALC662_DIGIN_NID 0x0a
14491 static hda_nid_t alc662_dac_nids[4] = {
14492 /* front, rear, clfe, rear_surr */
14496 static hda_nid_t alc662_adc_nids[1] = {
14501 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14504 /* FIXME: should be a matrix-type input source selection */
14505 static struct hda_input_mux alc662_capture_source = {
14509 { "Front Mic", 0x1 },
14515 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14523 static struct hda_input_mux alc662_eeepc_capture_source = {
14531 static struct hda_input_mux alc663_capture_source = {
14535 { "Front Mic", 0x1 },
14540 static struct hda_input_mux alc663_m51va_capture_source = {
14543 { "Ext-Mic", 0x0 },
14551 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14558 static struct hda_verb alc662_3ST_ch2_init[] = {
14559 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14560 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14561 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14562 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14569 static struct hda_verb alc662_3ST_ch6_init[] = {
14570 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14571 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14572 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14573 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14574 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14575 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14579 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14580 { 2, alc662_3ST_ch2_init },
14581 { 6, alc662_3ST_ch6_init },
14587 static struct hda_verb alc662_sixstack_ch6_init[] = {
14588 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14589 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14590 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14597 static struct hda_verb alc662_sixstack_ch8_init[] = {
14598 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14599 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14600 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14604 static struct hda_channel_mode alc662_5stack_modes[2] = {
14605 { 2, alc662_sixstack_ch6_init },
14606 { 6, alc662_sixstack_ch8_init },
14609 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14610 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14613 static struct snd_kcontrol_new alc662_base_mixer[] = {
14614 /* output mixer control */
14615 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14616 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14617 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14618 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14619 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14620 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14621 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14622 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14623 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14625 /*Input mixer control */
14626 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14627 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14628 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14629 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14630 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14631 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14632 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14633 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14637 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14638 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14639 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14640 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14641 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14642 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14643 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14644 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14647 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14648 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14649 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14650 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14654 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14655 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14656 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14658 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14659 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14660 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14661 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14662 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14664 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14665 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14666 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14667 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14669 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14670 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14671 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14672 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14673 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14677 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
14678 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14679 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
14680 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14681 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
14682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14683 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14684 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14690 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
14691 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14693 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14694 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14696 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
14697 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14698 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14700 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
14701 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14702 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14706 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
14707 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14708 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14709 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14710 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
14711 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14712 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14713 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
14714 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
14715 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14716 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
14717 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14718 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14724 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14725 .ops = &snd_hda_bind_vol,
14727 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14728 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14733 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14734 .ops = &snd_hda_bind_sw,
14736 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14737 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14742 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14743 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14744 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14750 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14751 .ops = &snd_hda_bind_sw,
14753 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14754 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14755 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14760 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14761 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14762 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14763 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14764 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14765 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14766 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14771 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14772 .ops = &snd_hda_bind_sw,
14774 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14775 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14776 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14781 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14782 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14783 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14785 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14786 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14787 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14791 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
14792 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14793 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14794 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14797 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14798 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14802 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14803 .ops = &snd_hda_bind_vol,
14805 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14806 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14811 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14812 .ops = &snd_hda_bind_sw,
14814 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14815 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14820 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14821 HDA_BIND_VOL("Master Playback Volume",
14822 &alc663_asus_two_bind_master_vol),
14823 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14824 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14825 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14827 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14831 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14832 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14833 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14834 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14835 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14836 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14837 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14841 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
14842 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14843 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14844 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14845 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14846 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14850 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14851 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14855 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
14856 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14857 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14858 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14862 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14863 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14864 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14865 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14869 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
14871 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14872 .name = "Channel Mode",
14873 .info = alc_ch_mode_info,
14874 .get = alc_ch_mode_get,
14875 .put = alc_ch_mode_put,
14880 static struct hda_verb alc662_init_verbs[] = {
14881 /* ADC: mute amp left and right */
14882 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14883 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14884 /* Front mixer: unmute input/output amp left and right (volume = 0) */
14886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14889 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14892 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14894 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14896 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14899 /* Front Pin: output 0 (0x0c) */
14900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14901 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14903 /* Rear Pin: output 1 (0x0d) */
14904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14907 /* CLFE Pin: output 2 (0x0e) */
14908 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14909 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14911 /* Mic (rear) pin: input vref at 80% */
14912 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14913 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14914 /* Front Mic pin: input vref at 80% */
14915 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14916 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14917 /* Line In pin: input */
14918 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14919 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14920 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14921 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14922 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14923 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14924 /* CD pin widget for input */
14925 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14927 /* FIXME: use matrix-type input source selection */
14928 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14935 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14936 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14937 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14938 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14940 /* always trun on EAPD */
14941 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14942 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14947 static struct hda_verb alc662_sue_init_verbs[] = {
14948 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14949 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14953 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
14954 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14955 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14959 /* Set Unsolicited Event*/
14960 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
14961 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14962 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14967 * generic initialization of ADC, input mixers and output mixers
14969 static struct hda_verb alc662_auto_init_verbs[] = {
14971 * Unmute ADC and set the default input to mic-in
14973 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14974 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14976 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
14978 * Note: PASD motherboards uses the Line In 2 as the input for front
14979 * panel mic (mic 2)
14981 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14982 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14983 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14984 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14989 * Set up output mixers (0x0c - 0x0f)
14991 /* set vol=0 to output mixers */
14992 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14993 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14994 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14996 /* set up input amps for analog loopback */
14997 /* Amp Indices: DAC = 0, mixer = 1 */
14998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15000 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15001 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15002 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15006 /* FIXME: use matrix-type input source selection */
15007 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15010 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15014 /* additional verbs for ALC663 */
15015 static struct hda_verb alc663_auto_init_verbs[] = {
15016 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15017 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15021 static struct hda_verb alc663_m51va_init_verbs[] = {
15022 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15023 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15024 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15025 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15026 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15027 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15029 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15030 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15034 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15035 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15036 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15037 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15040 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15041 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15045 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15046 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15047 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15048 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15049 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15050 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15052 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15053 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15057 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15058 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15060 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15063 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15068 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15069 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15070 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15071 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15072 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15073 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15075 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15076 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15078 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15079 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15080 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15084 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15085 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15086 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15087 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15088 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15089 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15091 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15094 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15095 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15096 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15100 static struct hda_verb alc663_g71v_init_verbs[] = {
15101 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15102 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15103 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15105 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15106 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15107 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15109 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15110 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15111 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15115 static struct hda_verb alc663_g50v_init_verbs[] = {
15116 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15117 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15118 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15120 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15121 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15125 static struct hda_verb alc662_ecs_init_verbs[] = {
15126 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15127 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15128 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15129 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15133 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15134 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15135 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15139 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15141 unsigned int present;
15142 unsigned char bits;
15144 present = snd_hda_codec_read(codec, 0x14, 0,
15145 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15146 bits = present ? HDA_AMP_MUTE : 0;
15147 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15148 HDA_AMP_MUTE, bits);
15151 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15153 unsigned int present;
15154 unsigned char bits;
15156 present = snd_hda_codec_read(codec, 0x1b, 0,
15157 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15158 bits = present ? HDA_AMP_MUTE : 0;
15159 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15160 HDA_AMP_MUTE, bits);
15161 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15162 HDA_AMP_MUTE, bits);
15165 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15168 if ((res >> 26) == ALC880_HP_EVENT)
15169 alc662_lenovo_101e_all_automute(codec);
15170 if ((res >> 26) == ALC880_FRONT_EVENT)
15171 alc662_lenovo_101e_ispeaker_automute(codec);
15174 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15176 unsigned int present;
15178 present = snd_hda_codec_read(codec, 0x18, 0,
15179 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15180 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15181 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15182 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15183 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15184 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15185 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15186 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15187 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15190 /* unsolicited event for HP jack sensing */
15191 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15194 if ((res >> 26) == ALC880_HP_EVENT)
15195 alc262_hippo1_automute( codec );
15197 if ((res >> 26) == ALC880_MIC_EVENT)
15198 alc662_eeepc_mic_automute(codec);
15201 static void alc662_eeepc_inithook(struct hda_codec *codec)
15203 alc262_hippo1_automute( codec );
15204 alc662_eeepc_mic_automute(codec);
15207 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15210 unsigned int present;
15212 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15213 present = snd_hda_codec_read(codec, 0x14, 0,
15214 AC_VERB_GET_PIN_SENSE, 0);
15215 present = (present & 0x80000000) != 0;
15217 /* mute internal speaker */
15218 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15219 HDA_AMP_MUTE, HDA_AMP_MUTE);
15221 /* unmute internal speaker if necessary */
15222 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15223 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15224 HDA_AMP_MUTE, mute);
15228 /* unsolicited event for HP jack sensing */
15229 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15232 if ((res >> 26) == ALC880_HP_EVENT)
15233 alc662_eeepc_ep20_automute(codec);
15236 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15238 alc662_eeepc_ep20_automute(codec);
15241 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15243 unsigned int present;
15244 unsigned char bits;
15246 present = snd_hda_codec_read(codec, 0x21, 0,
15247 AC_VERB_GET_PIN_SENSE, 0)
15248 & AC_PINSENSE_PRESENCE;
15249 bits = present ? HDA_AMP_MUTE : 0;
15250 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15251 AMP_IN_MUTE(0), bits);
15252 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15253 AMP_IN_MUTE(0), bits);
15256 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15258 unsigned int present;
15259 unsigned char bits;
15261 present = snd_hda_codec_read(codec, 0x21, 0,
15262 AC_VERB_GET_PIN_SENSE, 0)
15263 & AC_PINSENSE_PRESENCE;
15264 bits = present ? HDA_AMP_MUTE : 0;
15265 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15266 AMP_IN_MUTE(0), bits);
15267 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15268 AMP_IN_MUTE(0), bits);
15269 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15270 AMP_IN_MUTE(0), bits);
15271 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15272 AMP_IN_MUTE(0), bits);
15275 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15277 unsigned int present;
15278 unsigned char bits;
15280 present = snd_hda_codec_read(codec, 0x15, 0,
15281 AC_VERB_GET_PIN_SENSE, 0)
15282 & AC_PINSENSE_PRESENCE;
15283 bits = present ? HDA_AMP_MUTE : 0;
15284 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15285 AMP_IN_MUTE(0), bits);
15286 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15287 AMP_IN_MUTE(0), bits);
15288 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15289 AMP_IN_MUTE(0), bits);
15290 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15291 AMP_IN_MUTE(0), bits);
15294 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15296 unsigned int present;
15297 unsigned char bits;
15299 present = snd_hda_codec_read(codec, 0x1b, 0,
15300 AC_VERB_GET_PIN_SENSE, 0)
15301 & AC_PINSENSE_PRESENCE;
15302 bits = present ? 0 : PIN_OUT;
15303 snd_hda_codec_write(codec, 0x14, 0,
15304 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15307 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15309 unsigned int present1, present2;
15311 present1 = snd_hda_codec_read(codec, 0x21, 0,
15312 AC_VERB_GET_PIN_SENSE, 0)
15313 & AC_PINSENSE_PRESENCE;
15314 present2 = snd_hda_codec_read(codec, 0x15, 0,
15315 AC_VERB_GET_PIN_SENSE, 0)
15316 & AC_PINSENSE_PRESENCE;
15318 if (present1 || present2) {
15319 snd_hda_codec_write_cache(codec, 0x14, 0,
15320 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15322 snd_hda_codec_write_cache(codec, 0x14, 0,
15323 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15327 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15329 unsigned int present1, present2;
15331 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15332 AC_VERB_GET_PIN_SENSE, 0)
15333 & AC_PINSENSE_PRESENCE;
15334 present2 = snd_hda_codec_read(codec, 0x15, 0,
15335 AC_VERB_GET_PIN_SENSE, 0)
15336 & AC_PINSENSE_PRESENCE;
15338 if (present1 || present2) {
15339 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15340 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15341 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15342 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15345 AMP_IN_MUTE(0), 0);
15346 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15347 AMP_IN_MUTE(0), 0);
15351 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15353 unsigned int present;
15355 present = snd_hda_codec_read(codec, 0x18, 0,
15356 AC_VERB_GET_PIN_SENSE, 0)
15357 & AC_PINSENSE_PRESENCE;
15358 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15359 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15360 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15361 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15362 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15363 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15364 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15365 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15368 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15371 switch (res >> 26) {
15372 case ALC880_HP_EVENT:
15373 alc663_m51va_speaker_automute(codec);
15375 case ALC880_MIC_EVENT:
15376 alc663_m51va_mic_automute(codec);
15381 static void alc663_m51va_inithook(struct hda_codec *codec)
15383 alc663_m51va_speaker_automute(codec);
15384 alc663_m51va_mic_automute(codec);
15387 /* ***************** Mode1 ******************************/
15388 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15391 switch (res >> 26) {
15392 case ALC880_HP_EVENT:
15393 alc663_m51va_speaker_automute(codec);
15395 case ALC880_MIC_EVENT:
15396 alc662_eeepc_mic_automute(codec);
15401 static void alc663_mode1_inithook(struct hda_codec *codec)
15403 alc663_m51va_speaker_automute(codec);
15404 alc662_eeepc_mic_automute(codec);
15406 /* ***************** Mode2 ******************************/
15407 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15410 switch (res >> 26) {
15411 case ALC880_HP_EVENT:
15412 alc662_f5z_speaker_automute(codec);
15414 case ALC880_MIC_EVENT:
15415 alc662_eeepc_mic_automute(codec);
15420 static void alc662_mode2_inithook(struct hda_codec *codec)
15422 alc662_f5z_speaker_automute(codec);
15423 alc662_eeepc_mic_automute(codec);
15425 /* ***************** Mode3 ******************************/
15426 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15429 switch (res >> 26) {
15430 case ALC880_HP_EVENT:
15431 alc663_two_hp_m1_speaker_automute(codec);
15433 case ALC880_MIC_EVENT:
15434 alc662_eeepc_mic_automute(codec);
15439 static void alc663_mode3_inithook(struct hda_codec *codec)
15441 alc663_two_hp_m1_speaker_automute(codec);
15442 alc662_eeepc_mic_automute(codec);
15444 /* ***************** Mode4 ******************************/
15445 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15448 switch (res >> 26) {
15449 case ALC880_HP_EVENT:
15450 alc663_21jd_two_speaker_automute(codec);
15452 case ALC880_MIC_EVENT:
15453 alc662_eeepc_mic_automute(codec);
15458 static void alc663_mode4_inithook(struct hda_codec *codec)
15460 alc663_21jd_two_speaker_automute(codec);
15461 alc662_eeepc_mic_automute(codec);
15463 /* ***************** Mode5 ******************************/
15464 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15467 switch (res >> 26) {
15468 case ALC880_HP_EVENT:
15469 alc663_15jd_two_speaker_automute(codec);
15471 case ALC880_MIC_EVENT:
15472 alc662_eeepc_mic_automute(codec);
15477 static void alc663_mode5_inithook(struct hda_codec *codec)
15479 alc663_15jd_two_speaker_automute(codec);
15480 alc662_eeepc_mic_automute(codec);
15482 /* ***************** Mode6 ******************************/
15483 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15486 switch (res >> 26) {
15487 case ALC880_HP_EVENT:
15488 alc663_two_hp_m2_speaker_automute(codec);
15490 case ALC880_MIC_EVENT:
15491 alc662_eeepc_mic_automute(codec);
15496 static void alc663_mode6_inithook(struct hda_codec *codec)
15498 alc663_two_hp_m2_speaker_automute(codec);
15499 alc662_eeepc_mic_automute(codec);
15502 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15504 unsigned int present;
15505 unsigned char bits;
15507 present = snd_hda_codec_read(codec, 0x21, 0,
15508 AC_VERB_GET_PIN_SENSE, 0)
15509 & AC_PINSENSE_PRESENCE;
15510 bits = present ? HDA_AMP_MUTE : 0;
15511 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15512 HDA_AMP_MUTE, bits);
15513 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15514 HDA_AMP_MUTE, bits);
15517 static void alc663_g71v_front_automute(struct hda_codec *codec)
15519 unsigned int present;
15520 unsigned char bits;
15522 present = snd_hda_codec_read(codec, 0x15, 0,
15523 AC_VERB_GET_PIN_SENSE, 0)
15524 & AC_PINSENSE_PRESENCE;
15525 bits = present ? HDA_AMP_MUTE : 0;
15526 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15527 HDA_AMP_MUTE, bits);
15530 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15533 switch (res >> 26) {
15534 case ALC880_HP_EVENT:
15535 alc663_g71v_hp_automute(codec);
15537 case ALC880_FRONT_EVENT:
15538 alc663_g71v_front_automute(codec);
15540 case ALC880_MIC_EVENT:
15541 alc662_eeepc_mic_automute(codec);
15546 static void alc663_g71v_inithook(struct hda_codec *codec)
15548 alc663_g71v_front_automute(codec);
15549 alc663_g71v_hp_automute(codec);
15550 alc662_eeepc_mic_automute(codec);
15553 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15556 switch (res >> 26) {
15557 case ALC880_HP_EVENT:
15558 alc663_m51va_speaker_automute(codec);
15560 case ALC880_MIC_EVENT:
15561 alc662_eeepc_mic_automute(codec);
15566 static void alc663_g50v_inithook(struct hda_codec *codec)
15568 alc663_m51va_speaker_automute(codec);
15569 alc662_eeepc_mic_automute(codec);
15572 /* bind hp and internal speaker mute (with plug check) */
15573 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15574 struct snd_ctl_elem_value *ucontrol)
15576 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15577 long *valp = ucontrol->value.integer.value;
15580 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15582 valp[0] ? 0 : HDA_AMP_MUTE);
15583 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15585 valp[1] ? 0 : HDA_AMP_MUTE);
15587 alc262_hippo1_automute(codec);
15591 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15592 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15594 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15595 .name = "Master Playback Switch",
15596 .info = snd_hda_mixer_amp_switch_info,
15597 .get = snd_hda_mixer_amp_switch_get,
15598 .put = alc662_ecs_master_sw_put,
15599 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15602 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15603 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15604 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15606 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15607 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15608 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15612 #ifdef CONFIG_SND_HDA_POWER_SAVE
15613 #define alc662_loopbacks alc880_loopbacks
15617 /* pcm configuration: identiacal with ALC880 */
15618 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15619 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15620 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15621 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15624 * configuration and preset
15626 static const char *alc662_models[ALC662_MODEL_LAST] = {
15627 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15628 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15629 [ALC662_3ST_6ch] = "3stack-6ch",
15630 [ALC662_5ST_DIG] = "6stack-dig",
15631 [ALC662_LENOVO_101E] = "lenovo-101e",
15632 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15633 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15634 [ALC662_ECS] = "ecs",
15635 [ALC663_ASUS_M51VA] = "m51va",
15636 [ALC663_ASUS_G71V] = "g71v",
15637 [ALC663_ASUS_H13] = "h13",
15638 [ALC663_ASUS_G50V] = "g50v",
15639 [ALC663_ASUS_MODE1] = "asus-mode1",
15640 [ALC662_ASUS_MODE2] = "asus-mode2",
15641 [ALC663_ASUS_MODE3] = "asus-mode3",
15642 [ALC663_ASUS_MODE4] = "asus-mode4",
15643 [ALC663_ASUS_MODE5] = "asus-mode5",
15644 [ALC663_ASUS_MODE6] = "asus-mode6",
15645 [ALC662_AUTO] = "auto",
15648 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15649 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15650 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15651 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15652 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15653 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15654 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15655 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15656 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15657 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15658 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15659 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15660 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15661 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15662 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15663 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15664 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15665 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15666 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15667 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15668 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15669 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15670 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15671 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15672 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15673 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15674 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15675 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15676 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15677 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15678 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15679 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15680 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15681 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15682 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15683 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15684 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15685 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15686 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15687 ALC662_3ST_6ch_DIG),
15688 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15689 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15690 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15691 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15692 ALC662_3ST_6ch_DIG),
15693 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15694 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15695 ALC662_3ST_6ch_DIG),
15696 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15697 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15698 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
15702 static struct alc_config_preset alc662_presets[] = {
15703 [ALC662_3ST_2ch_DIG] = {
15704 .mixers = { alc662_3ST_2ch_mixer },
15705 .init_verbs = { alc662_init_verbs },
15706 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15707 .dac_nids = alc662_dac_nids,
15708 .dig_out_nid = ALC662_DIGOUT_NID,
15709 .dig_in_nid = ALC662_DIGIN_NID,
15710 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15711 .channel_mode = alc662_3ST_2ch_modes,
15712 .input_mux = &alc662_capture_source,
15714 [ALC662_3ST_6ch_DIG] = {
15715 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
15716 .init_verbs = { alc662_init_verbs },
15717 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15718 .dac_nids = alc662_dac_nids,
15719 .dig_out_nid = ALC662_DIGOUT_NID,
15720 .dig_in_nid = ALC662_DIGIN_NID,
15721 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15722 .channel_mode = alc662_3ST_6ch_modes,
15724 .input_mux = &alc662_capture_source,
15726 [ALC662_3ST_6ch] = {
15727 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
15728 .init_verbs = { alc662_init_verbs },
15729 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15730 .dac_nids = alc662_dac_nids,
15731 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15732 .channel_mode = alc662_3ST_6ch_modes,
15734 .input_mux = &alc662_capture_source,
15736 [ALC662_5ST_DIG] = {
15737 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
15738 .init_verbs = { alc662_init_verbs },
15739 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15740 .dac_nids = alc662_dac_nids,
15741 .dig_out_nid = ALC662_DIGOUT_NID,
15742 .dig_in_nid = ALC662_DIGIN_NID,
15743 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
15744 .channel_mode = alc662_5stack_modes,
15745 .input_mux = &alc662_capture_source,
15747 [ALC662_LENOVO_101E] = {
15748 .mixers = { alc662_lenovo_101e_mixer },
15749 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
15750 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15751 .dac_nids = alc662_dac_nids,
15752 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15753 .channel_mode = alc662_3ST_2ch_modes,
15754 .input_mux = &alc662_lenovo_101e_capture_source,
15755 .unsol_event = alc662_lenovo_101e_unsol_event,
15756 .init_hook = alc662_lenovo_101e_all_automute,
15758 [ALC662_ASUS_EEEPC_P701] = {
15759 .mixers = { alc662_eeepc_p701_mixer },
15760 .init_verbs = { alc662_init_verbs,
15761 alc662_eeepc_sue_init_verbs },
15762 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15763 .dac_nids = alc662_dac_nids,
15764 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15765 .channel_mode = alc662_3ST_2ch_modes,
15766 .input_mux = &alc662_eeepc_capture_source,
15767 .unsol_event = alc662_eeepc_unsol_event,
15768 .init_hook = alc662_eeepc_inithook,
15770 [ALC662_ASUS_EEEPC_EP20] = {
15771 .mixers = { alc662_eeepc_ep20_mixer,
15772 alc662_chmode_mixer },
15773 .init_verbs = { alc662_init_verbs,
15774 alc662_eeepc_ep20_sue_init_verbs },
15775 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15776 .dac_nids = alc662_dac_nids,
15777 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15778 .channel_mode = alc662_3ST_6ch_modes,
15779 .input_mux = &alc662_lenovo_101e_capture_source,
15780 .unsol_event = alc662_eeepc_ep20_unsol_event,
15781 .init_hook = alc662_eeepc_ep20_inithook,
15784 .mixers = { alc662_ecs_mixer },
15785 .init_verbs = { alc662_init_verbs,
15786 alc662_ecs_init_verbs },
15787 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15788 .dac_nids = alc662_dac_nids,
15789 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15790 .channel_mode = alc662_3ST_2ch_modes,
15791 .input_mux = &alc662_eeepc_capture_source,
15792 .unsol_event = alc662_eeepc_unsol_event,
15793 .init_hook = alc662_eeepc_inithook,
15795 [ALC663_ASUS_M51VA] = {
15796 .mixers = { alc663_m51va_mixer },
15797 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15798 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15799 .dac_nids = alc662_dac_nids,
15800 .dig_out_nid = ALC662_DIGOUT_NID,
15801 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15802 .channel_mode = alc662_3ST_2ch_modes,
15803 .input_mux = &alc663_m51va_capture_source,
15804 .unsol_event = alc663_m51va_unsol_event,
15805 .init_hook = alc663_m51va_inithook,
15807 [ALC663_ASUS_G71V] = {
15808 .mixers = { alc663_g71v_mixer },
15809 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
15810 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15811 .dac_nids = alc662_dac_nids,
15812 .dig_out_nid = ALC662_DIGOUT_NID,
15813 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15814 .channel_mode = alc662_3ST_2ch_modes,
15815 .input_mux = &alc662_eeepc_capture_source,
15816 .unsol_event = alc663_g71v_unsol_event,
15817 .init_hook = alc663_g71v_inithook,
15819 [ALC663_ASUS_H13] = {
15820 .mixers = { alc663_m51va_mixer },
15821 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15822 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15823 .dac_nids = alc662_dac_nids,
15824 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15825 .channel_mode = alc662_3ST_2ch_modes,
15826 .input_mux = &alc663_m51va_capture_source,
15827 .unsol_event = alc663_m51va_unsol_event,
15828 .init_hook = alc663_m51va_inithook,
15830 [ALC663_ASUS_G50V] = {
15831 .mixers = { alc663_g50v_mixer },
15832 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
15833 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15834 .dac_nids = alc662_dac_nids,
15835 .dig_out_nid = ALC662_DIGOUT_NID,
15836 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15837 .channel_mode = alc662_3ST_6ch_modes,
15838 .input_mux = &alc663_capture_source,
15839 .unsol_event = alc663_g50v_unsol_event,
15840 .init_hook = alc663_g50v_inithook,
15842 [ALC663_ASUS_MODE1] = {
15843 .mixers = { alc663_m51va_mixer },
15844 .cap_mixer = alc662_auto_capture_mixer,
15845 .init_verbs = { alc662_init_verbs,
15846 alc663_21jd_amic_init_verbs },
15847 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15849 .dac_nids = alc662_dac_nids,
15850 .dig_out_nid = ALC662_DIGOUT_NID,
15851 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15852 .channel_mode = alc662_3ST_2ch_modes,
15853 .input_mux = &alc662_eeepc_capture_source,
15854 .unsol_event = alc663_mode1_unsol_event,
15855 .init_hook = alc663_mode1_inithook,
15857 [ALC662_ASUS_MODE2] = {
15858 .mixers = { alc662_1bjd_mixer },
15859 .cap_mixer = alc662_auto_capture_mixer,
15860 .init_verbs = { alc662_init_verbs,
15861 alc662_1bjd_amic_init_verbs },
15862 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15863 .dac_nids = alc662_dac_nids,
15864 .dig_out_nid = ALC662_DIGOUT_NID,
15865 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15866 .channel_mode = alc662_3ST_2ch_modes,
15867 .input_mux = &alc662_eeepc_capture_source,
15868 .unsol_event = alc662_mode2_unsol_event,
15869 .init_hook = alc662_mode2_inithook,
15871 [ALC663_ASUS_MODE3] = {
15872 .mixers = { alc663_two_hp_m1_mixer },
15873 .cap_mixer = alc662_auto_capture_mixer,
15874 .init_verbs = { alc662_init_verbs,
15875 alc663_two_hp_amic_m1_init_verbs },
15876 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15878 .dac_nids = alc662_dac_nids,
15879 .dig_out_nid = ALC662_DIGOUT_NID,
15880 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15881 .channel_mode = alc662_3ST_2ch_modes,
15882 .input_mux = &alc662_eeepc_capture_source,
15883 .unsol_event = alc663_mode3_unsol_event,
15884 .init_hook = alc663_mode3_inithook,
15886 [ALC663_ASUS_MODE4] = {
15887 .mixers = { alc663_asus_21jd_clfe_mixer },
15888 .cap_mixer = alc662_auto_capture_mixer,
15889 .init_verbs = { alc662_init_verbs,
15890 alc663_21jd_amic_init_verbs},
15891 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15893 .dac_nids = alc662_dac_nids,
15894 .dig_out_nid = ALC662_DIGOUT_NID,
15895 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15896 .channel_mode = alc662_3ST_2ch_modes,
15897 .input_mux = &alc662_eeepc_capture_source,
15898 .unsol_event = alc663_mode4_unsol_event,
15899 .init_hook = alc663_mode4_inithook,
15901 [ALC663_ASUS_MODE5] = {
15902 .mixers = { alc663_asus_15jd_clfe_mixer },
15903 .cap_mixer = alc662_auto_capture_mixer,
15904 .init_verbs = { alc662_init_verbs,
15905 alc663_15jd_amic_init_verbs },
15906 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15908 .dac_nids = alc662_dac_nids,
15909 .dig_out_nid = ALC662_DIGOUT_NID,
15910 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15911 .channel_mode = alc662_3ST_2ch_modes,
15912 .input_mux = &alc662_eeepc_capture_source,
15913 .unsol_event = alc663_mode5_unsol_event,
15914 .init_hook = alc663_mode5_inithook,
15916 [ALC663_ASUS_MODE6] = {
15917 .mixers = { alc663_two_hp_m2_mixer },
15918 .cap_mixer = alc662_auto_capture_mixer,
15919 .init_verbs = { alc662_init_verbs,
15920 alc663_two_hp_amic_m2_init_verbs },
15921 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15923 .dac_nids = alc662_dac_nids,
15924 .dig_out_nid = ALC662_DIGOUT_NID,
15925 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15926 .channel_mode = alc662_3ST_2ch_modes,
15927 .input_mux = &alc662_eeepc_capture_source,
15928 .unsol_event = alc663_mode6_unsol_event,
15929 .init_hook = alc663_mode6_inithook,
15935 * BIOS auto configuration
15938 /* add playback controls from the parsed DAC table */
15939 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
15940 const struct auto_pin_cfg *cfg)
15943 static const char *chname[4] = {
15944 "Front", "Surround", NULL /*CLFE*/, "Side"
15949 for (i = 0; i < cfg->line_outs; i++) {
15950 if (!spec->multiout.dac_nids[i])
15952 nid = alc880_idx_to_dac(i);
15955 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15956 "Center Playback Volume",
15957 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
15961 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15962 "LFE Playback Volume",
15963 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
15967 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
15968 "Center Playback Switch",
15969 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
15973 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
15974 "LFE Playback Switch",
15975 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
15980 sprintf(name, "%s Playback Volume", chname[i]);
15981 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15982 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
15986 sprintf(name, "%s Playback Switch", chname[i]);
15987 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15988 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
15997 /* add playback controls for speaker and HP outputs */
15998 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16009 /* ALC663 has a mono output pin on 0x17 */
16010 sprintf(name, "%s Playback Switch", pfx);
16011 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16012 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16016 if (alc880_is_fixed_pin(pin)) {
16017 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16018 /* printk("DAC nid=%x\n",nid); */
16019 /* specify the DAC as the extra output */
16020 if (!spec->multiout.hp_nid)
16021 spec->multiout.hp_nid = nid;
16023 spec->multiout.extra_out_nid[0] = nid;
16024 /* control HP volume/switch on the output mixer amp */
16025 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16026 sprintf(name, "%s Playback Volume", pfx);
16027 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16028 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16031 sprintf(name, "%s Playback Switch", pfx);
16032 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16033 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16036 } else if (alc880_is_multi_pin(pin)) {
16037 /* set manual connection */
16038 /* we have only a switch on HP-out PIN */
16039 sprintf(name, "%s Playback Switch", pfx);
16040 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16041 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16048 /* create playback/capture controls for input pins */
16049 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16050 const struct auto_pin_cfg *cfg)
16052 struct hda_input_mux *imux = &spec->private_imux;
16055 for (i = 0; i < AUTO_PIN_LAST; i++) {
16056 if (alc880_is_input_pin(cfg->input_pins[i])) {
16057 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16058 err = new_analog_input(spec, cfg->input_pins[i],
16059 auto_pin_cfg_labels[i],
16063 imux->items[imux->num_items].label =
16064 auto_pin_cfg_labels[i];
16065 imux->items[imux->num_items].index =
16066 alc880_input_pin_idx(cfg->input_pins[i]);
16073 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16074 hda_nid_t nid, int pin_type,
16077 alc_set_pin_output(codec, nid, pin_type);
16078 /* need the manual connection? */
16079 if (alc880_is_multi_pin(nid)) {
16080 struct alc_spec *spec = codec->spec;
16081 int idx = alc880_multi_pin_idx(nid);
16082 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16083 AC_VERB_SET_CONNECT_SEL,
16084 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16088 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16090 struct alc_spec *spec = codec->spec;
16093 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16094 for (i = 0; i <= HDA_SIDE; i++) {
16095 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16096 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16098 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16103 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16105 struct alc_spec *spec = codec->spec;
16108 pin = spec->autocfg.hp_pins[0];
16109 if (pin) /* connect to front */
16111 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16112 pin = spec->autocfg.speaker_pins[0];
16114 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16117 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16118 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16120 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16122 struct alc_spec *spec = codec->spec;
16125 for (i = 0; i < AUTO_PIN_LAST; i++) {
16126 hda_nid_t nid = spec->autocfg.input_pins[i];
16127 if (alc662_is_input_pin(nid)) {
16128 snd_hda_codec_write(codec, nid, 0,
16129 AC_VERB_SET_PIN_WIDGET_CONTROL,
16130 (i <= AUTO_PIN_FRONT_MIC ?
16131 PIN_VREF80 : PIN_IN));
16132 if (nid != ALC662_PIN_CD_NID)
16133 snd_hda_codec_write(codec, nid, 0,
16134 AC_VERB_SET_AMP_GAIN_MUTE,
16140 #define alc662_auto_init_input_src alc882_auto_init_input_src
16142 static int alc662_parse_auto_config(struct hda_codec *codec)
16144 struct alc_spec *spec = codec->spec;
16146 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16148 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16152 if (!spec->autocfg.line_outs)
16153 return 0; /* can't find valid BIOS pin config */
16155 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16158 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16161 err = alc662_auto_create_extra_out(spec,
16162 spec->autocfg.speaker_pins[0],
16166 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16170 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16174 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16176 if (spec->autocfg.dig_out_pin)
16177 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16179 if (spec->kctls.list)
16180 add_mixer(spec, spec->kctls.list);
16182 spec->num_mux_defs = 1;
16183 spec->input_mux = &spec->private_imux;
16185 add_verb(spec, alc662_auto_init_verbs);
16186 if (codec->vendor_id == 0x10ec0663)
16187 add_verb(spec, alc663_auto_init_verbs);
16189 err = alc_auto_add_mic_boost(codec);
16193 store_pin_configs(codec);
16197 /* additional initialization for auto-configuration model */
16198 static void alc662_auto_init(struct hda_codec *codec)
16200 struct alc_spec *spec = codec->spec;
16201 alc662_auto_init_multi_out(codec);
16202 alc662_auto_init_hp_out(codec);
16203 alc662_auto_init_analog_input(codec);
16204 alc662_auto_init_input_src(codec);
16205 if (spec->unsol_event)
16206 alc_inithook(codec);
16209 static int patch_alc662(struct hda_codec *codec)
16211 struct alc_spec *spec;
16212 int err, board_config;
16214 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16218 codec->spec = spec;
16220 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16222 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16225 if (board_config < 0) {
16226 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16227 "trying auto-probe from BIOS...\n");
16228 board_config = ALC662_AUTO;
16231 if (board_config == ALC662_AUTO) {
16232 /* automatic parse from the BIOS config */
16233 err = alc662_parse_auto_config(codec);
16239 "hda_codec: Cannot set up configuration "
16240 "from BIOS. Using base mode...\n");
16241 board_config = ALC662_3ST_2ch_DIG;
16245 if (board_config != ALC662_AUTO)
16246 setup_preset(spec, &alc662_presets[board_config]);
16248 if (codec->vendor_id == 0x10ec0663) {
16249 spec->stream_name_analog = "ALC663 Analog";
16250 spec->stream_name_digital = "ALC663 Digital";
16251 } else if (codec->vendor_id == 0x10ec0272) {
16252 spec->stream_name_analog = "ALC272 Analog";
16253 spec->stream_name_digital = "ALC272 Digital";
16255 spec->stream_name_analog = "ALC662 Analog";
16256 spec->stream_name_digital = "ALC662 Digital";
16259 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16260 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16262 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16263 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16265 spec->adc_nids = alc662_adc_nids;
16266 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16267 spec->capsrc_nids = alc662_capsrc_nids;
16268 spec->is_mix_capture = 1;
16270 if (!spec->cap_mixer)
16271 set_capture_mixer(spec);
16273 spec->vmaster_nid = 0x02;
16275 codec->patch_ops = alc_patch_ops;
16276 if (board_config == ALC662_AUTO)
16277 spec->init_hook = alc662_auto_init;
16278 #ifdef CONFIG_SND_HDA_POWER_SAVE
16279 if (!spec->loopback.amplist)
16280 spec->loopback.amplist = alc662_loopbacks;
16289 struct hda_codec_preset snd_hda_preset_realtek[] = {
16290 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16291 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16292 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16293 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16294 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16295 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16296 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16297 .patch = patch_alc861 },
16298 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16299 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16300 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16301 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16302 .patch = patch_alc883 },
16303 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16304 .patch = patch_alc662 },
16305 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16306 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16307 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16308 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16309 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16310 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16311 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16312 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16313 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16314 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16315 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16316 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16317 .patch = patch_alc883 },
16318 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16319 {} /* terminator */