2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
81 #ifdef CONFIG_SND_DEBUG
85 ALC260_MODEL_LAST /* last tag */
95 ALC262_HP_BPC_D7000_WL,
96 ALC262_HP_BPC_D7000_WF,
108 ALC262_MODEL_LAST /* last tag */
118 ALC268_ACER_ASPIRE_ONE,
121 #ifdef CONFIG_SND_DEBUG
125 ALC268_MODEL_LAST /* last tag */
132 ALC269_ASUS_EEEPC_P703,
133 ALC269_ASUS_EEEPC_P901,
137 ALC269_MODEL_LAST /* last tag */
154 /* ALC861-VD models */
176 ALC662_ASUS_EEEPC_P701,
177 ALC662_ASUS_EEEPC_EP20,
216 ALC883_TARGA_2ch_DIG,
219 ALC888_ACER_ASPIRE_4930G,
223 ALC883_LENOVO_101E_2ch,
224 ALC883_LENOVO_NB0763,
225 ALC888_LENOVO_MS7195_DIG,
232 ALC883_FUJITSU_PI2515,
233 ALC888_FUJITSU_XA3530,
234 ALC883_3ST_6ch_INTEL,
243 #define GPIO_MASK 0x03
246 /* codec parameterization */
247 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
248 unsigned int num_mixers;
249 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
251 const struct hda_verb *init_verbs[5]; /* initialization verbs
255 unsigned int num_init_verbs;
257 char *stream_name_analog; /* analog PCM stream */
258 struct hda_pcm_stream *stream_analog_playback;
259 struct hda_pcm_stream *stream_analog_capture;
260 struct hda_pcm_stream *stream_analog_alt_playback;
261 struct hda_pcm_stream *stream_analog_alt_capture;
263 char *stream_name_digital; /* digital PCM stream */
264 struct hda_pcm_stream *stream_digital_playback;
265 struct hda_pcm_stream *stream_digital_capture;
268 struct hda_multi_out multiout; /* playback set-up
269 * max_channels, dacs must be set
270 * dig_out_nid and hp_nid are optional
272 hda_nid_t alt_dac_nid;
275 unsigned int num_adc_nids;
277 hda_nid_t *capsrc_nids;
278 hda_nid_t dig_in_nid; /* digital-in NID; optional */
279 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */
282 unsigned int num_mux_defs;
283 const struct hda_input_mux *input_mux;
284 unsigned int cur_mux[3];
287 const struct hda_channel_mode *channel_mode;
288 int num_channel_mode;
291 /* PCM information */
292 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
294 /* dynamic controls, init_verbs and input_mux */
295 struct auto_pin_cfg autocfg;
296 struct snd_array kctls;
297 struct hda_input_mux private_imux;
298 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
301 void (*init_hook)(struct hda_codec *codec);
302 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
304 /* for pin sensing */
305 unsigned int sense_updated: 1;
306 unsigned int jack_present: 1;
307 unsigned int master_sw: 1;
309 /* for virtual master */
310 hda_nid_t vmaster_nid;
311 #ifdef CONFIG_SND_HDA_POWER_SAVE
312 struct hda_loopback_check loopback;
317 unsigned int pll_coef_idx, pll_coef_bit;
319 #ifdef SND_HDA_NEEDS_RESUME
320 #define ALC_MAX_PINS 16
321 unsigned int num_pins;
322 hda_nid_t pin_nids[ALC_MAX_PINS];
323 unsigned int pin_cfgs[ALC_MAX_PINS];
328 * configuration template - to be copied to the spec instance
330 struct alc_config_preset {
331 struct snd_kcontrol_new *mixers[5]; /* should be identical size
334 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
335 const struct hda_verb *init_verbs[5];
336 unsigned int num_dacs;
338 hda_nid_t dig_out_nid; /* optional */
339 hda_nid_t hp_nid; /* optional */
340 unsigned int num_adc_nids;
342 hda_nid_t *capsrc_nids;
343 hda_nid_t dig_in_nid;
344 unsigned int num_channel_mode;
345 const struct hda_channel_mode *channel_mode;
347 unsigned int num_mux_defs;
348 const struct hda_input_mux *input_mux;
349 void (*unsol_event)(struct hda_codec *, unsigned int);
350 void (*init_hook)(struct hda_codec *);
351 #ifdef CONFIG_SND_HDA_POWER_SAVE
352 struct hda_amp_list *loopbacks;
360 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
361 struct snd_ctl_elem_info *uinfo)
363 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
364 struct alc_spec *spec = codec->spec;
365 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
366 if (mux_idx >= spec->num_mux_defs)
368 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
371 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
372 struct snd_ctl_elem_value *ucontrol)
374 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
375 struct alc_spec *spec = codec->spec;
376 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
378 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
382 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
383 struct snd_ctl_elem_value *ucontrol)
385 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
386 struct alc_spec *spec = codec->spec;
387 const struct hda_input_mux *imux;
388 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
389 unsigned int mux_idx;
390 hda_nid_t nid = spec->capsrc_nids ?
391 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
393 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
394 imux = &spec->input_mux[mux_idx];
396 if (spec->is_mix_capture) {
397 /* Matrix-mixer style (e.g. ALC882) */
398 unsigned int *cur_val = &spec->cur_mux[adc_idx];
401 idx = ucontrol->value.enumerated.item[0];
402 if (idx >= imux->num_items)
403 idx = imux->num_items - 1;
406 for (i = 0; i < imux->num_items; i++) {
407 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
408 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
409 imux->items[i].index,
415 /* MUX style (e.g. ALC880) */
416 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
417 &spec->cur_mux[adc_idx]);
422 * channel mode setting
424 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_info *uinfo)
427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
428 struct alc_spec *spec = codec->spec;
429 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
430 spec->num_channel_mode);
433 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
434 struct snd_ctl_elem_value *ucontrol)
436 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
437 struct alc_spec *spec = codec->spec;
438 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
439 spec->num_channel_mode,
440 spec->multiout.max_channels);
443 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
444 struct snd_ctl_elem_value *ucontrol)
446 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
447 struct alc_spec *spec = codec->spec;
448 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
449 spec->num_channel_mode,
450 &spec->multiout.max_channels);
451 if (err >= 0 && spec->need_dac_fix)
452 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
457 * Control the mode of pin widget settings via the mixer. "pc" is used
458 * instead of "%" to avoid consequences of accidently treating the % as
459 * being part of a format specifier. Maximum allowed length of a value is
460 * 63 characters plus NULL terminator.
462 * Note: some retasking pin complexes seem to ignore requests for input
463 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
464 * are requested. Therefore order this list so that this behaviour will not
465 * cause problems when mixer clients move through the enum sequentially.
466 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
469 static char *alc_pin_mode_names[] = {
470 "Mic 50pc bias", "Mic 80pc bias",
471 "Line in", "Line out", "Headphone out",
473 static unsigned char alc_pin_mode_values[] = {
474 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
476 /* The control can present all 5 options, or it can limit the options based
477 * in the pin being assumed to be exclusively an input or an output pin. In
478 * addition, "input" pins may or may not process the mic bias option
479 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
480 * accept requests for bias as of chip versions up to March 2006) and/or
481 * wiring in the computer.
483 #define ALC_PIN_DIR_IN 0x00
484 #define ALC_PIN_DIR_OUT 0x01
485 #define ALC_PIN_DIR_INOUT 0x02
486 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
487 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
489 /* Info about the pin modes supported by the different pin direction modes.
490 * For each direction the minimum and maximum values are given.
492 static signed char alc_pin_mode_dir_info[5][2] = {
493 { 0, 2 }, /* ALC_PIN_DIR_IN */
494 { 3, 4 }, /* ALC_PIN_DIR_OUT */
495 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
496 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
497 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
499 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
500 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
501 #define alc_pin_mode_n_items(_dir) \
502 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
504 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
505 struct snd_ctl_elem_info *uinfo)
507 unsigned int item_num = uinfo->value.enumerated.item;
508 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
510 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
512 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
514 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
515 item_num = alc_pin_mode_min(dir);
516 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
520 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
521 struct snd_ctl_elem_value *ucontrol)
524 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
525 hda_nid_t nid = kcontrol->private_value & 0xffff;
526 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
527 long *valp = ucontrol->value.integer.value;
528 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
529 AC_VERB_GET_PIN_WIDGET_CONTROL,
532 /* Find enumerated value for current pinctl setting */
533 i = alc_pin_mode_min(dir);
534 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
536 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
540 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
541 struct snd_ctl_elem_value *ucontrol)
544 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
545 hda_nid_t nid = kcontrol->private_value & 0xffff;
546 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
547 long val = *ucontrol->value.integer.value;
548 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
549 AC_VERB_GET_PIN_WIDGET_CONTROL,
552 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
553 val = alc_pin_mode_min(dir);
555 change = pinctl != alc_pin_mode_values[val];
557 /* Set pin mode to that requested */
558 snd_hda_codec_write_cache(codec, nid, 0,
559 AC_VERB_SET_PIN_WIDGET_CONTROL,
560 alc_pin_mode_values[val]);
562 /* Also enable the retasking pin's input/output as required
563 * for the requested pin mode. Enum values of 2 or less are
566 * Dynamically switching the input/output buffers probably
567 * reduces noise slightly (particularly on input) so we'll
568 * do it. However, having both input and output buffers
569 * enabled simultaneously doesn't seem to be problematic if
570 * this turns out to be necessary in the future.
573 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
574 HDA_AMP_MUTE, HDA_AMP_MUTE);
575 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
578 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
579 HDA_AMP_MUTE, HDA_AMP_MUTE);
580 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
587 #define ALC_PIN_MODE(xname, nid, dir) \
588 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
589 .info = alc_pin_mode_info, \
590 .get = alc_pin_mode_get, \
591 .put = alc_pin_mode_put, \
592 .private_value = nid | (dir<<16) }
594 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
595 * together using a mask with more than one bit set. This control is
596 * currently used only by the ALC260 test model. At this stage they are not
597 * needed for any "production" models.
599 #ifdef CONFIG_SND_DEBUG
600 #define alc_gpio_data_info snd_ctl_boolean_mono_info
602 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
603 struct snd_ctl_elem_value *ucontrol)
605 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
606 hda_nid_t nid = kcontrol->private_value & 0xffff;
607 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
608 long *valp = ucontrol->value.integer.value;
609 unsigned int val = snd_hda_codec_read(codec, nid, 0,
610 AC_VERB_GET_GPIO_DATA, 0x00);
612 *valp = (val & mask) != 0;
615 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
616 struct snd_ctl_elem_value *ucontrol)
619 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
620 hda_nid_t nid = kcontrol->private_value & 0xffff;
621 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
622 long val = *ucontrol->value.integer.value;
623 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
624 AC_VERB_GET_GPIO_DATA,
627 /* Set/unset the masked GPIO bit(s) as needed */
628 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
633 snd_hda_codec_write_cache(codec, nid, 0,
634 AC_VERB_SET_GPIO_DATA, gpio_data);
638 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
639 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
640 .info = alc_gpio_data_info, \
641 .get = alc_gpio_data_get, \
642 .put = alc_gpio_data_put, \
643 .private_value = nid | (mask<<16) }
644 #endif /* CONFIG_SND_DEBUG */
646 /* A switch control to allow the enabling of the digital IO pins on the
647 * ALC260. This is incredibly simplistic; the intention of this control is
648 * to provide something in the test model allowing digital outputs to be
649 * identified if present. If models are found which can utilise these
650 * outputs a more complete mixer control can be devised for those models if
653 #ifdef CONFIG_SND_DEBUG
654 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
656 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
657 struct snd_ctl_elem_value *ucontrol)
659 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
660 hda_nid_t nid = kcontrol->private_value & 0xffff;
661 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
662 long *valp = ucontrol->value.integer.value;
663 unsigned int val = snd_hda_codec_read(codec, nid, 0,
664 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
666 *valp = (val & mask) != 0;
669 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
670 struct snd_ctl_elem_value *ucontrol)
673 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
674 hda_nid_t nid = kcontrol->private_value & 0xffff;
675 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
676 long val = *ucontrol->value.integer.value;
677 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
678 AC_VERB_GET_DIGI_CONVERT_1,
681 /* Set/unset the masked control bit(s) as needed */
682 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
687 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
692 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
693 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
694 .info = alc_spdif_ctrl_info, \
695 .get = alc_spdif_ctrl_get, \
696 .put = alc_spdif_ctrl_put, \
697 .private_value = nid | (mask<<16) }
698 #endif /* CONFIG_SND_DEBUG */
700 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
701 * Again, this is only used in the ALC26x test models to help identify when
702 * the EAPD line must be asserted for features to work.
704 #ifdef CONFIG_SND_DEBUG
705 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
707 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
708 struct snd_ctl_elem_value *ucontrol)
710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
711 hda_nid_t nid = kcontrol->private_value & 0xffff;
712 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
713 long *valp = ucontrol->value.integer.value;
714 unsigned int val = snd_hda_codec_read(codec, nid, 0,
715 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
717 *valp = (val & mask) != 0;
721 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
722 struct snd_ctl_elem_value *ucontrol)
725 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
726 hda_nid_t nid = kcontrol->private_value & 0xffff;
727 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
728 long val = *ucontrol->value.integer.value;
729 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
730 AC_VERB_GET_EAPD_BTLENABLE,
733 /* Set/unset the masked control bit(s) as needed */
734 change = (!val ? 0 : mask) != (ctrl_data & mask);
739 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
745 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
746 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
747 .info = alc_eapd_ctrl_info, \
748 .get = alc_eapd_ctrl_get, \
749 .put = alc_eapd_ctrl_put, \
750 .private_value = nid | (mask<<16) }
751 #endif /* CONFIG_SND_DEBUG */
755 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
757 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
759 spec->mixers[spec->num_mixers++] = mix;
762 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
764 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
766 spec->init_verbs[spec->num_init_verbs++] = verb;
769 #ifdef CONFIG_PROC_FS
773 static void print_realtek_coef(struct snd_info_buffer *buffer,
774 struct hda_codec *codec, hda_nid_t nid)
780 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
781 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
782 coeff = snd_hda_codec_read(codec, nid, 0,
783 AC_VERB_GET_COEF_INDEX, 0);
784 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
787 #define print_realtek_coef NULL
791 * set up from the preset table
793 static void setup_preset(struct alc_spec *spec,
794 const struct alc_config_preset *preset)
798 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
799 add_mixer(spec, preset->mixers[i]);
800 spec->cap_mixer = preset->cap_mixer;
801 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
803 add_verb(spec, preset->init_verbs[i]);
805 spec->channel_mode = preset->channel_mode;
806 spec->num_channel_mode = preset->num_channel_mode;
807 spec->need_dac_fix = preset->need_dac_fix;
809 spec->multiout.max_channels = spec->channel_mode[0].channels;
811 spec->multiout.num_dacs = preset->num_dacs;
812 spec->multiout.dac_nids = preset->dac_nids;
813 spec->multiout.dig_out_nid = preset->dig_out_nid;
814 spec->multiout.hp_nid = preset->hp_nid;
816 spec->num_mux_defs = preset->num_mux_defs;
817 if (!spec->num_mux_defs)
818 spec->num_mux_defs = 1;
819 spec->input_mux = preset->input_mux;
821 spec->num_adc_nids = preset->num_adc_nids;
822 spec->adc_nids = preset->adc_nids;
823 spec->capsrc_nids = preset->capsrc_nids;
824 spec->dig_in_nid = preset->dig_in_nid;
826 spec->unsol_event = preset->unsol_event;
827 spec->init_hook = preset->init_hook;
828 #ifdef CONFIG_SND_HDA_POWER_SAVE
829 spec->loopback.amplist = preset->loopbacks;
833 /* Enable GPIO mask and set output */
834 static struct hda_verb alc_gpio1_init_verbs[] = {
835 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
836 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
837 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
841 static struct hda_verb alc_gpio2_init_verbs[] = {
842 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
843 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
844 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
848 static struct hda_verb alc_gpio3_init_verbs[] = {
849 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
850 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
851 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
856 * Fix hardware PLL issue
857 * On some codecs, the analog PLL gating control must be off while
858 * the default value is 1.
860 static void alc_fix_pll(struct hda_codec *codec)
862 struct alc_spec *spec = codec->spec;
867 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
869 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
870 AC_VERB_GET_PROC_COEF, 0);
871 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
873 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
874 val & ~(1 << spec->pll_coef_bit));
877 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
878 unsigned int coef_idx, unsigned int coef_bit)
880 struct alc_spec *spec = codec->spec;
882 spec->pll_coef_idx = coef_idx;
883 spec->pll_coef_bit = coef_bit;
887 static void alc_sku_automute(struct hda_codec *codec)
889 struct alc_spec *spec = codec->spec;
890 unsigned int present;
891 unsigned int hp_nid = spec->autocfg.hp_pins[0];
892 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
894 /* need to execute and sync at first */
895 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
896 present = snd_hda_codec_read(codec, hp_nid, 0,
897 AC_VERB_GET_PIN_SENSE, 0);
898 spec->jack_present = (present & 0x80000000) != 0;
899 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
900 spec->jack_present ? 0 : PIN_OUT);
903 #if 0 /* it's broken in some acses -- temporarily disabled */
904 static void alc_mic_automute(struct hda_codec *codec)
906 struct alc_spec *spec = codec->spec;
907 unsigned int present;
908 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
909 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
910 unsigned int mix_nid = spec->capsrc_nids[0];
911 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
913 capsrc_idx_mic = mic_nid - 0x18;
914 capsrc_idx_fmic = fmic_nid - 0x18;
915 present = snd_hda_codec_read(codec, mic_nid, 0,
916 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
917 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
918 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
919 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
920 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
921 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
922 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
925 #define alc_mic_automute(codec) /* NOP */
926 #endif /* disabled */
928 /* unsolicited event for HP jack sensing */
929 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
931 if (codec->vendor_id == 0x10ec0880)
935 if (res == ALC880_HP_EVENT)
936 alc_sku_automute(codec);
938 if (res == ALC880_MIC_EVENT)
939 alc_mic_automute(codec);
942 static void alc_inithook(struct hda_codec *codec)
944 alc_sku_automute(codec);
945 alc_mic_automute(codec);
948 /* additional initialization for ALC888 variants */
949 static void alc888_coef_init(struct hda_codec *codec)
953 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
954 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
955 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
956 if ((tmp & 0xf0) == 2)
958 snd_hda_codec_read(codec, 0x20, 0,
959 AC_VERB_SET_PROC_COEF, 0x830);
962 snd_hda_codec_read(codec, 0x20, 0,
963 AC_VERB_SET_PROC_COEF, 0x3030);
966 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
967 * 31 ~ 16 : Manufacture ID
969 * 7 ~ 0 : Assembly ID
970 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
972 static void alc_subsystem_id(struct hda_codec *codec,
973 unsigned int porta, unsigned int porte,
976 unsigned int ass, tmp, i;
978 struct alc_spec *spec = codec->spec;
980 ass = codec->subsystem_id & 0xffff;
981 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
985 * 31~30 : port conetcivity
988 * 19~16 : Check sum (15:1)
993 if (codec->vendor_id == 0x10ec0260)
995 ass = snd_hda_codec_read(codec, nid, 0,
996 AC_VERB_GET_CONFIG_DEFAULT, 0);
997 if (!(ass & 1) && !(ass & 0x100000))
999 if ((ass >> 30) != 1) /* no physical connection */
1004 for (i = 1; i < 16; i++) {
1008 if (((ass >> 16) & 0xf) != tmp)
1014 * 2 : 0 --> Desktop, 1 --> Laptop
1015 * 3~5 : External Amplifier control
1018 tmp = (ass & 0x38) >> 3; /* external Amp control */
1021 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1024 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1027 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1029 case 5: /* set EAPD output high */
1030 switch (codec->vendor_id) {
1032 snd_hda_codec_write(codec, 0x0f, 0,
1033 AC_VERB_SET_EAPD_BTLENABLE, 2);
1034 snd_hda_codec_write(codec, 0x10, 0,
1035 AC_VERB_SET_EAPD_BTLENABLE, 2);
1046 snd_hda_codec_write(codec, 0x14, 0,
1047 AC_VERB_SET_EAPD_BTLENABLE, 2);
1048 snd_hda_codec_write(codec, 0x15, 0,
1049 AC_VERB_SET_EAPD_BTLENABLE, 2);
1052 switch (codec->vendor_id) {
1054 snd_hda_codec_write(codec, 0x1a, 0,
1055 AC_VERB_SET_COEF_INDEX, 7);
1056 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1057 AC_VERB_GET_PROC_COEF, 0);
1058 snd_hda_codec_write(codec, 0x1a, 0,
1059 AC_VERB_SET_COEF_INDEX, 7);
1060 snd_hda_codec_write(codec, 0x1a, 0,
1061 AC_VERB_SET_PROC_COEF,
1070 snd_hda_codec_write(codec, 0x20, 0,
1071 AC_VERB_SET_COEF_INDEX, 7);
1072 tmp = snd_hda_codec_read(codec, 0x20, 0,
1073 AC_VERB_GET_PROC_COEF, 0);
1074 snd_hda_codec_write(codec, 0x20, 0,
1075 AC_VERB_SET_COEF_INDEX, 7);
1076 snd_hda_codec_write(codec, 0x20, 0,
1077 AC_VERB_SET_PROC_COEF,
1081 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1085 snd_hda_codec_write(codec, 0x20, 0,
1086 AC_VERB_SET_COEF_INDEX, 7);
1087 tmp = snd_hda_codec_read(codec, 0x20, 0,
1088 AC_VERB_GET_PROC_COEF, 0);
1089 snd_hda_codec_write(codec, 0x20, 0,
1090 AC_VERB_SET_COEF_INDEX, 7);
1091 snd_hda_codec_write(codec, 0x20, 0,
1092 AC_VERB_SET_PROC_COEF,
1100 /* is laptop or Desktop and enable the function "Mute internal speaker
1101 * when the external headphone out jack is plugged"
1103 if (!(ass & 0x8000))
1106 * 10~8 : Jack location
1107 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1109 * 15 : 1 --> enable the function "Mute internal speaker
1110 * when the external headphone out jack is plugged"
1112 if (!spec->autocfg.speaker_pins[0]) {
1113 if (spec->autocfg.line_out_pins[0])
1114 spec->autocfg.speaker_pins[0] =
1115 spec->autocfg.line_out_pins[0];
1120 if (!spec->autocfg.hp_pins[0]) {
1121 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1123 spec->autocfg.hp_pins[0] = porta;
1125 spec->autocfg.hp_pins[0] = porte;
1127 spec->autocfg.hp_pins[0] = portd;
1131 if (spec->autocfg.hp_pins[0])
1132 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1133 AC_VERB_SET_UNSOLICITED_ENABLE,
1134 AC_USRSP_EN | ALC880_HP_EVENT);
1136 #if 0 /* it's broken in some acses -- temporarily disabled */
1137 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1138 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1139 snd_hda_codec_write(codec,
1140 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1141 AC_VERB_SET_UNSOLICITED_ENABLE,
1142 AC_USRSP_EN | ALC880_MIC_EVENT);
1143 #endif /* disabled */
1145 spec->unsol_event = alc_sku_unsol_event;
1149 * Fix-up pin default configurations
1157 static void alc_fix_pincfg(struct hda_codec *codec,
1158 const struct snd_pci_quirk *quirk,
1159 const struct alc_pincfg **pinfix)
1161 const struct alc_pincfg *cfg;
1163 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1167 cfg = pinfix[quirk->value];
1168 for (; cfg->nid; cfg++) {
1171 for (i = 0; i < 4; i++) {
1172 snd_hda_codec_write(codec, cfg->nid, 0,
1173 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1187 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1188 /* Mic-in jack as mic in */
1189 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1190 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1191 /* Line-in jack as Line in */
1192 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1193 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1194 /* Line-Out as Front */
1195 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1202 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1203 /* Mic-in jack as mic in */
1204 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1205 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1206 /* Line-in jack as Surround */
1207 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1208 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1209 /* Line-Out as Front */
1210 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1217 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1218 /* Mic-in jack as CLFE */
1219 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1220 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1221 /* Line-in jack as Surround */
1222 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1223 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1224 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1225 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1232 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1233 /* Mic-in jack as CLFE */
1234 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1235 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1236 /* Line-in jack as Surround */
1237 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1238 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1239 /* Line-Out as Side */
1240 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1244 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1245 { 2, alc888_4ST_ch2_intel_init },
1246 { 4, alc888_4ST_ch4_intel_init },
1247 { 6, alc888_4ST_ch6_intel_init },
1248 { 8, alc888_4ST_ch8_intel_init },
1252 * ALC888 Fujitsu Siemens Amillo xa3530
1255 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1256 /* Front Mic: set to PIN_IN (empty by default) */
1257 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1258 /* Connect Internal HP to Front */
1259 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1260 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1261 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1262 /* Connect Bass HP to Front */
1263 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1265 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1266 /* Connect Line-Out side jack (SPDIF) to Side */
1267 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1268 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1269 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1270 /* Connect Mic jack to CLFE */
1271 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1272 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1273 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1274 /* Connect Line-in jack to Surround */
1275 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1276 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1277 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1278 /* Connect HP out jack to Front */
1279 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1280 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1281 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1282 /* Enable unsolicited event for HP jack and Line-out jack */
1283 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1284 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1288 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
1290 unsigned int present;
1292 /* Line out presence */
1293 present = snd_hda_codec_read(codec, 0x17, 0,
1294 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1295 /* HP out presence */
1296 present = present || snd_hda_codec_read(codec, 0x1b, 0,
1297 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1298 bits = present ? HDA_AMP_MUTE : 0;
1299 /* Toggle internal speakers muting */
1300 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1301 HDA_AMP_MUTE, bits);
1302 /* Toggle internal bass muting */
1303 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1304 HDA_AMP_MUTE, bits);
1307 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
1310 if (res >> 26 == ALC880_HP_EVENT)
1311 alc888_fujitsu_xa3530_automute(codec);
1316 * ALC888 Acer Aspire 4930G model
1319 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1320 /* Front Mic: set to PIN_IN (empty by default) */
1321 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1322 /* Unselect Front Mic by default in input mixer 3 */
1323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1324 /* Enable unsolicited event for HP jack */
1325 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1326 /* Connect Internal HP to front */
1327 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1328 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1329 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1330 /* Connect HP out to front */
1331 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1333 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1337 static struct hda_input_mux alc888_2_capture_sources[2] = {
1338 /* Front mic only available on one ADC */
1345 { "Front Mic", 0xb },
1358 static struct snd_kcontrol_new alc888_base_mixer[] = {
1359 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1360 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1361 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1362 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1363 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1365 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1366 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1367 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1368 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1369 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1370 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1371 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1372 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1373 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1375 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1376 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1377 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1378 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1382 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
1384 unsigned int present;
1386 present = snd_hda_codec_read(codec, 0x15, 0,
1387 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1388 bits = present ? HDA_AMP_MUTE : 0;
1389 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1390 HDA_AMP_MUTE, bits);
1393 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
1396 if (res >> 26 == ALC880_HP_EVENT)
1397 alc888_acer_aspire_4930g_automute(codec);
1401 * ALC880 3-stack model
1403 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1404 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1405 * F-Mic = 0x1b, HP = 0x19
1408 static hda_nid_t alc880_dac_nids[4] = {
1409 /* front, rear, clfe, rear_surr */
1410 0x02, 0x05, 0x04, 0x03
1413 static hda_nid_t alc880_adc_nids[3] = {
1418 /* The datasheet says the node 0x07 is connected from inputs,
1419 * but it shows zero connection in the real implementation on some devices.
1420 * Note: this is a 915GAV bug, fixed on 915GLV
1422 static hda_nid_t alc880_adc_nids_alt[2] = {
1427 #define ALC880_DIGOUT_NID 0x06
1428 #define ALC880_DIGIN_NID 0x0a
1430 static struct hda_input_mux alc880_capture_source = {
1434 { "Front Mic", 0x3 },
1440 /* channel source setting (2/6 channel selection for 3-stack) */
1442 static struct hda_verb alc880_threestack_ch2_init[] = {
1443 /* set line-in to input, mute it */
1444 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1445 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1446 /* set mic-in to input vref 80%, mute it */
1447 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1448 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1453 static struct hda_verb alc880_threestack_ch6_init[] = {
1454 /* set line-in to output, unmute it */
1455 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1456 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1457 /* set mic-in to output, unmute it */
1458 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1459 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1463 static struct hda_channel_mode alc880_threestack_modes[2] = {
1464 { 2, alc880_threestack_ch2_init },
1465 { 6, alc880_threestack_ch6_init },
1468 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1469 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1471 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1472 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1473 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1474 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1475 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1476 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1477 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1478 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1479 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1480 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1481 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1482 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1483 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1484 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1485 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1486 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1487 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1490 .name = "Channel Mode",
1491 .info = alc_ch_mode_info,
1492 .get = alc_ch_mode_get,
1493 .put = alc_ch_mode_put,
1498 /* capture mixer elements */
1499 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1500 struct snd_ctl_elem_info *uinfo)
1502 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1503 struct alc_spec *spec = codec->spec;
1506 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1507 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1509 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1510 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1514 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1515 unsigned int size, unsigned int __user *tlv)
1517 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1518 struct alc_spec *spec = codec->spec;
1521 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1522 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1524 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1525 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1529 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1530 struct snd_ctl_elem_value *ucontrol);
1532 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1533 struct snd_ctl_elem_value *ucontrol,
1536 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1537 struct alc_spec *spec = codec->spec;
1538 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1541 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1542 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1544 err = func(kcontrol, ucontrol);
1545 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1549 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1550 struct snd_ctl_elem_value *ucontrol)
1552 return alc_cap_getput_caller(kcontrol, ucontrol,
1553 snd_hda_mixer_amp_volume_get);
1556 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1557 struct snd_ctl_elem_value *ucontrol)
1559 return alc_cap_getput_caller(kcontrol, ucontrol,
1560 snd_hda_mixer_amp_volume_put);
1563 /* capture mixer elements */
1564 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1566 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1567 struct snd_ctl_elem_value *ucontrol)
1569 return alc_cap_getput_caller(kcontrol, ucontrol,
1570 snd_hda_mixer_amp_switch_get);
1573 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1574 struct snd_ctl_elem_value *ucontrol)
1576 return alc_cap_getput_caller(kcontrol, ucontrol,
1577 snd_hda_mixer_amp_switch_put);
1580 #define DEFINE_CAPMIX(num) \
1581 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1583 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1584 .name = "Capture Switch", \
1585 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1587 .info = alc_cap_sw_info, \
1588 .get = alc_cap_sw_get, \
1589 .put = alc_cap_sw_put, \
1592 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1593 .name = "Capture Volume", \
1594 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1595 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1596 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1598 .info = alc_cap_vol_info, \
1599 .get = alc_cap_vol_get, \
1600 .put = alc_cap_vol_put, \
1601 .tlv = { .c = alc_cap_vol_tlv }, \
1604 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1605 /* .name = "Capture Source", */ \
1606 .name = "Input Source", \
1608 .info = alc_mux_enum_info, \
1609 .get = alc_mux_enum_get, \
1610 .put = alc_mux_enum_put, \
1615 /* up to three ADCs */
1622 * ALC880 5-stack model
1624 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1626 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1627 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1630 /* additional mixers to alc880_three_stack_mixer */
1631 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1632 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1633 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1637 /* channel source setting (6/8 channel selection for 5-stack) */
1639 static struct hda_verb alc880_fivestack_ch6_init[] = {
1640 /* set line-in to input, mute it */
1641 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1642 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1647 static struct hda_verb alc880_fivestack_ch8_init[] = {
1648 /* set line-in to output, unmute it */
1649 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1650 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1654 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1655 { 6, alc880_fivestack_ch6_init },
1656 { 8, alc880_fivestack_ch8_init },
1661 * ALC880 6-stack model
1663 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1664 * Side = 0x05 (0x0f)
1665 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1666 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1669 static hda_nid_t alc880_6st_dac_nids[4] = {
1670 /* front, rear, clfe, rear_surr */
1671 0x02, 0x03, 0x04, 0x05
1674 static struct hda_input_mux alc880_6stack_capture_source = {
1678 { "Front Mic", 0x1 },
1684 /* fixed 8-channels */
1685 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1689 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1690 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1691 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1692 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1693 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1694 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1695 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1696 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1697 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1698 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1699 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1700 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1701 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1702 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1703 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1706 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1707 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1708 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1709 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1711 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1712 .name = "Channel Mode",
1713 .info = alc_ch_mode_info,
1714 .get = alc_ch_mode_get,
1715 .put = alc_ch_mode_put,
1724 * W810 has rear IO for:
1727 * Center/LFE (DAC 04)
1730 * The system also has a pair of internal speakers, and a headphone jack.
1731 * These are both connected to Line2 on the codec, hence to DAC 02.
1733 * There is a variable resistor to control the speaker or headphone
1734 * volume. This is a hardware-only device without a software API.
1736 * Plugging headphones in will disable the internal speakers. This is
1737 * implemented in hardware, not via the driver using jack sense. In
1738 * a similar fashion, plugging into the rear socket marked "front" will
1739 * disable both the speakers and headphones.
1741 * For input, there's a microphone jack, and an "audio in" jack.
1742 * These may not do anything useful with this driver yet, because I
1743 * haven't setup any initialization verbs for these yet...
1746 static hda_nid_t alc880_w810_dac_nids[3] = {
1747 /* front, rear/surround, clfe */
1751 /* fixed 6 channels */
1752 static struct hda_channel_mode alc880_w810_modes[1] = {
1756 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1757 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1758 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1759 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1760 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1761 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1762 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1763 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1764 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1765 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1766 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1774 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1775 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1779 static hda_nid_t alc880_z71v_dac_nids[1] = {
1782 #define ALC880_Z71V_HP_DAC 0x03
1784 /* fixed 2 channels */
1785 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1789 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1791 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1794 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1795 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1803 * ALC880 F1734 model
1805 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1806 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1809 static hda_nid_t alc880_f1734_dac_nids[1] = {
1812 #define ALC880_F1734_HP_DAC 0x02
1814 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1815 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1816 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1817 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1818 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1819 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1820 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1822 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1826 static struct hda_input_mux alc880_f1734_capture_source = {
1838 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1839 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1840 * Mic = 0x18, Line = 0x1a
1843 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1844 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1846 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1847 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1848 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1849 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1850 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1851 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1852 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1853 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1854 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1855 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1856 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1862 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1863 .name = "Channel Mode",
1864 .info = alc_ch_mode_info,
1865 .get = alc_ch_mode_get,
1866 .put = alc_ch_mode_put,
1872 * ALC880 ASUS W1V model
1874 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1875 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1876 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1879 /* additional mixers to alc880_asus_mixer */
1880 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1881 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1882 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1886 /* additional mixers to alc880_asus_mixer */
1887 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1888 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1889 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1894 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1895 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1896 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1899 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1902 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1903 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1908 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1909 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1910 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1911 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1912 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1913 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1914 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1915 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1916 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1917 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1918 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1919 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1920 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1923 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1924 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1925 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1926 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1928 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1929 .name = "Channel Mode",
1930 .info = alc_ch_mode_info,
1931 .get = alc_ch_mode_get,
1932 .put = alc_ch_mode_put,
1937 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1938 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1939 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1940 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1941 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1942 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1943 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1944 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1945 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1946 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1947 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1951 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1952 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1953 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1954 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1955 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1956 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1957 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1962 * virtual master controls
1966 * slave controls for virtual master
1968 static const char *alc_slave_vols[] = {
1969 "Front Playback Volume",
1970 "Surround Playback Volume",
1971 "Center Playback Volume",
1972 "LFE Playback Volume",
1973 "Side Playback Volume",
1974 "Headphone Playback Volume",
1975 "Speaker Playback Volume",
1976 "Mono Playback Volume",
1977 "Line-Out Playback Volume",
1978 "PCM Playback Volume",
1982 static const char *alc_slave_sws[] = {
1983 "Front Playback Switch",
1984 "Surround Playback Switch",
1985 "Center Playback Switch",
1986 "LFE Playback Switch",
1987 "Side Playback Switch",
1988 "Headphone Playback Switch",
1989 "Speaker Playback Switch",
1990 "Mono Playback Switch",
1991 "IEC958 Playback Switch",
1996 * build control elements
1999 static void alc_free_kctls(struct hda_codec *codec);
2001 static int alc_build_controls(struct hda_codec *codec)
2003 struct alc_spec *spec = codec->spec;
2007 for (i = 0; i < spec->num_mixers; i++) {
2008 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2012 if (spec->cap_mixer) {
2013 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2017 if (spec->multiout.dig_out_nid) {
2018 err = snd_hda_create_spdif_out_ctls(codec,
2019 spec->multiout.dig_out_nid);
2022 err = snd_hda_create_spdif_share_sw(codec,
2026 spec->multiout.share_spdif = 1;
2028 if (spec->dig_in_nid) {
2029 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2034 /* if we have no master control, let's create it */
2035 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2036 unsigned int vmaster_tlv[4];
2037 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2038 HDA_OUTPUT, vmaster_tlv);
2039 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2040 vmaster_tlv, alc_slave_vols);
2044 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2045 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2046 NULL, alc_slave_sws);
2051 alc_free_kctls(codec); /* no longer needed */
2057 * initialize the codec volumes, etc
2061 * generic initialization of ADC, input mixers and output mixers
2063 static struct hda_verb alc880_volume_init_verbs[] = {
2065 * Unmute ADC0-2 and set the default input to mic-in
2067 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2069 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2071 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2074 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2076 * Note: PASD motherboards uses the Line In 2 as the input for front
2079 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2089 * Set up output mixers (0x0c - 0x0f)
2091 /* set vol=0 to output mixers */
2092 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2093 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2094 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2095 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2096 /* set up input amps for analog loopback */
2097 /* Amp Indices: DAC = 0, mixer = 1 */
2098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2101 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2102 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2111 * 3-stack pin configuration:
2112 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2114 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2116 * preset connection lists of input pins
2117 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2119 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2120 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2121 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2124 * Set pin mode and muting
2126 /* set front pin widgets 0x14 for output */
2127 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2128 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2129 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2130 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2131 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2132 /* Mic2 (as headphone out) for HP output */
2133 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2134 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2135 /* Line In pin widget for input */
2136 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2137 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2138 /* Line2 (as front mic) pin widget for input and vref at 80% */
2139 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2140 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2141 /* CD pin widget for input */
2142 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2148 * 5-stack pin configuration:
2149 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2150 * line-in/side = 0x1a, f-mic = 0x1b
2152 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2154 * preset connection lists of input pins
2155 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2157 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2158 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2161 * Set pin mode and muting
2163 /* set pin widgets 0x14-0x17 for output */
2164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2166 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2167 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2168 /* unmute pins for output (no gain on this amp) */
2169 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2170 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2171 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2172 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2174 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2175 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2176 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2177 /* Mic2 (as headphone out) for HP output */
2178 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2179 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2180 /* Line In pin widget for input */
2181 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2182 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2183 /* Line2 (as front mic) pin widget for input and vref at 80% */
2184 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2185 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2186 /* CD pin widget for input */
2187 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2193 * W810 pin configuration:
2194 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2196 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2197 /* hphone/speaker input selector: front DAC */
2198 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2201 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2204 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2205 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2207 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2208 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2214 * Z71V pin configuration:
2215 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2217 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2223 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2224 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2225 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2226 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2232 * 6-stack pin configuration:
2233 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2234 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2236 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2237 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2239 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2240 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2241 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2243 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2244 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2245 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2246 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2248 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2249 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2250 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2251 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2252 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2254 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2255 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2256 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2262 * Uniwill pin configuration:
2263 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2266 static struct hda_verb alc880_uniwill_init_verbs[] = {
2267 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2269 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2270 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2272 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2273 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2274 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2275 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2276 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2279 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2281 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2282 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2284 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2285 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2286 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2287 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2288 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2289 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2290 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2291 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2292 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2294 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2295 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2302 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2304 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2305 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2308 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2311 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2312 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2314 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2317 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2320 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2321 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2322 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2323 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2324 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2325 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2327 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2328 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2333 static struct hda_verb alc880_beep_init_verbs[] = {
2334 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2338 /* toggle speaker-output according to the hp-jack state */
2339 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2341 unsigned int present;
2344 present = snd_hda_codec_read(codec, 0x14, 0,
2345 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2346 bits = present ? HDA_AMP_MUTE : 0;
2347 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2348 HDA_AMP_MUTE, bits);
2349 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2350 HDA_AMP_MUTE, bits);
2353 /* auto-toggle front mic */
2354 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2356 unsigned int present;
2359 present = snd_hda_codec_read(codec, 0x18, 0,
2360 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2361 bits = present ? HDA_AMP_MUTE : 0;
2362 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2365 static void alc880_uniwill_automute(struct hda_codec *codec)
2367 alc880_uniwill_hp_automute(codec);
2368 alc880_uniwill_mic_automute(codec);
2371 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2374 /* Looks like the unsol event is incompatible with the standard
2375 * definition. 4bit tag is placed at 28 bit!
2377 switch (res >> 28) {
2378 case ALC880_HP_EVENT:
2379 alc880_uniwill_hp_automute(codec);
2381 case ALC880_MIC_EVENT:
2382 alc880_uniwill_mic_automute(codec);
2387 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2389 unsigned int present;
2392 present = snd_hda_codec_read(codec, 0x14, 0,
2393 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2394 bits = present ? HDA_AMP_MUTE : 0;
2395 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2398 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2400 unsigned int present;
2402 present = snd_hda_codec_read(codec, 0x21, 0,
2403 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2404 present &= HDA_AMP_VOLMASK;
2405 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2406 HDA_AMP_VOLMASK, present);
2407 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2408 HDA_AMP_VOLMASK, present);
2411 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2414 /* Looks like the unsol event is incompatible with the standard
2415 * definition. 4bit tag is placed at 28 bit!
2417 if ((res >> 28) == ALC880_HP_EVENT)
2418 alc880_uniwill_p53_hp_automute(codec);
2419 if ((res >> 28) == ALC880_DCVOL_EVENT)
2420 alc880_uniwill_p53_dcvol_automute(codec);
2424 * F1734 pin configuration:
2425 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2427 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2428 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2429 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2430 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2431 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2432 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2434 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2435 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2436 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2437 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2439 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2440 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2441 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2442 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2445 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2446 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2447 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2449 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2450 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2456 * ASUS pin configuration:
2457 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2459 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2460 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2461 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2462 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2463 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2468 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2469 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2470 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2471 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2472 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2474 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2476 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2478 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2480 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2481 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2482 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2487 /* Enable GPIO mask and set output */
2488 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2489 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2491 /* Clevo m520g init */
2492 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2493 /* headphone output */
2494 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2499 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2500 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2503 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2504 /* Mic1 (rear panel) */
2505 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2506 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2507 /* Mic2 (front panel) */
2508 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2509 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2511 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2512 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2513 /* change to EAPD mode */
2514 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2515 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2520 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2521 /* change to EAPD mode */
2522 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2523 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2525 /* Headphone output */
2526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2528 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2529 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2531 /* Line In pin widget for input */
2532 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2533 /* CD pin widget for input */
2534 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2535 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2536 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2538 /* change to EAPD mode */
2539 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2540 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2546 * LG m1 express dual
2549 * Rear Line-In/Out (blue): 0x14
2550 * Build-in Mic-In: 0x15
2552 * HP-Out (green): 0x1b
2553 * Mic-In/Out (red): 0x19
2557 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2558 static hda_nid_t alc880_lg_dac_nids[3] = {
2562 /* seems analog CD is not working */
2563 static struct hda_input_mux alc880_lg_capture_source = {
2568 { "Internal Mic", 0x6 },
2572 /* 2,4,6 channel modes */
2573 static struct hda_verb alc880_lg_ch2_init[] = {
2574 /* set line-in and mic-in to input */
2575 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2576 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2580 static struct hda_verb alc880_lg_ch4_init[] = {
2581 /* set line-in to out and mic-in to input */
2582 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2583 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2587 static struct hda_verb alc880_lg_ch6_init[] = {
2588 /* set line-in and mic-in to output */
2589 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2590 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2594 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2595 { 2, alc880_lg_ch2_init },
2596 { 4, alc880_lg_ch4_init },
2597 { 6, alc880_lg_ch6_init },
2600 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2601 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2602 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2603 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2604 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2605 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2606 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2607 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2608 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2609 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2610 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2611 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2612 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2613 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2614 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2616 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2617 .name = "Channel Mode",
2618 .info = alc_ch_mode_info,
2619 .get = alc_ch_mode_get,
2620 .put = alc_ch_mode_put,
2625 static struct hda_verb alc880_lg_init_verbs[] = {
2626 /* set capture source to mic-in */
2627 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2628 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2629 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2630 /* mute all amp mixer inputs */
2631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2634 /* line-in to input */
2635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2638 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2641 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2642 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2643 /* mic-in to input */
2644 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2648 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2649 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2650 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2652 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2656 /* toggle speaker-output according to the hp-jack state */
2657 static void alc880_lg_automute(struct hda_codec *codec)
2659 unsigned int present;
2662 present = snd_hda_codec_read(codec, 0x1b, 0,
2663 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2664 bits = present ? HDA_AMP_MUTE : 0;
2665 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2666 HDA_AMP_MUTE, bits);
2669 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2671 /* Looks like the unsol event is incompatible with the standard
2672 * definition. 4bit tag is placed at 28 bit!
2674 if ((res >> 28) == 0x01)
2675 alc880_lg_automute(codec);
2684 * Built-in Mic-In: 0x19
2690 static struct hda_input_mux alc880_lg_lw_capture_source = {
2694 { "Internal Mic", 0x1 },
2699 #define alc880_lg_lw_modes alc880_threestack_modes
2701 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2702 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2703 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2704 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2705 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2706 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2707 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2708 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2709 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2710 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2711 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2714 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2715 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2717 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2718 .name = "Channel Mode",
2719 .info = alc_ch_mode_info,
2720 .get = alc_ch_mode_get,
2721 .put = alc_ch_mode_put,
2726 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2727 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2728 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2729 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2731 /* set capture source to mic-in */
2732 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2737 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2738 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2740 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2741 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2742 /* mic-in to input */
2743 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2744 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2746 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2753 /* toggle speaker-output according to the hp-jack state */
2754 static void alc880_lg_lw_automute(struct hda_codec *codec)
2756 unsigned int present;
2759 present = snd_hda_codec_read(codec, 0x1b, 0,
2760 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2761 bits = present ? HDA_AMP_MUTE : 0;
2762 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2763 HDA_AMP_MUTE, bits);
2766 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2768 /* Looks like the unsol event is incompatible with the standard
2769 * definition. 4bit tag is placed at 28 bit!
2771 if ((res >> 28) == 0x01)
2772 alc880_lg_lw_automute(codec);
2775 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2776 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2777 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2780 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2781 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2785 static struct hda_input_mux alc880_medion_rim_capture_source = {
2789 { "Internal Mic", 0x1 },
2793 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2794 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2799 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2800 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2801 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2802 /* Mic2 (as headphone out) for HP output */
2803 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2804 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2805 /* Internal Speaker */
2806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2807 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2809 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2810 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2812 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2816 /* toggle speaker-output according to the hp-jack state */
2817 static void alc880_medion_rim_automute(struct hda_codec *codec)
2819 unsigned int present;
2822 present = snd_hda_codec_read(codec, 0x14, 0,
2823 AC_VERB_GET_PIN_SENSE, 0)
2824 & AC_PINSENSE_PRESENCE;
2825 bits = present ? HDA_AMP_MUTE : 0;
2826 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2827 HDA_AMP_MUTE, bits);
2829 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2831 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2834 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2837 /* Looks like the unsol event is incompatible with the standard
2838 * definition. 4bit tag is placed at 28 bit!
2840 if ((res >> 28) == ALC880_HP_EVENT)
2841 alc880_medion_rim_automute(codec);
2844 #ifdef CONFIG_SND_HDA_POWER_SAVE
2845 static struct hda_amp_list alc880_loopbacks[] = {
2846 { 0x0b, HDA_INPUT, 0 },
2847 { 0x0b, HDA_INPUT, 1 },
2848 { 0x0b, HDA_INPUT, 2 },
2849 { 0x0b, HDA_INPUT, 3 },
2850 { 0x0b, HDA_INPUT, 4 },
2854 static struct hda_amp_list alc880_lg_loopbacks[] = {
2855 { 0x0b, HDA_INPUT, 1 },
2856 { 0x0b, HDA_INPUT, 6 },
2857 { 0x0b, HDA_INPUT, 7 },
2866 static int alc_init(struct hda_codec *codec)
2868 struct alc_spec *spec = codec->spec;
2872 if (codec->vendor_id == 0x10ec0888)
2873 alc888_coef_init(codec);
2875 for (i = 0; i < spec->num_init_verbs; i++)
2876 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2878 if (spec->init_hook)
2879 spec->init_hook(codec);
2884 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2886 struct alc_spec *spec = codec->spec;
2888 if (spec->unsol_event)
2889 spec->unsol_event(codec, res);
2892 #ifdef CONFIG_SND_HDA_POWER_SAVE
2893 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2895 struct alc_spec *spec = codec->spec;
2896 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2901 * Analog playback callbacks
2903 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2904 struct hda_codec *codec,
2905 struct snd_pcm_substream *substream)
2907 struct alc_spec *spec = codec->spec;
2908 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2912 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2913 struct hda_codec *codec,
2914 unsigned int stream_tag,
2915 unsigned int format,
2916 struct snd_pcm_substream *substream)
2918 struct alc_spec *spec = codec->spec;
2919 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2920 stream_tag, format, substream);
2923 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2924 struct hda_codec *codec,
2925 struct snd_pcm_substream *substream)
2927 struct alc_spec *spec = codec->spec;
2928 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2934 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2935 struct hda_codec *codec,
2936 struct snd_pcm_substream *substream)
2938 struct alc_spec *spec = codec->spec;
2939 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2942 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2943 struct hda_codec *codec,
2944 unsigned int stream_tag,
2945 unsigned int format,
2946 struct snd_pcm_substream *substream)
2948 struct alc_spec *spec = codec->spec;
2949 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2950 stream_tag, format, substream);
2953 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2954 struct hda_codec *codec,
2955 struct snd_pcm_substream *substream)
2957 struct alc_spec *spec = codec->spec;
2958 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2964 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2965 struct hda_codec *codec,
2966 unsigned int stream_tag,
2967 unsigned int format,
2968 struct snd_pcm_substream *substream)
2970 struct alc_spec *spec = codec->spec;
2972 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2973 stream_tag, 0, format);
2977 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2978 struct hda_codec *codec,
2979 struct snd_pcm_substream *substream)
2981 struct alc_spec *spec = codec->spec;
2983 snd_hda_codec_cleanup_stream(codec,
2984 spec->adc_nids[substream->number + 1]);
2991 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2995 /* NID is set in alc_build_pcms */
2997 .open = alc880_playback_pcm_open,
2998 .prepare = alc880_playback_pcm_prepare,
2999 .cleanup = alc880_playback_pcm_cleanup
3003 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3007 /* NID is set in alc_build_pcms */
3010 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3014 /* NID is set in alc_build_pcms */
3017 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3018 .substreams = 2, /* can be overridden */
3021 /* NID is set in alc_build_pcms */
3023 .prepare = alc880_alt_capture_pcm_prepare,
3024 .cleanup = alc880_alt_capture_pcm_cleanup
3028 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3032 /* NID is set in alc_build_pcms */
3034 .open = alc880_dig_playback_pcm_open,
3035 .close = alc880_dig_playback_pcm_close,
3036 .prepare = alc880_dig_playback_pcm_prepare
3040 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3044 /* NID is set in alc_build_pcms */
3047 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3048 static struct hda_pcm_stream alc_pcm_null_stream = {
3054 static int alc_build_pcms(struct hda_codec *codec)
3056 struct alc_spec *spec = codec->spec;
3057 struct hda_pcm *info = spec->pcm_rec;
3060 codec->num_pcms = 1;
3061 codec->pcm_info = info;
3063 info->name = spec->stream_name_analog;
3064 if (spec->stream_analog_playback) {
3065 if (snd_BUG_ON(!spec->multiout.dac_nids))
3067 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3068 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3070 if (spec->stream_analog_capture) {
3071 if (snd_BUG_ON(!spec->adc_nids))
3073 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3074 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3077 if (spec->channel_mode) {
3078 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3079 for (i = 0; i < spec->num_channel_mode; i++) {
3080 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3081 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3086 /* SPDIF for stream index #1 */
3087 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3088 codec->num_pcms = 2;
3089 info = spec->pcm_rec + 1;
3090 info->name = spec->stream_name_digital;
3091 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3092 if (spec->multiout.dig_out_nid &&
3093 spec->stream_digital_playback) {
3094 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3095 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3097 if (spec->dig_in_nid &&
3098 spec->stream_digital_capture) {
3099 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3100 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3102 /* FIXME: do we need this for all Realtek codec models? */
3103 codec->spdif_status_reset = 1;
3106 /* If the use of more than one ADC is requested for the current
3107 * model, configure a second analog capture-only PCM.
3109 /* Additional Analaog capture for index #2 */
3110 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3111 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3112 codec->num_pcms = 3;
3113 info = spec->pcm_rec + 2;
3114 info->name = spec->stream_name_analog;
3115 if (spec->alt_dac_nid) {
3116 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3117 *spec->stream_analog_alt_playback;
3118 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3121 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3122 alc_pcm_null_stream;
3123 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3125 if (spec->num_adc_nids > 1) {
3126 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3127 *spec->stream_analog_alt_capture;
3128 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3130 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3131 spec->num_adc_nids - 1;
3133 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3134 alc_pcm_null_stream;
3135 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3142 static void alc_free_kctls(struct hda_codec *codec)
3144 struct alc_spec *spec = codec->spec;
3146 if (spec->kctls.list) {
3147 struct snd_kcontrol_new *kctl = spec->kctls.list;
3149 for (i = 0; i < spec->kctls.used; i++)
3150 kfree(kctl[i].name);
3152 snd_array_free(&spec->kctls);
3155 static void alc_free(struct hda_codec *codec)
3157 struct alc_spec *spec = codec->spec;
3162 alc_free_kctls(codec);
3164 codec->spec = NULL; /* to be sure */
3167 #ifdef SND_HDA_NEEDS_RESUME
3168 static void store_pin_configs(struct hda_codec *codec)
3170 struct alc_spec *spec = codec->spec;
3171 hda_nid_t nid, end_nid;
3173 end_nid = codec->start_nid + codec->num_nodes;
3174 for (nid = codec->start_nid; nid < end_nid; nid++) {
3175 unsigned int wid_caps = get_wcaps(codec, nid);
3176 unsigned int wid_type =
3177 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3178 if (wid_type != AC_WID_PIN)
3180 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3182 spec->pin_nids[spec->num_pins] = nid;
3183 spec->pin_cfgs[spec->num_pins] =
3184 snd_hda_codec_read(codec, nid, 0,
3185 AC_VERB_GET_CONFIG_DEFAULT, 0);
3190 static void resume_pin_configs(struct hda_codec *codec)
3192 struct alc_spec *spec = codec->spec;
3195 for (i = 0; i < spec->num_pins; i++) {
3196 hda_nid_t pin_nid = spec->pin_nids[i];
3197 unsigned int pin_config = spec->pin_cfgs[i];
3198 snd_hda_codec_write(codec, pin_nid, 0,
3199 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3200 pin_config & 0x000000ff);
3201 snd_hda_codec_write(codec, pin_nid, 0,
3202 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3203 (pin_config & 0x0000ff00) >> 8);
3204 snd_hda_codec_write(codec, pin_nid, 0,
3205 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3206 (pin_config & 0x00ff0000) >> 16);
3207 snd_hda_codec_write(codec, pin_nid, 0,
3208 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3213 static int alc_resume(struct hda_codec *codec)
3215 resume_pin_configs(codec);
3216 codec->patch_ops.init(codec);
3217 snd_hda_codec_resume_amp(codec);
3218 snd_hda_codec_resume_cache(codec);
3222 #define store_pin_configs(codec)
3227 static struct hda_codec_ops alc_patch_ops = {
3228 .build_controls = alc_build_controls,
3229 .build_pcms = alc_build_pcms,
3232 .unsol_event = alc_unsol_event,
3233 #ifdef SND_HDA_NEEDS_RESUME
3234 .resume = alc_resume,
3236 #ifdef CONFIG_SND_HDA_POWER_SAVE
3237 .check_power_status = alc_check_power_status,
3243 * Test configuration for debugging
3245 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3248 #ifdef CONFIG_SND_DEBUG
3249 static hda_nid_t alc880_test_dac_nids[4] = {
3250 0x02, 0x03, 0x04, 0x05
3253 static struct hda_input_mux alc880_test_capture_source = {
3262 { "Surround", 0x6 },
3266 static struct hda_channel_mode alc880_test_modes[4] = {
3273 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3274 struct snd_ctl_elem_info *uinfo)
3276 static char *texts[] = {
3277 "N/A", "Line Out", "HP Out",
3278 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3280 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3282 uinfo->value.enumerated.items = 8;
3283 if (uinfo->value.enumerated.item >= 8)
3284 uinfo->value.enumerated.item = 7;
3285 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3289 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3290 struct snd_ctl_elem_value *ucontrol)
3292 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3293 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3294 unsigned int pin_ctl, item = 0;
3296 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3297 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3298 if (pin_ctl & AC_PINCTL_OUT_EN) {
3299 if (pin_ctl & AC_PINCTL_HP_EN)
3303 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3304 switch (pin_ctl & AC_PINCTL_VREFEN) {
3305 case AC_PINCTL_VREF_HIZ: item = 3; break;
3306 case AC_PINCTL_VREF_50: item = 4; break;
3307 case AC_PINCTL_VREF_GRD: item = 5; break;
3308 case AC_PINCTL_VREF_80: item = 6; break;
3309 case AC_PINCTL_VREF_100: item = 7; break;
3312 ucontrol->value.enumerated.item[0] = item;
3316 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3317 struct snd_ctl_elem_value *ucontrol)
3319 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3320 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3321 static unsigned int ctls[] = {
3322 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3323 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3324 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3325 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3326 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3327 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3329 unsigned int old_ctl, new_ctl;
3331 old_ctl = snd_hda_codec_read(codec, nid, 0,
3332 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3333 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3334 if (old_ctl != new_ctl) {
3336 snd_hda_codec_write_cache(codec, nid, 0,
3337 AC_VERB_SET_PIN_WIDGET_CONTROL,
3339 val = ucontrol->value.enumerated.item[0] >= 3 ?
3341 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3348 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3349 struct snd_ctl_elem_info *uinfo)
3351 static char *texts[] = {
3352 "Front", "Surround", "CLFE", "Side"
3354 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3356 uinfo->value.enumerated.items = 4;
3357 if (uinfo->value.enumerated.item >= 4)
3358 uinfo->value.enumerated.item = 3;
3359 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3363 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3364 struct snd_ctl_elem_value *ucontrol)
3366 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3367 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3370 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3371 ucontrol->value.enumerated.item[0] = sel & 3;
3375 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3376 struct snd_ctl_elem_value *ucontrol)
3378 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3379 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3382 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3383 if (ucontrol->value.enumerated.item[0] != sel) {
3384 sel = ucontrol->value.enumerated.item[0] & 3;
3385 snd_hda_codec_write_cache(codec, nid, 0,
3386 AC_VERB_SET_CONNECT_SEL, sel);
3392 #define PIN_CTL_TEST(xname,nid) { \
3393 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3395 .info = alc_test_pin_ctl_info, \
3396 .get = alc_test_pin_ctl_get, \
3397 .put = alc_test_pin_ctl_put, \
3398 .private_value = nid \
3401 #define PIN_SRC_TEST(xname,nid) { \
3402 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3404 .info = alc_test_pin_src_info, \
3405 .get = alc_test_pin_src_get, \
3406 .put = alc_test_pin_src_put, \
3407 .private_value = nid \
3410 static struct snd_kcontrol_new alc880_test_mixer[] = {
3411 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3412 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3413 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3414 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3415 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3416 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3417 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3418 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3419 PIN_CTL_TEST("Front Pin Mode", 0x14),
3420 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3421 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3422 PIN_CTL_TEST("Side Pin Mode", 0x17),
3423 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3424 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3425 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3426 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3427 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3428 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3429 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3430 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3431 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3432 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3433 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3434 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3435 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3436 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3437 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3438 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3439 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3440 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3443 .name = "Channel Mode",
3444 .info = alc_ch_mode_info,
3445 .get = alc_ch_mode_get,
3446 .put = alc_ch_mode_put,
3451 static struct hda_verb alc880_test_init_verbs[] = {
3452 /* Unmute inputs of 0x0c - 0x0f */
3453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3455 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3457 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3459 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3460 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3461 /* Vol output for 0x0c-0x0f */
3462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3466 /* Set output pins 0x14-0x17 */
3467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3469 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3470 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3471 /* Unmute output pins 0x14-0x17 */
3472 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3473 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3474 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3475 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3476 /* Set input pins 0x18-0x1c */
3477 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3478 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3479 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3480 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3481 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3482 /* Mute input pins 0x18-0x1b */
3483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3484 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3485 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3486 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3489 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3491 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3493 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3494 /* Analog input/passthru */
3495 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3496 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3497 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3498 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3499 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3507 static const char *alc880_models[ALC880_MODEL_LAST] = {
3508 [ALC880_3ST] = "3stack",
3509 [ALC880_TCL_S700] = "tcl",
3510 [ALC880_3ST_DIG] = "3stack-digout",
3511 [ALC880_CLEVO] = "clevo",
3512 [ALC880_5ST] = "5stack",
3513 [ALC880_5ST_DIG] = "5stack-digout",
3514 [ALC880_W810] = "w810",
3515 [ALC880_Z71V] = "z71v",
3516 [ALC880_6ST] = "6stack",
3517 [ALC880_6ST_DIG] = "6stack-digout",
3518 [ALC880_ASUS] = "asus",
3519 [ALC880_ASUS_W1V] = "asus-w1v",
3520 [ALC880_ASUS_DIG] = "asus-dig",
3521 [ALC880_ASUS_DIG2] = "asus-dig2",
3522 [ALC880_UNIWILL_DIG] = "uniwill",
3523 [ALC880_UNIWILL_P53] = "uniwill-p53",
3524 [ALC880_FUJITSU] = "fujitsu",
3525 [ALC880_F1734] = "F1734",
3527 [ALC880_LG_LW] = "lg-lw",
3528 [ALC880_MEDION_RIM] = "medion",
3529 #ifdef CONFIG_SND_DEBUG
3530 [ALC880_TEST] = "test",
3532 [ALC880_AUTO] = "auto",
3535 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3536 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3537 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3538 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3539 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3540 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3541 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3542 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3543 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3544 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3545 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3546 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3547 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3548 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3549 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3550 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3551 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3552 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3553 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3554 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3555 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3556 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3557 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3558 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3559 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3560 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3561 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3562 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3563 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3564 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3565 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3566 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3567 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3568 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3569 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3570 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3571 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3572 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3573 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3574 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3575 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3576 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3577 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3578 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3579 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3580 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3581 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3582 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3583 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3584 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3585 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3586 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3587 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3588 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3589 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3590 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3591 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3592 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3593 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3594 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3595 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3596 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3597 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3598 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3599 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3600 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3601 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3602 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3603 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3604 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3605 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3606 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3611 * ALC880 codec presets
3613 static struct alc_config_preset alc880_presets[] = {
3615 .mixers = { alc880_three_stack_mixer },
3616 .init_verbs = { alc880_volume_init_verbs,
3617 alc880_pin_3stack_init_verbs },
3618 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3619 .dac_nids = alc880_dac_nids,
3620 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3621 .channel_mode = alc880_threestack_modes,
3623 .input_mux = &alc880_capture_source,
3625 [ALC880_3ST_DIG] = {
3626 .mixers = { alc880_three_stack_mixer },
3627 .init_verbs = { alc880_volume_init_verbs,
3628 alc880_pin_3stack_init_verbs },
3629 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3630 .dac_nids = alc880_dac_nids,
3631 .dig_out_nid = ALC880_DIGOUT_NID,
3632 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3633 .channel_mode = alc880_threestack_modes,
3635 .input_mux = &alc880_capture_source,
3637 [ALC880_TCL_S700] = {
3638 .mixers = { alc880_tcl_s700_mixer },
3639 .init_verbs = { alc880_volume_init_verbs,
3640 alc880_pin_tcl_S700_init_verbs,
3641 alc880_gpio2_init_verbs },
3642 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3643 .dac_nids = alc880_dac_nids,
3644 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3645 .num_adc_nids = 1, /* single ADC */
3647 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3648 .channel_mode = alc880_2_jack_modes,
3649 .input_mux = &alc880_capture_source,
3652 .mixers = { alc880_three_stack_mixer,
3653 alc880_five_stack_mixer},
3654 .init_verbs = { alc880_volume_init_verbs,
3655 alc880_pin_5stack_init_verbs },
3656 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3657 .dac_nids = alc880_dac_nids,
3658 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3659 .channel_mode = alc880_fivestack_modes,
3660 .input_mux = &alc880_capture_source,
3662 [ALC880_5ST_DIG] = {
3663 .mixers = { alc880_three_stack_mixer,
3664 alc880_five_stack_mixer },
3665 .init_verbs = { alc880_volume_init_verbs,
3666 alc880_pin_5stack_init_verbs },
3667 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3668 .dac_nids = alc880_dac_nids,
3669 .dig_out_nid = ALC880_DIGOUT_NID,
3670 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3671 .channel_mode = alc880_fivestack_modes,
3672 .input_mux = &alc880_capture_source,
3675 .mixers = { alc880_six_stack_mixer },
3676 .init_verbs = { alc880_volume_init_verbs,
3677 alc880_pin_6stack_init_verbs },
3678 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3679 .dac_nids = alc880_6st_dac_nids,
3680 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3681 .channel_mode = alc880_sixstack_modes,
3682 .input_mux = &alc880_6stack_capture_source,
3684 [ALC880_6ST_DIG] = {
3685 .mixers = { alc880_six_stack_mixer },
3686 .init_verbs = { alc880_volume_init_verbs,
3687 alc880_pin_6stack_init_verbs },
3688 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3689 .dac_nids = alc880_6st_dac_nids,
3690 .dig_out_nid = ALC880_DIGOUT_NID,
3691 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3692 .channel_mode = alc880_sixstack_modes,
3693 .input_mux = &alc880_6stack_capture_source,
3696 .mixers = { alc880_w810_base_mixer },
3697 .init_verbs = { alc880_volume_init_verbs,
3698 alc880_pin_w810_init_verbs,
3699 alc880_gpio2_init_verbs },
3700 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3701 .dac_nids = alc880_w810_dac_nids,
3702 .dig_out_nid = ALC880_DIGOUT_NID,
3703 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3704 .channel_mode = alc880_w810_modes,
3705 .input_mux = &alc880_capture_source,
3708 .mixers = { alc880_z71v_mixer },
3709 .init_verbs = { alc880_volume_init_verbs,
3710 alc880_pin_z71v_init_verbs },
3711 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3712 .dac_nids = alc880_z71v_dac_nids,
3713 .dig_out_nid = ALC880_DIGOUT_NID,
3715 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3716 .channel_mode = alc880_2_jack_modes,
3717 .input_mux = &alc880_capture_source,
3720 .mixers = { alc880_f1734_mixer },
3721 .init_verbs = { alc880_volume_init_verbs,
3722 alc880_pin_f1734_init_verbs },
3723 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3724 .dac_nids = alc880_f1734_dac_nids,
3726 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3727 .channel_mode = alc880_2_jack_modes,
3728 .input_mux = &alc880_f1734_capture_source,
3729 .unsol_event = alc880_uniwill_p53_unsol_event,
3730 .init_hook = alc880_uniwill_p53_hp_automute,
3733 .mixers = { alc880_asus_mixer },
3734 .init_verbs = { alc880_volume_init_verbs,
3735 alc880_pin_asus_init_verbs,
3736 alc880_gpio1_init_verbs },
3737 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3738 .dac_nids = alc880_asus_dac_nids,
3739 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3740 .channel_mode = alc880_asus_modes,
3742 .input_mux = &alc880_capture_source,
3744 [ALC880_ASUS_DIG] = {
3745 .mixers = { alc880_asus_mixer },
3746 .init_verbs = { alc880_volume_init_verbs,
3747 alc880_pin_asus_init_verbs,
3748 alc880_gpio1_init_verbs },
3749 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3750 .dac_nids = alc880_asus_dac_nids,
3751 .dig_out_nid = ALC880_DIGOUT_NID,
3752 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3753 .channel_mode = alc880_asus_modes,
3755 .input_mux = &alc880_capture_source,
3757 [ALC880_ASUS_DIG2] = {
3758 .mixers = { alc880_asus_mixer },
3759 .init_verbs = { alc880_volume_init_verbs,
3760 alc880_pin_asus_init_verbs,
3761 alc880_gpio2_init_verbs }, /* use GPIO2 */
3762 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3763 .dac_nids = alc880_asus_dac_nids,
3764 .dig_out_nid = ALC880_DIGOUT_NID,
3765 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3766 .channel_mode = alc880_asus_modes,
3768 .input_mux = &alc880_capture_source,
3770 [ALC880_ASUS_W1V] = {
3771 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3772 .init_verbs = { alc880_volume_init_verbs,
3773 alc880_pin_asus_init_verbs,
3774 alc880_gpio1_init_verbs },
3775 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3776 .dac_nids = alc880_asus_dac_nids,
3777 .dig_out_nid = ALC880_DIGOUT_NID,
3778 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3779 .channel_mode = alc880_asus_modes,
3781 .input_mux = &alc880_capture_source,
3783 [ALC880_UNIWILL_DIG] = {
3784 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3785 .init_verbs = { alc880_volume_init_verbs,
3786 alc880_pin_asus_init_verbs },
3787 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3788 .dac_nids = alc880_asus_dac_nids,
3789 .dig_out_nid = ALC880_DIGOUT_NID,
3790 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3791 .channel_mode = alc880_asus_modes,
3793 .input_mux = &alc880_capture_source,
3795 [ALC880_UNIWILL] = {
3796 .mixers = { alc880_uniwill_mixer },
3797 .init_verbs = { alc880_volume_init_verbs,
3798 alc880_uniwill_init_verbs },
3799 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3800 .dac_nids = alc880_asus_dac_nids,
3801 .dig_out_nid = ALC880_DIGOUT_NID,
3802 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3803 .channel_mode = alc880_threestack_modes,
3805 .input_mux = &alc880_capture_source,
3806 .unsol_event = alc880_uniwill_unsol_event,
3807 .init_hook = alc880_uniwill_automute,
3809 [ALC880_UNIWILL_P53] = {
3810 .mixers = { alc880_uniwill_p53_mixer },
3811 .init_verbs = { alc880_volume_init_verbs,
3812 alc880_uniwill_p53_init_verbs },
3813 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3814 .dac_nids = alc880_asus_dac_nids,
3815 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3816 .channel_mode = alc880_threestack_modes,
3817 .input_mux = &alc880_capture_source,
3818 .unsol_event = alc880_uniwill_p53_unsol_event,
3819 .init_hook = alc880_uniwill_p53_hp_automute,
3821 [ALC880_FUJITSU] = {
3822 .mixers = { alc880_fujitsu_mixer,
3823 alc880_pcbeep_mixer, },
3824 .init_verbs = { alc880_volume_init_verbs,
3825 alc880_uniwill_p53_init_verbs,
3826 alc880_beep_init_verbs },
3827 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3828 .dac_nids = alc880_dac_nids,
3829 .dig_out_nid = ALC880_DIGOUT_NID,
3830 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3831 .channel_mode = alc880_2_jack_modes,
3832 .input_mux = &alc880_capture_source,
3833 .unsol_event = alc880_uniwill_p53_unsol_event,
3834 .init_hook = alc880_uniwill_p53_hp_automute,
3837 .mixers = { alc880_three_stack_mixer },
3838 .init_verbs = { alc880_volume_init_verbs,
3839 alc880_pin_clevo_init_verbs },
3840 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3841 .dac_nids = alc880_dac_nids,
3843 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3844 .channel_mode = alc880_threestack_modes,
3846 .input_mux = &alc880_capture_source,
3849 .mixers = { alc880_lg_mixer },
3850 .init_verbs = { alc880_volume_init_verbs,
3851 alc880_lg_init_verbs },
3852 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3853 .dac_nids = alc880_lg_dac_nids,
3854 .dig_out_nid = ALC880_DIGOUT_NID,
3855 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3856 .channel_mode = alc880_lg_ch_modes,
3858 .input_mux = &alc880_lg_capture_source,
3859 .unsol_event = alc880_lg_unsol_event,
3860 .init_hook = alc880_lg_automute,
3861 #ifdef CONFIG_SND_HDA_POWER_SAVE
3862 .loopbacks = alc880_lg_loopbacks,
3866 .mixers = { alc880_lg_lw_mixer },
3867 .init_verbs = { alc880_volume_init_verbs,
3868 alc880_lg_lw_init_verbs },
3869 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3870 .dac_nids = alc880_dac_nids,
3871 .dig_out_nid = ALC880_DIGOUT_NID,
3872 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3873 .channel_mode = alc880_lg_lw_modes,
3874 .input_mux = &alc880_lg_lw_capture_source,
3875 .unsol_event = alc880_lg_lw_unsol_event,
3876 .init_hook = alc880_lg_lw_automute,
3878 [ALC880_MEDION_RIM] = {
3879 .mixers = { alc880_medion_rim_mixer },
3880 .init_verbs = { alc880_volume_init_verbs,
3881 alc880_medion_rim_init_verbs,
3882 alc_gpio2_init_verbs },
3883 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3884 .dac_nids = alc880_dac_nids,
3885 .dig_out_nid = ALC880_DIGOUT_NID,
3886 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3887 .channel_mode = alc880_2_jack_modes,
3888 .input_mux = &alc880_medion_rim_capture_source,
3889 .unsol_event = alc880_medion_rim_unsol_event,
3890 .init_hook = alc880_medion_rim_automute,
3892 #ifdef CONFIG_SND_DEBUG
3894 .mixers = { alc880_test_mixer },
3895 .init_verbs = { alc880_test_init_verbs },
3896 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3897 .dac_nids = alc880_test_dac_nids,
3898 .dig_out_nid = ALC880_DIGOUT_NID,
3899 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3900 .channel_mode = alc880_test_modes,
3901 .input_mux = &alc880_test_capture_source,
3907 * Automatic parse of I/O pins from the BIOS configuration
3912 ALC_CTL_WIDGET_MUTE,
3915 static struct snd_kcontrol_new alc880_control_templates[] = {
3916 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3917 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3918 HDA_BIND_MUTE(NULL, 0, 0, 0),
3921 /* add dynamic controls */
3922 static int add_control(struct alc_spec *spec, int type, const char *name,
3925 struct snd_kcontrol_new *knew;
3927 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3928 knew = snd_array_new(&spec->kctls);
3931 *knew = alc880_control_templates[type];
3932 knew->name = kstrdup(name, GFP_KERNEL);
3935 knew->private_value = val;
3939 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3940 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3941 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3942 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3943 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3944 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3945 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3946 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3947 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3948 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3949 #define ALC880_PIN_CD_NID 0x1c
3951 /* fill in the dac_nids table from the parsed pin configuration */
3952 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3953 const struct auto_pin_cfg *cfg)
3959 memset(assigned, 0, sizeof(assigned));
3960 spec->multiout.dac_nids = spec->private_dac_nids;
3962 /* check the pins hardwired to audio widget */
3963 for (i = 0; i < cfg->line_outs; i++) {
3964 nid = cfg->line_out_pins[i];
3965 if (alc880_is_fixed_pin(nid)) {
3966 int idx = alc880_fixed_pin_idx(nid);
3967 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3971 /* left pins can be connect to any audio widget */
3972 for (i = 0; i < cfg->line_outs; i++) {
3973 nid = cfg->line_out_pins[i];
3974 if (alc880_is_fixed_pin(nid))
3976 /* search for an empty channel */
3977 for (j = 0; j < cfg->line_outs; j++) {
3979 spec->multiout.dac_nids[i] =
3980 alc880_idx_to_dac(j);
3986 spec->multiout.num_dacs = cfg->line_outs;
3990 /* add playback controls from the parsed DAC table */
3991 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3992 const struct auto_pin_cfg *cfg)
3995 static const char *chname[4] = {
3996 "Front", "Surround", NULL /*CLFE*/, "Side"
4001 for (i = 0; i < cfg->line_outs; i++) {
4002 if (!spec->multiout.dac_nids[i])
4004 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4007 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4008 "Center Playback Volume",
4009 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4013 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4014 "LFE Playback Volume",
4015 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4019 err = add_control(spec, ALC_CTL_BIND_MUTE,
4020 "Center Playback Switch",
4021 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4025 err = add_control(spec, ALC_CTL_BIND_MUTE,
4026 "LFE Playback Switch",
4027 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4032 sprintf(name, "%s Playback Volume", chname[i]);
4033 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4034 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4038 sprintf(name, "%s Playback Switch", chname[i]);
4039 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4040 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4049 /* add playback controls for speaker and HP outputs */
4050 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4060 if (alc880_is_fixed_pin(pin)) {
4061 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4062 /* specify the DAC as the extra output */
4063 if (!spec->multiout.hp_nid)
4064 spec->multiout.hp_nid = nid;
4066 spec->multiout.extra_out_nid[0] = nid;
4067 /* control HP volume/switch on the output mixer amp */
4068 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4069 sprintf(name, "%s Playback Volume", pfx);
4070 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4071 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4074 sprintf(name, "%s Playback Switch", pfx);
4075 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4076 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4079 } else if (alc880_is_multi_pin(pin)) {
4080 /* set manual connection */
4081 /* we have only a switch on HP-out PIN */
4082 sprintf(name, "%s Playback Switch", pfx);
4083 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4084 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4091 /* create input playback/capture controls for the given pin */
4092 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4093 const char *ctlname,
4094 int idx, hda_nid_t mix_nid)
4099 sprintf(name, "%s Playback Volume", ctlname);
4100 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4101 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4104 sprintf(name, "%s Playback Switch", ctlname);
4105 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4106 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4112 /* create playback/capture controls for input pins */
4113 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4114 const struct auto_pin_cfg *cfg)
4116 struct hda_input_mux *imux = &spec->private_imux;
4119 for (i = 0; i < AUTO_PIN_LAST; i++) {
4120 if (alc880_is_input_pin(cfg->input_pins[i])) {
4121 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4122 err = new_analog_input(spec, cfg->input_pins[i],
4123 auto_pin_cfg_labels[i],
4127 imux->items[imux->num_items].label =
4128 auto_pin_cfg_labels[i];
4129 imux->items[imux->num_items].index =
4130 alc880_input_pin_idx(cfg->input_pins[i]);
4137 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4138 unsigned int pin_type)
4140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4143 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4147 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4148 hda_nid_t nid, int pin_type,
4151 alc_set_pin_output(codec, nid, pin_type);
4152 /* need the manual connection? */
4153 if (alc880_is_multi_pin(nid)) {
4154 struct alc_spec *spec = codec->spec;
4155 int idx = alc880_multi_pin_idx(nid);
4156 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4157 AC_VERB_SET_CONNECT_SEL,
4158 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4162 static int get_pin_type(int line_out_type)
4164 if (line_out_type == AUTO_PIN_HP_OUT)
4170 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4172 struct alc_spec *spec = codec->spec;
4175 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4176 for (i = 0; i < spec->autocfg.line_outs; i++) {
4177 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4178 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4179 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4183 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4185 struct alc_spec *spec = codec->spec;
4188 pin = spec->autocfg.speaker_pins[0];
4189 if (pin) /* connect to front */
4190 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4191 pin = spec->autocfg.hp_pins[0];
4192 if (pin) /* connect to front */
4193 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4196 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4198 struct alc_spec *spec = codec->spec;
4201 for (i = 0; i < AUTO_PIN_LAST; i++) {
4202 hda_nid_t nid = spec->autocfg.input_pins[i];
4203 if (alc880_is_input_pin(nid)) {
4204 snd_hda_codec_write(codec, nid, 0,
4205 AC_VERB_SET_PIN_WIDGET_CONTROL,
4206 i <= AUTO_PIN_FRONT_MIC ?
4207 PIN_VREF80 : PIN_IN);
4208 if (nid != ALC880_PIN_CD_NID)
4209 snd_hda_codec_write(codec, nid, 0,
4210 AC_VERB_SET_AMP_GAIN_MUTE,
4216 /* parse the BIOS configuration and set up the alc_spec */
4217 /* return 1 if successful, 0 if the proper config is not found,
4218 * or a negative error code
4220 static int alc880_parse_auto_config(struct hda_codec *codec)
4222 struct alc_spec *spec = codec->spec;
4224 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4226 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4230 if (!spec->autocfg.line_outs)
4231 return 0; /* can't find valid BIOS pin config */
4233 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4236 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4239 err = alc880_auto_create_extra_out(spec,
4240 spec->autocfg.speaker_pins[0],
4244 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4248 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4252 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4254 if (spec->autocfg.dig_out_pin)
4255 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4256 if (spec->autocfg.dig_in_pin)
4257 spec->dig_in_nid = ALC880_DIGIN_NID;
4259 if (spec->kctls.list)
4260 add_mixer(spec, spec->kctls.list);
4262 add_verb(spec, alc880_volume_init_verbs);
4264 spec->num_mux_defs = 1;
4265 spec->input_mux = &spec->private_imux;
4267 store_pin_configs(codec);
4271 /* additional initialization for auto-configuration model */
4272 static void alc880_auto_init(struct hda_codec *codec)
4274 struct alc_spec *spec = codec->spec;
4275 alc880_auto_init_multi_out(codec);
4276 alc880_auto_init_extra_out(codec);
4277 alc880_auto_init_analog_input(codec);
4278 if (spec->unsol_event)
4279 alc_inithook(codec);
4283 * OK, here we have finally the patch for ALC880
4286 static void set_capture_mixer(struct alc_spec *spec)
4288 static struct snd_kcontrol_new *caps[3] = {
4293 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
4294 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4297 static int patch_alc880(struct hda_codec *codec)
4299 struct alc_spec *spec;
4303 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4309 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4312 if (board_config < 0) {
4313 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4314 "trying auto-probe from BIOS...\n");
4315 board_config = ALC880_AUTO;
4318 if (board_config == ALC880_AUTO) {
4319 /* automatic parse from the BIOS config */
4320 err = alc880_parse_auto_config(codec);
4326 "hda_codec: Cannot set up configuration "
4327 "from BIOS. Using 3-stack mode...\n");
4328 board_config = ALC880_3ST;
4332 if (board_config != ALC880_AUTO)
4333 setup_preset(spec, &alc880_presets[board_config]);
4335 spec->stream_name_analog = "ALC880 Analog";
4336 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4337 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4338 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4340 spec->stream_name_digital = "ALC880 Digital";
4341 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4342 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4344 if (!spec->adc_nids && spec->input_mux) {
4345 /* check whether NID 0x07 is valid */
4346 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4348 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4349 if (wcap != AC_WID_AUD_IN) {
4350 spec->adc_nids = alc880_adc_nids_alt;
4351 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4353 spec->adc_nids = alc880_adc_nids;
4354 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4357 set_capture_mixer(spec);
4359 spec->vmaster_nid = 0x0c;
4361 codec->patch_ops = alc_patch_ops;
4362 if (board_config == ALC880_AUTO)
4363 spec->init_hook = alc880_auto_init;
4364 #ifdef CONFIG_SND_HDA_POWER_SAVE
4365 if (!spec->loopback.amplist)
4366 spec->loopback.amplist = alc880_loopbacks;
4368 codec->proc_widget_hook = print_realtek_coef;
4378 static hda_nid_t alc260_dac_nids[1] = {
4383 static hda_nid_t alc260_adc_nids[1] = {
4388 static hda_nid_t alc260_adc_nids_alt[1] = {
4393 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4394 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4396 static hda_nid_t alc260_dual_adc_nids[2] = {
4401 #define ALC260_DIGOUT_NID 0x03
4402 #define ALC260_DIGIN_NID 0x06
4404 static struct hda_input_mux alc260_capture_source = {
4408 { "Front Mic", 0x1 },
4414 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4415 * headphone jack and the internal CD lines since these are the only pins at
4416 * which audio can appear. For flexibility, also allow the option of
4417 * recording the mixer output on the second ADC (ADC0 doesn't have a
4418 * connection to the mixer output).
4420 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4424 { "Mic/Line", 0x0 },
4426 { "Headphone", 0x2 },
4432 { "Mic/Line", 0x0 },
4434 { "Headphone", 0x2 },
4441 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4442 * the Fujitsu S702x, but jacks are marked differently.
4444 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4451 { "Headphone", 0x5 },
4460 { "Headphone", 0x6 },
4466 * This is just place-holder, so there's something for alc_build_pcms to look
4467 * at when it calculates the maximum number of channels. ALC260 has no mixer
4468 * element which allows changing the channel mode, so the verb list is
4471 static struct hda_channel_mode alc260_modes[1] = {
4476 /* Mixer combinations
4478 * basic: base_output + input + pc_beep + capture
4479 * HP: base_output + input + capture_alt
4480 * HP_3013: hp_3013 + input + capture
4481 * fujitsu: fujitsu + capture
4482 * acer: acer + capture
4485 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4486 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4487 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4488 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4489 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4490 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4491 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4495 static struct snd_kcontrol_new alc260_input_mixer[] = {
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("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4499 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4501 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4502 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4503 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4507 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4508 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4509 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4513 /* update HP, line and mono out pins according to the master switch */
4514 static void alc260_hp_master_update(struct hda_codec *codec,
4515 hda_nid_t hp, hda_nid_t line,
4518 struct alc_spec *spec = codec->spec;
4519 unsigned int val = spec->master_sw ? PIN_HP : 0;
4520 /* change HP and line-out pins */
4521 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4523 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4525 /* mono (speaker) depending on the HP jack sense */
4526 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4527 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4531 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4532 struct snd_ctl_elem_value *ucontrol)
4534 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4535 struct alc_spec *spec = codec->spec;
4536 *ucontrol->value.integer.value = spec->master_sw;
4540 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4541 struct snd_ctl_elem_value *ucontrol)
4543 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4544 struct alc_spec *spec = codec->spec;
4545 int val = !!*ucontrol->value.integer.value;
4546 hda_nid_t hp, line, mono;
4548 if (val == spec->master_sw)
4550 spec->master_sw = val;
4551 hp = (kcontrol->private_value >> 16) & 0xff;
4552 line = (kcontrol->private_value >> 8) & 0xff;
4553 mono = kcontrol->private_value & 0xff;
4554 alc260_hp_master_update(codec, hp, line, mono);
4558 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4561 .name = "Master Playback Switch",
4562 .info = snd_ctl_boolean_mono_info,
4563 .get = alc260_hp_master_sw_get,
4564 .put = alc260_hp_master_sw_put,
4565 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4567 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4568 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4569 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4570 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4571 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4573 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4577 static struct hda_verb alc260_hp_unsol_verbs[] = {
4578 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4582 static void alc260_hp_automute(struct hda_codec *codec)
4584 struct alc_spec *spec = codec->spec;
4585 unsigned int present;
4587 present = snd_hda_codec_read(codec, 0x10, 0,
4588 AC_VERB_GET_PIN_SENSE, 0);
4589 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4590 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4593 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4595 if ((res >> 26) == ALC880_HP_EVENT)
4596 alc260_hp_automute(codec);
4599 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4601 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4602 .name = "Master Playback Switch",
4603 .info = snd_ctl_boolean_mono_info,
4604 .get = alc260_hp_master_sw_get,
4605 .put = alc260_hp_master_sw_put,
4606 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4608 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4609 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4610 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4611 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4612 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4614 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4615 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4619 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4620 .ops = &snd_hda_bind_vol,
4622 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4623 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4624 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4629 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4630 .ops = &snd_hda_bind_sw,
4632 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4633 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4638 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4639 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4640 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4641 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4642 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4646 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4647 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4651 static void alc260_hp_3013_automute(struct hda_codec *codec)
4653 struct alc_spec *spec = codec->spec;
4654 unsigned int present;
4656 present = snd_hda_codec_read(codec, 0x15, 0,
4657 AC_VERB_GET_PIN_SENSE, 0);
4658 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4659 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4662 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4665 if ((res >> 26) == ALC880_HP_EVENT)
4666 alc260_hp_3013_automute(codec);
4669 static void alc260_hp_3012_automute(struct hda_codec *codec)
4671 unsigned int present, bits;
4673 present = snd_hda_codec_read(codec, 0x10, 0,
4674 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4676 bits = present ? 0 : PIN_OUT;
4677 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4679 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4681 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4685 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4688 if ((res >> 26) == ALC880_HP_EVENT)
4689 alc260_hp_3012_automute(codec);
4692 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4693 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4695 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4696 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4697 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4698 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4699 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4700 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4701 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4702 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4703 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4704 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4705 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4706 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4707 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4711 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4712 * versions of the ALC260 don't act on requests to enable mic bias from NID
4713 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4714 * datasheet doesn't mention this restriction. At this stage it's not clear
4715 * whether this behaviour is intentional or is a hardware bug in chip
4716 * revisions available in early 2006. Therefore for now allow the
4717 * "Headphone Jack Mode" control to span all choices, but if it turns out
4718 * that the lack of mic bias for this NID is intentional we could change the
4719 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4721 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4722 * don't appear to make the mic bias available from the "line" jack, even
4723 * though the NID used for this jack (0x14) can supply it. The theory is
4724 * that perhaps Acer have included blocking capacitors between the ALC260
4725 * and the output jack. If this turns out to be the case for all such
4726 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4727 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4729 * The C20x Tablet series have a mono internal speaker which is controlled
4730 * via the chip's Mono sum widget and pin complex, so include the necessary
4731 * controls for such models. On models without a "mono speaker" the control
4732 * won't do anything.
4734 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4735 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4736 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4737 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4738 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4740 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4742 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4743 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4745 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4746 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4747 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4748 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4749 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4750 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4751 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4755 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4756 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4758 static struct snd_kcontrol_new alc260_will_mixer[] = {
4759 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4760 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4762 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4763 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4764 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4765 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4766 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4767 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4768 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4769 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4770 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4774 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4775 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4777 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4778 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4779 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4780 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4781 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4782 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4783 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4784 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4785 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4786 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4787 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4792 * initialization verbs
4794 static struct hda_verb alc260_init_verbs[] = {
4795 /* Line In pin widget for input */
4796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4797 /* CD pin widget for input */
4798 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4799 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4800 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4801 /* Mic2 (front panel) pin widget for input and vref at 80% */
4802 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4803 /* LINE-2 is used for line-out in rear */
4804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4805 /* select line-out */
4806 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4808 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4810 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4812 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4813 /* mute capture amp left and right */
4814 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4815 /* set connection select to line in (default select for this ADC) */
4816 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4817 /* mute capture amp left and right */
4818 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4819 /* set connection select to line in (default select for this ADC) */
4820 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4821 /* set vol=0 Line-Out mixer amp left and right */
4822 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4823 /* unmute pin widget amp left and right (no gain on this amp) */
4824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4825 /* set vol=0 HP mixer amp left and right */
4826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4827 /* unmute pin widget amp left and right (no gain on this amp) */
4828 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4829 /* set vol=0 Mono mixer amp left and right */
4830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4831 /* unmute pin widget amp left and right (no gain on this amp) */
4832 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4833 /* unmute LINE-2 out pin */
4834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4835 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4838 /* mute analog inputs */
4839 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4840 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4844 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4845 /* mute Front out path */
4846 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4847 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4848 /* mute Headphone out path */
4849 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4850 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4851 /* mute Mono out path */
4852 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4853 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4857 #if 0 /* should be identical with alc260_init_verbs? */
4858 static struct hda_verb alc260_hp_init_verbs[] = {
4859 /* Headphone and output */
4860 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4862 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4863 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4864 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4865 /* Mic2 (front panel) pin widget for input and vref at 80% */
4866 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4867 /* Line In pin widget for input */
4868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4869 /* Line-2 pin widget for output */
4870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4871 /* CD pin widget for input */
4872 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4873 /* unmute amp left and right */
4874 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4875 /* set connection select to line in (default select for this ADC) */
4876 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4877 /* unmute Line-Out mixer amp left and right (volume = 0) */
4878 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4879 /* mute pin widget amp left and right (no gain on this amp) */
4880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4881 /* unmute HP mixer amp left and right (volume = 0) */
4882 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4883 /* mute pin widget amp left and right (no gain on this amp) */
4884 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4885 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4888 /* mute analog inputs */
4889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4890 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4891 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4893 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4894 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4895 /* Unmute Front out path */
4896 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4898 /* Unmute Headphone out path */
4899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4900 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4901 /* Unmute Mono out path */
4902 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4903 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4908 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4909 /* Line out and output */
4910 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4912 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4913 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4914 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4915 /* Mic2 (front panel) pin widget for input and vref at 80% */
4916 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4917 /* Line In pin widget for input */
4918 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4919 /* Headphone pin widget for output */
4920 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4921 /* CD pin widget for input */
4922 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4923 /* unmute amp left and right */
4924 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4925 /* set connection select to line in (default select for this ADC) */
4926 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4927 /* unmute Line-Out mixer amp left and right (volume = 0) */
4928 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4929 /* mute pin widget amp left and right (no gain on this amp) */
4930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4931 /* unmute HP mixer amp left and right (volume = 0) */
4932 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4933 /* mute pin widget amp left and right (no gain on this amp) */
4934 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4935 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4938 /* mute analog inputs */
4939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4944 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4945 /* Unmute Front out path */
4946 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4947 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4948 /* Unmute Headphone out path */
4949 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4950 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4951 /* Unmute Mono out path */
4952 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4953 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4957 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4958 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4959 * audio = 0x16, internal speaker = 0x10.
4961 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4962 /* Disable all GPIOs */
4963 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4964 /* Internal speaker is connected to headphone pin */
4965 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4966 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4967 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4968 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4969 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4970 /* Ensure all other unused pins are disabled and muted. */
4971 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4972 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4973 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4974 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4975 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4976 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4978 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4980 /* Disable digital (SPDIF) pins */
4981 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4982 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4984 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4985 * when acting as an output.
4987 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4989 /* Start with output sum widgets muted and their output gains at min */
4990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4991 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4992 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4993 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4995 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4996 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4997 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4998 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5000 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5001 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5002 /* Unmute Line1 pin widget output buffer since it starts as an output.
5003 * If the pin mode is changed by the user the pin mode control will
5004 * take care of enabling the pin's input/output buffers as needed.
5005 * Therefore there's no need to enable the input buffer at this
5008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5009 /* Unmute input buffer of pin widget used for Line-in (no equiv
5012 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5014 /* Mute capture amp left and right */
5015 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5016 /* Set ADC connection select to match default mixer setting - line
5019 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5021 /* Do the same for the second ADC: mute capture input amp and
5022 * set ADC connection to line in (on mic1 pin)
5024 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5025 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5027 /* Mute all inputs to mixer widget (even unconnected ones) */
5028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5034 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5035 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5040 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5041 * similar laptops (adapted from Fujitsu init verbs).
5043 static struct hda_verb alc260_acer_init_verbs[] = {
5044 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5045 * the headphone jack. Turn this on and rely on the standard mute
5046 * methods whenever the user wants to turn these outputs off.
5048 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5049 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5050 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5051 /* Internal speaker/Headphone jack is connected to Line-out pin */
5052 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5053 /* Internal microphone/Mic jack is connected to Mic1 pin */
5054 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5055 /* Line In jack is connected to Line1 pin */
5056 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5057 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5058 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5059 /* Ensure all other unused pins are disabled and muted. */
5060 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5061 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5062 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5063 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5066 /* Disable digital (SPDIF) pins */
5067 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5068 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5070 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5071 * bus when acting as outputs.
5073 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5074 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5076 /* Start with output sum widgets muted and their output gains at min */
5077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5078 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5079 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5080 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5081 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5083 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5084 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5085 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5087 /* Unmute Line-out pin widget amp left and right
5088 * (no equiv mixer ctrl)
5090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5091 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5092 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5093 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5094 * inputs. If the pin mode is changed by the user the pin mode control
5095 * will take care of enabling the pin's input/output buffers as needed.
5096 * Therefore there's no need to enable the input buffer at this
5099 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5100 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5102 /* Mute capture amp left and right */
5103 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5104 /* Set ADC connection select to match default mixer setting - mic
5107 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5109 /* Do similar with the second ADC: mute capture input amp and
5110 * set ADC connection to mic to match ALSA's default state.
5112 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5113 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5115 /* Mute all inputs to mixer widget (even unconnected ones) */
5116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5123 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5128 static struct hda_verb alc260_will_verbs[] = {
5129 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5130 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5131 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5132 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5133 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5134 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5138 static struct hda_verb alc260_replacer_672v_verbs[] = {
5139 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5140 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5141 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5143 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5144 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5145 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5147 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5151 /* toggle speaker-output according to the hp-jack state */
5152 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5154 unsigned int present;
5156 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5157 present = snd_hda_codec_read(codec, 0x0f, 0,
5158 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5160 snd_hda_codec_write_cache(codec, 0x01, 0,
5161 AC_VERB_SET_GPIO_DATA, 1);
5162 snd_hda_codec_write_cache(codec, 0x0f, 0,
5163 AC_VERB_SET_PIN_WIDGET_CONTROL,
5166 snd_hda_codec_write_cache(codec, 0x01, 0,
5167 AC_VERB_SET_GPIO_DATA, 0);
5168 snd_hda_codec_write_cache(codec, 0x0f, 0,
5169 AC_VERB_SET_PIN_WIDGET_CONTROL,
5174 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5177 if ((res >> 26) == ALC880_HP_EVENT)
5178 alc260_replacer_672v_automute(codec);
5181 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5182 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5183 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5184 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5185 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5186 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5187 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5188 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5189 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5190 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5191 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5195 /* Test configuration for debugging, modelled after the ALC880 test
5198 #ifdef CONFIG_SND_DEBUG
5199 static hda_nid_t alc260_test_dac_nids[1] = {
5202 static hda_nid_t alc260_test_adc_nids[2] = {
5205 /* For testing the ALC260, each input MUX needs its own definition since
5206 * the signal assignments are different. This assumes that the first ADC
5209 static struct hda_input_mux alc260_test_capture_sources[2] = {
5213 { "MIC1 pin", 0x0 },
5214 { "MIC2 pin", 0x1 },
5215 { "LINE1 pin", 0x2 },
5216 { "LINE2 pin", 0x3 },
5218 { "LINE-OUT pin", 0x5 },
5219 { "HP-OUT pin", 0x6 },
5225 { "MIC1 pin", 0x0 },
5226 { "MIC2 pin", 0x1 },
5227 { "LINE1 pin", 0x2 },
5228 { "LINE2 pin", 0x3 },
5231 { "LINE-OUT pin", 0x6 },
5232 { "HP-OUT pin", 0x7 },
5236 static struct snd_kcontrol_new alc260_test_mixer[] = {
5237 /* Output driver widgets */
5238 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5239 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5240 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5241 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5242 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5243 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5245 /* Modes for retasking pin widgets
5246 * Note: the ALC260 doesn't seem to act on requests to enable mic
5247 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5248 * mention this restriction. At this stage it's not clear whether
5249 * this behaviour is intentional or is a hardware bug in chip
5250 * revisions available at least up until early 2006. Therefore for
5251 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5252 * choices, but if it turns out that the lack of mic bias for these
5253 * NIDs is intentional we could change their modes from
5254 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5256 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5257 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5258 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5259 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5260 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5261 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5263 /* Loopback mixer controls */
5264 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5265 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5266 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5267 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5268 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5269 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5270 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5271 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5272 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5273 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5274 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5275 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5276 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5277 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5278 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5279 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5281 /* Controls for GPIO pins, assuming they are configured as outputs */
5282 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5283 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5284 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5285 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5287 /* Switches to allow the digital IO pins to be enabled. The datasheet
5288 * is ambigious as to which NID is which; testing on laptops which
5289 * make this output available should provide clarification.
5291 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5292 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5294 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5295 * this output to turn on an external amplifier.
5297 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5298 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5302 static struct hda_verb alc260_test_init_verbs[] = {
5303 /* Enable all GPIOs as outputs with an initial value of 0 */
5304 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5305 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5306 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5308 /* Enable retasking pins as output, initially without power amp */
5309 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5310 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5311 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5313 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5314 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5316 /* Disable digital (SPDIF) pins initially, but users can enable
5317 * them via a mixer switch. In the case of SPDIF-out, this initverb
5318 * payload also sets the generation to 0, output to be in "consumer"
5319 * PCM format, copyright asserted, no pre-emphasis and no validity
5322 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5323 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5325 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5326 * OUT1 sum bus when acting as an output.
5328 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5329 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5330 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5331 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5333 /* Start with output sum widgets muted and their output gains at min */
5334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5337 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5340 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5341 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5342 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5344 /* Unmute retasking pin widget output buffers since the default
5345 * state appears to be output. As the pin mode is changed by the
5346 * user the pin mode control will take care of enabling the pin's
5347 * input/output buffers as needed.
5349 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5353 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5354 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5355 /* Also unmute the mono-out pin widget */
5356 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5358 /* Mute capture amp left and right */
5359 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5360 /* Set ADC connection select to match default mixer setting (mic1
5363 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5365 /* Do the same for the second ADC: mute capture input amp and
5366 * set ADC connection to mic1 pin
5368 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5369 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5371 /* Mute all inputs to mixer widget (even unconnected ones) */
5372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5385 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5386 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5388 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5389 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5392 * for BIOS auto-configuration
5395 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5396 const char *pfx, int *vol_bits)
5399 unsigned long vol_val, sw_val;
5403 if (nid >= 0x0f && nid < 0x11) {
5404 nid_vol = nid - 0x7;
5405 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5406 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5407 } else if (nid == 0x11) {
5408 nid_vol = nid - 0x7;
5409 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5410 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5411 } else if (nid >= 0x12 && nid <= 0x15) {
5413 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5414 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5418 if (!(*vol_bits & (1 << nid_vol))) {
5419 /* first control for the volume widget */
5420 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5421 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5424 *vol_bits |= (1 << nid_vol);
5426 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5427 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5433 /* add playback controls from the parsed DAC table */
5434 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5435 const struct auto_pin_cfg *cfg)
5441 spec->multiout.num_dacs = 1;
5442 spec->multiout.dac_nids = spec->private_dac_nids;
5443 spec->multiout.dac_nids[0] = 0x02;
5445 nid = cfg->line_out_pins[0];
5447 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5452 nid = cfg->speaker_pins[0];
5454 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5459 nid = cfg->hp_pins[0];
5461 err = alc260_add_playback_controls(spec, nid, "Headphone",
5469 /* create playback/capture controls for input pins */
5470 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5471 const struct auto_pin_cfg *cfg)
5473 struct hda_input_mux *imux = &spec->private_imux;
5476 for (i = 0; i < AUTO_PIN_LAST; i++) {
5477 if (cfg->input_pins[i] >= 0x12) {
5478 idx = cfg->input_pins[i] - 0x12;
5479 err = new_analog_input(spec, cfg->input_pins[i],
5480 auto_pin_cfg_labels[i], idx,
5484 imux->items[imux->num_items].label =
5485 auto_pin_cfg_labels[i];
5486 imux->items[imux->num_items].index = idx;
5489 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5490 idx = cfg->input_pins[i] - 0x09;
5491 err = new_analog_input(spec, cfg->input_pins[i],
5492 auto_pin_cfg_labels[i], idx,
5496 imux->items[imux->num_items].label =
5497 auto_pin_cfg_labels[i];
5498 imux->items[imux->num_items].index = idx;
5505 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5506 hda_nid_t nid, int pin_type,
5509 alc_set_pin_output(codec, nid, pin_type);
5510 /* need the manual connection? */
5512 int idx = nid - 0x12;
5513 snd_hda_codec_write(codec, idx + 0x0b, 0,
5514 AC_VERB_SET_CONNECT_SEL, sel_idx);
5518 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5520 struct alc_spec *spec = codec->spec;
5523 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5524 nid = spec->autocfg.line_out_pins[0];
5526 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5527 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5530 nid = spec->autocfg.speaker_pins[0];
5532 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5534 nid = spec->autocfg.hp_pins[0];
5536 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5539 #define ALC260_PIN_CD_NID 0x16
5540 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5542 struct alc_spec *spec = codec->spec;
5545 for (i = 0; i < AUTO_PIN_LAST; i++) {
5546 hda_nid_t nid = spec->autocfg.input_pins[i];
5548 snd_hda_codec_write(codec, nid, 0,
5549 AC_VERB_SET_PIN_WIDGET_CONTROL,
5550 i <= AUTO_PIN_FRONT_MIC ?
5551 PIN_VREF80 : PIN_IN);
5552 if (nid != ALC260_PIN_CD_NID)
5553 snd_hda_codec_write(codec, nid, 0,
5554 AC_VERB_SET_AMP_GAIN_MUTE,
5561 * generic initialization of ADC, input mixers and output mixers
5563 static struct hda_verb alc260_volume_init_verbs[] = {
5565 * Unmute ADC0-1 and set the default input to mic-in
5567 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5568 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5569 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5570 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5572 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5574 * Note: PASD motherboards uses the Line In 2 as the input for
5575 * front panel mic (mic 2)
5577 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5578 /* mute analog inputs */
5579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5583 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5586 * Set up output mixers (0x08 - 0x0a)
5588 /* set vol=0 to output mixers */
5589 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5590 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5591 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5592 /* set up input amps for analog loopback */
5593 /* Amp Indices: DAC = 0, mixer = 1 */
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5598 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5599 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5604 static int alc260_parse_auto_config(struct hda_codec *codec)
5606 struct alc_spec *spec = codec->spec;
5608 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5610 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5614 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5617 if (!spec->kctls.list)
5618 return 0; /* can't find valid BIOS pin config */
5619 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5623 spec->multiout.max_channels = 2;
5625 if (spec->autocfg.dig_out_pin)
5626 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5627 if (spec->kctls.list)
5628 add_mixer(spec, spec->kctls.list);
5630 add_verb(spec, alc260_volume_init_verbs);
5632 spec->num_mux_defs = 1;
5633 spec->input_mux = &spec->private_imux;
5635 store_pin_configs(codec);
5639 /* additional initialization for auto-configuration model */
5640 static void alc260_auto_init(struct hda_codec *codec)
5642 struct alc_spec *spec = codec->spec;
5643 alc260_auto_init_multi_out(codec);
5644 alc260_auto_init_analog_input(codec);
5645 if (spec->unsol_event)
5646 alc_inithook(codec);
5649 #ifdef CONFIG_SND_HDA_POWER_SAVE
5650 static struct hda_amp_list alc260_loopbacks[] = {
5651 { 0x07, HDA_INPUT, 0 },
5652 { 0x07, HDA_INPUT, 1 },
5653 { 0x07, HDA_INPUT, 2 },
5654 { 0x07, HDA_INPUT, 3 },
5655 { 0x07, HDA_INPUT, 4 },
5661 * ALC260 configurations
5663 static const char *alc260_models[ALC260_MODEL_LAST] = {
5664 [ALC260_BASIC] = "basic",
5666 [ALC260_HP_3013] = "hp-3013",
5667 [ALC260_HP_DC7600] = "hp-dc7600",
5668 [ALC260_FUJITSU_S702X] = "fujitsu",
5669 [ALC260_ACER] = "acer",
5670 [ALC260_WILL] = "will",
5671 [ALC260_REPLACER_672V] = "replacer",
5672 #ifdef CONFIG_SND_DEBUG
5673 [ALC260_TEST] = "test",
5675 [ALC260_AUTO] = "auto",
5678 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5679 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5680 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5681 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5682 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5683 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5684 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5685 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5686 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5687 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5688 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5689 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5690 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5691 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5692 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5693 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5694 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5695 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5696 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5700 static struct alc_config_preset alc260_presets[] = {
5702 .mixers = { alc260_base_output_mixer,
5704 alc260_pc_beep_mixer },
5705 .init_verbs = { alc260_init_verbs },
5706 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5707 .dac_nids = alc260_dac_nids,
5708 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5709 .adc_nids = alc260_adc_nids,
5710 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5711 .channel_mode = alc260_modes,
5712 .input_mux = &alc260_capture_source,
5715 .mixers = { alc260_hp_output_mixer,
5716 alc260_input_mixer },
5717 .init_verbs = { alc260_init_verbs,
5718 alc260_hp_unsol_verbs },
5719 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5720 .dac_nids = alc260_dac_nids,
5721 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5722 .adc_nids = alc260_adc_nids_alt,
5723 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5724 .channel_mode = alc260_modes,
5725 .input_mux = &alc260_capture_source,
5726 .unsol_event = alc260_hp_unsol_event,
5727 .init_hook = alc260_hp_automute,
5729 [ALC260_HP_DC7600] = {
5730 .mixers = { alc260_hp_dc7600_mixer,
5731 alc260_input_mixer },
5732 .init_verbs = { alc260_init_verbs,
5733 alc260_hp_dc7600_verbs },
5734 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5735 .dac_nids = alc260_dac_nids,
5736 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5737 .adc_nids = alc260_adc_nids_alt,
5738 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5739 .channel_mode = alc260_modes,
5740 .input_mux = &alc260_capture_source,
5741 .unsol_event = alc260_hp_3012_unsol_event,
5742 .init_hook = alc260_hp_3012_automute,
5744 [ALC260_HP_3013] = {
5745 .mixers = { alc260_hp_3013_mixer,
5746 alc260_input_mixer },
5747 .init_verbs = { alc260_hp_3013_init_verbs,
5748 alc260_hp_3013_unsol_verbs },
5749 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5750 .dac_nids = alc260_dac_nids,
5751 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5752 .adc_nids = alc260_adc_nids_alt,
5753 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5754 .channel_mode = alc260_modes,
5755 .input_mux = &alc260_capture_source,
5756 .unsol_event = alc260_hp_3013_unsol_event,
5757 .init_hook = alc260_hp_3013_automute,
5759 [ALC260_FUJITSU_S702X] = {
5760 .mixers = { alc260_fujitsu_mixer },
5761 .init_verbs = { alc260_fujitsu_init_verbs },
5762 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5763 .dac_nids = alc260_dac_nids,
5764 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5765 .adc_nids = alc260_dual_adc_nids,
5766 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5767 .channel_mode = alc260_modes,
5768 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5769 .input_mux = alc260_fujitsu_capture_sources,
5772 .mixers = { alc260_acer_mixer },
5773 .init_verbs = { alc260_acer_init_verbs },
5774 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5775 .dac_nids = alc260_dac_nids,
5776 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5777 .adc_nids = alc260_dual_adc_nids,
5778 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5779 .channel_mode = alc260_modes,
5780 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5781 .input_mux = alc260_acer_capture_sources,
5784 .mixers = { alc260_will_mixer },
5785 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5786 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5787 .dac_nids = alc260_dac_nids,
5788 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5789 .adc_nids = alc260_adc_nids,
5790 .dig_out_nid = ALC260_DIGOUT_NID,
5791 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5792 .channel_mode = alc260_modes,
5793 .input_mux = &alc260_capture_source,
5795 [ALC260_REPLACER_672V] = {
5796 .mixers = { alc260_replacer_672v_mixer },
5797 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5798 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5799 .dac_nids = alc260_dac_nids,
5800 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5801 .adc_nids = alc260_adc_nids,
5802 .dig_out_nid = ALC260_DIGOUT_NID,
5803 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5804 .channel_mode = alc260_modes,
5805 .input_mux = &alc260_capture_source,
5806 .unsol_event = alc260_replacer_672v_unsol_event,
5807 .init_hook = alc260_replacer_672v_automute,
5809 #ifdef CONFIG_SND_DEBUG
5811 .mixers = { alc260_test_mixer },
5812 .init_verbs = { alc260_test_init_verbs },
5813 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5814 .dac_nids = alc260_test_dac_nids,
5815 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5816 .adc_nids = alc260_test_adc_nids,
5817 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5818 .channel_mode = alc260_modes,
5819 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5820 .input_mux = alc260_test_capture_sources,
5825 static int patch_alc260(struct hda_codec *codec)
5827 struct alc_spec *spec;
5828 int err, board_config;
5830 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5836 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5839 if (board_config < 0) {
5840 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5841 "trying auto-probe from BIOS...\n");
5842 board_config = ALC260_AUTO;
5845 if (board_config == ALC260_AUTO) {
5846 /* automatic parse from the BIOS config */
5847 err = alc260_parse_auto_config(codec);
5853 "hda_codec: Cannot set up configuration "
5854 "from BIOS. Using base mode...\n");
5855 board_config = ALC260_BASIC;
5859 if (board_config != ALC260_AUTO)
5860 setup_preset(spec, &alc260_presets[board_config]);
5862 spec->stream_name_analog = "ALC260 Analog";
5863 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5864 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5866 spec->stream_name_digital = "ALC260 Digital";
5867 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5868 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5870 if (!spec->adc_nids && spec->input_mux) {
5871 /* check whether NID 0x04 is valid */
5872 unsigned int wcap = get_wcaps(codec, 0x04);
5873 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5875 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5876 spec->adc_nids = alc260_adc_nids_alt;
5877 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5879 spec->adc_nids = alc260_adc_nids;
5880 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5883 set_capture_mixer(spec);
5885 spec->vmaster_nid = 0x08;
5887 codec->patch_ops = alc_patch_ops;
5888 if (board_config == ALC260_AUTO)
5889 spec->init_hook = alc260_auto_init;
5890 #ifdef CONFIG_SND_HDA_POWER_SAVE
5891 if (!spec->loopback.amplist)
5892 spec->loopback.amplist = alc260_loopbacks;
5894 codec->proc_widget_hook = print_realtek_coef;
5903 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5904 * configuration. Each pin widget can choose any input DACs and a mixer.
5905 * Each ADC is connected from a mixer of all inputs. This makes possible
5906 * 6-channel independent captures.
5908 * In addition, an independent DAC for the multi-playback (not used in this
5911 #define ALC882_DIGOUT_NID 0x06
5912 #define ALC882_DIGIN_NID 0x0a
5914 static struct hda_channel_mode alc882_ch_modes[1] = {
5918 static hda_nid_t alc882_dac_nids[4] = {
5919 /* front, rear, clfe, rear_surr */
5920 0x02, 0x03, 0x04, 0x05
5923 /* identical with ALC880 */
5924 #define alc882_adc_nids alc880_adc_nids
5925 #define alc882_adc_nids_alt alc880_adc_nids_alt
5927 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5928 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5931 /* FIXME: should be a matrix-type input source selection */
5933 static struct hda_input_mux alc882_capture_source = {
5937 { "Front Mic", 0x1 },
5945 static struct hda_verb alc882_3ST_ch2_init[] = {
5946 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5947 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5948 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5949 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5956 static struct hda_verb alc882_3ST_ch6_init[] = {
5957 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5958 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5959 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5960 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5961 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5962 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5966 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5967 { 2, alc882_3ST_ch2_init },
5968 { 6, alc882_3ST_ch6_init },
5974 static struct hda_verb alc882_sixstack_ch6_init[] = {
5975 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5976 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5977 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5978 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5985 static struct hda_verb alc882_sixstack_ch8_init[] = {
5986 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5987 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5988 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5989 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5993 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5994 { 6, alc882_sixstack_ch6_init },
5995 { 8, alc882_sixstack_ch8_init },
5999 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6005 static struct hda_verb alc885_mbp_ch2_init[] = {
6006 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6007 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6008 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6015 static struct hda_verb alc885_mbp_ch6_init[] = {
6016 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6017 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6018 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6019 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6020 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6024 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6025 { 2, alc885_mbp_ch2_init },
6026 { 6, alc885_mbp_ch6_init },
6030 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6031 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6033 static struct snd_kcontrol_new alc882_base_mixer[] = {
6034 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6035 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6036 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6037 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6038 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6039 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6040 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6041 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6042 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6043 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6044 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6045 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6046 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6047 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6048 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6050 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6051 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6052 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6053 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6054 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6055 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6056 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6060 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6061 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6062 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6063 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6064 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6065 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6066 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6068 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6069 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6070 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6073 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6074 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6075 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6076 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6077 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6078 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6079 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6082 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6083 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6084 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6088 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6090 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6091 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6094 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6095 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6099 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6100 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6101 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6105 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6106 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6108 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6109 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6110 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6111 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6112 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6113 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6114 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6115 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6116 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6117 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6118 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6125 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6127 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6134 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6136 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6137 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6141 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6143 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6144 .name = "Channel Mode",
6145 .info = alc_ch_mode_info,
6146 .get = alc_ch_mode_get,
6147 .put = alc_ch_mode_put,
6152 static struct hda_verb alc882_init_verbs[] = {
6153 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6156 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6158 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6159 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6160 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6162 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6163 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6166 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6167 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6168 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6170 /* Front Pin: output 0 (0x0c) */
6171 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6172 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6173 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6174 /* Rear Pin: output 1 (0x0d) */
6175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6177 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6178 /* CLFE Pin: output 2 (0x0e) */
6179 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6180 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6181 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6182 /* Side Pin: output 3 (0x0f) */
6183 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6184 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6185 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6186 /* Mic (rear) pin: input vref at 80% */
6187 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6189 /* Front Mic pin: input vref at 80% */
6190 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6192 /* Line In pin: input */
6193 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6195 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6198 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6199 /* CD pin widget for input */
6200 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6202 /* FIXME: use matrix-type input source selection */
6203 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6204 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6212 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6219 /* ADC1: mute amp left and right */
6220 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6221 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6222 /* ADC2: mute amp left and right */
6223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6224 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6225 /* ADC3: mute amp left and right */
6226 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6227 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6232 static struct hda_verb alc882_eapd_verbs[] = {
6233 /* change to EAPD mode */
6234 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6235 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6240 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6241 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6242 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6243 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6244 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6245 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6246 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6247 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6251 static struct hda_verb alc882_macpro_init_verbs[] = {
6252 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6256 /* Front Pin: output 0 (0x0c) */
6257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6258 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6260 /* Front Mic pin: input vref at 80% */
6261 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6262 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6263 /* Speaker: output */
6264 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6265 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6266 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6267 /* Headphone output (output 0 - 0x0c) */
6268 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6269 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6270 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6272 /* FIXME: use matrix-type input source selection */
6273 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6274 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6289 /* ADC1: mute amp left and right */
6290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6291 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6292 /* ADC2: mute amp left and right */
6293 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6294 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6295 /* ADC3: mute amp left and right */
6296 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6297 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6302 /* Macbook Pro rev3 */
6303 static struct hda_verb alc885_mbp3_init_verbs[] = {
6304 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6312 /* Front Pin: output 0 (0x0c) */
6313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6314 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6315 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6316 /* HP Pin: output 0 (0x0d) */
6317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6318 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6319 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6320 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6321 /* Mic (rear) pin: input vref at 80% */
6322 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6323 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6324 /* Front Mic pin: input vref at 80% */
6325 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6326 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6327 /* Line In pin: use output 1 when in LineOut mode */
6328 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6329 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6330 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6332 /* FIXME: use matrix-type input source selection */
6333 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6334 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6341 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6342 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6348 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6349 /* ADC1: mute amp left and right */
6350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6351 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6352 /* ADC2: mute amp left and right */
6353 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6354 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6355 /* ADC3: mute amp left and right */
6356 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6357 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6362 /* iMac 24 mixer. */
6363 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6364 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6365 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6369 /* iMac 24 init verbs. */
6370 static struct hda_verb alc885_imac24_init_verbs[] = {
6371 /* Internal speakers: output 0 (0x0c) */
6372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6373 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6374 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6375 /* Internal speakers: output 0 (0x0c) */
6376 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6378 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6379 /* Headphone: output 0 (0x0c) */
6380 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6381 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6382 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6383 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6384 /* Front Mic: input vref at 80% */
6385 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6386 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6390 /* Toggle speaker-output according to the hp-jack state */
6391 static void alc885_imac24_automute(struct hda_codec *codec)
6393 unsigned int present;
6395 present = snd_hda_codec_read(codec, 0x14, 0,
6396 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6397 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6398 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6399 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6400 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6403 /* Processes unsolicited events. */
6404 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6407 /* Headphone insertion or removal. */
6408 if ((res >> 26) == ALC880_HP_EVENT)
6409 alc885_imac24_automute(codec);
6412 static void alc885_mbp3_automute(struct hda_codec *codec)
6414 unsigned int present;
6416 present = snd_hda_codec_read(codec, 0x15, 0,
6417 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6418 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6419 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6420 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6421 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6424 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6427 /* Headphone insertion or removal. */
6428 if ((res >> 26) == ALC880_HP_EVENT)
6429 alc885_mbp3_automute(codec);
6433 static struct hda_verb alc882_targa_verbs[] = {
6434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6438 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6440 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6441 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6442 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6444 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6445 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6446 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6447 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6451 /* toggle speaker-output according to the hp-jack state */
6452 static void alc882_targa_automute(struct hda_codec *codec)
6454 unsigned int present;
6456 present = snd_hda_codec_read(codec, 0x14, 0,
6457 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6458 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6459 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6460 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6464 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6466 /* Looks like the unsol event is incompatible with the standard
6467 * definition. 4bit tag is placed at 26 bit!
6469 if (((res >> 26) == ALC880_HP_EVENT)) {
6470 alc882_targa_automute(codec);
6474 static struct hda_verb alc882_asus_a7j_verbs[] = {
6475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6478 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6480 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6482 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6483 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6484 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6486 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6487 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6488 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6492 static struct hda_verb alc882_asus_a7m_verbs[] = {
6493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6498 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6500 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6502 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6504 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6505 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6506 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6510 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6512 unsigned int gpiostate, gpiomask, gpiodir;
6514 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6515 AC_VERB_GET_GPIO_DATA, 0);
6518 gpiostate |= (1 << pin);
6520 gpiostate &= ~(1 << pin);
6522 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6523 AC_VERB_GET_GPIO_MASK, 0);
6524 gpiomask |= (1 << pin);
6526 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6527 AC_VERB_GET_GPIO_DIRECTION, 0);
6528 gpiodir |= (1 << pin);
6531 snd_hda_codec_write(codec, codec->afg, 0,
6532 AC_VERB_SET_GPIO_MASK, gpiomask);
6533 snd_hda_codec_write(codec, codec->afg, 0,
6534 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6538 snd_hda_codec_write(codec, codec->afg, 0,
6539 AC_VERB_SET_GPIO_DATA, gpiostate);
6542 /* set up GPIO at initialization */
6543 static void alc885_macpro_init_hook(struct hda_codec *codec)
6545 alc882_gpio_mute(codec, 0, 0);
6546 alc882_gpio_mute(codec, 1, 0);
6549 /* set up GPIO and update auto-muting at initialization */
6550 static void alc885_imac24_init_hook(struct hda_codec *codec)
6552 alc885_macpro_init_hook(codec);
6553 alc885_imac24_automute(codec);
6557 * generic initialization of ADC, input mixers and output mixers
6559 static struct hda_verb alc882_auto_init_verbs[] = {
6561 * Unmute ADC0-2 and set the default input to mic-in
6563 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6565 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6566 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6567 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6568 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6570 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6572 * Note: PASD motherboards uses the Line In 2 as the input for
6573 * front panel mic (mic 2)
6575 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6578 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6580 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6583 * Set up output mixers (0x0c - 0x0f)
6585 /* set vol=0 to output mixers */
6586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6590 /* set up input amps for analog loopback */
6591 /* Amp Indices: DAC = 0, mixer = 1 */
6592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6594 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6595 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6596 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6599 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6600 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6601 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6603 /* FIXME: use matrix-type input source selection */
6604 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6605 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6606 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6607 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6609 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6611 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6624 #ifdef CONFIG_SND_HDA_POWER_SAVE
6625 #define alc882_loopbacks alc880_loopbacks
6628 /* pcm configuration: identiacal with ALC880 */
6629 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6630 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6631 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6632 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6635 * configuration and preset
6637 static const char *alc882_models[ALC882_MODEL_LAST] = {
6638 [ALC882_3ST_DIG] = "3stack-dig",
6639 [ALC882_6ST_DIG] = "6stack-dig",
6640 [ALC882_ARIMA] = "arima",
6641 [ALC882_W2JC] = "w2jc",
6642 [ALC882_TARGA] = "targa",
6643 [ALC882_ASUS_A7J] = "asus-a7j",
6644 [ALC882_ASUS_A7M] = "asus-a7m",
6645 [ALC885_MACPRO] = "macpro",
6646 [ALC885_MBP3] = "mbp3",
6647 [ALC885_IMAC24] = "imac24",
6648 [ALC882_AUTO] = "auto",
6651 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6652 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6653 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6654 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6655 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6656 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6657 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6658 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6659 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6660 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6661 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6662 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6663 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6667 static struct alc_config_preset alc882_presets[] = {
6668 [ALC882_3ST_DIG] = {
6669 .mixers = { alc882_base_mixer },
6670 .init_verbs = { alc882_init_verbs },
6671 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6672 .dac_nids = alc882_dac_nids,
6673 .dig_out_nid = ALC882_DIGOUT_NID,
6674 .dig_in_nid = ALC882_DIGIN_NID,
6675 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6676 .channel_mode = alc882_ch_modes,
6678 .input_mux = &alc882_capture_source,
6680 [ALC882_6ST_DIG] = {
6681 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6682 .init_verbs = { alc882_init_verbs },
6683 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6684 .dac_nids = alc882_dac_nids,
6685 .dig_out_nid = ALC882_DIGOUT_NID,
6686 .dig_in_nid = ALC882_DIGIN_NID,
6687 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6688 .channel_mode = alc882_sixstack_modes,
6689 .input_mux = &alc882_capture_source,
6692 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6693 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6694 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6695 .dac_nids = alc882_dac_nids,
6696 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6697 .channel_mode = alc882_sixstack_modes,
6698 .input_mux = &alc882_capture_source,
6701 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6702 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6703 alc880_gpio1_init_verbs },
6704 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6705 .dac_nids = alc882_dac_nids,
6706 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6707 .channel_mode = alc880_threestack_modes,
6709 .input_mux = &alc882_capture_source,
6710 .dig_out_nid = ALC882_DIGOUT_NID,
6713 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6714 .init_verbs = { alc885_mbp3_init_verbs,
6715 alc880_gpio1_init_verbs },
6716 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6717 .dac_nids = alc882_dac_nids,
6718 .channel_mode = alc885_mbp_6ch_modes,
6719 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6720 .input_mux = &alc882_capture_source,
6721 .dig_out_nid = ALC882_DIGOUT_NID,
6722 .dig_in_nid = ALC882_DIGIN_NID,
6723 .unsol_event = alc885_mbp3_unsol_event,
6724 .init_hook = alc885_mbp3_automute,
6727 .mixers = { alc882_macpro_mixer },
6728 .init_verbs = { alc882_macpro_init_verbs },
6729 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6730 .dac_nids = alc882_dac_nids,
6731 .dig_out_nid = ALC882_DIGOUT_NID,
6732 .dig_in_nid = ALC882_DIGIN_NID,
6733 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6734 .channel_mode = alc882_ch_modes,
6735 .input_mux = &alc882_capture_source,
6736 .init_hook = alc885_macpro_init_hook,
6739 .mixers = { alc885_imac24_mixer },
6740 .init_verbs = { alc885_imac24_init_verbs },
6741 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6742 .dac_nids = alc882_dac_nids,
6743 .dig_out_nid = ALC882_DIGOUT_NID,
6744 .dig_in_nid = ALC882_DIGIN_NID,
6745 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6746 .channel_mode = alc882_ch_modes,
6747 .input_mux = &alc882_capture_source,
6748 .unsol_event = alc885_imac24_unsol_event,
6749 .init_hook = alc885_imac24_init_hook,
6752 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6753 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6754 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6755 .dac_nids = alc882_dac_nids,
6756 .dig_out_nid = ALC882_DIGOUT_NID,
6757 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6758 .adc_nids = alc882_adc_nids,
6759 .capsrc_nids = alc882_capsrc_nids,
6760 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6761 .channel_mode = alc882_3ST_6ch_modes,
6763 .input_mux = &alc882_capture_source,
6764 .unsol_event = alc882_targa_unsol_event,
6765 .init_hook = alc882_targa_automute,
6767 [ALC882_ASUS_A7J] = {
6768 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6769 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6770 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6771 .dac_nids = alc882_dac_nids,
6772 .dig_out_nid = ALC882_DIGOUT_NID,
6773 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6774 .adc_nids = alc882_adc_nids,
6775 .capsrc_nids = alc882_capsrc_nids,
6776 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6777 .channel_mode = alc882_3ST_6ch_modes,
6779 .input_mux = &alc882_capture_source,
6781 [ALC882_ASUS_A7M] = {
6782 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6783 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6784 alc880_gpio1_init_verbs,
6785 alc882_asus_a7m_verbs },
6786 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6787 .dac_nids = alc882_dac_nids,
6788 .dig_out_nid = ALC882_DIGOUT_NID,
6789 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6790 .channel_mode = alc880_threestack_modes,
6792 .input_mux = &alc882_capture_source,
6801 PINFIX_ABIT_AW9D_MAX
6804 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6805 { 0x15, 0x01080104 }, /* side */
6806 { 0x16, 0x01011012 }, /* rear */
6807 { 0x17, 0x01016011 }, /* clfe */
6811 static const struct alc_pincfg *alc882_pin_fixes[] = {
6812 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6815 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6816 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6821 * BIOS auto configuration
6823 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6824 hda_nid_t nid, int pin_type,
6828 struct alc_spec *spec = codec->spec;
6831 alc_set_pin_output(codec, nid, pin_type);
6832 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6835 idx = spec->multiout.dac_nids[dac_idx] - 2;
6836 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6840 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6842 struct alc_spec *spec = codec->spec;
6845 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6846 for (i = 0; i <= HDA_SIDE; i++) {
6847 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6848 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6850 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6855 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6857 struct alc_spec *spec = codec->spec;
6860 pin = spec->autocfg.hp_pins[0];
6861 if (pin) /* connect to front */
6863 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6864 pin = spec->autocfg.speaker_pins[0];
6866 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6869 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6870 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6872 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6874 struct alc_spec *spec = codec->spec;
6877 for (i = 0; i < AUTO_PIN_LAST; i++) {
6878 hda_nid_t nid = spec->autocfg.input_pins[i];
6883 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6884 unsigned int pincap;
6885 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6886 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6890 snd_hda_codec_write(codec, nid, 0,
6891 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6892 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6893 snd_hda_codec_write(codec, nid, 0,
6894 AC_VERB_SET_AMP_GAIN_MUTE,
6899 static void alc882_auto_init_input_src(struct hda_codec *codec)
6901 struct alc_spec *spec = codec->spec;
6902 const struct hda_input_mux *imux = spec->input_mux;
6905 for (c = 0; c < spec->num_adc_nids; c++) {
6906 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6907 hda_nid_t nid = spec->capsrc_nids[c];
6908 int conns, mute, idx, item;
6910 conns = snd_hda_get_connections(codec, nid, conn_list,
6911 ARRAY_SIZE(conn_list));
6914 for (idx = 0; idx < conns; idx++) {
6915 /* if the current connection is the selected one,
6916 * unmute it as default - otherwise mute it
6918 mute = AMP_IN_MUTE(idx);
6919 for (item = 0; item < imux->num_items; item++) {
6920 if (imux->items[item].index == idx) {
6921 if (spec->cur_mux[c] == item)
6922 mute = AMP_IN_UNMUTE(idx);
6926 snd_hda_codec_write(codec, nid, 0,
6927 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6932 /* add mic boosts if needed */
6933 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6935 struct alc_spec *spec = codec->spec;
6939 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6940 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6941 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6943 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6947 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6948 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6949 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6951 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6958 /* almost identical with ALC880 parser... */
6959 static int alc882_parse_auto_config(struct hda_codec *codec)
6961 struct alc_spec *spec = codec->spec;
6962 int err = alc880_parse_auto_config(codec);
6967 return 0; /* no config found */
6969 err = alc_auto_add_mic_boost(codec);
6973 /* hack - override the init verbs */
6974 spec->init_verbs[0] = alc882_auto_init_verbs;
6976 return 1; /* config found */
6979 /* additional initialization for auto-configuration model */
6980 static void alc882_auto_init(struct hda_codec *codec)
6982 struct alc_spec *spec = codec->spec;
6983 alc882_auto_init_multi_out(codec);
6984 alc882_auto_init_hp_out(codec);
6985 alc882_auto_init_analog_input(codec);
6986 alc882_auto_init_input_src(codec);
6987 if (spec->unsol_event)
6988 alc_inithook(codec);
6991 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6993 static int patch_alc882(struct hda_codec *codec)
6995 struct alc_spec *spec;
6996 int err, board_config;
6998 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7004 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7008 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7009 /* Pick up systems that don't supply PCI SSID */
7010 switch (codec->subsystem_id) {
7011 case 0x106b0c00: /* Mac Pro */
7012 board_config = ALC885_MACPRO;
7014 case 0x106b1000: /* iMac 24 */
7015 case 0x106b2800: /* AppleTV */
7016 board_config = ALC885_IMAC24;
7018 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7019 case 0x106b00a4: /* MacbookPro4,1 */
7020 case 0x106b2c00: /* Macbook Pro rev3 */
7021 case 0x106b3600: /* Macbook 3.1 */
7022 board_config = ALC885_MBP3;
7025 /* ALC889A is handled better as ALC888-compatible */
7026 if (codec->revision_id == 0x100101 ||
7027 codec->revision_id == 0x100103) {
7029 return patch_alc883(codec);
7031 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
7032 "trying auto-probe from BIOS...\n");
7033 board_config = ALC882_AUTO;
7037 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7039 if (board_config == ALC882_AUTO) {
7040 /* automatic parse from the BIOS config */
7041 err = alc882_parse_auto_config(codec);
7047 "hda_codec: Cannot set up configuration "
7048 "from BIOS. Using base mode...\n");
7049 board_config = ALC882_3ST_DIG;
7053 if (board_config != ALC882_AUTO)
7054 setup_preset(spec, &alc882_presets[board_config]);
7056 if (codec->vendor_id == 0x10ec0885) {
7057 spec->stream_name_analog = "ALC885 Analog";
7058 spec->stream_name_digital = "ALC885 Digital";
7060 spec->stream_name_analog = "ALC882 Analog";
7061 spec->stream_name_digital = "ALC882 Digital";
7064 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7065 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7066 /* FIXME: setup DAC5 */
7067 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7068 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7070 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7071 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7073 spec->is_mix_capture = 1; /* matrix-style capture */
7074 if (!spec->adc_nids && spec->input_mux) {
7075 /* check whether NID 0x07 is valid */
7076 unsigned int wcap = get_wcaps(codec, 0x07);
7078 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7079 if (wcap != AC_WID_AUD_IN) {
7080 spec->adc_nids = alc882_adc_nids_alt;
7081 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7082 spec->capsrc_nids = alc882_capsrc_nids_alt;
7084 spec->adc_nids = alc882_adc_nids;
7085 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7086 spec->capsrc_nids = alc882_capsrc_nids;
7089 set_capture_mixer(spec);
7091 spec->vmaster_nid = 0x0c;
7093 codec->patch_ops = alc_patch_ops;
7094 if (board_config == ALC882_AUTO)
7095 spec->init_hook = alc882_auto_init;
7096 #ifdef CONFIG_SND_HDA_POWER_SAVE
7097 if (!spec->loopback.amplist)
7098 spec->loopback.amplist = alc882_loopbacks;
7100 codec->proc_widget_hook = print_realtek_coef;
7108 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7109 * configuration. Each pin widget can choose any input DACs and a mixer.
7110 * Each ADC is connected from a mixer of all inputs. This makes possible
7111 * 6-channel independent captures.
7113 * In addition, an independent DAC for the multi-playback (not used in this
7116 #define ALC883_DIGOUT_NID 0x06
7117 #define ALC883_DIGIN_NID 0x0a
7119 #define ALC1200_DIGOUT_NID 0x10
7121 static hda_nid_t alc883_dac_nids[4] = {
7122 /* front, rear, clfe, rear_surr */
7123 0x02, 0x03, 0x04, 0x05
7126 static hda_nid_t alc883_adc_nids[2] = {
7131 static hda_nid_t alc883_adc_nids_alt[1] = {
7136 static hda_nid_t alc883_adc_nids_rev[2] = {
7141 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7143 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7146 /* FIXME: should be a matrix-type input source selection */
7148 static struct hda_input_mux alc883_capture_source = {
7152 { "Front Mic", 0x1 },
7158 static struct hda_input_mux alc883_3stack_6ch_intel = {
7162 { "Front Mic", 0x0 },
7168 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7176 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7186 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7194 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7198 { "Front Mic", 0x1 },
7203 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7214 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7221 static struct hda_verb alc883_3ST_ch2_init[] = {
7222 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7223 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7224 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7225 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7232 static struct hda_verb alc883_3ST_ch4_init[] = {
7233 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7234 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7235 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7236 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7237 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7244 static struct hda_verb alc883_3ST_ch6_init[] = {
7245 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7246 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7247 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7248 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7249 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7250 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7254 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7255 { 2, alc883_3ST_ch2_init },
7256 { 4, alc883_3ST_ch4_init },
7257 { 6, alc883_3ST_ch6_init },
7263 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7264 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7265 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7266 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7267 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7274 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7275 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7276 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7277 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7278 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7279 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7286 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7287 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7288 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7289 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7290 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7291 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7292 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7296 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7297 { 2, alc883_3ST_ch2_intel_init },
7298 { 4, alc883_3ST_ch4_intel_init },
7299 { 6, alc883_3ST_ch6_intel_init },
7305 static struct hda_verb alc883_sixstack_ch6_init[] = {
7306 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7307 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7308 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7309 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7316 static struct hda_verb alc883_sixstack_ch8_init[] = {
7317 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7318 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7319 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7320 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7324 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7325 { 6, alc883_sixstack_ch6_init },
7326 { 8, alc883_sixstack_ch8_init },
7329 static struct hda_verb alc883_medion_eapd_verbs[] = {
7330 /* eanable EAPD on medion laptop */
7331 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7332 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7336 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7337 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7340 static struct snd_kcontrol_new alc883_base_mixer[] = {
7341 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7342 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7343 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7344 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7345 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7346 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7347 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7348 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7349 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7350 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7353 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7354 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7355 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7357 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7358 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7359 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7360 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7361 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7362 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7363 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7367 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7368 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7369 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7370 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7371 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7372 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7373 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7378 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7379 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7384 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7385 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7386 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7387 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7388 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7391 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7392 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7393 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7394 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7398 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7399 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7400 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7401 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7402 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7403 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7404 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7406 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7407 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7408 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7412 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7413 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7414 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7415 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7416 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7417 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7418 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7419 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7425 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7426 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7427 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7431 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7433 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7435 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7436 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7437 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7438 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7439 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7440 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7441 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7442 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7443 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7444 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7445 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7446 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7447 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7449 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7450 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7451 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7452 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7456 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7457 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7458 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7459 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7460 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7461 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7463 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7464 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7465 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7466 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7467 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7468 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7475 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7476 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7477 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7478 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7482 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7483 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7484 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7485 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7486 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7487 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7488 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7489 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7490 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7491 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7492 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7493 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7494 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7495 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7496 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7499 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7500 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7501 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7502 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7503 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7507 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7508 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7509 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7510 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7511 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7512 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7513 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7514 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7515 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7516 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7517 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7518 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7519 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7520 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7521 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7522 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7523 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7527 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7528 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7529 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7530 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7531 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7532 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7534 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7535 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7537 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7538 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7542 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7543 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7544 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7545 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7546 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7547 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7549 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7550 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7554 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7555 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7556 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7558 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7559 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7562 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7563 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7567 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7568 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7569 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7570 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7571 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7572 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7573 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7574 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7575 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7576 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7580 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7581 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7582 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7583 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7584 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7585 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7587 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7592 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7593 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7594 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7595 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7596 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7597 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7598 0x0d, 1, 0x0, HDA_OUTPUT),
7599 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7600 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7601 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7602 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7603 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7604 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7605 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7606 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7607 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7608 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7609 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7611 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7612 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7613 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7614 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7615 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7619 static struct hda_bind_ctls alc883_bind_cap_vol = {
7620 .ops = &snd_hda_bind_vol,
7622 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7623 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7628 static struct hda_bind_ctls alc883_bind_cap_switch = {
7629 .ops = &snd_hda_bind_sw,
7631 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7632 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7637 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7638 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7639 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7640 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7641 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7642 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7649 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7650 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7651 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7654 /* .name = "Capture Source", */
7655 .name = "Input Source",
7657 .info = alc_mux_enum_info,
7658 .get = alc_mux_enum_get,
7659 .put = alc_mux_enum_put,
7664 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7666 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7667 .name = "Channel Mode",
7668 .info = alc_ch_mode_info,
7669 .get = alc_ch_mode_get,
7670 .put = alc_ch_mode_put,
7675 static struct hda_verb alc883_init_verbs[] = {
7676 /* ADC1: mute amp left and right */
7677 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7678 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7679 /* ADC2: mute amp left and right */
7680 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7681 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7682 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7683 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7687 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7688 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7689 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7691 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7692 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7693 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7695 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7696 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7697 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7699 /* mute analog input loopbacks */
7700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7706 /* Front Pin: output 0 (0x0c) */
7707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7708 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7709 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7710 /* Rear Pin: output 1 (0x0d) */
7711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7714 /* CLFE Pin: output 2 (0x0e) */
7715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7717 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7718 /* Side Pin: output 3 (0x0f) */
7719 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7721 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7722 /* Mic (rear) pin: input vref at 80% */
7723 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7724 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7725 /* Front Mic pin: input vref at 80% */
7726 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7727 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7728 /* Line In pin: input */
7729 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7730 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7731 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7733 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7734 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7735 /* CD pin widget for input */
7736 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7738 /* FIXME: use matrix-type input source selection */
7739 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7741 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7742 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7747 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7753 /* toggle speaker-output according to the hp-jack state */
7754 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7756 unsigned int present;
7758 present = snd_hda_codec_read(codec, 0x15, 0,
7759 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7760 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7761 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7762 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7763 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7766 /* auto-toggle front mic */
7768 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7770 unsigned int present;
7773 present = snd_hda_codec_read(codec, 0x18, 0,
7774 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7775 bits = present ? HDA_AMP_MUTE : 0;
7776 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7780 static void alc883_mitac_automute(struct hda_codec *codec)
7782 alc883_mitac_hp_automute(codec);
7783 /* alc883_mitac_mic_automute(codec); */
7786 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7789 switch (res >> 26) {
7790 case ALC880_HP_EVENT:
7791 alc883_mitac_hp_automute(codec);
7793 case ALC880_MIC_EVENT:
7794 /* alc883_mitac_mic_automute(codec); */
7799 static struct hda_verb alc883_mitac_verbs[] = {
7801 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7804 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7805 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7807 /* enable unsolicited event */
7808 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7809 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7814 static struct hda_verb alc883_clevo_m720_verbs[] = {
7816 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7817 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7819 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7820 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7822 /* enable unsolicited event */
7823 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7824 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7829 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7831 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7834 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7837 /* enable unsolicited event */
7838 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7843 static struct hda_verb alc883_tagra_verbs[] = {
7844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7847 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7848 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7850 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7851 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7852 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7854 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7855 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7856 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7857 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7862 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7863 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7864 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7865 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7869 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7870 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7872 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7877 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7878 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7879 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7880 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7881 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7882 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7886 static struct hda_verb alc883_haier_w66_verbs[] = {
7887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7890 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7892 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7893 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7895 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7899 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7904 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7905 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7906 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7907 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7911 static struct hda_verb alc888_3st_hp_verbs[] = {
7912 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7913 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7914 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7918 static struct hda_verb alc888_6st_dell_verbs[] = {
7919 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7923 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7924 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7925 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7926 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7927 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7931 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7932 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7933 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7934 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7935 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7939 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7940 { 2, alc888_3st_hp_2ch_init },
7941 { 6, alc888_3st_hp_6ch_init },
7944 /* toggle front-jack and RCA according to the hp-jack state */
7945 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7947 unsigned int present;
7949 present = snd_hda_codec_read(codec, 0x1b, 0,
7950 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7951 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7952 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7953 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7954 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7957 /* toggle RCA according to the front-jack state */
7958 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7960 unsigned int present;
7962 present = snd_hda_codec_read(codec, 0x14, 0,
7963 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7964 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7965 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7968 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7971 if ((res >> 26) == ALC880_HP_EVENT)
7972 alc888_lenovo_ms7195_front_automute(codec);
7973 if ((res >> 26) == ALC880_FRONT_EVENT)
7974 alc888_lenovo_ms7195_rca_automute(codec);
7977 static struct hda_verb alc883_medion_md2_verbs[] = {
7978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7983 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7987 /* toggle speaker-output according to the hp-jack state */
7988 static void alc883_medion_md2_automute(struct hda_codec *codec)
7990 unsigned int present;
7992 present = snd_hda_codec_read(codec, 0x14, 0,
7993 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7994 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7995 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7998 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8001 if ((res >> 26) == ALC880_HP_EVENT)
8002 alc883_medion_md2_automute(codec);
8005 /* toggle speaker-output according to the hp-jack state */
8006 static void alc883_tagra_automute(struct hda_codec *codec)
8008 unsigned int present;
8011 present = snd_hda_codec_read(codec, 0x14, 0,
8012 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8013 bits = present ? HDA_AMP_MUTE : 0;
8014 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8015 HDA_AMP_MUTE, bits);
8016 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8020 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
8022 if ((res >> 26) == ALC880_HP_EVENT)
8023 alc883_tagra_automute(codec);
8026 /* toggle speaker-output according to the hp-jack state */
8027 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
8029 unsigned int present;
8032 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8033 & AC_PINSENSE_PRESENCE;
8034 bits = present ? HDA_AMP_MUTE : 0;
8035 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8036 HDA_AMP_MUTE, bits);
8039 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8041 unsigned int present;
8043 present = snd_hda_codec_read(codec, 0x18, 0,
8044 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8045 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8046 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8049 static void alc883_clevo_m720_automute(struct hda_codec *codec)
8051 alc883_clevo_m720_hp_automute(codec);
8052 alc883_clevo_m720_mic_automute(codec);
8055 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8058 switch (res >> 26) {
8059 case ALC880_HP_EVENT:
8060 alc883_clevo_m720_hp_automute(codec);
8062 case ALC880_MIC_EVENT:
8063 alc883_clevo_m720_mic_automute(codec);
8068 /* toggle speaker-output according to the hp-jack state */
8069 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
8071 unsigned int present;
8074 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8075 & AC_PINSENSE_PRESENCE;
8076 bits = present ? HDA_AMP_MUTE : 0;
8077 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8078 HDA_AMP_MUTE, bits);
8081 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
8084 if ((res >> 26) == ALC880_HP_EVENT)
8085 alc883_2ch_fujitsu_pi2515_automute(codec);
8088 static void alc883_haier_w66_automute(struct hda_codec *codec)
8090 unsigned int present;
8093 present = snd_hda_codec_read(codec, 0x1b, 0,
8094 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8095 bits = present ? 0x80 : 0;
8096 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8100 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8103 if ((res >> 26) == ALC880_HP_EVENT)
8104 alc883_haier_w66_automute(codec);
8107 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8109 unsigned int present;
8112 present = snd_hda_codec_read(codec, 0x14, 0,
8113 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8114 bits = present ? HDA_AMP_MUTE : 0;
8115 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8116 HDA_AMP_MUTE, bits);
8119 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8121 unsigned int present;
8124 present = snd_hda_codec_read(codec, 0x1b, 0,
8125 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8126 bits = present ? HDA_AMP_MUTE : 0;
8127 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8128 HDA_AMP_MUTE, bits);
8129 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8130 HDA_AMP_MUTE, bits);
8133 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8136 if ((res >> 26) == ALC880_HP_EVENT)
8137 alc883_lenovo_101e_all_automute(codec);
8138 if ((res >> 26) == ALC880_FRONT_EVENT)
8139 alc883_lenovo_101e_ispeaker_automute(codec);
8142 /* toggle speaker-output according to the hp-jack state */
8143 static void alc883_acer_aspire_automute(struct hda_codec *codec)
8145 unsigned int present;
8147 present = snd_hda_codec_read(codec, 0x14, 0,
8148 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8149 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8150 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8151 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8152 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8155 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8158 if ((res >> 26) == ALC880_HP_EVENT)
8159 alc883_acer_aspire_automute(codec);
8162 static struct hda_verb alc883_acer_eapd_verbs[] = {
8163 /* HP Pin: output 0 (0x0c) */
8164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8165 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8166 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8167 /* Front Pin: output 0 (0x0c) */
8168 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8169 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8170 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8171 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8172 /* eanable EAPD on medion laptop */
8173 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8174 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8175 /* enable unsolicited event */
8176 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8180 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
8182 unsigned int present;
8184 present = snd_hda_codec_read(codec, 0x1b, 0,
8185 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8186 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8187 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8188 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8189 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8190 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8191 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8192 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8193 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8196 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
8199 switch (res >> 26) {
8200 case ALC880_HP_EVENT:
8201 printk("hp_event\n");
8202 alc888_6st_dell_front_automute(codec);
8207 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8210 unsigned int present;
8212 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8213 present = snd_hda_codec_read(codec, 0x1b, 0,
8214 AC_VERB_GET_PIN_SENSE, 0);
8215 present = (present & 0x80000000) != 0;
8217 /* mute internal speaker */
8218 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8219 HDA_AMP_MUTE, HDA_AMP_MUTE);
8220 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8221 HDA_AMP_MUTE, HDA_AMP_MUTE);
8222 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8223 HDA_AMP_MUTE, HDA_AMP_MUTE);
8224 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8225 HDA_AMP_MUTE, HDA_AMP_MUTE);
8226 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8227 HDA_AMP_MUTE, HDA_AMP_MUTE);
8229 /* unmute internal speaker if necessary */
8230 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8231 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8232 HDA_AMP_MUTE, mute);
8233 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8234 HDA_AMP_MUTE, mute);
8235 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8236 HDA_AMP_MUTE, mute);
8237 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8238 HDA_AMP_MUTE, mute);
8239 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8240 HDA_AMP_MUTE, mute);
8244 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
8247 if ((res >> 26) == ALC880_HP_EVENT)
8248 alc888_lenovo_sky_front_automute(codec);
8252 * generic initialization of ADC, input mixers and output mixers
8254 static struct hda_verb alc883_auto_init_verbs[] = {
8256 * Unmute ADC0-2 and set the default input to mic-in
8258 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8259 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8260 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8261 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8263 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8265 * Note: PASD motherboards uses the Line In 2 as the input for
8266 * front panel mic (mic 2)
8268 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8276 * Set up output mixers (0x0c - 0x0f)
8278 /* set vol=0 to output mixers */
8279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8281 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8282 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8283 /* set up input amps for analog loopback */
8284 /* Amp Indices: DAC = 0, mixer = 1 */
8285 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8286 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8288 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8290 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8291 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8292 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8293 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8294 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8296 /* FIXME: use matrix-type input source selection */
8297 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8301 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8302 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8308 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8314 static struct hda_verb alc888_asus_m90v_verbs[] = {
8315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8318 /* enable unsolicited event */
8319 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8320 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8324 static void alc883_nb_mic_automute(struct hda_codec *codec)
8326 unsigned int present;
8328 present = snd_hda_codec_read(codec, 0x18, 0,
8329 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8330 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8331 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8332 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8333 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8336 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8338 unsigned int present;
8341 present = snd_hda_codec_read(codec, 0x1b, 0,
8342 AC_VERB_GET_PIN_SENSE, 0)
8343 & AC_PINSENSE_PRESENCE;
8344 bits = present ? 0 : PIN_OUT;
8345 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8347 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8349 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8353 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8356 switch (res >> 26) {
8357 case ALC880_HP_EVENT:
8358 alc883_M90V_speaker_automute(codec);
8360 case ALC880_MIC_EVENT:
8361 alc883_nb_mic_automute(codec);
8366 static void alc883_mode2_inithook(struct hda_codec *codec)
8368 alc883_M90V_speaker_automute(codec);
8369 alc883_nb_mic_automute(codec);
8372 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8373 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8374 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8378 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8379 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8380 /* enable unsolicited event */
8381 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8385 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8387 unsigned int present;
8390 present = snd_hda_codec_read(codec, 0x14, 0,
8391 AC_VERB_GET_PIN_SENSE, 0)
8392 & AC_PINSENSE_PRESENCE;
8393 bits = present ? 0 : PIN_OUT;
8394 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8398 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8401 switch (res >> 26) {
8402 case ALC880_HP_EVENT:
8403 alc883_eee1601_speaker_automute(codec);
8408 static void alc883_eee1601_inithook(struct hda_codec *codec)
8410 alc883_eee1601_speaker_automute(codec);
8413 #ifdef CONFIG_SND_HDA_POWER_SAVE
8414 #define alc883_loopbacks alc880_loopbacks
8417 /* pcm configuration: identiacal with ALC880 */
8418 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8419 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8420 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8421 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8422 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8425 * configuration and preset
8427 static const char *alc883_models[ALC883_MODEL_LAST] = {
8428 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8429 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8430 [ALC883_3ST_6ch] = "3stack-6ch",
8431 [ALC883_6ST_DIG] = "6stack-dig",
8432 [ALC883_TARGA_DIG] = "targa-dig",
8433 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8434 [ALC883_ACER] = "acer",
8435 [ALC883_ACER_ASPIRE] = "acer-aspire",
8436 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8437 [ALC883_MEDION] = "medion",
8438 [ALC883_MEDION_MD2] = "medion-md2",
8439 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8440 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8441 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8442 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8443 [ALC888_LENOVO_SKY] = "lenovo-sky",
8444 [ALC883_HAIER_W66] = "haier-w66",
8445 [ALC888_3ST_HP] = "3stack-hp",
8446 [ALC888_6ST_DELL] = "6stack-dell",
8447 [ALC883_MITAC] = "mitac",
8448 [ALC883_CLEVO_M720] = "clevo-m720",
8449 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8450 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8451 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8452 [ALC1200_ASUS_P5Q] = "asus-p5q",
8453 [ALC883_AUTO] = "auto",
8456 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8457 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8458 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8459 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8460 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8461 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8462 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8463 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8464 ALC888_ACER_ASPIRE_4930G),
8465 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8466 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8467 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8468 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8469 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8470 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8471 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8472 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8473 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8474 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8475 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8476 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8477 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8478 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8479 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8480 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8481 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8482 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8483 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8484 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8485 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8486 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8487 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8488 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8489 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8490 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8491 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8492 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8493 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8494 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8495 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8496 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8497 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8498 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8499 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8500 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8501 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8502 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8503 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8504 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8505 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8506 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8507 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8508 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8509 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8510 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8511 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8512 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
8513 ALC888_FUJITSU_XA3530),
8514 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8515 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8516 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8517 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8518 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8519 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8520 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8521 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8522 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8523 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8524 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8525 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8529 static struct alc_config_preset alc883_presets[] = {
8530 [ALC883_3ST_2ch_DIG] = {
8531 .mixers = { alc883_3ST_2ch_mixer },
8532 .init_verbs = { alc883_init_verbs },
8533 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8534 .dac_nids = alc883_dac_nids,
8535 .dig_out_nid = ALC883_DIGOUT_NID,
8536 .dig_in_nid = ALC883_DIGIN_NID,
8537 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8538 .channel_mode = alc883_3ST_2ch_modes,
8539 .input_mux = &alc883_capture_source,
8541 [ALC883_3ST_6ch_DIG] = {
8542 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8543 .init_verbs = { alc883_init_verbs },
8544 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8545 .dac_nids = alc883_dac_nids,
8546 .dig_out_nid = ALC883_DIGOUT_NID,
8547 .dig_in_nid = ALC883_DIGIN_NID,
8548 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8549 .channel_mode = alc883_3ST_6ch_modes,
8551 .input_mux = &alc883_capture_source,
8553 [ALC883_3ST_6ch] = {
8554 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8555 .init_verbs = { alc883_init_verbs },
8556 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8557 .dac_nids = alc883_dac_nids,
8558 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8559 .channel_mode = alc883_3ST_6ch_modes,
8561 .input_mux = &alc883_capture_source,
8563 [ALC883_3ST_6ch_INTEL] = {
8564 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8565 .init_verbs = { alc883_init_verbs },
8566 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8567 .dac_nids = alc883_dac_nids,
8568 .dig_out_nid = ALC883_DIGOUT_NID,
8569 .dig_in_nid = ALC883_DIGIN_NID,
8570 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8571 .channel_mode = alc883_3ST_6ch_intel_modes,
8573 .input_mux = &alc883_3stack_6ch_intel,
8575 [ALC883_6ST_DIG] = {
8576 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8577 .init_verbs = { alc883_init_verbs },
8578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8579 .dac_nids = alc883_dac_nids,
8580 .dig_out_nid = ALC883_DIGOUT_NID,
8581 .dig_in_nid = ALC883_DIGIN_NID,
8582 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8583 .channel_mode = alc883_sixstack_modes,
8584 .input_mux = &alc883_capture_source,
8586 [ALC883_TARGA_DIG] = {
8587 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8588 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8589 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8590 .dac_nids = alc883_dac_nids,
8591 .dig_out_nid = ALC883_DIGOUT_NID,
8592 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8593 .channel_mode = alc883_3ST_6ch_modes,
8595 .input_mux = &alc883_capture_source,
8596 .unsol_event = alc883_tagra_unsol_event,
8597 .init_hook = alc883_tagra_automute,
8599 [ALC883_TARGA_2ch_DIG] = {
8600 .mixers = { alc883_tagra_2ch_mixer},
8601 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8602 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8603 .dac_nids = alc883_dac_nids,
8604 .adc_nids = alc883_adc_nids_alt,
8605 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8606 .dig_out_nid = ALC883_DIGOUT_NID,
8607 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8608 .channel_mode = alc883_3ST_2ch_modes,
8609 .input_mux = &alc883_capture_source,
8610 .unsol_event = alc883_tagra_unsol_event,
8611 .init_hook = alc883_tagra_automute,
8614 .mixers = { alc883_base_mixer },
8615 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8616 * and the headphone jack. Turn this on and rely on the
8617 * standard mute methods whenever the user wants to turn
8618 * these outputs off.
8620 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8621 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8622 .dac_nids = alc883_dac_nids,
8623 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8624 .channel_mode = alc883_3ST_2ch_modes,
8625 .input_mux = &alc883_capture_source,
8627 [ALC883_ACER_ASPIRE] = {
8628 .mixers = { alc883_acer_aspire_mixer },
8629 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8630 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8631 .dac_nids = alc883_dac_nids,
8632 .dig_out_nid = ALC883_DIGOUT_NID,
8633 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8634 .channel_mode = alc883_3ST_2ch_modes,
8635 .input_mux = &alc883_capture_source,
8636 .unsol_event = alc883_acer_aspire_unsol_event,
8637 .init_hook = alc883_acer_aspire_automute,
8639 [ALC888_ACER_ASPIRE_4930G] = {
8640 .mixers = { alc888_base_mixer,
8641 alc883_chmode_mixer },
8642 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8643 alc888_acer_aspire_4930g_verbs },
8644 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8645 .dac_nids = alc883_dac_nids,
8646 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8647 .adc_nids = alc883_adc_nids_rev,
8648 .capsrc_nids = alc883_capsrc_nids_rev,
8649 .dig_out_nid = ALC883_DIGOUT_NID,
8650 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8651 .channel_mode = alc883_3ST_6ch_modes,
8654 ARRAY_SIZE(alc888_2_capture_sources),
8655 .input_mux = alc888_2_capture_sources,
8656 .unsol_event = alc888_acer_aspire_4930g_unsol_event,
8657 .init_hook = alc888_acer_aspire_4930g_automute,
8660 .mixers = { alc883_fivestack_mixer,
8661 alc883_chmode_mixer },
8662 .init_verbs = { alc883_init_verbs,
8663 alc883_medion_eapd_verbs },
8664 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8665 .dac_nids = alc883_dac_nids,
8666 .adc_nids = alc883_adc_nids_alt,
8667 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8668 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8669 .channel_mode = alc883_sixstack_modes,
8670 .input_mux = &alc883_capture_source,
8672 [ALC883_MEDION_MD2] = {
8673 .mixers = { alc883_medion_md2_mixer},
8674 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8675 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8676 .dac_nids = alc883_dac_nids,
8677 .dig_out_nid = ALC883_DIGOUT_NID,
8678 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8679 .channel_mode = alc883_3ST_2ch_modes,
8680 .input_mux = &alc883_capture_source,
8681 .unsol_event = alc883_medion_md2_unsol_event,
8682 .init_hook = alc883_medion_md2_automute,
8684 [ALC883_LAPTOP_EAPD] = {
8685 .mixers = { alc883_base_mixer },
8686 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8687 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8688 .dac_nids = alc883_dac_nids,
8689 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8690 .channel_mode = alc883_3ST_2ch_modes,
8691 .input_mux = &alc883_capture_source,
8693 [ALC883_CLEVO_M720] = {
8694 .mixers = { alc883_clevo_m720_mixer },
8695 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8696 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8697 .dac_nids = alc883_dac_nids,
8698 .dig_out_nid = ALC883_DIGOUT_NID,
8699 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8700 .channel_mode = alc883_3ST_2ch_modes,
8701 .input_mux = &alc883_capture_source,
8702 .unsol_event = alc883_clevo_m720_unsol_event,
8703 .init_hook = alc883_clevo_m720_automute,
8705 [ALC883_LENOVO_101E_2ch] = {
8706 .mixers = { alc883_lenovo_101e_2ch_mixer},
8707 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8708 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8709 .dac_nids = alc883_dac_nids,
8710 .adc_nids = alc883_adc_nids_alt,
8711 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8712 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8713 .channel_mode = alc883_3ST_2ch_modes,
8714 .input_mux = &alc883_lenovo_101e_capture_source,
8715 .unsol_event = alc883_lenovo_101e_unsol_event,
8716 .init_hook = alc883_lenovo_101e_all_automute,
8718 [ALC883_LENOVO_NB0763] = {
8719 .mixers = { alc883_lenovo_nb0763_mixer },
8720 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8721 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8722 .dac_nids = alc883_dac_nids,
8723 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8724 .channel_mode = alc883_3ST_2ch_modes,
8726 .input_mux = &alc883_lenovo_nb0763_capture_source,
8727 .unsol_event = alc883_medion_md2_unsol_event,
8728 .init_hook = alc883_medion_md2_automute,
8730 [ALC888_LENOVO_MS7195_DIG] = {
8731 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8732 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8733 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8734 .dac_nids = alc883_dac_nids,
8735 .dig_out_nid = ALC883_DIGOUT_NID,
8736 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8737 .channel_mode = alc883_3ST_6ch_modes,
8739 .input_mux = &alc883_capture_source,
8740 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8741 .init_hook = alc888_lenovo_ms7195_front_automute,
8743 [ALC883_HAIER_W66] = {
8744 .mixers = { alc883_tagra_2ch_mixer},
8745 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8746 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8747 .dac_nids = alc883_dac_nids,
8748 .dig_out_nid = ALC883_DIGOUT_NID,
8749 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8750 .channel_mode = alc883_3ST_2ch_modes,
8751 .input_mux = &alc883_capture_source,
8752 .unsol_event = alc883_haier_w66_unsol_event,
8753 .init_hook = alc883_haier_w66_automute,
8756 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8757 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8759 .dac_nids = alc883_dac_nids,
8760 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8761 .channel_mode = alc888_3st_hp_modes,
8763 .input_mux = &alc883_capture_source,
8765 [ALC888_6ST_DELL] = {
8766 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8767 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8768 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8769 .dac_nids = alc883_dac_nids,
8770 .dig_out_nid = ALC883_DIGOUT_NID,
8771 .dig_in_nid = ALC883_DIGIN_NID,
8772 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8773 .channel_mode = alc883_sixstack_modes,
8774 .input_mux = &alc883_capture_source,
8775 .unsol_event = alc888_6st_dell_unsol_event,
8776 .init_hook = alc888_6st_dell_front_automute,
8779 .mixers = { alc883_mitac_mixer },
8780 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8781 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8782 .dac_nids = alc883_dac_nids,
8783 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8784 .channel_mode = alc883_3ST_2ch_modes,
8785 .input_mux = &alc883_capture_source,
8786 .unsol_event = alc883_mitac_unsol_event,
8787 .init_hook = alc883_mitac_automute,
8789 [ALC883_FUJITSU_PI2515] = {
8790 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8791 .init_verbs = { alc883_init_verbs,
8792 alc883_2ch_fujitsu_pi2515_verbs},
8793 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8794 .dac_nids = alc883_dac_nids,
8795 .dig_out_nid = ALC883_DIGOUT_NID,
8796 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8797 .channel_mode = alc883_3ST_2ch_modes,
8798 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8799 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8800 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8802 [ALC888_FUJITSU_XA3530] = {
8803 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8804 .init_verbs = { alc883_init_verbs,
8805 alc888_fujitsu_xa3530_verbs },
8806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8807 .dac_nids = alc883_dac_nids,
8808 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8809 .adc_nids = alc883_adc_nids_rev,
8810 .capsrc_nids = alc883_capsrc_nids_rev,
8811 .dig_out_nid = ALC883_DIGOUT_NID,
8812 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8813 .channel_mode = alc888_4ST_8ch_intel_modes,
8815 ARRAY_SIZE(alc888_2_capture_sources),
8816 .input_mux = alc888_2_capture_sources,
8817 .unsol_event = alc888_fujitsu_xa3530_unsol_event,
8818 .init_hook = alc888_fujitsu_xa3530_automute,
8820 [ALC888_LENOVO_SKY] = {
8821 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8822 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8823 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8824 .dac_nids = alc883_dac_nids,
8825 .dig_out_nid = ALC883_DIGOUT_NID,
8826 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8827 .channel_mode = alc883_sixstack_modes,
8829 .input_mux = &alc883_lenovo_sky_capture_source,
8830 .unsol_event = alc883_lenovo_sky_unsol_event,
8831 .init_hook = alc888_lenovo_sky_front_automute,
8833 [ALC888_ASUS_M90V] = {
8834 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8835 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8836 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8837 .dac_nids = alc883_dac_nids,
8838 .dig_out_nid = ALC883_DIGOUT_NID,
8839 .dig_in_nid = ALC883_DIGIN_NID,
8840 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8841 .channel_mode = alc883_3ST_6ch_modes,
8843 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8844 .unsol_event = alc883_mode2_unsol_event,
8845 .init_hook = alc883_mode2_inithook,
8847 [ALC888_ASUS_EEE1601] = {
8848 .mixers = { alc883_asus_eee1601_mixer },
8849 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8850 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8851 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8852 .dac_nids = alc883_dac_nids,
8853 .dig_out_nid = ALC883_DIGOUT_NID,
8854 .dig_in_nid = ALC883_DIGIN_NID,
8855 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8856 .channel_mode = alc883_3ST_2ch_modes,
8858 .input_mux = &alc883_asus_eee1601_capture_source,
8859 .unsol_event = alc883_eee1601_unsol_event,
8860 .init_hook = alc883_eee1601_inithook,
8862 [ALC1200_ASUS_P5Q] = {
8863 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8864 .init_verbs = { alc883_init_verbs },
8865 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8866 .dac_nids = alc883_dac_nids,
8867 .dig_out_nid = ALC1200_DIGOUT_NID,
8868 .dig_in_nid = ALC883_DIGIN_NID,
8869 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8870 .channel_mode = alc883_sixstack_modes,
8871 .input_mux = &alc883_capture_source,
8877 * BIOS auto configuration
8879 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8880 hda_nid_t nid, int pin_type,
8884 struct alc_spec *spec = codec->spec;
8887 alc_set_pin_output(codec, nid, pin_type);
8888 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8891 idx = spec->multiout.dac_nids[dac_idx] - 2;
8892 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8896 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8898 struct alc_spec *spec = codec->spec;
8901 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8902 for (i = 0; i <= HDA_SIDE; i++) {
8903 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8904 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8906 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8911 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8913 struct alc_spec *spec = codec->spec;
8916 pin = spec->autocfg.hp_pins[0];
8917 if (pin) /* connect to front */
8919 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8920 pin = spec->autocfg.speaker_pins[0];
8922 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8925 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8926 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8928 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8930 struct alc_spec *spec = codec->spec;
8933 for (i = 0; i < AUTO_PIN_LAST; i++) {
8934 hda_nid_t nid = spec->autocfg.input_pins[i];
8935 if (alc883_is_input_pin(nid)) {
8936 snd_hda_codec_write(codec, nid, 0,
8937 AC_VERB_SET_PIN_WIDGET_CONTROL,
8938 (i <= AUTO_PIN_FRONT_MIC ?
8939 PIN_VREF80 : PIN_IN));
8940 if (nid != ALC883_PIN_CD_NID)
8941 snd_hda_codec_write(codec, nid, 0,
8942 AC_VERB_SET_AMP_GAIN_MUTE,
8948 #define alc883_auto_init_input_src alc882_auto_init_input_src
8950 /* almost identical with ALC880 parser... */
8951 static int alc883_parse_auto_config(struct hda_codec *codec)
8953 struct alc_spec *spec = codec->spec;
8954 int err = alc880_parse_auto_config(codec);
8959 return 0; /* no config found */
8961 err = alc_auto_add_mic_boost(codec);
8965 /* hack - override the init verbs */
8966 spec->init_verbs[0] = alc883_auto_init_verbs;
8968 return 1; /* config found */
8971 /* additional initialization for auto-configuration model */
8972 static void alc883_auto_init(struct hda_codec *codec)
8974 struct alc_spec *spec = codec->spec;
8975 alc883_auto_init_multi_out(codec);
8976 alc883_auto_init_hp_out(codec);
8977 alc883_auto_init_analog_input(codec);
8978 alc883_auto_init_input_src(codec);
8979 if (spec->unsol_event)
8980 alc_inithook(codec);
8983 static int patch_alc883(struct hda_codec *codec)
8985 struct alc_spec *spec;
8986 int err, board_config;
8988 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8994 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8996 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8999 if (board_config < 0) {
9000 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
9001 "trying auto-probe from BIOS...\n");
9002 board_config = ALC883_AUTO;
9005 if (board_config == ALC883_AUTO) {
9006 /* automatic parse from the BIOS config */
9007 err = alc883_parse_auto_config(codec);
9013 "hda_codec: Cannot set up configuration "
9014 "from BIOS. Using base mode...\n");
9015 board_config = ALC883_3ST_2ch_DIG;
9019 if (board_config != ALC883_AUTO)
9020 setup_preset(spec, &alc883_presets[board_config]);
9022 switch (codec->vendor_id) {
9024 if (codec->revision_id == 0x100101) {
9025 spec->stream_name_analog = "ALC1200 Analog";
9026 spec->stream_name_digital = "ALC1200 Digital";
9028 spec->stream_name_analog = "ALC888 Analog";
9029 spec->stream_name_digital = "ALC888 Digital";
9033 spec->stream_name_analog = "ALC889 Analog";
9034 spec->stream_name_digital = "ALC889 Digital";
9037 spec->stream_name_analog = "ALC883 Analog";
9038 spec->stream_name_digital = "ALC883 Digital";
9042 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9043 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9044 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9046 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9047 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9049 if (!spec->num_adc_nids) {
9050 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9051 spec->adc_nids = alc883_adc_nids;
9053 if (!spec->capsrc_nids)
9054 spec->capsrc_nids = alc883_capsrc_nids;
9055 spec->is_mix_capture = 1; /* matrix-style capture */
9056 if (!spec->cap_mixer)
9057 set_capture_mixer(spec);
9059 spec->vmaster_nid = 0x0c;
9061 codec->patch_ops = alc_patch_ops;
9062 if (board_config == ALC883_AUTO)
9063 spec->init_hook = alc883_auto_init;
9065 #ifdef CONFIG_SND_HDA_POWER_SAVE
9066 if (!spec->loopback.amplist)
9067 spec->loopback.amplist = alc883_loopbacks;
9069 codec->proc_widget_hook = print_realtek_coef;
9078 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9079 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9081 #define alc262_dac_nids alc260_dac_nids
9082 #define alc262_adc_nids alc882_adc_nids
9083 #define alc262_adc_nids_alt alc882_adc_nids_alt
9084 #define alc262_capsrc_nids alc882_capsrc_nids
9085 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9087 #define alc262_modes alc260_modes
9088 #define alc262_capture_source alc882_capture_source
9090 static hda_nid_t alc262_dmic_adc_nids[1] = {
9095 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9097 static struct snd_kcontrol_new alc262_base_mixer[] = {
9098 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9099 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9100 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9101 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9102 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9103 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9106 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9107 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9108 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9109 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9110 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9111 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9112 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9113 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9114 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9115 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9119 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9120 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9121 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9129 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9130 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9132 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9133 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
9134 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9135 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9139 /* update HP, line and mono-out pins according to the master switch */
9140 static void alc262_hp_master_update(struct hda_codec *codec)
9142 struct alc_spec *spec = codec->spec;
9143 int val = spec->master_sw;
9146 snd_hda_codec_write_cache(codec, 0x1b, 0,
9147 AC_VERB_SET_PIN_WIDGET_CONTROL,
9149 snd_hda_codec_write_cache(codec, 0x15, 0,
9150 AC_VERB_SET_PIN_WIDGET_CONTROL,
9152 /* mono (speaker) depending on the HP jack sense */
9153 val = val && !spec->jack_present;
9154 snd_hda_codec_write_cache(codec, 0x16, 0,
9155 AC_VERB_SET_PIN_WIDGET_CONTROL,
9159 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9161 struct alc_spec *spec = codec->spec;
9162 unsigned int presence;
9163 presence = snd_hda_codec_read(codec, 0x1b, 0,
9164 AC_VERB_GET_PIN_SENSE, 0);
9165 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9166 alc262_hp_master_update(codec);
9169 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9171 if ((res >> 26) != ALC880_HP_EVENT)
9173 alc262_hp_bpc_automute(codec);
9176 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9178 struct alc_spec *spec = codec->spec;
9179 unsigned int presence;
9180 presence = snd_hda_codec_read(codec, 0x15, 0,
9181 AC_VERB_GET_PIN_SENSE, 0);
9182 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9183 alc262_hp_master_update(codec);
9186 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9189 if ((res >> 26) != ALC880_HP_EVENT)
9191 alc262_hp_wildwest_automute(codec);
9194 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
9195 struct snd_ctl_elem_value *ucontrol)
9197 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9198 struct alc_spec *spec = codec->spec;
9199 *ucontrol->value.integer.value = spec->master_sw;
9203 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9204 struct snd_ctl_elem_value *ucontrol)
9206 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9207 struct alc_spec *spec = codec->spec;
9208 int val = !!*ucontrol->value.integer.value;
9210 if (val == spec->master_sw)
9212 spec->master_sw = val;
9213 alc262_hp_master_update(codec);
9217 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9220 .name = "Master Playback Switch",
9221 .info = snd_ctl_boolean_mono_info,
9222 .get = alc262_hp_master_sw_get,
9223 .put = alc262_hp_master_sw_put,
9225 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9226 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9228 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9230 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9235 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9236 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9237 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9238 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9239 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9242 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9243 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9244 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9245 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9249 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9252 .name = "Master Playback Switch",
9253 .info = snd_ctl_boolean_mono_info,
9254 .get = alc262_hp_master_sw_get,
9255 .put = alc262_hp_master_sw_put,
9257 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9258 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9259 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9261 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9263 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9265 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9266 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9267 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9268 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9269 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9270 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9271 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9272 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
9273 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
9277 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9278 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9279 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9280 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9284 /* mute/unmute internal speaker according to the hp jack and mute state */
9285 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
9287 struct alc_spec *spec = codec->spec;
9289 if (force || !spec->sense_updated) {
9290 unsigned int present;
9291 present = snd_hda_codec_read(codec, 0x15, 0,
9292 AC_VERB_GET_PIN_SENSE, 0);
9293 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9294 spec->sense_updated = 1;
9296 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9297 spec->jack_present ? HDA_AMP_MUTE : 0);
9300 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9303 if ((res >> 26) != ALC880_HP_EVENT)
9305 alc262_hp_t5735_automute(codec, 1);
9308 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9310 alc262_hp_t5735_automute(codec, 1);
9313 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9314 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9315 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9316 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9317 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9320 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9324 static struct hda_verb alc262_hp_t5735_verbs[] = {
9325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9328 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9332 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9333 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9335 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9336 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9337 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9338 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9342 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9343 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9344 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9345 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9346 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9347 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9348 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9351 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9356 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9363 /* bind hp and internal speaker mute (with plug check) */
9364 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9365 struct snd_ctl_elem_value *ucontrol)
9367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9368 long *valp = ucontrol->value.integer.value;
9371 /* change hp mute */
9372 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9374 valp[0] ? 0 : HDA_AMP_MUTE);
9375 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9377 valp[1] ? 0 : HDA_AMP_MUTE);
9379 /* change speaker according to HP jack state */
9380 struct alc_spec *spec = codec->spec;
9382 if (spec->jack_present)
9383 mute = HDA_AMP_MUTE;
9385 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9387 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9388 HDA_AMP_MUTE, mute);
9393 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9394 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9396 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9397 .name = "Master Playback Switch",
9398 .info = snd_hda_mixer_amp_switch_info,
9399 .get = snd_hda_mixer_amp_switch_get,
9400 .put = alc262_sony_master_sw_put,
9401 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9403 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9404 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9405 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9406 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9410 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9411 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9412 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9413 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9414 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9415 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9416 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9417 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9421 #define alc262_capture_mixer alc882_capture_mixer
9422 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9425 * generic initialization of ADC, input mixers and output mixers
9427 static struct hda_verb alc262_init_verbs[] = {
9429 * Unmute ADC0-2 and set the default input to mic-in
9431 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9433 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9434 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9435 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9436 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9438 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9440 * Note: PASD motherboards uses the Line In 2 as the input for
9441 * front panel mic (mic 2)
9443 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9451 * Set up output mixers (0x0c - 0x0e)
9453 /* set vol=0 to output mixers */
9454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9455 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9456 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9457 /* set up input amps for analog loopback */
9458 /* Amp Indices: DAC = 0, mixer = 1 */
9459 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9461 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9463 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9468 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9469 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9470 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9471 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9474 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9475 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9476 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9477 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9479 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9480 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9482 /* FIXME: use matrix-type input source selection */
9483 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9484 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9485 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9487 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9492 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9497 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9498 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9503 static struct hda_verb alc262_eapd_verbs[] = {
9504 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9505 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9509 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9510 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9511 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9515 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9517 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9518 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9520 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9521 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9525 static struct hda_verb alc262_sony_unsol_verbs[] = {
9526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9527 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9528 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9530 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9531 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9535 static struct hda_input_mux alc262_dmic_capture_source = {
9538 { "Int DMic", 0x9 },
9543 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9544 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9545 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9548 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9552 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9553 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9554 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9556 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9557 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9558 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9559 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9560 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9564 static void alc262_dmic_automute(struct hda_codec *codec)
9566 unsigned int present;
9568 present = snd_hda_codec_read(codec, 0x18, 0,
9569 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9570 snd_hda_codec_write(codec, 0x22, 0,
9571 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9574 /* toggle speaker-output according to the hp-jack state */
9575 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9577 unsigned int present;
9580 present = snd_hda_codec_read(codec, 0x15, 0,
9581 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9582 bits = present ? 0 : PIN_OUT;
9583 snd_hda_codec_write(codec, 0x14, 0,
9584 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9589 /* unsolicited event for HP jack sensing */
9590 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9593 if ((res >> 26) == ALC880_HP_EVENT)
9594 alc262_toshiba_s06_speaker_automute(codec);
9595 if ((res >> 26) == ALC880_MIC_EVENT)
9596 alc262_dmic_automute(codec);
9600 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9602 alc262_toshiba_s06_speaker_automute(codec);
9603 alc262_dmic_automute(codec);
9606 /* mute/unmute internal speaker according to the hp jack and mute state */
9607 static void alc262_hippo_automute(struct hda_codec *codec)
9609 struct alc_spec *spec = codec->spec;
9611 unsigned int present;
9613 /* need to execute and sync at first */
9614 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9615 present = snd_hda_codec_read(codec, 0x15, 0,
9616 AC_VERB_GET_PIN_SENSE, 0);
9617 spec->jack_present = (present & 0x80000000) != 0;
9618 if (spec->jack_present) {
9619 /* mute internal speaker */
9620 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9621 HDA_AMP_MUTE, HDA_AMP_MUTE);
9623 /* unmute internal speaker if necessary */
9624 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9625 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9626 HDA_AMP_MUTE, mute);
9630 /* unsolicited event for HP jack sensing */
9631 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9634 if ((res >> 26) != ALC880_HP_EVENT)
9636 alc262_hippo_automute(codec);
9639 static void alc262_hippo1_automute(struct hda_codec *codec)
9642 unsigned int present;
9644 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9645 present = snd_hda_codec_read(codec, 0x1b, 0,
9646 AC_VERB_GET_PIN_SENSE, 0);
9647 present = (present & 0x80000000) != 0;
9649 /* mute internal speaker */
9650 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9651 HDA_AMP_MUTE, HDA_AMP_MUTE);
9653 /* unmute internal speaker if necessary */
9654 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9655 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9656 HDA_AMP_MUTE, mute);
9660 /* unsolicited event for HP jack sensing */
9661 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9664 if ((res >> 26) != ALC880_HP_EVENT)
9666 alc262_hippo1_automute(codec);
9672 * 0x16 = internal speaker
9673 * 0x18 = external mic
9676 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9677 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9678 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9682 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9684 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9685 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9689 static struct hda_verb alc262_nec_verbs[] = {
9690 /* Unmute Speaker */
9691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9694 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9695 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9697 /* External mic to headphone */
9698 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9699 /* External mic to speaker */
9700 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9706 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9707 * 0x1b = port replicator headphone out
9710 #define ALC_HP_EVENT 0x37
9712 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9713 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9714 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9715 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9716 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9720 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9721 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9722 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9726 static struct hda_input_mux alc262_fujitsu_capture_source = {
9735 static struct hda_input_mux alc262_HP_capture_source = {
9739 { "Front Mic", 0x1 },
9746 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9750 { "Front Mic", 0x2 },
9756 /* mute/unmute internal speaker according to the hp jacks and mute state */
9757 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9759 struct alc_spec *spec = codec->spec;
9762 if (force || !spec->sense_updated) {
9763 unsigned int present;
9764 /* need to execute and sync at first */
9765 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9766 /* check laptop HP jack */
9767 present = snd_hda_codec_read(codec, 0x14, 0,
9768 AC_VERB_GET_PIN_SENSE, 0);
9769 /* need to execute and sync at first */
9770 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9771 /* check docking HP jack */
9772 present |= snd_hda_codec_read(codec, 0x1b, 0,
9773 AC_VERB_GET_PIN_SENSE, 0);
9774 if (present & AC_PINSENSE_PRESENCE)
9775 spec->jack_present = 1;
9777 spec->jack_present = 0;
9778 spec->sense_updated = 1;
9780 /* unmute internal speaker only if both HPs are unplugged and
9781 * master switch is on
9783 if (spec->jack_present)
9784 mute = HDA_AMP_MUTE;
9786 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9787 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9788 HDA_AMP_MUTE, mute);
9791 /* unsolicited event for HP jack sensing */
9792 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9795 if ((res >> 26) != ALC_HP_EVENT)
9797 alc262_fujitsu_automute(codec, 1);
9800 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9802 alc262_fujitsu_automute(codec, 1);
9805 /* bind volumes of both NID 0x0c and 0x0d */
9806 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9807 .ops = &snd_hda_bind_vol,
9809 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9810 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9815 /* mute/unmute internal speaker according to the hp jack and mute state */
9816 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9818 struct alc_spec *spec = codec->spec;
9821 if (force || !spec->sense_updated) {
9822 unsigned int present_int_hp;
9823 /* need to execute and sync at first */
9824 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9825 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9826 AC_VERB_GET_PIN_SENSE, 0);
9827 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9828 spec->sense_updated = 1;
9830 if (spec->jack_present) {
9831 /* mute internal speaker */
9832 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9833 HDA_AMP_MUTE, HDA_AMP_MUTE);
9834 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9835 HDA_AMP_MUTE, HDA_AMP_MUTE);
9837 /* unmute internal speaker if necessary */
9838 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9839 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9840 HDA_AMP_MUTE, mute);
9841 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9842 HDA_AMP_MUTE, mute);
9846 /* unsolicited event for HP jack sensing */
9847 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9850 if ((res >> 26) != ALC_HP_EVENT)
9852 alc262_lenovo_3000_automute(codec, 1);
9855 /* bind hp and internal speaker mute (with plug check) */
9856 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9857 struct snd_ctl_elem_value *ucontrol)
9859 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9860 long *valp = ucontrol->value.integer.value;
9863 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9865 valp ? 0 : HDA_AMP_MUTE);
9866 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9868 valp ? 0 : HDA_AMP_MUTE);
9871 alc262_fujitsu_automute(codec, 0);
9875 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9876 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9878 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9879 .name = "Master Playback Switch",
9880 .info = snd_hda_mixer_amp_switch_info,
9881 .get = snd_hda_mixer_amp_switch_get,
9882 .put = alc262_fujitsu_master_sw_put,
9883 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9885 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9886 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9887 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9888 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9892 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9893 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9894 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9898 /* bind hp and internal speaker mute (with plug check) */
9899 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9900 struct snd_ctl_elem_value *ucontrol)
9902 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9903 long *valp = ucontrol->value.integer.value;
9906 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9908 valp ? 0 : HDA_AMP_MUTE);
9911 alc262_lenovo_3000_automute(codec, 0);
9915 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9916 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9918 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9919 .name = "Master Playback Switch",
9920 .info = snd_hda_mixer_amp_switch_info,
9921 .get = snd_hda_mixer_amp_switch_get,
9922 .put = alc262_lenovo_3000_master_sw_put,
9923 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9925 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9926 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9927 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9930 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9931 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9932 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9936 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9937 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9939 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9940 .name = "Master Playback Switch",
9941 .info = snd_hda_mixer_amp_switch_info,
9942 .get = snd_hda_mixer_amp_switch_get,
9943 .put = alc262_sony_master_sw_put,
9944 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9949 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9950 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9951 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9955 /* additional init verbs for Benq laptops */
9956 static struct hda_verb alc262_EAPD_verbs[] = {
9957 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9958 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9962 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9963 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9964 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9966 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9967 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9971 /* Samsung Q1 Ultra Vista model setup */
9972 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9973 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9974 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9976 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9977 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9978 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9982 static struct hda_verb alc262_ultra_verbs[] = {
9984 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9988 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9989 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9990 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9991 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9993 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9996 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9997 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9999 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10001 /* ADC, choose mic */
10002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10003 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10004 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10005 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10006 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10007 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10008 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10009 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10010 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10011 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10015 /* mute/unmute internal speaker according to the hp jack and mute state */
10016 static void alc262_ultra_automute(struct hda_codec *codec)
10018 struct alc_spec *spec = codec->spec;
10022 /* auto-mute only when HP is used as HP */
10023 if (!spec->cur_mux[0]) {
10024 unsigned int present;
10025 /* need to execute and sync at first */
10026 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10027 present = snd_hda_codec_read(codec, 0x15, 0,
10028 AC_VERB_GET_PIN_SENSE, 0);
10029 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10030 if (spec->jack_present)
10031 mute = HDA_AMP_MUTE;
10033 /* mute/unmute internal speaker */
10034 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10035 HDA_AMP_MUTE, mute);
10036 /* mute/unmute HP */
10037 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10038 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10041 /* unsolicited event for HP jack sensing */
10042 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10045 if ((res >> 26) != ALC880_HP_EVENT)
10047 alc262_ultra_automute(codec);
10050 static struct hda_input_mux alc262_ultra_capture_source = {
10054 { "Headphone", 0x7 },
10058 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10059 struct snd_ctl_elem_value *ucontrol)
10061 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10062 struct alc_spec *spec = codec->spec;
10065 ret = alc_mux_enum_put(kcontrol, ucontrol);
10068 /* reprogram the HP pin as mic or HP according to the input source */
10069 snd_hda_codec_write_cache(codec, 0x15, 0,
10070 AC_VERB_SET_PIN_WIDGET_CONTROL,
10071 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10072 alc262_ultra_automute(codec); /* mute/unmute HP */
10076 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10077 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10078 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10080 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10081 .name = "Capture Source",
10082 .info = alc_mux_enum_info,
10083 .get = alc_mux_enum_get,
10084 .put = alc262_ultra_mux_enum_put,
10089 /* add playback controls from the parsed DAC table */
10090 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10091 const struct auto_pin_cfg *cfg)
10096 spec->multiout.num_dacs = 1; /* only use one dac */
10097 spec->multiout.dac_nids = spec->private_dac_nids;
10098 spec->multiout.dac_nids[0] = 2;
10100 nid = cfg->line_out_pins[0];
10102 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10103 "Front Playback Volume",
10104 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10107 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10108 "Front Playback Switch",
10109 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10114 nid = cfg->speaker_pins[0];
10117 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10118 "Speaker Playback Volume",
10119 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10123 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10124 "Speaker Playback Switch",
10125 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10130 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10131 "Speaker Playback Switch",
10132 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10138 nid = cfg->hp_pins[0];
10140 /* spec->multiout.hp_nid = 2; */
10142 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10143 "Headphone Playback Volume",
10144 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10148 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10149 "Headphone Playback Switch",
10150 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10155 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10156 "Headphone Playback Switch",
10157 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10166 /* identical with ALC880 */
10167 #define alc262_auto_create_analog_input_ctls \
10168 alc880_auto_create_analog_input_ctls
10171 * generic initialization of ADC, input mixers and output mixers
10173 static struct hda_verb alc262_volume_init_verbs[] = {
10175 * Unmute ADC0-2 and set the default input to mic-in
10177 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10179 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10180 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10181 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10182 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10184 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10186 * Note: PASD motherboards uses the Line In 2 as the input for
10187 * front panel mic (mic 2)
10189 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10190 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10191 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10192 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10193 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10194 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10197 * Set up output mixers (0x0c - 0x0f)
10199 /* set vol=0 to output mixers */
10200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10201 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10202 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10204 /* set up input amps for analog loopback */
10205 /* Amp Indices: DAC = 0, mixer = 1 */
10206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10208 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10209 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10210 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10213 /* FIXME: use matrix-type input source selection */
10214 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10215 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10216 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10217 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10221 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10222 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10223 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10224 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10226 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10227 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10228 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10229 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10234 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10236 * Unmute ADC0-2 and set the default input to mic-in
10238 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10239 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10240 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10241 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10242 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10245 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10247 * Note: PASD motherboards uses the Line In 2 as the input for
10248 * front panel mic (mic 2)
10250 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10256 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10257 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10260 * Set up output mixers (0x0c - 0x0e)
10262 /* set vol=0 to output mixers */
10263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10264 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10267 /* set up input amps for analog loopback */
10268 /* Amp Indices: DAC = 0, mixer = 1 */
10269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10271 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10272 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10273 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10274 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10276 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10277 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10278 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10280 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10283 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10284 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10287 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10288 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10289 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10290 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10292 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10293 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10295 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10296 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10297 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10300 /* FIXME: use matrix-type input source selection */
10301 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10302 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10318 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10323 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10325 * Unmute ADC0-2 and set the default input to mic-in
10327 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10329 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10330 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10331 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10332 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10334 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10336 * Note: PASD motherboards uses the Line In 2 as the input for front
10337 * panel mic (mic 2)
10339 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10347 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10349 * Set up output mixers (0x0c - 0x0e)
10351 /* set vol=0 to output mixers */
10352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10356 /* set up input amps for analog loopback */
10357 /* Amp Indices: DAC = 0, mixer = 1 */
10358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10362 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10363 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10367 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10368 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10369 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10370 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10371 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10372 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10374 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10377 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10378 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10380 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10381 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10382 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10383 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10384 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10385 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10387 /* FIXME: use matrix-type input source selection */
10388 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10389 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10391 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10395 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10403 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10407 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10408 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10409 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10411 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10414 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10419 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10421 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10422 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10423 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10425 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10426 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10427 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10432 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10437 #ifdef CONFIG_SND_HDA_POWER_SAVE
10438 #define alc262_loopbacks alc880_loopbacks
10441 /* pcm configuration: identiacal with ALC880 */
10442 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10443 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10444 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10445 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10448 * BIOS auto configuration
10450 static int alc262_parse_auto_config(struct hda_codec *codec)
10452 struct alc_spec *spec = codec->spec;
10454 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10456 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10460 if (!spec->autocfg.line_outs)
10461 return 0; /* can't find valid BIOS pin config */
10462 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10465 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10469 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10471 if (spec->autocfg.dig_out_pin)
10472 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10473 if (spec->autocfg.dig_in_pin)
10474 spec->dig_in_nid = ALC262_DIGIN_NID;
10476 if (spec->kctls.list)
10477 add_mixer(spec, spec->kctls.list);
10479 add_verb(spec, alc262_volume_init_verbs);
10480 spec->num_mux_defs = 1;
10481 spec->input_mux = &spec->private_imux;
10483 err = alc_auto_add_mic_boost(codec);
10487 store_pin_configs(codec);
10491 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10492 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10493 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10494 #define alc262_auto_init_input_src alc882_auto_init_input_src
10497 /* init callback for auto-configuration model -- overriding the default init */
10498 static void alc262_auto_init(struct hda_codec *codec)
10500 struct alc_spec *spec = codec->spec;
10501 alc262_auto_init_multi_out(codec);
10502 alc262_auto_init_hp_out(codec);
10503 alc262_auto_init_analog_input(codec);
10504 alc262_auto_init_input_src(codec);
10505 if (spec->unsol_event)
10506 alc_inithook(codec);
10510 * configuration and preset
10512 static const char *alc262_models[ALC262_MODEL_LAST] = {
10513 [ALC262_BASIC] = "basic",
10514 [ALC262_HIPPO] = "hippo",
10515 [ALC262_HIPPO_1] = "hippo_1",
10516 [ALC262_FUJITSU] = "fujitsu",
10517 [ALC262_HP_BPC] = "hp-bpc",
10518 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10519 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10520 [ALC262_HP_RP5700] = "hp-rp5700",
10521 [ALC262_BENQ_ED8] = "benq",
10522 [ALC262_BENQ_T31] = "benq-t31",
10523 [ALC262_SONY_ASSAMD] = "sony-assamd",
10524 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10525 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10526 [ALC262_ULTRA] = "ultra",
10527 [ALC262_LENOVO_3000] = "lenovo-3000",
10528 [ALC262_NEC] = "nec",
10529 [ALC262_AUTO] = "auto",
10532 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10533 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10534 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10535 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10536 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10537 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10538 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10539 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10540 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10541 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10542 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10543 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10544 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10545 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10546 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10547 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10548 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10549 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10550 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10551 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10552 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10553 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10554 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10555 ALC262_HP_TC_T5735),
10556 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10557 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10558 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10559 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10560 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10561 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10562 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10563 ALC262_TOSHIBA_RX1),
10564 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10565 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10566 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10567 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10568 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10569 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10570 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10571 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10572 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10576 static struct alc_config_preset alc262_presets[] = {
10578 .mixers = { alc262_base_mixer },
10579 .init_verbs = { alc262_init_verbs },
10580 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10581 .dac_nids = alc262_dac_nids,
10583 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10584 .channel_mode = alc262_modes,
10585 .input_mux = &alc262_capture_source,
10588 .mixers = { alc262_base_mixer },
10589 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10590 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10591 .dac_nids = alc262_dac_nids,
10593 .dig_out_nid = ALC262_DIGOUT_NID,
10594 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10595 .channel_mode = alc262_modes,
10596 .input_mux = &alc262_capture_source,
10597 .unsol_event = alc262_hippo_unsol_event,
10598 .init_hook = alc262_hippo_automute,
10600 [ALC262_HIPPO_1] = {
10601 .mixers = { alc262_hippo1_mixer },
10602 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10603 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10604 .dac_nids = alc262_dac_nids,
10606 .dig_out_nid = ALC262_DIGOUT_NID,
10607 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10608 .channel_mode = alc262_modes,
10609 .input_mux = &alc262_capture_source,
10610 .unsol_event = alc262_hippo1_unsol_event,
10611 .init_hook = alc262_hippo1_automute,
10613 [ALC262_FUJITSU] = {
10614 .mixers = { alc262_fujitsu_mixer },
10615 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10616 alc262_fujitsu_unsol_verbs },
10617 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10618 .dac_nids = alc262_dac_nids,
10620 .dig_out_nid = ALC262_DIGOUT_NID,
10621 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10622 .channel_mode = alc262_modes,
10623 .input_mux = &alc262_fujitsu_capture_source,
10624 .unsol_event = alc262_fujitsu_unsol_event,
10625 .init_hook = alc262_fujitsu_init_hook,
10627 [ALC262_HP_BPC] = {
10628 .mixers = { alc262_HP_BPC_mixer },
10629 .init_verbs = { alc262_HP_BPC_init_verbs },
10630 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10631 .dac_nids = alc262_dac_nids,
10633 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10634 .channel_mode = alc262_modes,
10635 .input_mux = &alc262_HP_capture_source,
10636 .unsol_event = alc262_hp_bpc_unsol_event,
10637 .init_hook = alc262_hp_bpc_automute,
10639 [ALC262_HP_BPC_D7000_WF] = {
10640 .mixers = { alc262_HP_BPC_WildWest_mixer },
10641 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10642 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10643 .dac_nids = alc262_dac_nids,
10645 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10646 .channel_mode = alc262_modes,
10647 .input_mux = &alc262_HP_D7000_capture_source,
10648 .unsol_event = alc262_hp_wildwest_unsol_event,
10649 .init_hook = alc262_hp_wildwest_automute,
10651 [ALC262_HP_BPC_D7000_WL] = {
10652 .mixers = { alc262_HP_BPC_WildWest_mixer,
10653 alc262_HP_BPC_WildWest_option_mixer },
10654 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10655 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10656 .dac_nids = alc262_dac_nids,
10658 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10659 .channel_mode = alc262_modes,
10660 .input_mux = &alc262_HP_D7000_capture_source,
10661 .unsol_event = alc262_hp_wildwest_unsol_event,
10662 .init_hook = alc262_hp_wildwest_automute,
10664 [ALC262_HP_TC_T5735] = {
10665 .mixers = { alc262_hp_t5735_mixer },
10666 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10667 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10668 .dac_nids = alc262_dac_nids,
10670 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10671 .channel_mode = alc262_modes,
10672 .input_mux = &alc262_capture_source,
10673 .unsol_event = alc262_hp_t5735_unsol_event,
10674 .init_hook = alc262_hp_t5735_init_hook,
10676 [ALC262_HP_RP5700] = {
10677 .mixers = { alc262_hp_rp5700_mixer },
10678 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10679 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10680 .dac_nids = alc262_dac_nids,
10681 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10682 .channel_mode = alc262_modes,
10683 .input_mux = &alc262_hp_rp5700_capture_source,
10685 [ALC262_BENQ_ED8] = {
10686 .mixers = { alc262_base_mixer },
10687 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10688 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10689 .dac_nids = alc262_dac_nids,
10691 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10692 .channel_mode = alc262_modes,
10693 .input_mux = &alc262_capture_source,
10695 [ALC262_SONY_ASSAMD] = {
10696 .mixers = { alc262_sony_mixer },
10697 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10698 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10699 .dac_nids = alc262_dac_nids,
10701 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10702 .channel_mode = alc262_modes,
10703 .input_mux = &alc262_capture_source,
10704 .unsol_event = alc262_hippo_unsol_event,
10705 .init_hook = alc262_hippo_automute,
10707 [ALC262_BENQ_T31] = {
10708 .mixers = { alc262_benq_t31_mixer },
10709 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10710 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10711 .dac_nids = alc262_dac_nids,
10713 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10714 .channel_mode = alc262_modes,
10715 .input_mux = &alc262_capture_source,
10716 .unsol_event = alc262_hippo_unsol_event,
10717 .init_hook = alc262_hippo_automute,
10720 .mixers = { alc262_ultra_mixer },
10721 .cap_mixer = alc262_ultra_capture_mixer,
10722 .init_verbs = { alc262_ultra_verbs },
10723 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10724 .dac_nids = alc262_dac_nids,
10725 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10726 .channel_mode = alc262_modes,
10727 .input_mux = &alc262_ultra_capture_source,
10728 .adc_nids = alc262_adc_nids, /* ADC0 */
10729 .capsrc_nids = alc262_capsrc_nids,
10730 .num_adc_nids = 1, /* single ADC */
10731 .unsol_event = alc262_ultra_unsol_event,
10732 .init_hook = alc262_ultra_automute,
10734 [ALC262_LENOVO_3000] = {
10735 .mixers = { alc262_lenovo_3000_mixer },
10736 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10737 alc262_lenovo_3000_unsol_verbs },
10738 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10739 .dac_nids = alc262_dac_nids,
10741 .dig_out_nid = ALC262_DIGOUT_NID,
10742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10743 .channel_mode = alc262_modes,
10744 .input_mux = &alc262_fujitsu_capture_source,
10745 .unsol_event = alc262_lenovo_3000_unsol_event,
10748 .mixers = { alc262_nec_mixer },
10749 .init_verbs = { alc262_nec_verbs },
10750 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10751 .dac_nids = alc262_dac_nids,
10753 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10754 .channel_mode = alc262_modes,
10755 .input_mux = &alc262_capture_source,
10757 [ALC262_TOSHIBA_S06] = {
10758 .mixers = { alc262_toshiba_s06_mixer },
10759 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10760 alc262_eapd_verbs },
10761 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10762 .capsrc_nids = alc262_dmic_capsrc_nids,
10763 .dac_nids = alc262_dac_nids,
10764 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10765 .dig_out_nid = ALC262_DIGOUT_NID,
10766 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10767 .channel_mode = alc262_modes,
10768 .input_mux = &alc262_dmic_capture_source,
10769 .unsol_event = alc262_toshiba_s06_unsol_event,
10770 .init_hook = alc262_toshiba_s06_init_hook,
10772 [ALC262_TOSHIBA_RX1] = {
10773 .mixers = { alc262_toshiba_rx1_mixer },
10774 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10775 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10776 .dac_nids = alc262_dac_nids,
10778 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10779 .channel_mode = alc262_modes,
10780 .input_mux = &alc262_capture_source,
10781 .unsol_event = alc262_hippo_unsol_event,
10782 .init_hook = alc262_hippo_automute,
10786 static int patch_alc262(struct hda_codec *codec)
10788 struct alc_spec *spec;
10792 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10796 codec->spec = spec;
10798 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10803 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10804 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10805 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10806 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10810 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10812 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10816 if (board_config < 0) {
10817 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10818 "trying auto-probe from BIOS...\n");
10819 board_config = ALC262_AUTO;
10822 if (board_config == ALC262_AUTO) {
10823 /* automatic parse from the BIOS config */
10824 err = alc262_parse_auto_config(codec);
10830 "hda_codec: Cannot set up configuration "
10831 "from BIOS. Using base mode...\n");
10832 board_config = ALC262_BASIC;
10836 if (board_config != ALC262_AUTO)
10837 setup_preset(spec, &alc262_presets[board_config]);
10839 spec->stream_name_analog = "ALC262 Analog";
10840 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10841 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10843 spec->stream_name_digital = "ALC262 Digital";
10844 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10845 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10847 spec->is_mix_capture = 1;
10848 if (!spec->adc_nids && spec->input_mux) {
10849 /* check whether NID 0x07 is valid */
10850 unsigned int wcap = get_wcaps(codec, 0x07);
10853 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10854 if (wcap != AC_WID_AUD_IN) {
10855 spec->adc_nids = alc262_adc_nids_alt;
10856 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10857 spec->capsrc_nids = alc262_capsrc_nids_alt;
10859 spec->adc_nids = alc262_adc_nids;
10860 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10861 spec->capsrc_nids = alc262_capsrc_nids;
10864 if (!spec->cap_mixer)
10865 set_capture_mixer(spec);
10867 spec->vmaster_nid = 0x0c;
10869 codec->patch_ops = alc_patch_ops;
10870 if (board_config == ALC262_AUTO)
10871 spec->init_hook = alc262_auto_init;
10872 #ifdef CONFIG_SND_HDA_POWER_SAVE
10873 if (!spec->loopback.amplist)
10874 spec->loopback.amplist = alc262_loopbacks;
10876 codec->proc_widget_hook = print_realtek_coef;
10882 * ALC268 channel source setting (2 channel)
10884 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10885 #define alc268_modes alc260_modes
10887 static hda_nid_t alc268_dac_nids[2] = {
10892 static hda_nid_t alc268_adc_nids[2] = {
10897 static hda_nid_t alc268_adc_nids_alt[1] = {
10902 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10904 static struct snd_kcontrol_new alc268_base_mixer[] = {
10905 /* output mixer control */
10906 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10907 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10910 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10911 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10912 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10916 /* bind Beep switches of both NID 0x0f and 0x10 */
10917 static struct hda_bind_ctls alc268_bind_beep_sw = {
10918 .ops = &snd_hda_bind_sw,
10920 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10921 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10926 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10927 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10928 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10932 static struct hda_verb alc268_eapd_verbs[] = {
10933 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10934 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10938 /* Toshiba specific */
10939 #define alc268_toshiba_automute alc262_hippo_automute
10941 static struct hda_verb alc268_toshiba_verbs[] = {
10942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10946 static struct hda_input_mux alc268_acer_lc_capture_source = {
10954 /* Acer specific */
10955 /* bind volumes of both NID 0x02 and 0x03 */
10956 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10957 .ops = &snd_hda_bind_vol,
10959 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10960 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10965 /* mute/unmute internal speaker according to the hp jack and mute state */
10966 static void alc268_acer_automute(struct hda_codec *codec, int force)
10968 struct alc_spec *spec = codec->spec;
10971 if (force || !spec->sense_updated) {
10972 unsigned int present;
10973 present = snd_hda_codec_read(codec, 0x14, 0,
10974 AC_VERB_GET_PIN_SENSE, 0);
10975 spec->jack_present = (present & 0x80000000) != 0;
10976 spec->sense_updated = 1;
10978 if (spec->jack_present)
10979 mute = HDA_AMP_MUTE; /* mute internal speaker */
10980 else /* unmute internal speaker if necessary */
10981 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10982 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10983 HDA_AMP_MUTE, mute);
10987 /* bind hp and internal speaker mute (with plug check) */
10988 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10989 struct snd_ctl_elem_value *ucontrol)
10991 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10992 long *valp = ucontrol->value.integer.value;
10995 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10997 valp[0] ? 0 : HDA_AMP_MUTE);
10998 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11000 valp[1] ? 0 : HDA_AMP_MUTE);
11002 alc268_acer_automute(codec, 0);
11006 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11007 /* output mixer control */
11008 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11010 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11011 .name = "Master Playback Switch",
11012 .info = snd_hda_mixer_amp_switch_info,
11013 .get = snd_hda_mixer_amp_switch_get,
11014 .put = alc268_acer_master_sw_put,
11015 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11017 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11021 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11022 /* output mixer control */
11023 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11025 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11026 .name = "Master Playback Switch",
11027 .info = snd_hda_mixer_amp_switch_info,
11028 .get = snd_hda_mixer_amp_switch_get,
11029 .put = alc268_acer_master_sw_put,
11030 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11033 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11034 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11038 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11039 /* output mixer control */
11040 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11042 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11043 .name = "Master Playback Switch",
11044 .info = snd_hda_mixer_amp_switch_info,
11045 .get = snd_hda_mixer_amp_switch_get,
11046 .put = alc268_acer_master_sw_put,
11047 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11050 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11054 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11055 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11057 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11058 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11059 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11064 static struct hda_verb alc268_acer_verbs[] = {
11065 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11066 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11071 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11075 /* unsolicited event for HP jack sensing */
11076 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
11079 if ((res >> 26) != ALC880_HP_EVENT)
11081 alc268_toshiba_automute(codec);
11084 static void alc268_acer_unsol_event(struct hda_codec *codec,
11087 if ((res >> 26) != ALC880_HP_EVENT)
11089 alc268_acer_automute(codec, 1);
11092 static void alc268_acer_init_hook(struct hda_codec *codec)
11094 alc268_acer_automute(codec, 1);
11097 /* toggle speaker-output according to the hp-jack state */
11098 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11100 unsigned int present;
11101 unsigned char bits;
11103 present = snd_hda_codec_read(codec, 0x15, 0,
11104 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11105 bits = present ? AMP_IN_MUTE(0) : 0;
11106 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11107 AMP_IN_MUTE(0), bits);
11108 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11109 AMP_IN_MUTE(0), bits);
11113 static void alc268_acer_mic_automute(struct hda_codec *codec)
11115 unsigned int present;
11117 present = snd_hda_codec_read(codec, 0x18, 0,
11118 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11119 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11120 present ? 0x0 : 0x6);
11123 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11126 if ((res >> 26) == ALC880_HP_EVENT)
11127 alc268_aspire_one_speaker_automute(codec);
11128 if ((res >> 26) == ALC880_MIC_EVENT)
11129 alc268_acer_mic_automute(codec);
11132 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11134 alc268_aspire_one_speaker_automute(codec);
11135 alc268_acer_mic_automute(codec);
11138 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11139 /* output mixer control */
11140 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11141 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11142 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11145 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11149 static struct hda_verb alc268_dell_verbs[] = {
11150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11151 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11152 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11156 /* mute/unmute internal speaker according to the hp jack and mute state */
11157 static void alc268_dell_automute(struct hda_codec *codec)
11159 unsigned int present;
11162 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11163 if (present & 0x80000000)
11164 mute = HDA_AMP_MUTE;
11166 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11167 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11168 HDA_AMP_MUTE, mute);
11171 static void alc268_dell_unsol_event(struct hda_codec *codec,
11174 if ((res >> 26) != ALC880_HP_EVENT)
11176 alc268_dell_automute(codec);
11179 #define alc268_dell_init_hook alc268_dell_automute
11181 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11182 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11183 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11184 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11185 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11186 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11187 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11188 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11189 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11193 static struct hda_verb alc267_quanta_il1_verbs[] = {
11194 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11195 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11199 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11201 unsigned int present;
11203 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11204 & AC_PINSENSE_PRESENCE;
11205 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11206 present ? 0 : PIN_OUT);
11209 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11211 unsigned int present;
11213 present = snd_hda_codec_read(codec, 0x18, 0,
11214 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11215 snd_hda_codec_write(codec, 0x23, 0,
11216 AC_VERB_SET_CONNECT_SEL,
11217 present ? 0x00 : 0x01);
11220 static void alc267_quanta_il1_automute(struct hda_codec *codec)
11222 alc267_quanta_il1_hp_automute(codec);
11223 alc267_quanta_il1_mic_automute(codec);
11226 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11229 switch (res >> 26) {
11230 case ALC880_HP_EVENT:
11231 alc267_quanta_il1_hp_automute(codec);
11233 case ALC880_MIC_EVENT:
11234 alc267_quanta_il1_mic_automute(codec);
11240 * generic initialization of ADC, input mixers and output mixers
11242 static struct hda_verb alc268_base_init_verbs[] = {
11243 /* Unmute DAC0-1 and set vol = 0 */
11244 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11245 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11246 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11247 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11248 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11249 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11252 * Set up output mixers (0x0c - 0x0e)
11254 /* set vol=0 to output mixers */
11255 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11257 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11258 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11260 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11261 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11263 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11265 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11266 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11268 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11269 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11270 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11272 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11274 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11276 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11277 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11278 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11280 /* set PCBEEP vol = 0, mute connections */
11281 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11282 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11283 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11285 /* Unmute Selector 23h,24h and set the default input to mic-in */
11287 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11288 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11289 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11296 * generic initialization of ADC, input mixers and output mixers
11298 static struct hda_verb alc268_volume_init_verbs[] = {
11299 /* set output DAC */
11300 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11301 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11302 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11303 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11306 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11307 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11308 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11309 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11315 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11317 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11320 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11322 /* set PCBEEP vol = 0, mute connections */
11323 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11325 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11330 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11331 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11332 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11335 /* The multiple "Capture Source" controls confuse alsamixer
11336 * So call somewhat different..
11338 /* .name = "Capture Source", */
11339 .name = "Input Source",
11341 .info = alc_mux_enum_info,
11342 .get = alc_mux_enum_get,
11343 .put = alc_mux_enum_put,
11348 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11349 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11350 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11351 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11352 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11354 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11355 /* The multiple "Capture Source" controls confuse alsamixer
11356 * So call somewhat different..
11358 /* .name = "Capture Source", */
11359 .name = "Input Source",
11361 .info = alc_mux_enum_info,
11362 .get = alc_mux_enum_get,
11363 .put = alc_mux_enum_put,
11368 static struct hda_input_mux alc268_capture_source = {
11372 { "Front Mic", 0x1 },
11378 static struct hda_input_mux alc268_acer_capture_source = {
11382 { "Internal Mic", 0x1 },
11387 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11391 { "Internal Mic", 0x6 },
11396 #ifdef CONFIG_SND_DEBUG
11397 static struct snd_kcontrol_new alc268_test_mixer[] = {
11398 /* Volume widgets */
11399 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11400 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11401 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11402 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11403 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11404 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11405 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11406 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11407 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11408 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11409 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11410 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11411 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11412 /* The below appears problematic on some hardwares */
11413 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11414 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11415 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11416 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11417 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11419 /* Modes for retasking pin widgets */
11420 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11421 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11422 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11423 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11425 /* Controls for GPIO pins, assuming they are configured as outputs */
11426 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11427 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11428 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11429 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11431 /* Switches to allow the digital SPDIF output pin to be enabled.
11432 * The ALC268 does not have an SPDIF input.
11434 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11436 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11437 * this output to turn on an external amplifier.
11439 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11440 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11446 /* create input playback/capture controls for the given pin */
11447 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11448 const char *ctlname, int idx)
11453 sprintf(name, "%s Playback Volume", ctlname);
11455 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11456 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11460 } else if (nid == 0x15) {
11461 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11462 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11468 sprintf(name, "%s Playback Switch", ctlname);
11469 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11470 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11476 /* add playback controls from the parsed DAC table */
11477 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11478 const struct auto_pin_cfg *cfg)
11483 spec->multiout.num_dacs = 2; /* only use one dac */
11484 spec->multiout.dac_nids = spec->private_dac_nids;
11485 spec->multiout.dac_nids[0] = 2;
11486 spec->multiout.dac_nids[1] = 3;
11488 nid = cfg->line_out_pins[0];
11490 alc268_new_analog_output(spec, nid, "Front", 0);
11492 nid = cfg->speaker_pins[0];
11494 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11495 "Speaker Playback Volume",
11496 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11500 nid = cfg->hp_pins[0];
11502 alc268_new_analog_output(spec, nid, "Headphone", 0);
11504 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11506 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11507 "Mono Playback Switch",
11508 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11515 /* create playback/capture controls for input pins */
11516 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11517 const struct auto_pin_cfg *cfg)
11519 struct hda_input_mux *imux = &spec->private_imux;
11522 for (i = 0; i < AUTO_PIN_LAST; i++) {
11523 switch(cfg->input_pins[i]) {
11525 idx1 = 0; /* Mic 1 */
11528 idx1 = 1; /* Mic 2 */
11531 idx1 = 2; /* Line In */
11538 idx1 = 6; /* digital mics */
11543 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11544 imux->items[imux->num_items].index = idx1;
11550 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11552 struct alc_spec *spec = codec->spec;
11553 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11554 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11555 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11556 unsigned int dac_vol1, dac_vol2;
11559 snd_hda_codec_write(codec, speaker_nid, 0,
11560 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11561 snd_hda_codec_write(codec, 0x0f, 0,
11562 AC_VERB_SET_AMP_GAIN_MUTE,
11564 snd_hda_codec_write(codec, 0x10, 0,
11565 AC_VERB_SET_AMP_GAIN_MUTE,
11568 snd_hda_codec_write(codec, 0x0f, 0,
11569 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11570 snd_hda_codec_write(codec, 0x10, 0,
11571 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11574 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11575 if (line_nid == 0x14)
11576 dac_vol2 = AMP_OUT_ZERO;
11577 else if (line_nid == 0x15)
11578 dac_vol1 = AMP_OUT_ZERO;
11579 if (hp_nid == 0x14)
11580 dac_vol2 = AMP_OUT_ZERO;
11581 else if (hp_nid == 0x15)
11582 dac_vol1 = AMP_OUT_ZERO;
11583 if (line_nid != 0x16 || hp_nid != 0x16 ||
11584 spec->autocfg.line_out_pins[1] != 0x16 ||
11585 spec->autocfg.line_out_pins[2] != 0x16)
11586 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11588 snd_hda_codec_write(codec, 0x02, 0,
11589 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11590 snd_hda_codec_write(codec, 0x03, 0,
11591 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11594 /* pcm configuration: identiacal with ALC880 */
11595 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11596 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11597 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11598 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11601 * BIOS auto configuration
11603 static int alc268_parse_auto_config(struct hda_codec *codec)
11605 struct alc_spec *spec = codec->spec;
11607 static hda_nid_t alc268_ignore[] = { 0 };
11609 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11613 if (!spec->autocfg.line_outs)
11614 return 0; /* can't find valid BIOS pin config */
11616 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11619 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11623 spec->multiout.max_channels = 2;
11625 /* digital only support output */
11626 if (spec->autocfg.dig_out_pin)
11627 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11629 if (spec->kctls.list)
11630 add_mixer(spec, spec->kctls.list);
11632 if (spec->autocfg.speaker_pins[0] != 0x1d)
11633 add_mixer(spec, alc268_beep_mixer);
11635 add_verb(spec, alc268_volume_init_verbs);
11636 spec->num_mux_defs = 1;
11637 spec->input_mux = &spec->private_imux;
11639 err = alc_auto_add_mic_boost(codec);
11643 store_pin_configs(codec);
11647 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11648 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11649 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11651 /* init callback for auto-configuration model -- overriding the default init */
11652 static void alc268_auto_init(struct hda_codec *codec)
11654 struct alc_spec *spec = codec->spec;
11655 alc268_auto_init_multi_out(codec);
11656 alc268_auto_init_hp_out(codec);
11657 alc268_auto_init_mono_speaker_out(codec);
11658 alc268_auto_init_analog_input(codec);
11659 if (spec->unsol_event)
11660 alc_inithook(codec);
11664 * configuration and preset
11666 static const char *alc268_models[ALC268_MODEL_LAST] = {
11667 [ALC267_QUANTA_IL1] = "quanta-il1",
11668 [ALC268_3ST] = "3stack",
11669 [ALC268_TOSHIBA] = "toshiba",
11670 [ALC268_ACER] = "acer",
11671 [ALC268_ACER_DMIC] = "acer-dmic",
11672 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11673 [ALC268_DELL] = "dell",
11674 [ALC268_ZEPTO] = "zepto",
11675 #ifdef CONFIG_SND_DEBUG
11676 [ALC268_TEST] = "test",
11678 [ALC268_AUTO] = "auto",
11681 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11682 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11683 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11684 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11685 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11686 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11687 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11688 ALC268_ACER_ASPIRE_ONE),
11689 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11690 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11691 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11692 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11693 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11694 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11695 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11696 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11697 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11698 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11702 static struct alc_config_preset alc268_presets[] = {
11703 [ALC267_QUANTA_IL1] = {
11704 .mixers = { alc267_quanta_il1_mixer },
11705 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11706 alc267_quanta_il1_verbs },
11707 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11708 .dac_nids = alc268_dac_nids,
11709 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11710 .adc_nids = alc268_adc_nids_alt,
11712 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11713 .channel_mode = alc268_modes,
11714 .input_mux = &alc268_capture_source,
11715 .unsol_event = alc267_quanta_il1_unsol_event,
11716 .init_hook = alc267_quanta_il1_automute,
11719 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11720 alc268_beep_mixer },
11721 .init_verbs = { alc268_base_init_verbs },
11722 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11723 .dac_nids = alc268_dac_nids,
11724 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11725 .adc_nids = alc268_adc_nids_alt,
11726 .capsrc_nids = alc268_capsrc_nids,
11728 .dig_out_nid = ALC268_DIGOUT_NID,
11729 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11730 .channel_mode = alc268_modes,
11731 .input_mux = &alc268_capture_source,
11733 [ALC268_TOSHIBA] = {
11734 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11735 alc268_beep_mixer },
11736 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11737 alc268_toshiba_verbs },
11738 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11739 .dac_nids = alc268_dac_nids,
11740 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11741 .adc_nids = alc268_adc_nids_alt,
11742 .capsrc_nids = alc268_capsrc_nids,
11744 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11745 .channel_mode = alc268_modes,
11746 .input_mux = &alc268_capture_source,
11747 .unsol_event = alc268_toshiba_unsol_event,
11748 .init_hook = alc268_toshiba_automute,
11751 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11752 alc268_beep_mixer },
11753 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11754 alc268_acer_verbs },
11755 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11756 .dac_nids = alc268_dac_nids,
11757 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11758 .adc_nids = alc268_adc_nids_alt,
11759 .capsrc_nids = alc268_capsrc_nids,
11761 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11762 .channel_mode = alc268_modes,
11763 .input_mux = &alc268_acer_capture_source,
11764 .unsol_event = alc268_acer_unsol_event,
11765 .init_hook = alc268_acer_init_hook,
11767 [ALC268_ACER_DMIC] = {
11768 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
11769 alc268_beep_mixer },
11770 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11771 alc268_acer_verbs },
11772 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11773 .dac_nids = alc268_dac_nids,
11774 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11775 .adc_nids = alc268_adc_nids_alt,
11776 .capsrc_nids = alc268_capsrc_nids,
11778 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11779 .channel_mode = alc268_modes,
11780 .input_mux = &alc268_acer_dmic_capture_source,
11781 .unsol_event = alc268_acer_unsol_event,
11782 .init_hook = alc268_acer_init_hook,
11784 [ALC268_ACER_ASPIRE_ONE] = {
11785 .mixers = { alc268_acer_aspire_one_mixer,
11786 alc268_capture_alt_mixer },
11787 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11788 alc268_acer_aspire_one_verbs },
11789 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11790 .dac_nids = alc268_dac_nids,
11791 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11792 .adc_nids = alc268_adc_nids_alt,
11793 .capsrc_nids = alc268_capsrc_nids,
11795 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11796 .channel_mode = alc268_modes,
11797 .input_mux = &alc268_acer_lc_capture_source,
11798 .unsol_event = alc268_acer_lc_unsol_event,
11799 .init_hook = alc268_acer_lc_init_hook,
11802 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11803 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11804 alc268_dell_verbs },
11805 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11806 .dac_nids = alc268_dac_nids,
11808 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11809 .channel_mode = alc268_modes,
11810 .unsol_event = alc268_dell_unsol_event,
11811 .init_hook = alc268_dell_init_hook,
11812 .input_mux = &alc268_capture_source,
11815 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11816 alc268_beep_mixer },
11817 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11818 alc268_toshiba_verbs },
11819 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11820 .dac_nids = alc268_dac_nids,
11821 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11822 .adc_nids = alc268_adc_nids_alt,
11823 .capsrc_nids = alc268_capsrc_nids,
11825 .dig_out_nid = ALC268_DIGOUT_NID,
11826 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11827 .channel_mode = alc268_modes,
11828 .input_mux = &alc268_capture_source,
11829 .unsol_event = alc268_toshiba_unsol_event,
11830 .init_hook = alc268_toshiba_automute
11832 #ifdef CONFIG_SND_DEBUG
11834 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11835 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11836 alc268_volume_init_verbs },
11837 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11838 .dac_nids = alc268_dac_nids,
11839 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11840 .adc_nids = alc268_adc_nids_alt,
11841 .capsrc_nids = alc268_capsrc_nids,
11843 .dig_out_nid = ALC268_DIGOUT_NID,
11844 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11845 .channel_mode = alc268_modes,
11846 .input_mux = &alc268_capture_source,
11851 static int patch_alc268(struct hda_codec *codec)
11853 struct alc_spec *spec;
11857 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11861 codec->spec = spec;
11863 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11867 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11868 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11869 "trying auto-probe from BIOS...\n");
11870 board_config = ALC268_AUTO;
11873 if (board_config == ALC268_AUTO) {
11874 /* automatic parse from the BIOS config */
11875 err = alc268_parse_auto_config(codec);
11881 "hda_codec: Cannot set up configuration "
11882 "from BIOS. Using base mode...\n");
11883 board_config = ALC268_3ST;
11887 if (board_config != ALC268_AUTO)
11888 setup_preset(spec, &alc268_presets[board_config]);
11890 if (codec->vendor_id == 0x10ec0267) {
11891 spec->stream_name_analog = "ALC267 Analog";
11892 spec->stream_name_digital = "ALC267 Digital";
11894 spec->stream_name_analog = "ALC268 Analog";
11895 spec->stream_name_digital = "ALC268 Digital";
11898 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11899 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11900 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11902 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11904 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11905 /* override the amp caps for beep generator */
11906 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11907 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11908 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11909 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11910 (0 << AC_AMPCAP_MUTE_SHIFT));
11912 if (!spec->adc_nids && spec->input_mux) {
11913 /* check whether NID 0x07 is valid */
11914 unsigned int wcap = get_wcaps(codec, 0x07);
11918 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11919 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11920 spec->adc_nids = alc268_adc_nids_alt;
11921 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11922 add_mixer(spec, alc268_capture_alt_mixer);
11924 spec->adc_nids = alc268_adc_nids;
11925 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11926 add_mixer(spec, alc268_capture_mixer);
11928 spec->capsrc_nids = alc268_capsrc_nids;
11929 /* set default input source */
11930 for (i = 0; i < spec->num_adc_nids; i++)
11931 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11932 0, AC_VERB_SET_CONNECT_SEL,
11933 spec->input_mux->items[0].index);
11936 spec->vmaster_nid = 0x02;
11938 codec->patch_ops = alc_patch_ops;
11939 if (board_config == ALC268_AUTO)
11940 spec->init_hook = alc268_auto_init;
11942 codec->proc_widget_hook = print_realtek_coef;
11948 * ALC269 channel source setting (2 channel)
11950 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11952 #define alc269_dac_nids alc260_dac_nids
11954 static hda_nid_t alc269_adc_nids[1] = {
11959 static hda_nid_t alc269_capsrc_nids[1] = {
11963 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11967 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11975 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11983 #define alc269_modes alc260_modes
11984 #define alc269_capture_source alc880_lg_lw_capture_source
11986 static struct snd_kcontrol_new alc269_base_mixer[] = {
11987 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11988 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11989 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11990 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11992 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11993 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11994 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11995 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11996 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11998 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12000 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12004 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12005 /* output mixer control */
12006 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12009 .name = "Master Playback Switch",
12010 .info = snd_hda_mixer_amp_switch_info,
12011 .get = snd_hda_mixer_amp_switch_get,
12012 .put = alc268_acer_master_sw_put,
12013 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12017 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12018 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12019 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12020 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12021 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12022 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12026 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12027 /* output mixer control */
12028 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12030 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12031 .name = "Master Playback Switch",
12032 .info = snd_hda_mixer_amp_switch_info,
12033 .get = snd_hda_mixer_amp_switch_get,
12034 .put = alc268_acer_master_sw_put,
12035 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12038 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12039 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12040 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12041 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12042 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12043 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12044 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12045 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12046 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
12047 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
12051 /* bind volumes of both NID 0x0c and 0x0d */
12052 static struct hda_bind_ctls alc269_epc_bind_vol = {
12053 .ops = &snd_hda_bind_vol,
12055 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12056 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12061 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12062 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12063 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12064 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12068 /* capture mixer elements */
12069 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12070 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12071 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12072 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12077 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12078 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12080 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12085 static struct snd_kcontrol_new alc269_beep_mixer[] = {
12086 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
12087 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
12091 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12092 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12093 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12094 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12095 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12096 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12097 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12101 static struct hda_verb alc269_lifebook_verbs[] = {
12102 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12103 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12104 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12105 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12106 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12107 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12108 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12109 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12110 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12111 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12115 /* toggle speaker-output according to the hp-jack state */
12116 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12118 unsigned int present;
12119 unsigned char bits;
12121 present = snd_hda_codec_read(codec, 0x15, 0,
12122 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12123 bits = present ? AMP_IN_MUTE(0) : 0;
12124 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12125 AMP_IN_MUTE(0), bits);
12126 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12127 AMP_IN_MUTE(0), bits);
12129 snd_hda_codec_write(codec, 0x20, 0,
12130 AC_VERB_SET_COEF_INDEX, 0x0c);
12131 snd_hda_codec_write(codec, 0x20, 0,
12132 AC_VERB_SET_PROC_COEF, 0x680);
12134 snd_hda_codec_write(codec, 0x20, 0,
12135 AC_VERB_SET_COEF_INDEX, 0x0c);
12136 snd_hda_codec_write(codec, 0x20, 0,
12137 AC_VERB_SET_PROC_COEF, 0x480);
12140 /* toggle speaker-output according to the hp-jacks state */
12141 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12143 unsigned int present;
12144 unsigned char bits;
12146 /* Check laptop headphone socket */
12147 present = snd_hda_codec_read(codec, 0x15, 0,
12148 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12150 /* Check port replicator headphone socket */
12151 present |= snd_hda_codec_read(codec, 0x1a, 0,
12152 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12154 bits = present ? AMP_IN_MUTE(0) : 0;
12155 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12156 AMP_IN_MUTE(0), bits);
12157 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12158 AMP_IN_MUTE(0), bits);
12160 snd_hda_codec_write(codec, 0x20, 0,
12161 AC_VERB_SET_COEF_INDEX, 0x0c);
12162 snd_hda_codec_write(codec, 0x20, 0,
12163 AC_VERB_SET_PROC_COEF, 0x680);
12165 snd_hda_codec_write(codec, 0x20, 0,
12166 AC_VERB_SET_COEF_INDEX, 0x0c);
12167 snd_hda_codec_write(codec, 0x20, 0,
12168 AC_VERB_SET_PROC_COEF, 0x480);
12171 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12173 unsigned int present;
12175 present = snd_hda_codec_read(codec, 0x18, 0,
12176 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12177 snd_hda_codec_write(codec, 0x23, 0,
12178 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12181 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12183 unsigned int present_laptop;
12184 unsigned int present_dock;
12186 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12187 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12189 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12190 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12192 /* Laptop mic port overrides dock mic port, design decision */
12194 snd_hda_codec_write(codec, 0x23, 0,
12195 AC_VERB_SET_CONNECT_SEL, 0x3);
12196 if (present_laptop)
12197 snd_hda_codec_write(codec, 0x23, 0,
12198 AC_VERB_SET_CONNECT_SEL, 0x0);
12199 if (!present_dock && !present_laptop)
12200 snd_hda_codec_write(codec, 0x23, 0,
12201 AC_VERB_SET_CONNECT_SEL, 0x1);
12204 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12207 if ((res >> 26) == ALC880_HP_EVENT)
12208 alc269_quanta_fl1_speaker_automute(codec);
12209 if ((res >> 26) == ALC880_MIC_EVENT)
12210 alc269_quanta_fl1_mic_automute(codec);
12213 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12216 if ((res >> 26) == ALC880_HP_EVENT)
12217 alc269_lifebook_speaker_automute(codec);
12218 if ((res >> 26) == ALC880_MIC_EVENT)
12219 alc269_lifebook_mic_autoswitch(codec);
12222 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12224 alc269_quanta_fl1_speaker_automute(codec);
12225 alc269_quanta_fl1_mic_automute(codec);
12228 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12230 alc269_lifebook_speaker_automute(codec);
12231 alc269_lifebook_mic_autoswitch(codec);
12234 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12235 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12236 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12237 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12238 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12239 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12240 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12241 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12245 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12246 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12247 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12248 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12250 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12251 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12255 /* toggle speaker-output according to the hp-jack state */
12256 static void alc269_speaker_automute(struct hda_codec *codec)
12258 unsigned int present;
12259 unsigned char bits;
12261 present = snd_hda_codec_read(codec, 0x15, 0,
12262 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12263 bits = present ? AMP_IN_MUTE(0) : 0;
12264 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12265 AMP_IN_MUTE(0), bits);
12266 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12267 AMP_IN_MUTE(0), bits);
12270 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12272 unsigned int present;
12274 present = snd_hda_codec_read(codec, 0x18, 0,
12275 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12276 snd_hda_codec_write(codec, 0x23, 0,
12277 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12280 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12282 unsigned int present;
12284 present = snd_hda_codec_read(codec, 0x18, 0,
12285 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12286 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12287 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12288 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12289 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12292 /* unsolicited event for HP jack sensing */
12293 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12296 if ((res >> 26) == ALC880_HP_EVENT)
12297 alc269_speaker_automute(codec);
12299 if ((res >> 26) == ALC880_MIC_EVENT)
12300 alc269_eeepc_dmic_automute(codec);
12303 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12305 alc269_speaker_automute(codec);
12306 alc269_eeepc_dmic_automute(codec);
12309 /* unsolicited event for HP jack sensing */
12310 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12313 if ((res >> 26) == ALC880_HP_EVENT)
12314 alc269_speaker_automute(codec);
12316 if ((res >> 26) == ALC880_MIC_EVENT)
12317 alc269_eeepc_amic_automute(codec);
12320 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12322 alc269_speaker_automute(codec);
12323 alc269_eeepc_amic_automute(codec);
12327 * generic initialization of ADC, input mixers and output mixers
12329 static struct hda_verb alc269_init_verbs[] = {
12331 * Unmute ADC0 and set the default input to mic-in
12333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12335 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12336 * analog-loopback mixer widget
12337 * Note: PASD motherboards uses the Line In 2 as the input for
12338 * front panel mic (mic 2)
12340 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12348 * Set up output mixers (0x0c - 0x0e)
12350 /* set vol=0 to output mixers */
12351 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12352 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12354 /* set up input amps for analog loopback */
12355 /* Amp Indices: DAC = 0, mixer = 1 */
12356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12357 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12358 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12359 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12360 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12361 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12363 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12366 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12367 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12368 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12369 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12372 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12373 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12377 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12379 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12380 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12382 /* FIXME: use matrix-type input source selection */
12383 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12384 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12391 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12392 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12396 /* add playback controls from the parsed DAC table */
12397 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12398 const struct auto_pin_cfg *cfg)
12403 spec->multiout.num_dacs = 1; /* only use one dac */
12404 spec->multiout.dac_nids = spec->private_dac_nids;
12405 spec->multiout.dac_nids[0] = 2;
12407 nid = cfg->line_out_pins[0];
12409 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12410 "Front Playback Volume",
12411 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12414 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12415 "Front Playback Switch",
12416 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12421 nid = cfg->speaker_pins[0];
12423 if (!cfg->line_out_pins[0]) {
12424 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12425 "Speaker Playback Volume",
12426 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12432 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12433 "Speaker Playback Switch",
12434 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12439 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12440 "Speaker Playback Switch",
12441 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12447 nid = cfg->hp_pins[0];
12449 /* spec->multiout.hp_nid = 2; */
12450 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12451 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12452 "Headphone Playback Volume",
12453 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12459 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12460 "Headphone Playback Switch",
12461 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12466 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12467 "Headphone Playback Switch",
12468 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12477 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12478 const struct auto_pin_cfg *cfg)
12482 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12485 /* digital-mic input pin is excluded in alc880_auto_create..()
12486 * because it's under 0x18
12488 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12489 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12490 struct hda_input_mux *imux = &spec->private_imux;
12491 imux->items[imux->num_items].label = "Int Mic";
12492 imux->items[imux->num_items].index = 0x05;
12498 #ifdef CONFIG_SND_HDA_POWER_SAVE
12499 #define alc269_loopbacks alc880_loopbacks
12502 /* pcm configuration: identiacal with ALC880 */
12503 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12504 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12505 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12506 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12509 * BIOS auto configuration
12511 static int alc269_parse_auto_config(struct hda_codec *codec)
12513 struct alc_spec *spec = codec->spec;
12515 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12517 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12522 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12525 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12529 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12531 if (spec->autocfg.dig_out_pin)
12532 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12534 if (spec->kctls.list)
12535 add_mixer(spec, spec->kctls.list);
12537 /* create a beep mixer control if the pin 0x1d isn't assigned */
12538 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12539 if (spec->autocfg.input_pins[i] == 0x1d)
12541 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12542 add_mixer(spec, alc269_beep_mixer);
12544 add_verb(spec, alc269_init_verbs);
12545 spec->num_mux_defs = 1;
12546 spec->input_mux = &spec->private_imux;
12547 /* set default input source */
12548 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12549 0, AC_VERB_SET_CONNECT_SEL,
12550 spec->input_mux->items[0].index);
12552 err = alc_auto_add_mic_boost(codec);
12556 if (!spec->cap_mixer)
12557 set_capture_mixer(spec);
12559 store_pin_configs(codec);
12563 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12564 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12565 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12568 /* init callback for auto-configuration model -- overriding the default init */
12569 static void alc269_auto_init(struct hda_codec *codec)
12571 struct alc_spec *spec = codec->spec;
12572 alc269_auto_init_multi_out(codec);
12573 alc269_auto_init_hp_out(codec);
12574 alc269_auto_init_analog_input(codec);
12575 if (spec->unsol_event)
12576 alc_inithook(codec);
12580 * configuration and preset
12582 static const char *alc269_models[ALC269_MODEL_LAST] = {
12583 [ALC269_BASIC] = "basic",
12584 [ALC269_QUANTA_FL1] = "quanta",
12585 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12586 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12587 [ALC269_FUJITSU] = "fujitsu",
12588 [ALC269_LIFEBOOK] = "lifebook"
12591 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12592 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12593 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12594 ALC269_ASUS_EEEPC_P703),
12595 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12596 ALC269_ASUS_EEEPC_P901),
12597 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12598 ALC269_ASUS_EEEPC_P901),
12599 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12600 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12604 static struct alc_config_preset alc269_presets[] = {
12606 .mixers = { alc269_base_mixer },
12607 .init_verbs = { alc269_init_verbs },
12608 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12609 .dac_nids = alc269_dac_nids,
12611 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12612 .channel_mode = alc269_modes,
12613 .input_mux = &alc269_capture_source,
12615 [ALC269_QUANTA_FL1] = {
12616 .mixers = { alc269_quanta_fl1_mixer },
12617 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12618 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12619 .dac_nids = alc269_dac_nids,
12621 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12622 .channel_mode = alc269_modes,
12623 .input_mux = &alc269_capture_source,
12624 .unsol_event = alc269_quanta_fl1_unsol_event,
12625 .init_hook = alc269_quanta_fl1_init_hook,
12627 [ALC269_ASUS_EEEPC_P703] = {
12628 .mixers = { alc269_eeepc_mixer },
12629 .cap_mixer = alc269_epc_capture_mixer,
12630 .init_verbs = { alc269_init_verbs,
12631 alc269_eeepc_amic_init_verbs },
12632 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12633 .dac_nids = alc269_dac_nids,
12635 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12636 .channel_mode = alc269_modes,
12637 .input_mux = &alc269_eeepc_amic_capture_source,
12638 .unsol_event = alc269_eeepc_amic_unsol_event,
12639 .init_hook = alc269_eeepc_amic_inithook,
12641 [ALC269_ASUS_EEEPC_P901] = {
12642 .mixers = { alc269_eeepc_mixer },
12643 .cap_mixer = alc269_epc_capture_mixer,
12644 .init_verbs = { alc269_init_verbs,
12645 alc269_eeepc_dmic_init_verbs },
12646 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12647 .dac_nids = alc269_dac_nids,
12649 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12650 .channel_mode = alc269_modes,
12651 .input_mux = &alc269_eeepc_dmic_capture_source,
12652 .unsol_event = alc269_eeepc_dmic_unsol_event,
12653 .init_hook = alc269_eeepc_dmic_inithook,
12655 [ALC269_FUJITSU] = {
12656 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12657 .cap_mixer = alc269_epc_capture_mixer,
12658 .init_verbs = { alc269_init_verbs,
12659 alc269_eeepc_dmic_init_verbs },
12660 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12661 .dac_nids = alc269_dac_nids,
12663 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12664 .channel_mode = alc269_modes,
12665 .input_mux = &alc269_eeepc_dmic_capture_source,
12666 .unsol_event = alc269_eeepc_dmic_unsol_event,
12667 .init_hook = alc269_eeepc_dmic_inithook,
12669 [ALC269_LIFEBOOK] = {
12670 .mixers = { alc269_lifebook_mixer },
12671 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
12672 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12673 .dac_nids = alc269_dac_nids,
12675 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12676 .channel_mode = alc269_modes,
12677 .input_mux = &alc269_capture_source,
12678 .unsol_event = alc269_lifebook_unsol_event,
12679 .init_hook = alc269_lifebook_init_hook,
12683 static int patch_alc269(struct hda_codec *codec)
12685 struct alc_spec *spec;
12689 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12693 codec->spec = spec;
12695 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12697 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12701 if (board_config < 0) {
12702 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12703 "trying auto-probe from BIOS...\n");
12704 board_config = ALC269_AUTO;
12707 if (board_config == ALC269_AUTO) {
12708 /* automatic parse from the BIOS config */
12709 err = alc269_parse_auto_config(codec);
12715 "hda_codec: Cannot set up configuration "
12716 "from BIOS. Using base mode...\n");
12717 board_config = ALC269_BASIC;
12721 if (board_config != ALC269_AUTO)
12722 setup_preset(spec, &alc269_presets[board_config]);
12724 spec->stream_name_analog = "ALC269 Analog";
12725 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12726 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12728 spec->stream_name_digital = "ALC269 Digital";
12729 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12730 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12732 spec->adc_nids = alc269_adc_nids;
12733 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12734 spec->capsrc_nids = alc269_capsrc_nids;
12735 if (!spec->cap_mixer)
12736 set_capture_mixer(spec);
12738 codec->patch_ops = alc_patch_ops;
12739 if (board_config == ALC269_AUTO)
12740 spec->init_hook = alc269_auto_init;
12741 #ifdef CONFIG_SND_HDA_POWER_SAVE
12742 if (!spec->loopback.amplist)
12743 spec->loopback.amplist = alc269_loopbacks;
12745 codec->proc_widget_hook = print_realtek_coef;
12751 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12755 * set the path ways for 2 channel output
12756 * need to set the codec line out and mic 1 pin widgets to inputs
12758 static struct hda_verb alc861_threestack_ch2_init[] = {
12759 /* set pin widget 1Ah (line in) for input */
12760 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12761 /* set pin widget 18h (mic1/2) for input, for mic also enable
12764 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12766 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12768 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12769 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12775 * need to set the codec line out and mic 1 pin widgets to outputs
12777 static struct hda_verb alc861_threestack_ch6_init[] = {
12778 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12779 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12780 /* set pin widget 18h (mic1) for output (CLFE)*/
12781 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12783 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12784 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12786 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12788 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12789 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12794 static struct hda_channel_mode alc861_threestack_modes[2] = {
12795 { 2, alc861_threestack_ch2_init },
12796 { 6, alc861_threestack_ch6_init },
12798 /* Set mic1 as input and unmute the mixer */
12799 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12800 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12801 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12804 /* Set mic1 as output and mute mixer */
12805 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12806 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12807 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12811 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12812 { 2, alc861_uniwill_m31_ch2_init },
12813 { 4, alc861_uniwill_m31_ch4_init },
12816 /* Set mic1 and line-in as input and unmute the mixer */
12817 static struct hda_verb alc861_asus_ch2_init[] = {
12818 /* set pin widget 1Ah (line in) for input */
12819 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12820 /* set pin widget 18h (mic1/2) for input, for mic also enable
12823 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12825 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12827 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12828 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12832 /* Set mic1 nad line-in as output and mute mixer */
12833 static struct hda_verb alc861_asus_ch6_init[] = {
12834 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12835 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12836 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12837 /* set pin widget 18h (mic1) for output (CLFE)*/
12838 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12839 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12840 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12841 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12843 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12845 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12846 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12851 static struct hda_channel_mode alc861_asus_modes[2] = {
12852 { 2, alc861_asus_ch2_init },
12853 { 6, alc861_asus_ch6_init },
12858 static struct snd_kcontrol_new alc861_base_mixer[] = {
12859 /* output mixer control */
12860 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12861 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12862 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12863 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12864 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12866 /*Input mixer control */
12867 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12868 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12869 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12870 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12871 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12872 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12874 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12875 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12876 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12881 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12882 /* output mixer control */
12883 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12884 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12885 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12886 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12887 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12889 /* Input mixer control */
12890 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12891 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12892 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12893 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12894 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12895 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12897 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12898 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12899 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12903 .name = "Channel Mode",
12904 .info = alc_ch_mode_info,
12905 .get = alc_ch_mode_get,
12906 .put = alc_ch_mode_put,
12907 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12912 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12913 /* output mixer control */
12914 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12915 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12916 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12921 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12922 /* output mixer control */
12923 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12924 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12925 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12926 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12927 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12929 /* Input mixer control */
12930 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12931 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12932 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12933 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12934 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12935 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12936 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12937 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12938 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12939 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12943 .name = "Channel Mode",
12944 .info = alc_ch_mode_info,
12945 .get = alc_ch_mode_get,
12946 .put = alc_ch_mode_put,
12947 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12952 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12953 /* output mixer control */
12954 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12955 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12956 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12957 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12958 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12960 /* Input mixer control */
12961 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12962 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12963 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12964 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12965 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12966 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12968 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12969 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12973 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12974 .name = "Channel Mode",
12975 .info = alc_ch_mode_info,
12976 .get = alc_ch_mode_get,
12977 .put = alc_ch_mode_put,
12978 .private_value = ARRAY_SIZE(alc861_asus_modes),
12983 /* additional mixer */
12984 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12985 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12986 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12987 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12988 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12993 * generic initialization of ADC, input mixers and output mixers
12995 static struct hda_verb alc861_base_init_verbs[] = {
12997 * Unmute ADC0 and set the default input to mic-in
12999 /* port-A for surround (rear panel) */
13000 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13001 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13002 /* port-B for mic-in (rear panel) with vref */
13003 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13004 /* port-C for line-in (rear panel) */
13005 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13006 /* port-D for Front */
13007 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13008 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13009 /* port-E for HP out (front panel) */
13010 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13011 /* route front PCM to HP */
13012 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13013 /* port-F for mic-in (front panel) with vref */
13014 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13015 /* port-G for CLFE (rear panel) */
13016 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13017 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13018 /* port-H for side (rear panel) */
13019 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13020 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13022 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13023 /* route front mic to ADC1*/
13024 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13025 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13027 /* Unmute DAC0~3 & spdif out*/
13028 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13029 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13030 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13031 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13034 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13035 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13036 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13037 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13038 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13040 /* Unmute Stereo Mixer 15 */
13041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13044 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13046 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13047 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13048 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13049 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13050 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13051 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13052 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13053 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13054 /* hp used DAC 3 (Front) */
13055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13056 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13061 static struct hda_verb alc861_threestack_init_verbs[] = {
13063 * Unmute ADC0 and set the default input to mic-in
13065 /* port-A for surround (rear panel) */
13066 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13067 /* port-B for mic-in (rear panel) with vref */
13068 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13069 /* port-C for line-in (rear panel) */
13070 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13071 /* port-D for Front */
13072 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13073 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13074 /* port-E for HP out (front panel) */
13075 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13076 /* route front PCM to HP */
13077 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13078 /* port-F for mic-in (front panel) with vref */
13079 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13080 /* port-G for CLFE (rear panel) */
13081 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13082 /* port-H for side (rear panel) */
13083 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13085 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13086 /* route front mic to ADC1*/
13087 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13088 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13089 /* Unmute DAC0~3 & spdif out*/
13090 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13091 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13092 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13093 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13096 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13097 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13098 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13099 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13100 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13102 /* Unmute Stereo Mixer 15 */
13103 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13104 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13108 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13109 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13110 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13111 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13112 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13113 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13114 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13115 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13116 /* hp used DAC 3 (Front) */
13117 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13118 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13122 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13124 * Unmute ADC0 and set the default input to mic-in
13126 /* port-A for surround (rear panel) */
13127 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13128 /* port-B for mic-in (rear panel) with vref */
13129 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13130 /* port-C for line-in (rear panel) */
13131 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13132 /* port-D for Front */
13133 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13134 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13135 /* port-E for HP out (front panel) */
13136 /* this has to be set to VREF80 */
13137 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13138 /* route front PCM to HP */
13139 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13140 /* port-F for mic-in (front panel) with vref */
13141 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13142 /* port-G for CLFE (rear panel) */
13143 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13144 /* port-H for side (rear panel) */
13145 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13147 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13148 /* route front mic to ADC1*/
13149 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13150 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13151 /* Unmute DAC0~3 & spdif out*/
13152 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13153 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13154 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13155 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13158 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13159 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13160 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13161 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13162 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13164 /* Unmute Stereo Mixer 15 */
13165 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13166 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13168 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13170 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13171 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13172 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13173 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13174 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13175 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13176 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13177 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13178 /* hp used DAC 3 (Front) */
13179 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13180 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13184 static struct hda_verb alc861_asus_init_verbs[] = {
13186 * Unmute ADC0 and set the default input to mic-in
13188 /* port-A for surround (rear panel)
13189 * according to codec#0 this is the HP jack
13191 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13192 /* route front PCM to HP */
13193 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13194 /* port-B for mic-in (rear panel) with vref */
13195 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13196 /* port-C for line-in (rear panel) */
13197 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13198 /* port-D for Front */
13199 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13200 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13201 /* port-E for HP out (front panel) */
13202 /* this has to be set to VREF80 */
13203 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13204 /* route front PCM to HP */
13205 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13206 /* port-F for mic-in (front panel) with vref */
13207 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13208 /* port-G for CLFE (rear panel) */
13209 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13210 /* port-H for side (rear panel) */
13211 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13213 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13214 /* route front mic to ADC1*/
13215 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13216 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13217 /* Unmute DAC0~3 & spdif out*/
13218 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13219 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13220 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13221 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13223 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13224 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13225 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13226 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13227 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13229 /* Unmute Stereo Mixer 15 */
13230 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13231 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13232 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13233 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13235 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13236 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13237 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13238 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13239 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13240 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13241 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13242 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13243 /* hp used DAC 3 (Front) */
13244 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13245 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13249 /* additional init verbs for ASUS laptops */
13250 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13251 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13252 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13257 * generic initialization of ADC, input mixers and output mixers
13259 static struct hda_verb alc861_auto_init_verbs[] = {
13261 * Unmute ADC0 and set the default input to mic-in
13263 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13264 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13266 /* Unmute DAC0~3 & spdif out*/
13267 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13268 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13269 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13270 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13273 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13274 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13275 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13276 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13277 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13279 /* Unmute Stereo Mixer 15 */
13280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13285 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13286 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13287 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13288 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13289 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13290 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13291 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13292 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13294 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13295 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13296 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13298 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13299 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13300 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13301 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13303 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13308 static struct hda_verb alc861_toshiba_init_verbs[] = {
13309 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13314 /* toggle speaker-output according to the hp-jack state */
13315 static void alc861_toshiba_automute(struct hda_codec *codec)
13317 unsigned int present;
13319 present = snd_hda_codec_read(codec, 0x0f, 0,
13320 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13321 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13322 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13323 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13324 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13327 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13330 if ((res >> 26) == ALC880_HP_EVENT)
13331 alc861_toshiba_automute(codec);
13334 /* pcm configuration: identiacal with ALC880 */
13335 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13336 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13337 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13338 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13341 #define ALC861_DIGOUT_NID 0x07
13343 static struct hda_channel_mode alc861_8ch_modes[1] = {
13347 static hda_nid_t alc861_dac_nids[4] = {
13348 /* front, surround, clfe, side */
13349 0x03, 0x06, 0x05, 0x04
13352 static hda_nid_t alc660_dac_nids[3] = {
13353 /* front, clfe, surround */
13357 static hda_nid_t alc861_adc_nids[1] = {
13362 static struct hda_input_mux alc861_capture_source = {
13366 { "Front Mic", 0x3 },
13373 /* fill in the dac_nids table from the parsed pin configuration */
13374 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13375 const struct auto_pin_cfg *cfg)
13380 spec->multiout.dac_nids = spec->private_dac_nids;
13381 for (i = 0; i < cfg->line_outs; i++) {
13382 nid = cfg->line_out_pins[i];
13384 if (i >= ARRAY_SIZE(alc861_dac_nids))
13386 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13389 spec->multiout.num_dacs = cfg->line_outs;
13393 /* add playback controls from the parsed DAC table */
13394 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13395 const struct auto_pin_cfg *cfg)
13398 static const char *chname[4] = {
13399 "Front", "Surround", NULL /*CLFE*/, "Side"
13404 for (i = 0; i < cfg->line_outs; i++) {
13405 nid = spec->multiout.dac_nids[i];
13410 err = add_control(spec, ALC_CTL_BIND_MUTE,
13411 "Center Playback Switch",
13412 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13416 err = add_control(spec, ALC_CTL_BIND_MUTE,
13417 "LFE Playback Switch",
13418 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13423 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13425 if (nid == alc861_dac_nids[idx])
13427 sprintf(name, "%s Playback Switch", chname[idx]);
13428 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13429 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13438 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13446 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13448 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13449 "Headphone Playback Switch",
13450 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13453 spec->multiout.hp_nid = nid;
13458 /* create playback/capture controls for input pins */
13459 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13460 const struct auto_pin_cfg *cfg)
13462 struct hda_input_mux *imux = &spec->private_imux;
13463 int i, err, idx, idx1;
13465 for (i = 0; i < AUTO_PIN_LAST; i++) {
13466 switch (cfg->input_pins[i]) {
13469 idx = 2; /* Line In */
13473 idx = 2; /* Line In */
13477 idx = 1; /* Mic In */
13481 idx = 1; /* Mic In */
13491 err = new_analog_input(spec, cfg->input_pins[i],
13492 auto_pin_cfg_labels[i], idx, 0x15);
13496 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13497 imux->items[imux->num_items].index = idx1;
13503 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13505 int pin_type, int dac_idx)
13507 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13509 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13513 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13515 struct alc_spec *spec = codec->spec;
13518 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13519 for (i = 0; i < spec->autocfg.line_outs; i++) {
13520 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13521 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13523 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13524 spec->multiout.dac_nids[i]);
13528 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13530 struct alc_spec *spec = codec->spec;
13533 pin = spec->autocfg.hp_pins[0];
13534 if (pin) /* connect to front */
13535 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13536 spec->multiout.dac_nids[0]);
13537 pin = spec->autocfg.speaker_pins[0];
13539 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13542 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13544 struct alc_spec *spec = codec->spec;
13547 for (i = 0; i < AUTO_PIN_LAST; i++) {
13548 hda_nid_t nid = spec->autocfg.input_pins[i];
13549 if (nid >= 0x0c && nid <= 0x11) {
13550 snd_hda_codec_write(codec, nid, 0,
13551 AC_VERB_SET_PIN_WIDGET_CONTROL,
13552 i <= AUTO_PIN_FRONT_MIC ?
13553 PIN_VREF80 : PIN_IN);
13558 /* parse the BIOS configuration and set up the alc_spec */
13559 /* return 1 if successful, 0 if the proper config is not found,
13560 * or a negative error code
13562 static int alc861_parse_auto_config(struct hda_codec *codec)
13564 struct alc_spec *spec = codec->spec;
13566 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13568 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13572 if (!spec->autocfg.line_outs)
13573 return 0; /* can't find valid BIOS pin config */
13575 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13578 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13581 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13584 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13588 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13590 if (spec->autocfg.dig_out_pin)
13591 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13593 if (spec->kctls.list)
13594 add_mixer(spec, spec->kctls.list);
13596 add_verb(spec, alc861_auto_init_verbs);
13598 spec->num_mux_defs = 1;
13599 spec->input_mux = &spec->private_imux;
13601 spec->adc_nids = alc861_adc_nids;
13602 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13603 set_capture_mixer(spec);
13605 store_pin_configs(codec);
13609 /* additional initialization for auto-configuration model */
13610 static void alc861_auto_init(struct hda_codec *codec)
13612 struct alc_spec *spec = codec->spec;
13613 alc861_auto_init_multi_out(codec);
13614 alc861_auto_init_hp_out(codec);
13615 alc861_auto_init_analog_input(codec);
13616 if (spec->unsol_event)
13617 alc_inithook(codec);
13620 #ifdef CONFIG_SND_HDA_POWER_SAVE
13621 static struct hda_amp_list alc861_loopbacks[] = {
13622 { 0x15, HDA_INPUT, 0 },
13623 { 0x15, HDA_INPUT, 1 },
13624 { 0x15, HDA_INPUT, 2 },
13625 { 0x15, HDA_INPUT, 3 },
13632 * configuration and preset
13634 static const char *alc861_models[ALC861_MODEL_LAST] = {
13635 [ALC861_3ST] = "3stack",
13636 [ALC660_3ST] = "3stack-660",
13637 [ALC861_3ST_DIG] = "3stack-dig",
13638 [ALC861_6ST_DIG] = "6stack-dig",
13639 [ALC861_UNIWILL_M31] = "uniwill-m31",
13640 [ALC861_TOSHIBA] = "toshiba",
13641 [ALC861_ASUS] = "asus",
13642 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13643 [ALC861_AUTO] = "auto",
13646 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13647 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13648 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13649 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13650 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13651 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13652 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13653 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13654 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13655 * Any other models that need this preset?
13657 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13658 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13659 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13660 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13661 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13662 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13663 /* FIXME: the below seems conflict */
13664 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13665 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13666 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13670 static struct alc_config_preset alc861_presets[] = {
13672 .mixers = { alc861_3ST_mixer },
13673 .init_verbs = { alc861_threestack_init_verbs },
13674 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13675 .dac_nids = alc861_dac_nids,
13676 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13677 .channel_mode = alc861_threestack_modes,
13679 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13680 .adc_nids = alc861_adc_nids,
13681 .input_mux = &alc861_capture_source,
13683 [ALC861_3ST_DIG] = {
13684 .mixers = { alc861_base_mixer },
13685 .init_verbs = { alc861_threestack_init_verbs },
13686 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13687 .dac_nids = alc861_dac_nids,
13688 .dig_out_nid = ALC861_DIGOUT_NID,
13689 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13690 .channel_mode = alc861_threestack_modes,
13692 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13693 .adc_nids = alc861_adc_nids,
13694 .input_mux = &alc861_capture_source,
13696 [ALC861_6ST_DIG] = {
13697 .mixers = { alc861_base_mixer },
13698 .init_verbs = { alc861_base_init_verbs },
13699 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13700 .dac_nids = alc861_dac_nids,
13701 .dig_out_nid = ALC861_DIGOUT_NID,
13702 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13703 .channel_mode = alc861_8ch_modes,
13704 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13705 .adc_nids = alc861_adc_nids,
13706 .input_mux = &alc861_capture_source,
13709 .mixers = { alc861_3ST_mixer },
13710 .init_verbs = { alc861_threestack_init_verbs },
13711 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13712 .dac_nids = alc660_dac_nids,
13713 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13714 .channel_mode = alc861_threestack_modes,
13716 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13717 .adc_nids = alc861_adc_nids,
13718 .input_mux = &alc861_capture_source,
13720 [ALC861_UNIWILL_M31] = {
13721 .mixers = { alc861_uniwill_m31_mixer },
13722 .init_verbs = { alc861_uniwill_m31_init_verbs },
13723 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13724 .dac_nids = alc861_dac_nids,
13725 .dig_out_nid = ALC861_DIGOUT_NID,
13726 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13727 .channel_mode = alc861_uniwill_m31_modes,
13729 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13730 .adc_nids = alc861_adc_nids,
13731 .input_mux = &alc861_capture_source,
13733 [ALC861_TOSHIBA] = {
13734 .mixers = { alc861_toshiba_mixer },
13735 .init_verbs = { alc861_base_init_verbs,
13736 alc861_toshiba_init_verbs },
13737 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13738 .dac_nids = alc861_dac_nids,
13739 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13740 .channel_mode = alc883_3ST_2ch_modes,
13741 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13742 .adc_nids = alc861_adc_nids,
13743 .input_mux = &alc861_capture_source,
13744 .unsol_event = alc861_toshiba_unsol_event,
13745 .init_hook = alc861_toshiba_automute,
13748 .mixers = { alc861_asus_mixer },
13749 .init_verbs = { alc861_asus_init_verbs },
13750 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13751 .dac_nids = alc861_dac_nids,
13752 .dig_out_nid = ALC861_DIGOUT_NID,
13753 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13754 .channel_mode = alc861_asus_modes,
13757 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13758 .adc_nids = alc861_adc_nids,
13759 .input_mux = &alc861_capture_source,
13761 [ALC861_ASUS_LAPTOP] = {
13762 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13763 .init_verbs = { alc861_asus_init_verbs,
13764 alc861_asus_laptop_init_verbs },
13765 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13766 .dac_nids = alc861_dac_nids,
13767 .dig_out_nid = ALC861_DIGOUT_NID,
13768 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13769 .channel_mode = alc883_3ST_2ch_modes,
13771 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13772 .adc_nids = alc861_adc_nids,
13773 .input_mux = &alc861_capture_source,
13778 static int patch_alc861(struct hda_codec *codec)
13780 struct alc_spec *spec;
13784 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13788 codec->spec = spec;
13790 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13794 if (board_config < 0) {
13795 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13796 "trying auto-probe from BIOS...\n");
13797 board_config = ALC861_AUTO;
13800 if (board_config == ALC861_AUTO) {
13801 /* automatic parse from the BIOS config */
13802 err = alc861_parse_auto_config(codec);
13808 "hda_codec: Cannot set up configuration "
13809 "from BIOS. Using base mode...\n");
13810 board_config = ALC861_3ST_DIG;
13814 if (board_config != ALC861_AUTO)
13815 setup_preset(spec, &alc861_presets[board_config]);
13817 spec->stream_name_analog = "ALC861 Analog";
13818 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13819 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13821 spec->stream_name_digital = "ALC861 Digital";
13822 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13823 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13825 spec->vmaster_nid = 0x03;
13827 codec->patch_ops = alc_patch_ops;
13828 if (board_config == ALC861_AUTO)
13829 spec->init_hook = alc861_auto_init;
13830 #ifdef CONFIG_SND_HDA_POWER_SAVE
13831 if (!spec->loopback.amplist)
13832 spec->loopback.amplist = alc861_loopbacks;
13834 codec->proc_widget_hook = print_realtek_coef;
13840 * ALC861-VD support
13844 * In addition, an independent DAC
13846 #define ALC861VD_DIGOUT_NID 0x06
13848 static hda_nid_t alc861vd_dac_nids[4] = {
13849 /* front, surr, clfe, side surr */
13850 0x02, 0x03, 0x04, 0x05
13853 /* dac_nids for ALC660vd are in a different order - according to
13854 * Realtek's driver.
13855 * This should probably tesult in a different mixer for 6stack models
13856 * of ALC660vd codecs, but for now there is only 3stack mixer
13857 * - and it is the same as in 861vd.
13858 * adc_nids in ALC660vd are (is) the same as in 861vd
13860 static hda_nid_t alc660vd_dac_nids[3] = {
13861 /* front, rear, clfe, rear_surr */
13865 static hda_nid_t alc861vd_adc_nids[1] = {
13870 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13873 /* FIXME: should be a matrix-type input source selection */
13874 static struct hda_input_mux alc861vd_capture_source = {
13878 { "Front Mic", 0x1 },
13884 static struct hda_input_mux alc861vd_dallas_capture_source = {
13887 { "Ext Mic", 0x0 },
13888 { "Int Mic", 0x1 },
13892 static struct hda_input_mux alc861vd_hp_capture_source = {
13895 { "Front Mic", 0x0 },
13896 { "ATAPI Mic", 0x1 },
13903 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13910 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13911 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13912 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13913 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13914 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13921 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13922 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13923 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13924 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13925 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13929 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13930 { 6, alc861vd_6stack_ch6_init },
13931 { 8, alc861vd_6stack_ch8_init },
13934 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13937 .name = "Channel Mode",
13938 .info = alc_ch_mode_info,
13939 .get = alc_ch_mode_get,
13940 .put = alc_ch_mode_put,
13945 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13946 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13948 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13949 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13950 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13952 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13953 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13955 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13957 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13959 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13960 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13962 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13963 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13967 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13968 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13969 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13971 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13972 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13973 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13975 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13976 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13978 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13979 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13981 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13982 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13987 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13988 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13989 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13991 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13997 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13998 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13999 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14001 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14002 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14004 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14005 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14007 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14008 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14013 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14014 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14015 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14016 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14018 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14020 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14024 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14025 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14026 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14028 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14029 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14034 /* Pin assignment: Speaker=0x14, HP = 0x15,
14035 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14037 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14038 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14039 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14040 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14041 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14042 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14043 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14044 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14045 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14046 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14047 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14048 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
14049 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
14053 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14054 * Front Mic=0x18, ATAPI Mic = 0x19,
14056 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14057 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14058 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14059 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14060 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14061 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14062 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14063 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14064 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14070 * generic initialization of ADC, input mixers and output mixers
14072 static struct hda_verb alc861vd_volume_init_verbs[] = {
14074 * Unmute ADC0 and set the default input to mic-in
14076 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14077 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14079 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14080 * the analog-loopback mixer widget
14082 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14089 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14096 * Set up output mixers (0x02 - 0x05)
14098 /* set vol=0 to output mixers */
14099 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14100 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14101 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14102 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14104 /* set up input amps for analog loopback */
14105 /* Amp Indices: DAC = 0, mixer = 1 */
14106 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14108 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14109 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14111 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14112 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14113 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14119 * 3-stack pin configuration:
14120 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14122 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14124 * Set pin mode and muting
14126 /* set front pin widgets 0x14 for output */
14127 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14128 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14129 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14131 /* Mic (rear) pin: input vref at 80% */
14132 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14133 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14134 /* Front Mic pin: input vref at 80% */
14135 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14136 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14137 /* Line In pin: input */
14138 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14139 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14140 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14141 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14142 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14143 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14144 /* CD pin widget for input */
14145 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14151 * 6-stack pin configuration:
14153 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14155 * Set pin mode and muting
14157 /* set front pin widgets 0x14 for output */
14158 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14159 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14160 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14162 /* Rear Pin: output 1 (0x0d) */
14163 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14164 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14165 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14166 /* CLFE Pin: output 2 (0x0e) */
14167 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14168 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14169 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14170 /* Side Pin: output 3 (0x0f) */
14171 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14172 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14173 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14175 /* Mic (rear) pin: input vref at 80% */
14176 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14177 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14178 /* Front Mic pin: input vref at 80% */
14179 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14180 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14181 /* Line In pin: input */
14182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14183 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14184 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14185 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14187 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14188 /* CD pin widget for input */
14189 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14194 static struct hda_verb alc861vd_eapd_verbs[] = {
14195 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14199 static struct hda_verb alc660vd_eapd_verbs[] = {
14200 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14201 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14205 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14208 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14209 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14210 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14214 /* toggle speaker-output according to the hp-jack state */
14215 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14217 unsigned int present;
14218 unsigned char bits;
14220 present = snd_hda_codec_read(codec, 0x1b, 0,
14221 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14222 bits = present ? HDA_AMP_MUTE : 0;
14223 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14224 HDA_AMP_MUTE, bits);
14227 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14229 unsigned int present;
14230 unsigned char bits;
14232 present = snd_hda_codec_read(codec, 0x18, 0,
14233 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14234 bits = present ? HDA_AMP_MUTE : 0;
14235 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14236 HDA_AMP_MUTE, bits);
14239 static void alc861vd_lenovo_automute(struct hda_codec *codec)
14241 alc861vd_lenovo_hp_automute(codec);
14242 alc861vd_lenovo_mic_automute(codec);
14245 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14248 switch (res >> 26) {
14249 case ALC880_HP_EVENT:
14250 alc861vd_lenovo_hp_automute(codec);
14252 case ALC880_MIC_EVENT:
14253 alc861vd_lenovo_mic_automute(codec);
14258 static struct hda_verb alc861vd_dallas_verbs[] = {
14259 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14260 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14261 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14262 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14265 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14267 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14269 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14270 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14271 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14273 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14274 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14277 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14278 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14279 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14280 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14282 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14283 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14284 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14285 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14286 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14287 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14288 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14289 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14293 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14294 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14296 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14297 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14298 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14303 /* toggle speaker-output according to the hp-jack state */
14304 static void alc861vd_dallas_automute(struct hda_codec *codec)
14306 unsigned int present;
14308 present = snd_hda_codec_read(codec, 0x15, 0,
14309 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14310 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14311 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14314 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14316 if ((res >> 26) == ALC880_HP_EVENT)
14317 alc861vd_dallas_automute(codec);
14320 #ifdef CONFIG_SND_HDA_POWER_SAVE
14321 #define alc861vd_loopbacks alc880_loopbacks
14324 /* pcm configuration: identiacal with ALC880 */
14325 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14326 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14327 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14328 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14331 * configuration and preset
14333 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14334 [ALC660VD_3ST] = "3stack-660",
14335 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14336 [ALC660VD_ASUS_V1S] = "asus-v1s",
14337 [ALC861VD_3ST] = "3stack",
14338 [ALC861VD_3ST_DIG] = "3stack-digout",
14339 [ALC861VD_6ST_DIG] = "6stack-digout",
14340 [ALC861VD_LENOVO] = "lenovo",
14341 [ALC861VD_DALLAS] = "dallas",
14342 [ALC861VD_HP] = "hp",
14343 [ALC861VD_AUTO] = "auto",
14346 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14347 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14348 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14349 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14350 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14351 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14352 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14353 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14354 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14355 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14356 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14357 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14358 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14359 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14360 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
14361 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
14362 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
14363 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14367 static struct alc_config_preset alc861vd_presets[] = {
14369 .mixers = { alc861vd_3st_mixer },
14370 .init_verbs = { alc861vd_volume_init_verbs,
14371 alc861vd_3stack_init_verbs },
14372 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14373 .dac_nids = alc660vd_dac_nids,
14374 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14375 .channel_mode = alc861vd_3stack_2ch_modes,
14376 .input_mux = &alc861vd_capture_source,
14378 [ALC660VD_3ST_DIG] = {
14379 .mixers = { alc861vd_3st_mixer },
14380 .init_verbs = { alc861vd_volume_init_verbs,
14381 alc861vd_3stack_init_verbs },
14382 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14383 .dac_nids = alc660vd_dac_nids,
14384 .dig_out_nid = ALC861VD_DIGOUT_NID,
14385 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14386 .channel_mode = alc861vd_3stack_2ch_modes,
14387 .input_mux = &alc861vd_capture_source,
14390 .mixers = { alc861vd_3st_mixer },
14391 .init_verbs = { alc861vd_volume_init_verbs,
14392 alc861vd_3stack_init_verbs },
14393 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14394 .dac_nids = alc861vd_dac_nids,
14395 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14396 .channel_mode = alc861vd_3stack_2ch_modes,
14397 .input_mux = &alc861vd_capture_source,
14399 [ALC861VD_3ST_DIG] = {
14400 .mixers = { alc861vd_3st_mixer },
14401 .init_verbs = { alc861vd_volume_init_verbs,
14402 alc861vd_3stack_init_verbs },
14403 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14404 .dac_nids = alc861vd_dac_nids,
14405 .dig_out_nid = ALC861VD_DIGOUT_NID,
14406 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14407 .channel_mode = alc861vd_3stack_2ch_modes,
14408 .input_mux = &alc861vd_capture_source,
14410 [ALC861VD_6ST_DIG] = {
14411 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14412 .init_verbs = { alc861vd_volume_init_verbs,
14413 alc861vd_6stack_init_verbs },
14414 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14415 .dac_nids = alc861vd_dac_nids,
14416 .dig_out_nid = ALC861VD_DIGOUT_NID,
14417 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14418 .channel_mode = alc861vd_6stack_modes,
14419 .input_mux = &alc861vd_capture_source,
14421 [ALC861VD_LENOVO] = {
14422 .mixers = { alc861vd_lenovo_mixer },
14423 .init_verbs = { alc861vd_volume_init_verbs,
14424 alc861vd_3stack_init_verbs,
14425 alc861vd_eapd_verbs,
14426 alc861vd_lenovo_unsol_verbs },
14427 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14428 .dac_nids = alc660vd_dac_nids,
14429 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14430 .channel_mode = alc861vd_3stack_2ch_modes,
14431 .input_mux = &alc861vd_capture_source,
14432 .unsol_event = alc861vd_lenovo_unsol_event,
14433 .init_hook = alc861vd_lenovo_automute,
14435 [ALC861VD_DALLAS] = {
14436 .mixers = { alc861vd_dallas_mixer },
14437 .init_verbs = { alc861vd_dallas_verbs },
14438 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14439 .dac_nids = alc861vd_dac_nids,
14440 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14441 .channel_mode = alc861vd_3stack_2ch_modes,
14442 .input_mux = &alc861vd_dallas_capture_source,
14443 .unsol_event = alc861vd_dallas_unsol_event,
14444 .init_hook = alc861vd_dallas_automute,
14447 .mixers = { alc861vd_hp_mixer },
14448 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14449 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14450 .dac_nids = alc861vd_dac_nids,
14451 .dig_out_nid = ALC861VD_DIGOUT_NID,
14452 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14453 .channel_mode = alc861vd_3stack_2ch_modes,
14454 .input_mux = &alc861vd_hp_capture_source,
14455 .unsol_event = alc861vd_dallas_unsol_event,
14456 .init_hook = alc861vd_dallas_automute,
14458 [ALC660VD_ASUS_V1S] = {
14459 .mixers = { alc861vd_lenovo_mixer },
14460 .init_verbs = { alc861vd_volume_init_verbs,
14461 alc861vd_3stack_init_verbs,
14462 alc861vd_eapd_verbs,
14463 alc861vd_lenovo_unsol_verbs },
14464 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14465 .dac_nids = alc660vd_dac_nids,
14466 .dig_out_nid = ALC861VD_DIGOUT_NID,
14467 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14468 .channel_mode = alc861vd_3stack_2ch_modes,
14469 .input_mux = &alc861vd_capture_source,
14470 .unsol_event = alc861vd_lenovo_unsol_event,
14471 .init_hook = alc861vd_lenovo_automute,
14476 * BIOS auto configuration
14478 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14479 hda_nid_t nid, int pin_type, int dac_idx)
14481 alc_set_pin_output(codec, nid, pin_type);
14484 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14486 struct alc_spec *spec = codec->spec;
14489 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14490 for (i = 0; i <= HDA_SIDE; i++) {
14491 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14492 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14494 alc861vd_auto_set_output_and_unmute(codec, nid,
14500 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14502 struct alc_spec *spec = codec->spec;
14505 pin = spec->autocfg.hp_pins[0];
14506 if (pin) /* connect to front and use dac 0 */
14507 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14508 pin = spec->autocfg.speaker_pins[0];
14510 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14513 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14514 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14516 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14518 struct alc_spec *spec = codec->spec;
14521 for (i = 0; i < AUTO_PIN_LAST; i++) {
14522 hda_nid_t nid = spec->autocfg.input_pins[i];
14523 if (alc861vd_is_input_pin(nid)) {
14524 snd_hda_codec_write(codec, nid, 0,
14525 AC_VERB_SET_PIN_WIDGET_CONTROL,
14526 i <= AUTO_PIN_FRONT_MIC ?
14527 PIN_VREF80 : PIN_IN);
14528 if (nid != ALC861VD_PIN_CD_NID)
14529 snd_hda_codec_write(codec, nid, 0,
14530 AC_VERB_SET_AMP_GAIN_MUTE,
14536 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14538 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14539 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14541 /* add playback controls from the parsed DAC table */
14542 /* Based on ALC880 version. But ALC861VD has separate,
14543 * different NIDs for mute/unmute switch and volume control */
14544 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14545 const struct auto_pin_cfg *cfg)
14548 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14549 hda_nid_t nid_v, nid_s;
14552 for (i = 0; i < cfg->line_outs; i++) {
14553 if (!spec->multiout.dac_nids[i])
14555 nid_v = alc861vd_idx_to_mixer_vol(
14557 spec->multiout.dac_nids[i]));
14558 nid_s = alc861vd_idx_to_mixer_switch(
14560 spec->multiout.dac_nids[i]));
14564 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14565 "Center Playback Volume",
14566 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14570 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14571 "LFE Playback Volume",
14572 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14576 err = add_control(spec, ALC_CTL_BIND_MUTE,
14577 "Center Playback Switch",
14578 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14582 err = add_control(spec, ALC_CTL_BIND_MUTE,
14583 "LFE Playback Switch",
14584 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14589 sprintf(name, "%s Playback Volume", chname[i]);
14590 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14591 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14595 sprintf(name, "%s Playback Switch", chname[i]);
14596 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14597 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14606 /* add playback controls for speaker and HP outputs */
14607 /* Based on ALC880 version. But ALC861VD has separate,
14608 * different NIDs for mute/unmute switch and volume control */
14609 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14610 hda_nid_t pin, const char *pfx)
14612 hda_nid_t nid_v, nid_s;
14619 if (alc880_is_fixed_pin(pin)) {
14620 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14621 /* specify the DAC as the extra output */
14622 if (!spec->multiout.hp_nid)
14623 spec->multiout.hp_nid = nid_v;
14625 spec->multiout.extra_out_nid[0] = nid_v;
14626 /* control HP volume/switch on the output mixer amp */
14627 nid_v = alc861vd_idx_to_mixer_vol(
14628 alc880_fixed_pin_idx(pin));
14629 nid_s = alc861vd_idx_to_mixer_switch(
14630 alc880_fixed_pin_idx(pin));
14632 sprintf(name, "%s Playback Volume", pfx);
14633 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14634 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14637 sprintf(name, "%s Playback Switch", pfx);
14638 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14639 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14642 } else if (alc880_is_multi_pin(pin)) {
14643 /* set manual connection */
14644 /* we have only a switch on HP-out PIN */
14645 sprintf(name, "%s Playback Switch", pfx);
14646 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14647 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14654 /* parse the BIOS configuration and set up the alc_spec
14655 * return 1 if successful, 0 if the proper config is not found,
14656 * or a negative error code
14657 * Based on ALC880 version - had to change it to override
14658 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14659 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14661 struct alc_spec *spec = codec->spec;
14663 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14665 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14669 if (!spec->autocfg.line_outs)
14670 return 0; /* can't find valid BIOS pin config */
14672 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14675 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14678 err = alc861vd_auto_create_extra_out(spec,
14679 spec->autocfg.speaker_pins[0],
14683 err = alc861vd_auto_create_extra_out(spec,
14684 spec->autocfg.hp_pins[0],
14688 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14692 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14694 if (spec->autocfg.dig_out_pin)
14695 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14697 if (spec->kctls.list)
14698 add_mixer(spec, spec->kctls.list);
14700 add_verb(spec, alc861vd_volume_init_verbs);
14702 spec->num_mux_defs = 1;
14703 spec->input_mux = &spec->private_imux;
14705 err = alc_auto_add_mic_boost(codec);
14709 store_pin_configs(codec);
14713 /* additional initialization for auto-configuration model */
14714 static void alc861vd_auto_init(struct hda_codec *codec)
14716 struct alc_spec *spec = codec->spec;
14717 alc861vd_auto_init_multi_out(codec);
14718 alc861vd_auto_init_hp_out(codec);
14719 alc861vd_auto_init_analog_input(codec);
14720 alc861vd_auto_init_input_src(codec);
14721 if (spec->unsol_event)
14722 alc_inithook(codec);
14725 static int patch_alc861vd(struct hda_codec *codec)
14727 struct alc_spec *spec;
14728 int err, board_config;
14730 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14734 codec->spec = spec;
14736 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14740 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14741 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14742 "ALC861VD, trying auto-probe from BIOS...\n");
14743 board_config = ALC861VD_AUTO;
14746 if (board_config == ALC861VD_AUTO) {
14747 /* automatic parse from the BIOS config */
14748 err = alc861vd_parse_auto_config(codec);
14754 "hda_codec: Cannot set up configuration "
14755 "from BIOS. Using base mode...\n");
14756 board_config = ALC861VD_3ST;
14760 if (board_config != ALC861VD_AUTO)
14761 setup_preset(spec, &alc861vd_presets[board_config]);
14763 if (codec->vendor_id == 0x10ec0660) {
14764 spec->stream_name_analog = "ALC660-VD Analog";
14765 spec->stream_name_digital = "ALC660-VD Digital";
14766 /* always turn on EAPD */
14767 add_verb(spec, alc660vd_eapd_verbs);
14769 spec->stream_name_analog = "ALC861VD Analog";
14770 spec->stream_name_digital = "ALC861VD Digital";
14773 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14774 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14776 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14777 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14779 spec->adc_nids = alc861vd_adc_nids;
14780 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14781 spec->capsrc_nids = alc861vd_capsrc_nids;
14782 spec->is_mix_capture = 1;
14784 set_capture_mixer(spec);
14786 spec->vmaster_nid = 0x02;
14788 codec->patch_ops = alc_patch_ops;
14790 if (board_config == ALC861VD_AUTO)
14791 spec->init_hook = alc861vd_auto_init;
14792 #ifdef CONFIG_SND_HDA_POWER_SAVE
14793 if (!spec->loopback.amplist)
14794 spec->loopback.amplist = alc861vd_loopbacks;
14796 codec->proc_widget_hook = print_realtek_coef;
14804 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14805 * configuration. Each pin widget can choose any input DACs and a mixer.
14806 * Each ADC is connected from a mixer of all inputs. This makes possible
14807 * 6-channel independent captures.
14809 * In addition, an independent DAC for the multi-playback (not used in this
14812 #define ALC662_DIGOUT_NID 0x06
14813 #define ALC662_DIGIN_NID 0x0a
14815 static hda_nid_t alc662_dac_nids[4] = {
14816 /* front, rear, clfe, rear_surr */
14820 static hda_nid_t alc662_adc_nids[1] = {
14825 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14828 /* FIXME: should be a matrix-type input source selection */
14829 static struct hda_input_mux alc662_capture_source = {
14833 { "Front Mic", 0x1 },
14839 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14847 static struct hda_input_mux alc662_eeepc_capture_source = {
14855 static struct hda_input_mux alc663_capture_source = {
14859 { "Front Mic", 0x1 },
14864 static struct hda_input_mux alc663_m51va_capture_source = {
14867 { "Ext-Mic", 0x0 },
14875 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14882 static struct hda_verb alc662_3ST_ch2_init[] = {
14883 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14884 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14893 static struct hda_verb alc662_3ST_ch6_init[] = {
14894 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14895 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14896 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14897 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14898 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14899 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14903 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14904 { 2, alc662_3ST_ch2_init },
14905 { 6, alc662_3ST_ch6_init },
14911 static struct hda_verb alc662_sixstack_ch6_init[] = {
14912 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14913 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14914 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14921 static struct hda_verb alc662_sixstack_ch8_init[] = {
14922 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14923 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14924 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14928 static struct hda_channel_mode alc662_5stack_modes[2] = {
14929 { 2, alc662_sixstack_ch6_init },
14930 { 6, alc662_sixstack_ch8_init },
14933 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14934 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14937 static struct snd_kcontrol_new alc662_base_mixer[] = {
14938 /* output mixer control */
14939 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14940 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14941 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14942 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14943 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14944 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14945 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14946 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14947 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14949 /*Input mixer control */
14950 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14951 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14952 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14953 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14954 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14955 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14956 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14957 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14961 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14962 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14963 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14964 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14970 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14971 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14972 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14973 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14974 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14978 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14979 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14980 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14982 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14983 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14985 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14986 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14996 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14997 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
15001 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15002 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15003 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15004 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15005 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15006 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15007 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15008 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15014 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15015 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15017 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15018 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15020 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15021 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15022 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15024 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15025 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15026 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15030 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15031 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15032 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15033 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15034 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15035 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15036 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15037 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15038 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15039 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15040 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15042 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15048 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15049 .ops = &snd_hda_bind_vol,
15051 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15052 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15057 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15058 .ops = &snd_hda_bind_sw,
15060 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15061 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15066 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15067 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15068 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15070 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15074 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15075 .ops = &snd_hda_bind_sw,
15077 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15078 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15079 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15084 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15085 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15086 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15087 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15088 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15089 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15090 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15095 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15096 .ops = &snd_hda_bind_sw,
15098 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15099 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15100 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15105 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15106 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15107 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15110 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15111 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15115 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15116 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15117 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15121 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15122 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15126 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15127 .ops = &snd_hda_bind_vol,
15129 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15130 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15135 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15136 .ops = &snd_hda_bind_sw,
15138 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15139 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15144 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15145 HDA_BIND_VOL("Master Playback Volume",
15146 &alc663_asus_two_bind_master_vol),
15147 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15151 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15155 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15156 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15157 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15158 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15165 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15166 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15167 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15168 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15169 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15170 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15174 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15175 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15179 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15180 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15181 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15186 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15187 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15188 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15189 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15193 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15195 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15196 .name = "Channel Mode",
15197 .info = alc_ch_mode_info,
15198 .get = alc_ch_mode_get,
15199 .put = alc_ch_mode_put,
15204 static struct hda_verb alc662_init_verbs[] = {
15205 /* ADC: mute amp left and right */
15206 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15207 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15208 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15210 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15211 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15216 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15218 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15219 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15220 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15221 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15223 /* Front Pin: output 0 (0x0c) */
15224 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15227 /* Rear Pin: output 1 (0x0d) */
15228 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15231 /* CLFE Pin: output 2 (0x0e) */
15232 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15233 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15235 /* Mic (rear) pin: input vref at 80% */
15236 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15237 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15238 /* Front Mic pin: input vref at 80% */
15239 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15240 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15241 /* Line In pin: input */
15242 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15243 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15244 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15245 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15246 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15247 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15248 /* CD pin widget for input */
15249 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15251 /* FIXME: use matrix-type input source selection */
15252 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15255 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15256 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15264 /* always trun on EAPD */
15265 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15266 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15271 static struct hda_verb alc662_sue_init_verbs[] = {
15272 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15273 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15277 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15278 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15279 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15283 /* Set Unsolicited Event*/
15284 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15285 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15286 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15291 * generic initialization of ADC, input mixers and output mixers
15293 static struct hda_verb alc662_auto_init_verbs[] = {
15295 * Unmute ADC and set the default input to mic-in
15297 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15300 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15302 * Note: PASD motherboards uses the Line In 2 as the input for front
15303 * panel mic (mic 2)
15305 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15313 * Set up output mixers (0x0c - 0x0f)
15315 /* set vol=0 to output mixers */
15316 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15317 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15318 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15320 /* set up input amps for analog loopback */
15321 /* Amp Indices: DAC = 0, mixer = 1 */
15322 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15324 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15326 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15327 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15330 /* FIXME: use matrix-type input source selection */
15331 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15338 /* additional verbs for ALC663 */
15339 static struct hda_verb alc663_auto_init_verbs[] = {
15340 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15341 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15345 static struct hda_verb alc663_m51va_init_verbs[] = {
15346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15347 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15348 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15349 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15350 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15353 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15354 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15358 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15359 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15360 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15361 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15364 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15365 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15369 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15370 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15371 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15372 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15373 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15376 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15377 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15381 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15387 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15388 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15392 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15393 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15394 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15395 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15396 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15399 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15402 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15403 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15404 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15408 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15409 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15410 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15411 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15412 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15414 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15415 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15418 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15419 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15420 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15424 static struct hda_verb alc663_g71v_init_verbs[] = {
15425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15426 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15427 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15429 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15430 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15431 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15433 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15434 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15435 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15439 static struct hda_verb alc663_g50v_init_verbs[] = {
15440 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15441 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15442 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15444 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15445 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15449 static struct hda_verb alc662_ecs_init_verbs[] = {
15450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15452 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15453 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15457 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15458 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15459 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15463 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15465 unsigned int present;
15466 unsigned char bits;
15468 present = snd_hda_codec_read(codec, 0x14, 0,
15469 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15470 bits = present ? HDA_AMP_MUTE : 0;
15471 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15472 HDA_AMP_MUTE, bits);
15475 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15477 unsigned int present;
15478 unsigned char bits;
15480 present = snd_hda_codec_read(codec, 0x1b, 0,
15481 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15482 bits = present ? HDA_AMP_MUTE : 0;
15483 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15484 HDA_AMP_MUTE, bits);
15485 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15486 HDA_AMP_MUTE, bits);
15489 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15492 if ((res >> 26) == ALC880_HP_EVENT)
15493 alc662_lenovo_101e_all_automute(codec);
15494 if ((res >> 26) == ALC880_FRONT_EVENT)
15495 alc662_lenovo_101e_ispeaker_automute(codec);
15498 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15500 unsigned int present;
15502 present = snd_hda_codec_read(codec, 0x18, 0,
15503 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15504 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15505 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15506 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15507 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15508 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15509 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15510 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15511 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15514 /* unsolicited event for HP jack sensing */
15515 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15518 if ((res >> 26) == ALC880_HP_EVENT)
15519 alc262_hippo1_automute( codec );
15521 if ((res >> 26) == ALC880_MIC_EVENT)
15522 alc662_eeepc_mic_automute(codec);
15525 static void alc662_eeepc_inithook(struct hda_codec *codec)
15527 alc262_hippo1_automute( codec );
15528 alc662_eeepc_mic_automute(codec);
15531 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15534 unsigned int present;
15536 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15537 present = snd_hda_codec_read(codec, 0x14, 0,
15538 AC_VERB_GET_PIN_SENSE, 0);
15539 present = (present & 0x80000000) != 0;
15541 /* mute internal speaker */
15542 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15543 HDA_AMP_MUTE, HDA_AMP_MUTE);
15545 /* unmute internal speaker if necessary */
15546 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15547 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15548 HDA_AMP_MUTE, mute);
15552 /* unsolicited event for HP jack sensing */
15553 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15556 if ((res >> 26) == ALC880_HP_EVENT)
15557 alc662_eeepc_ep20_automute(codec);
15560 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15562 alc662_eeepc_ep20_automute(codec);
15565 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15567 unsigned int present;
15568 unsigned char bits;
15570 present = snd_hda_codec_read(codec, 0x21, 0,
15571 AC_VERB_GET_PIN_SENSE, 0)
15572 & AC_PINSENSE_PRESENCE;
15573 bits = present ? HDA_AMP_MUTE : 0;
15574 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15575 AMP_IN_MUTE(0), bits);
15576 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15577 AMP_IN_MUTE(0), bits);
15580 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15582 unsigned int present;
15583 unsigned char bits;
15585 present = snd_hda_codec_read(codec, 0x21, 0,
15586 AC_VERB_GET_PIN_SENSE, 0)
15587 & AC_PINSENSE_PRESENCE;
15588 bits = present ? HDA_AMP_MUTE : 0;
15589 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15590 AMP_IN_MUTE(0), bits);
15591 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15592 AMP_IN_MUTE(0), bits);
15593 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15594 AMP_IN_MUTE(0), bits);
15595 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15596 AMP_IN_MUTE(0), bits);
15599 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15601 unsigned int present;
15602 unsigned char bits;
15604 present = snd_hda_codec_read(codec, 0x15, 0,
15605 AC_VERB_GET_PIN_SENSE, 0)
15606 & AC_PINSENSE_PRESENCE;
15607 bits = present ? HDA_AMP_MUTE : 0;
15608 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15609 AMP_IN_MUTE(0), bits);
15610 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15611 AMP_IN_MUTE(0), bits);
15612 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15613 AMP_IN_MUTE(0), bits);
15614 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15615 AMP_IN_MUTE(0), bits);
15618 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15620 unsigned int present;
15621 unsigned char bits;
15623 present = snd_hda_codec_read(codec, 0x1b, 0,
15624 AC_VERB_GET_PIN_SENSE, 0)
15625 & AC_PINSENSE_PRESENCE;
15626 bits = present ? 0 : PIN_OUT;
15627 snd_hda_codec_write(codec, 0x14, 0,
15628 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15631 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15633 unsigned int present1, present2;
15635 present1 = snd_hda_codec_read(codec, 0x21, 0,
15636 AC_VERB_GET_PIN_SENSE, 0)
15637 & AC_PINSENSE_PRESENCE;
15638 present2 = snd_hda_codec_read(codec, 0x15, 0,
15639 AC_VERB_GET_PIN_SENSE, 0)
15640 & AC_PINSENSE_PRESENCE;
15642 if (present1 || present2) {
15643 snd_hda_codec_write_cache(codec, 0x14, 0,
15644 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15646 snd_hda_codec_write_cache(codec, 0x14, 0,
15647 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15651 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15653 unsigned int present1, present2;
15655 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15656 AC_VERB_GET_PIN_SENSE, 0)
15657 & AC_PINSENSE_PRESENCE;
15658 present2 = snd_hda_codec_read(codec, 0x15, 0,
15659 AC_VERB_GET_PIN_SENSE, 0)
15660 & AC_PINSENSE_PRESENCE;
15662 if (present1 || present2) {
15663 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15664 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15665 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15666 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15668 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15669 AMP_IN_MUTE(0), 0);
15670 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15671 AMP_IN_MUTE(0), 0);
15675 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15677 unsigned int present;
15679 present = snd_hda_codec_read(codec, 0x18, 0,
15680 AC_VERB_GET_PIN_SENSE, 0)
15681 & AC_PINSENSE_PRESENCE;
15682 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15683 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15684 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15685 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15686 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15687 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15688 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15689 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15692 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15695 switch (res >> 26) {
15696 case ALC880_HP_EVENT:
15697 alc663_m51va_speaker_automute(codec);
15699 case ALC880_MIC_EVENT:
15700 alc663_m51va_mic_automute(codec);
15705 static void alc663_m51va_inithook(struct hda_codec *codec)
15707 alc663_m51va_speaker_automute(codec);
15708 alc663_m51va_mic_automute(codec);
15711 /* ***************** Mode1 ******************************/
15712 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15715 switch (res >> 26) {
15716 case ALC880_HP_EVENT:
15717 alc663_m51va_speaker_automute(codec);
15719 case ALC880_MIC_EVENT:
15720 alc662_eeepc_mic_automute(codec);
15725 static void alc663_mode1_inithook(struct hda_codec *codec)
15727 alc663_m51va_speaker_automute(codec);
15728 alc662_eeepc_mic_automute(codec);
15730 /* ***************** Mode2 ******************************/
15731 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15734 switch (res >> 26) {
15735 case ALC880_HP_EVENT:
15736 alc662_f5z_speaker_automute(codec);
15738 case ALC880_MIC_EVENT:
15739 alc662_eeepc_mic_automute(codec);
15744 static void alc662_mode2_inithook(struct hda_codec *codec)
15746 alc662_f5z_speaker_automute(codec);
15747 alc662_eeepc_mic_automute(codec);
15749 /* ***************** Mode3 ******************************/
15750 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15753 switch (res >> 26) {
15754 case ALC880_HP_EVENT:
15755 alc663_two_hp_m1_speaker_automute(codec);
15757 case ALC880_MIC_EVENT:
15758 alc662_eeepc_mic_automute(codec);
15763 static void alc663_mode3_inithook(struct hda_codec *codec)
15765 alc663_two_hp_m1_speaker_automute(codec);
15766 alc662_eeepc_mic_automute(codec);
15768 /* ***************** Mode4 ******************************/
15769 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15772 switch (res >> 26) {
15773 case ALC880_HP_EVENT:
15774 alc663_21jd_two_speaker_automute(codec);
15776 case ALC880_MIC_EVENT:
15777 alc662_eeepc_mic_automute(codec);
15782 static void alc663_mode4_inithook(struct hda_codec *codec)
15784 alc663_21jd_two_speaker_automute(codec);
15785 alc662_eeepc_mic_automute(codec);
15787 /* ***************** Mode5 ******************************/
15788 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15791 switch (res >> 26) {
15792 case ALC880_HP_EVENT:
15793 alc663_15jd_two_speaker_automute(codec);
15795 case ALC880_MIC_EVENT:
15796 alc662_eeepc_mic_automute(codec);
15801 static void alc663_mode5_inithook(struct hda_codec *codec)
15803 alc663_15jd_two_speaker_automute(codec);
15804 alc662_eeepc_mic_automute(codec);
15806 /* ***************** Mode6 ******************************/
15807 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15810 switch (res >> 26) {
15811 case ALC880_HP_EVENT:
15812 alc663_two_hp_m2_speaker_automute(codec);
15814 case ALC880_MIC_EVENT:
15815 alc662_eeepc_mic_automute(codec);
15820 static void alc663_mode6_inithook(struct hda_codec *codec)
15822 alc663_two_hp_m2_speaker_automute(codec);
15823 alc662_eeepc_mic_automute(codec);
15826 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15828 unsigned int present;
15829 unsigned char bits;
15831 present = snd_hda_codec_read(codec, 0x21, 0,
15832 AC_VERB_GET_PIN_SENSE, 0)
15833 & AC_PINSENSE_PRESENCE;
15834 bits = present ? HDA_AMP_MUTE : 0;
15835 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15836 HDA_AMP_MUTE, bits);
15837 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15838 HDA_AMP_MUTE, bits);
15841 static void alc663_g71v_front_automute(struct hda_codec *codec)
15843 unsigned int present;
15844 unsigned char bits;
15846 present = snd_hda_codec_read(codec, 0x15, 0,
15847 AC_VERB_GET_PIN_SENSE, 0)
15848 & AC_PINSENSE_PRESENCE;
15849 bits = present ? HDA_AMP_MUTE : 0;
15850 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15851 HDA_AMP_MUTE, bits);
15854 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15857 switch (res >> 26) {
15858 case ALC880_HP_EVENT:
15859 alc663_g71v_hp_automute(codec);
15861 case ALC880_FRONT_EVENT:
15862 alc663_g71v_front_automute(codec);
15864 case ALC880_MIC_EVENT:
15865 alc662_eeepc_mic_automute(codec);
15870 static void alc663_g71v_inithook(struct hda_codec *codec)
15872 alc663_g71v_front_automute(codec);
15873 alc663_g71v_hp_automute(codec);
15874 alc662_eeepc_mic_automute(codec);
15877 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15880 switch (res >> 26) {
15881 case ALC880_HP_EVENT:
15882 alc663_m51va_speaker_automute(codec);
15884 case ALC880_MIC_EVENT:
15885 alc662_eeepc_mic_automute(codec);
15890 static void alc663_g50v_inithook(struct hda_codec *codec)
15892 alc663_m51va_speaker_automute(codec);
15893 alc662_eeepc_mic_automute(codec);
15896 /* bind hp and internal speaker mute (with plug check) */
15897 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15898 struct snd_ctl_elem_value *ucontrol)
15900 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15901 long *valp = ucontrol->value.integer.value;
15904 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15906 valp[0] ? 0 : HDA_AMP_MUTE);
15907 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15909 valp[1] ? 0 : HDA_AMP_MUTE);
15911 alc262_hippo1_automute(codec);
15915 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15916 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15918 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15919 .name = "Master Playback Switch",
15920 .info = snd_hda_mixer_amp_switch_info,
15921 .get = snd_hda_mixer_amp_switch_get,
15922 .put = alc662_ecs_master_sw_put,
15923 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15926 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15927 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15928 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15930 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15931 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15932 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15936 #ifdef CONFIG_SND_HDA_POWER_SAVE
15937 #define alc662_loopbacks alc880_loopbacks
15941 /* pcm configuration: identiacal with ALC880 */
15942 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15943 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15944 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15945 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15948 * configuration and preset
15950 static const char *alc662_models[ALC662_MODEL_LAST] = {
15951 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15952 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15953 [ALC662_3ST_6ch] = "3stack-6ch",
15954 [ALC662_5ST_DIG] = "6stack-dig",
15955 [ALC662_LENOVO_101E] = "lenovo-101e",
15956 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15957 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15958 [ALC662_ECS] = "ecs",
15959 [ALC663_ASUS_M51VA] = "m51va",
15960 [ALC663_ASUS_G71V] = "g71v",
15961 [ALC663_ASUS_H13] = "h13",
15962 [ALC663_ASUS_G50V] = "g50v",
15963 [ALC663_ASUS_MODE1] = "asus-mode1",
15964 [ALC662_ASUS_MODE2] = "asus-mode2",
15965 [ALC663_ASUS_MODE3] = "asus-mode3",
15966 [ALC663_ASUS_MODE4] = "asus-mode4",
15967 [ALC663_ASUS_MODE5] = "asus-mode5",
15968 [ALC663_ASUS_MODE6] = "asus-mode6",
15969 [ALC662_AUTO] = "auto",
15972 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15973 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15974 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15975 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15976 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15977 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15978 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15979 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15980 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15981 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15982 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15983 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15984 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15985 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15986 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15987 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15988 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15989 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15990 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15991 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15992 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15993 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15994 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15995 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15996 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15997 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15998 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15999 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16000 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16001 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16002 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16003 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16004 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16005 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16006 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16007 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16008 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16009 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16010 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16011 ALC662_3ST_6ch_DIG),
16012 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16013 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16014 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16015 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16016 ALC662_3ST_6ch_DIG),
16017 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16018 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16019 ALC662_3ST_6ch_DIG),
16020 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
16021 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
16022 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
16026 static struct alc_config_preset alc662_presets[] = {
16027 [ALC662_3ST_2ch_DIG] = {
16028 .mixers = { alc662_3ST_2ch_mixer },
16029 .init_verbs = { alc662_init_verbs },
16030 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16031 .dac_nids = alc662_dac_nids,
16032 .dig_out_nid = ALC662_DIGOUT_NID,
16033 .dig_in_nid = ALC662_DIGIN_NID,
16034 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16035 .channel_mode = alc662_3ST_2ch_modes,
16036 .input_mux = &alc662_capture_source,
16038 [ALC662_3ST_6ch_DIG] = {
16039 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16040 .init_verbs = { alc662_init_verbs },
16041 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16042 .dac_nids = alc662_dac_nids,
16043 .dig_out_nid = ALC662_DIGOUT_NID,
16044 .dig_in_nid = ALC662_DIGIN_NID,
16045 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16046 .channel_mode = alc662_3ST_6ch_modes,
16048 .input_mux = &alc662_capture_source,
16050 [ALC662_3ST_6ch] = {
16051 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16052 .init_verbs = { alc662_init_verbs },
16053 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16054 .dac_nids = alc662_dac_nids,
16055 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16056 .channel_mode = alc662_3ST_6ch_modes,
16058 .input_mux = &alc662_capture_source,
16060 [ALC662_5ST_DIG] = {
16061 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16062 .init_verbs = { alc662_init_verbs },
16063 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16064 .dac_nids = alc662_dac_nids,
16065 .dig_out_nid = ALC662_DIGOUT_NID,
16066 .dig_in_nid = ALC662_DIGIN_NID,
16067 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16068 .channel_mode = alc662_5stack_modes,
16069 .input_mux = &alc662_capture_source,
16071 [ALC662_LENOVO_101E] = {
16072 .mixers = { alc662_lenovo_101e_mixer },
16073 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16074 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16075 .dac_nids = alc662_dac_nids,
16076 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16077 .channel_mode = alc662_3ST_2ch_modes,
16078 .input_mux = &alc662_lenovo_101e_capture_source,
16079 .unsol_event = alc662_lenovo_101e_unsol_event,
16080 .init_hook = alc662_lenovo_101e_all_automute,
16082 [ALC662_ASUS_EEEPC_P701] = {
16083 .mixers = { alc662_eeepc_p701_mixer },
16084 .init_verbs = { alc662_init_verbs,
16085 alc662_eeepc_sue_init_verbs },
16086 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16087 .dac_nids = alc662_dac_nids,
16088 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16089 .channel_mode = alc662_3ST_2ch_modes,
16090 .input_mux = &alc662_eeepc_capture_source,
16091 .unsol_event = alc662_eeepc_unsol_event,
16092 .init_hook = alc662_eeepc_inithook,
16094 [ALC662_ASUS_EEEPC_EP20] = {
16095 .mixers = { alc662_eeepc_ep20_mixer,
16096 alc662_chmode_mixer },
16097 .init_verbs = { alc662_init_verbs,
16098 alc662_eeepc_ep20_sue_init_verbs },
16099 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16100 .dac_nids = alc662_dac_nids,
16101 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16102 .channel_mode = alc662_3ST_6ch_modes,
16103 .input_mux = &alc662_lenovo_101e_capture_source,
16104 .unsol_event = alc662_eeepc_ep20_unsol_event,
16105 .init_hook = alc662_eeepc_ep20_inithook,
16108 .mixers = { alc662_ecs_mixer },
16109 .init_verbs = { alc662_init_verbs,
16110 alc662_ecs_init_verbs },
16111 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16112 .dac_nids = alc662_dac_nids,
16113 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16114 .channel_mode = alc662_3ST_2ch_modes,
16115 .input_mux = &alc662_eeepc_capture_source,
16116 .unsol_event = alc662_eeepc_unsol_event,
16117 .init_hook = alc662_eeepc_inithook,
16119 [ALC663_ASUS_M51VA] = {
16120 .mixers = { alc663_m51va_mixer },
16121 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16122 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16123 .dac_nids = alc662_dac_nids,
16124 .dig_out_nid = ALC662_DIGOUT_NID,
16125 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16126 .channel_mode = alc662_3ST_2ch_modes,
16127 .input_mux = &alc663_m51va_capture_source,
16128 .unsol_event = alc663_m51va_unsol_event,
16129 .init_hook = alc663_m51va_inithook,
16131 [ALC663_ASUS_G71V] = {
16132 .mixers = { alc663_g71v_mixer },
16133 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16134 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16135 .dac_nids = alc662_dac_nids,
16136 .dig_out_nid = ALC662_DIGOUT_NID,
16137 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16138 .channel_mode = alc662_3ST_2ch_modes,
16139 .input_mux = &alc662_eeepc_capture_source,
16140 .unsol_event = alc663_g71v_unsol_event,
16141 .init_hook = alc663_g71v_inithook,
16143 [ALC663_ASUS_H13] = {
16144 .mixers = { alc663_m51va_mixer },
16145 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16146 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16147 .dac_nids = alc662_dac_nids,
16148 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16149 .channel_mode = alc662_3ST_2ch_modes,
16150 .input_mux = &alc663_m51va_capture_source,
16151 .unsol_event = alc663_m51va_unsol_event,
16152 .init_hook = alc663_m51va_inithook,
16154 [ALC663_ASUS_G50V] = {
16155 .mixers = { alc663_g50v_mixer },
16156 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16157 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16158 .dac_nids = alc662_dac_nids,
16159 .dig_out_nid = ALC662_DIGOUT_NID,
16160 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16161 .channel_mode = alc662_3ST_6ch_modes,
16162 .input_mux = &alc663_capture_source,
16163 .unsol_event = alc663_g50v_unsol_event,
16164 .init_hook = alc663_g50v_inithook,
16166 [ALC663_ASUS_MODE1] = {
16167 .mixers = { alc663_m51va_mixer },
16168 .cap_mixer = alc662_auto_capture_mixer,
16169 .init_verbs = { alc662_init_verbs,
16170 alc663_21jd_amic_init_verbs },
16171 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16173 .dac_nids = alc662_dac_nids,
16174 .dig_out_nid = ALC662_DIGOUT_NID,
16175 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16176 .channel_mode = alc662_3ST_2ch_modes,
16177 .input_mux = &alc662_eeepc_capture_source,
16178 .unsol_event = alc663_mode1_unsol_event,
16179 .init_hook = alc663_mode1_inithook,
16181 [ALC662_ASUS_MODE2] = {
16182 .mixers = { alc662_1bjd_mixer },
16183 .cap_mixer = alc662_auto_capture_mixer,
16184 .init_verbs = { alc662_init_verbs,
16185 alc662_1bjd_amic_init_verbs },
16186 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16187 .dac_nids = alc662_dac_nids,
16188 .dig_out_nid = ALC662_DIGOUT_NID,
16189 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16190 .channel_mode = alc662_3ST_2ch_modes,
16191 .input_mux = &alc662_eeepc_capture_source,
16192 .unsol_event = alc662_mode2_unsol_event,
16193 .init_hook = alc662_mode2_inithook,
16195 [ALC663_ASUS_MODE3] = {
16196 .mixers = { alc663_two_hp_m1_mixer },
16197 .cap_mixer = alc662_auto_capture_mixer,
16198 .init_verbs = { alc662_init_verbs,
16199 alc663_two_hp_amic_m1_init_verbs },
16200 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16202 .dac_nids = alc662_dac_nids,
16203 .dig_out_nid = ALC662_DIGOUT_NID,
16204 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16205 .channel_mode = alc662_3ST_2ch_modes,
16206 .input_mux = &alc662_eeepc_capture_source,
16207 .unsol_event = alc663_mode3_unsol_event,
16208 .init_hook = alc663_mode3_inithook,
16210 [ALC663_ASUS_MODE4] = {
16211 .mixers = { alc663_asus_21jd_clfe_mixer },
16212 .cap_mixer = alc662_auto_capture_mixer,
16213 .init_verbs = { alc662_init_verbs,
16214 alc663_21jd_amic_init_verbs},
16215 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16217 .dac_nids = alc662_dac_nids,
16218 .dig_out_nid = ALC662_DIGOUT_NID,
16219 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16220 .channel_mode = alc662_3ST_2ch_modes,
16221 .input_mux = &alc662_eeepc_capture_source,
16222 .unsol_event = alc663_mode4_unsol_event,
16223 .init_hook = alc663_mode4_inithook,
16225 [ALC663_ASUS_MODE5] = {
16226 .mixers = { alc663_asus_15jd_clfe_mixer },
16227 .cap_mixer = alc662_auto_capture_mixer,
16228 .init_verbs = { alc662_init_verbs,
16229 alc663_15jd_amic_init_verbs },
16230 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16232 .dac_nids = alc662_dac_nids,
16233 .dig_out_nid = ALC662_DIGOUT_NID,
16234 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16235 .channel_mode = alc662_3ST_2ch_modes,
16236 .input_mux = &alc662_eeepc_capture_source,
16237 .unsol_event = alc663_mode5_unsol_event,
16238 .init_hook = alc663_mode5_inithook,
16240 [ALC663_ASUS_MODE6] = {
16241 .mixers = { alc663_two_hp_m2_mixer },
16242 .cap_mixer = alc662_auto_capture_mixer,
16243 .init_verbs = { alc662_init_verbs,
16244 alc663_two_hp_amic_m2_init_verbs },
16245 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16247 .dac_nids = alc662_dac_nids,
16248 .dig_out_nid = ALC662_DIGOUT_NID,
16249 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16250 .channel_mode = alc662_3ST_2ch_modes,
16251 .input_mux = &alc662_eeepc_capture_source,
16252 .unsol_event = alc663_mode6_unsol_event,
16253 .init_hook = alc663_mode6_inithook,
16259 * BIOS auto configuration
16262 /* add playback controls from the parsed DAC table */
16263 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16264 const struct auto_pin_cfg *cfg)
16267 static const char *chname[4] = {
16268 "Front", "Surround", NULL /*CLFE*/, "Side"
16273 for (i = 0; i < cfg->line_outs; i++) {
16274 if (!spec->multiout.dac_nids[i])
16276 nid = alc880_idx_to_dac(i);
16279 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16280 "Center Playback Volume",
16281 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16285 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16286 "LFE Playback Volume",
16287 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16291 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16292 "Center Playback Switch",
16293 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16297 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16298 "LFE Playback Switch",
16299 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16304 sprintf(name, "%s Playback Volume", chname[i]);
16305 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16306 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16310 sprintf(name, "%s Playback Switch", chname[i]);
16311 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16312 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16321 /* add playback controls for speaker and HP outputs */
16322 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16333 /* ALC663 has a mono output pin on 0x17 */
16334 sprintf(name, "%s Playback Switch", pfx);
16335 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16336 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16340 if (alc880_is_fixed_pin(pin)) {
16341 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16342 /* printk("DAC nid=%x\n",nid); */
16343 /* specify the DAC as the extra output */
16344 if (!spec->multiout.hp_nid)
16345 spec->multiout.hp_nid = nid;
16347 spec->multiout.extra_out_nid[0] = nid;
16348 /* control HP volume/switch on the output mixer amp */
16349 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16350 sprintf(name, "%s Playback Volume", pfx);
16351 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16352 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16355 sprintf(name, "%s Playback Switch", pfx);
16356 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16357 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16360 } else if (alc880_is_multi_pin(pin)) {
16361 /* set manual connection */
16362 /* we have only a switch on HP-out PIN */
16363 sprintf(name, "%s Playback Switch", pfx);
16364 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16365 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16372 /* create playback/capture controls for input pins */
16373 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16374 const struct auto_pin_cfg *cfg)
16376 struct hda_input_mux *imux = &spec->private_imux;
16379 for (i = 0; i < AUTO_PIN_LAST; i++) {
16380 if (alc880_is_input_pin(cfg->input_pins[i])) {
16381 idx = alc880_input_pin_idx(cfg->input_pins[i]);
16382 err = new_analog_input(spec, cfg->input_pins[i],
16383 auto_pin_cfg_labels[i],
16387 imux->items[imux->num_items].label =
16388 auto_pin_cfg_labels[i];
16389 imux->items[imux->num_items].index =
16390 alc880_input_pin_idx(cfg->input_pins[i]);
16397 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16398 hda_nid_t nid, int pin_type,
16401 alc_set_pin_output(codec, nid, pin_type);
16402 /* need the manual connection? */
16403 if (alc880_is_multi_pin(nid)) {
16404 struct alc_spec *spec = codec->spec;
16405 int idx = alc880_multi_pin_idx(nid);
16406 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16407 AC_VERB_SET_CONNECT_SEL,
16408 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16412 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16414 struct alc_spec *spec = codec->spec;
16417 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16418 for (i = 0; i <= HDA_SIDE; i++) {
16419 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16420 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16422 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16427 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16429 struct alc_spec *spec = codec->spec;
16432 pin = spec->autocfg.hp_pins[0];
16433 if (pin) /* connect to front */
16435 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16436 pin = spec->autocfg.speaker_pins[0];
16438 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16441 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16442 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16444 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16446 struct alc_spec *spec = codec->spec;
16449 for (i = 0; i < AUTO_PIN_LAST; i++) {
16450 hda_nid_t nid = spec->autocfg.input_pins[i];
16451 if (alc662_is_input_pin(nid)) {
16452 snd_hda_codec_write(codec, nid, 0,
16453 AC_VERB_SET_PIN_WIDGET_CONTROL,
16454 (i <= AUTO_PIN_FRONT_MIC ?
16455 PIN_VREF80 : PIN_IN));
16456 if (nid != ALC662_PIN_CD_NID)
16457 snd_hda_codec_write(codec, nid, 0,
16458 AC_VERB_SET_AMP_GAIN_MUTE,
16464 #define alc662_auto_init_input_src alc882_auto_init_input_src
16466 static int alc662_parse_auto_config(struct hda_codec *codec)
16468 struct alc_spec *spec = codec->spec;
16470 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16472 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16476 if (!spec->autocfg.line_outs)
16477 return 0; /* can't find valid BIOS pin config */
16479 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16482 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16485 err = alc662_auto_create_extra_out(spec,
16486 spec->autocfg.speaker_pins[0],
16490 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16494 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16498 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16500 if (spec->autocfg.dig_out_pin)
16501 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16503 if (spec->kctls.list)
16504 add_mixer(spec, spec->kctls.list);
16506 spec->num_mux_defs = 1;
16507 spec->input_mux = &spec->private_imux;
16509 add_verb(spec, alc662_auto_init_verbs);
16510 if (codec->vendor_id == 0x10ec0663)
16511 add_verb(spec, alc663_auto_init_verbs);
16513 err = alc_auto_add_mic_boost(codec);
16517 store_pin_configs(codec);
16521 /* additional initialization for auto-configuration model */
16522 static void alc662_auto_init(struct hda_codec *codec)
16524 struct alc_spec *spec = codec->spec;
16525 alc662_auto_init_multi_out(codec);
16526 alc662_auto_init_hp_out(codec);
16527 alc662_auto_init_analog_input(codec);
16528 alc662_auto_init_input_src(codec);
16529 if (spec->unsol_event)
16530 alc_inithook(codec);
16533 static int patch_alc662(struct hda_codec *codec)
16535 struct alc_spec *spec;
16536 int err, board_config;
16538 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16542 codec->spec = spec;
16544 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16546 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16549 if (board_config < 0) {
16550 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16551 "trying auto-probe from BIOS...\n");
16552 board_config = ALC662_AUTO;
16555 if (board_config == ALC662_AUTO) {
16556 /* automatic parse from the BIOS config */
16557 err = alc662_parse_auto_config(codec);
16563 "hda_codec: Cannot set up configuration "
16564 "from BIOS. Using base mode...\n");
16565 board_config = ALC662_3ST_2ch_DIG;
16569 if (board_config != ALC662_AUTO)
16570 setup_preset(spec, &alc662_presets[board_config]);
16572 if (codec->vendor_id == 0x10ec0663) {
16573 spec->stream_name_analog = "ALC663 Analog";
16574 spec->stream_name_digital = "ALC663 Digital";
16575 } else if (codec->vendor_id == 0x10ec0272) {
16576 spec->stream_name_analog = "ALC272 Analog";
16577 spec->stream_name_digital = "ALC272 Digital";
16579 spec->stream_name_analog = "ALC662 Analog";
16580 spec->stream_name_digital = "ALC662 Digital";
16583 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16584 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16586 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16587 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16589 spec->adc_nids = alc662_adc_nids;
16590 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16591 spec->capsrc_nids = alc662_capsrc_nids;
16592 spec->is_mix_capture = 1;
16594 if (!spec->cap_mixer)
16595 set_capture_mixer(spec);
16597 spec->vmaster_nid = 0x02;
16599 codec->patch_ops = alc_patch_ops;
16600 if (board_config == ALC662_AUTO)
16601 spec->init_hook = alc662_auto_init;
16602 #ifdef CONFIG_SND_HDA_POWER_SAVE
16603 if (!spec->loopback.amplist)
16604 spec->loopback.amplist = alc662_loopbacks;
16606 codec->proc_widget_hook = print_realtek_coef;
16614 struct hda_codec_preset snd_hda_preset_realtek[] = {
16615 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16616 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16617 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16618 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16619 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16620 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16621 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16622 .patch = patch_alc861 },
16623 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16624 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16625 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16626 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16627 .patch = patch_alc883 },
16628 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16629 .patch = patch_alc662 },
16630 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16631 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16632 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16633 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16634 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16635 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16636 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16637 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16638 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16639 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16640 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16641 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16642 .patch = patch_alc883 },
16643 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16644 {} /* terminator */