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 */
80 #ifdef CONFIG_SND_DEBUG
84 ALC260_MODEL_LAST /* last tag */
94 ALC262_HP_BPC_D7000_WL,
95 ALC262_HP_BPC_D7000_WF,
105 ALC262_MODEL_LAST /* last tag */
116 #ifdef CONFIG_SND_DEBUG
120 ALC268_MODEL_LAST /* last tag */
126 ALC269_ASUS_EEEPC_P703,
127 ALC269_ASUS_EEEPC_P901,
129 ALC269_MODEL_LAST /* last tag */
146 /* ALC861-VD models */
167 ALC662_ASUS_EEEPC_P701,
168 ALC662_ASUS_EEEPC_EP20,
200 ALC883_TARGA_2ch_DIG,
206 ALC883_LENOVO_101E_2ch,
207 ALC883_LENOVO_NB0763,
208 ALC888_LENOVO_MS7195_DIG,
214 ALC883_FUJITSU_PI2515,
215 ALC883_3ST_6ch_INTEL,
221 #define GPIO_MASK 0x03
224 /* codec parameterization */
225 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
226 unsigned int num_mixers;
228 const struct hda_verb *init_verbs[5]; /* initialization verbs
232 unsigned int num_init_verbs;
234 char *stream_name_analog; /* analog PCM stream */
235 struct hda_pcm_stream *stream_analog_playback;
236 struct hda_pcm_stream *stream_analog_capture;
237 struct hda_pcm_stream *stream_analog_alt_playback;
238 struct hda_pcm_stream *stream_analog_alt_capture;
240 char *stream_name_digital; /* digital PCM stream */
241 struct hda_pcm_stream *stream_digital_playback;
242 struct hda_pcm_stream *stream_digital_capture;
245 struct hda_multi_out multiout; /* playback set-up
246 * max_channels, dacs must be set
247 * dig_out_nid and hp_nid are optional
249 hda_nid_t alt_dac_nid;
252 unsigned int num_adc_nids;
254 hda_nid_t *capsrc_nids;
255 hda_nid_t dig_in_nid; /* digital-in NID; optional */
258 unsigned int num_mux_defs;
259 const struct hda_input_mux *input_mux;
260 unsigned int cur_mux[3];
263 const struct hda_channel_mode *channel_mode;
264 int num_channel_mode;
267 /* PCM information */
268 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
270 /* dynamic controls, init_verbs and input_mux */
271 struct auto_pin_cfg autocfg;
272 unsigned int num_kctl_alloc, num_kctl_used;
273 struct snd_kcontrol_new *kctl_alloc;
274 struct hda_input_mux private_imux;
275 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
278 void (*init_hook)(struct hda_codec *codec);
279 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
281 /* for pin sensing */
282 unsigned int sense_updated: 1;
283 unsigned int jack_present: 1;
284 unsigned int master_sw: 1;
286 /* for virtual master */
287 hda_nid_t vmaster_nid;
288 #ifdef CONFIG_SND_HDA_POWER_SAVE
289 struct hda_loopback_check loopback;
294 unsigned int pll_coef_idx, pll_coef_bit;
298 * configuration template - to be copied to the spec instance
300 struct alc_config_preset {
301 struct snd_kcontrol_new *mixers[5]; /* should be identical size
304 const struct hda_verb *init_verbs[5];
305 unsigned int num_dacs;
307 hda_nid_t dig_out_nid; /* optional */
308 hda_nid_t hp_nid; /* optional */
309 unsigned int num_adc_nids;
311 hda_nid_t *capsrc_nids;
312 hda_nid_t dig_in_nid;
313 unsigned int num_channel_mode;
314 const struct hda_channel_mode *channel_mode;
316 unsigned int num_mux_defs;
317 const struct hda_input_mux *input_mux;
318 void (*unsol_event)(struct hda_codec *, unsigned int);
319 void (*init_hook)(struct hda_codec *);
320 #ifdef CONFIG_SND_HDA_POWER_SAVE
321 struct hda_amp_list *loopbacks;
329 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
330 struct snd_ctl_elem_info *uinfo)
332 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
333 struct alc_spec *spec = codec->spec;
334 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
335 if (mux_idx >= spec->num_mux_defs)
337 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
340 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
341 struct snd_ctl_elem_value *ucontrol)
343 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
344 struct alc_spec *spec = codec->spec;
345 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
347 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
351 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
352 struct snd_ctl_elem_value *ucontrol)
354 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
355 struct alc_spec *spec = codec->spec;
356 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
357 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
358 hda_nid_t nid = spec->capsrc_nids ?
359 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
360 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
361 nid, &spec->cur_mux[adc_idx]);
366 * channel mode setting
368 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
369 struct snd_ctl_elem_info *uinfo)
371 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
372 struct alc_spec *spec = codec->spec;
373 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
374 spec->num_channel_mode);
377 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
378 struct snd_ctl_elem_value *ucontrol)
380 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
381 struct alc_spec *spec = codec->spec;
382 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
383 spec->num_channel_mode,
384 spec->multiout.max_channels);
387 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
388 struct snd_ctl_elem_value *ucontrol)
390 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
391 struct alc_spec *spec = codec->spec;
392 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
393 spec->num_channel_mode,
394 &spec->multiout.max_channels);
395 if (err >= 0 && spec->need_dac_fix)
396 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
401 * Control the mode of pin widget settings via the mixer. "pc" is used
402 * instead of "%" to avoid consequences of accidently treating the % as
403 * being part of a format specifier. Maximum allowed length of a value is
404 * 63 characters plus NULL terminator.
406 * Note: some retasking pin complexes seem to ignore requests for input
407 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
408 * are requested. Therefore order this list so that this behaviour will not
409 * cause problems when mixer clients move through the enum sequentially.
410 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
413 static char *alc_pin_mode_names[] = {
414 "Mic 50pc bias", "Mic 80pc bias",
415 "Line in", "Line out", "Headphone out",
417 static unsigned char alc_pin_mode_values[] = {
418 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
420 /* The control can present all 5 options, or it can limit the options based
421 * in the pin being assumed to be exclusively an input or an output pin. In
422 * addition, "input" pins may or may not process the mic bias option
423 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
424 * accept requests for bias as of chip versions up to March 2006) and/or
425 * wiring in the computer.
427 #define ALC_PIN_DIR_IN 0x00
428 #define ALC_PIN_DIR_OUT 0x01
429 #define ALC_PIN_DIR_INOUT 0x02
430 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
431 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
433 /* Info about the pin modes supported by the different pin direction modes.
434 * For each direction the minimum and maximum values are given.
436 static signed char alc_pin_mode_dir_info[5][2] = {
437 { 0, 2 }, /* ALC_PIN_DIR_IN */
438 { 3, 4 }, /* ALC_PIN_DIR_OUT */
439 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
440 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
441 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
443 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
444 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
445 #define alc_pin_mode_n_items(_dir) \
446 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
448 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
449 struct snd_ctl_elem_info *uinfo)
451 unsigned int item_num = uinfo->value.enumerated.item;
452 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
454 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
456 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
458 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
459 item_num = alc_pin_mode_min(dir);
460 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
464 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
465 struct snd_ctl_elem_value *ucontrol)
468 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
469 hda_nid_t nid = kcontrol->private_value & 0xffff;
470 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
471 long *valp = ucontrol->value.integer.value;
472 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
473 AC_VERB_GET_PIN_WIDGET_CONTROL,
476 /* Find enumerated value for current pinctl setting */
477 i = alc_pin_mode_min(dir);
478 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
480 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
484 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
485 struct snd_ctl_elem_value *ucontrol)
488 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
489 hda_nid_t nid = kcontrol->private_value & 0xffff;
490 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
491 long val = *ucontrol->value.integer.value;
492 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
493 AC_VERB_GET_PIN_WIDGET_CONTROL,
496 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
497 val = alc_pin_mode_min(dir);
499 change = pinctl != alc_pin_mode_values[val];
501 /* Set pin mode to that requested */
502 snd_hda_codec_write_cache(codec, nid, 0,
503 AC_VERB_SET_PIN_WIDGET_CONTROL,
504 alc_pin_mode_values[val]);
506 /* Also enable the retasking pin's input/output as required
507 * for the requested pin mode. Enum values of 2 or less are
510 * Dynamically switching the input/output buffers probably
511 * reduces noise slightly (particularly on input) so we'll
512 * do it. However, having both input and output buffers
513 * enabled simultaneously doesn't seem to be problematic if
514 * this turns out to be necessary in the future.
517 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
518 HDA_AMP_MUTE, HDA_AMP_MUTE);
519 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
522 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
523 HDA_AMP_MUTE, HDA_AMP_MUTE);
524 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
531 #define ALC_PIN_MODE(xname, nid, dir) \
532 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
533 .info = alc_pin_mode_info, \
534 .get = alc_pin_mode_get, \
535 .put = alc_pin_mode_put, \
536 .private_value = nid | (dir<<16) }
538 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
539 * together using a mask with more than one bit set. This control is
540 * currently used only by the ALC260 test model. At this stage they are not
541 * needed for any "production" models.
543 #ifdef CONFIG_SND_DEBUG
544 #define alc_gpio_data_info snd_ctl_boolean_mono_info
546 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
547 struct snd_ctl_elem_value *ucontrol)
549 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
550 hda_nid_t nid = kcontrol->private_value & 0xffff;
551 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
552 long *valp = ucontrol->value.integer.value;
553 unsigned int val = snd_hda_codec_read(codec, nid, 0,
554 AC_VERB_GET_GPIO_DATA, 0x00);
556 *valp = (val & mask) != 0;
559 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
560 struct snd_ctl_elem_value *ucontrol)
563 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
564 hda_nid_t nid = kcontrol->private_value & 0xffff;
565 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
566 long val = *ucontrol->value.integer.value;
567 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
568 AC_VERB_GET_GPIO_DATA,
571 /* Set/unset the masked GPIO bit(s) as needed */
572 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
577 snd_hda_codec_write_cache(codec, nid, 0,
578 AC_VERB_SET_GPIO_DATA, gpio_data);
582 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
583 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
584 .info = alc_gpio_data_info, \
585 .get = alc_gpio_data_get, \
586 .put = alc_gpio_data_put, \
587 .private_value = nid | (mask<<16) }
588 #endif /* CONFIG_SND_DEBUG */
590 /* A switch control to allow the enabling of the digital IO pins on the
591 * ALC260. This is incredibly simplistic; the intention of this control is
592 * to provide something in the test model allowing digital outputs to be
593 * identified if present. If models are found which can utilise these
594 * outputs a more complete mixer control can be devised for those models if
597 #ifdef CONFIG_SND_DEBUG
598 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
600 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
601 struct snd_ctl_elem_value *ucontrol)
603 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
604 hda_nid_t nid = kcontrol->private_value & 0xffff;
605 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
606 long *valp = ucontrol->value.integer.value;
607 unsigned int val = snd_hda_codec_read(codec, nid, 0,
608 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
610 *valp = (val & mask) != 0;
613 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
614 struct snd_ctl_elem_value *ucontrol)
617 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
618 hda_nid_t nid = kcontrol->private_value & 0xffff;
619 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
620 long val = *ucontrol->value.integer.value;
621 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
622 AC_VERB_GET_DIGI_CONVERT_1,
625 /* Set/unset the masked control bit(s) as needed */
626 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
631 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
636 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
637 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
638 .info = alc_spdif_ctrl_info, \
639 .get = alc_spdif_ctrl_get, \
640 .put = alc_spdif_ctrl_put, \
641 .private_value = nid | (mask<<16) }
642 #endif /* CONFIG_SND_DEBUG */
644 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
645 * Again, this is only used in the ALC26x test models to help identify when
646 * the EAPD line must be asserted for features to work.
648 #ifdef CONFIG_SND_DEBUG
649 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
651 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
652 struct snd_ctl_elem_value *ucontrol)
654 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
655 hda_nid_t nid = kcontrol->private_value & 0xffff;
656 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
657 long *valp = ucontrol->value.integer.value;
658 unsigned int val = snd_hda_codec_read(codec, nid, 0,
659 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
661 *valp = (val & mask) != 0;
665 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
666 struct snd_ctl_elem_value *ucontrol)
669 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
670 hda_nid_t nid = kcontrol->private_value & 0xffff;
671 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
672 long val = *ucontrol->value.integer.value;
673 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
674 AC_VERB_GET_EAPD_BTLENABLE,
677 /* Set/unset the masked control bit(s) as needed */
678 change = (!val ? 0 : mask) != (ctrl_data & mask);
683 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
689 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
690 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
691 .info = alc_eapd_ctrl_info, \
692 .get = alc_eapd_ctrl_get, \
693 .put = alc_eapd_ctrl_put, \
694 .private_value = nid | (mask<<16) }
695 #endif /* CONFIG_SND_DEBUG */
698 * set up from the preset table
700 static void setup_preset(struct alc_spec *spec,
701 const struct alc_config_preset *preset)
705 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
706 spec->mixers[spec->num_mixers++] = preset->mixers[i];
707 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
709 spec->init_verbs[spec->num_init_verbs++] =
710 preset->init_verbs[i];
712 spec->channel_mode = preset->channel_mode;
713 spec->num_channel_mode = preset->num_channel_mode;
714 spec->need_dac_fix = preset->need_dac_fix;
716 spec->multiout.max_channels = spec->channel_mode[0].channels;
718 spec->multiout.num_dacs = preset->num_dacs;
719 spec->multiout.dac_nids = preset->dac_nids;
720 spec->multiout.dig_out_nid = preset->dig_out_nid;
721 spec->multiout.hp_nid = preset->hp_nid;
723 spec->num_mux_defs = preset->num_mux_defs;
724 if (!spec->num_mux_defs)
725 spec->num_mux_defs = 1;
726 spec->input_mux = preset->input_mux;
728 spec->num_adc_nids = preset->num_adc_nids;
729 spec->adc_nids = preset->adc_nids;
730 spec->capsrc_nids = preset->capsrc_nids;
731 spec->dig_in_nid = preset->dig_in_nid;
733 spec->unsol_event = preset->unsol_event;
734 spec->init_hook = preset->init_hook;
735 #ifdef CONFIG_SND_HDA_POWER_SAVE
736 spec->loopback.amplist = preset->loopbacks;
740 /* Enable GPIO mask and set output */
741 static struct hda_verb alc_gpio1_init_verbs[] = {
742 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
743 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
744 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
748 static struct hda_verb alc_gpio2_init_verbs[] = {
749 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
750 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
751 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
755 static struct hda_verb alc_gpio3_init_verbs[] = {
756 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
757 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
758 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
763 * Fix hardware PLL issue
764 * On some codecs, the analog PLL gating control must be off while
765 * the default value is 1.
767 static void alc_fix_pll(struct hda_codec *codec)
769 struct alc_spec *spec = codec->spec;
774 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
776 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
777 AC_VERB_GET_PROC_COEF, 0);
778 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
780 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
781 val & ~(1 << spec->pll_coef_bit));
784 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
785 unsigned int coef_idx, unsigned int coef_bit)
787 struct alc_spec *spec = codec->spec;
789 spec->pll_coef_idx = coef_idx;
790 spec->pll_coef_bit = coef_bit;
794 static void alc_sku_automute(struct hda_codec *codec)
796 struct alc_spec *spec = codec->spec;
797 unsigned int present;
798 unsigned int hp_nid = spec->autocfg.hp_pins[0];
799 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
801 /* need to execute and sync at first */
802 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
803 present = snd_hda_codec_read(codec, hp_nid, 0,
804 AC_VERB_GET_PIN_SENSE, 0);
805 spec->jack_present = (present & 0x80000000) != 0;
806 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
807 spec->jack_present ? 0 : PIN_OUT);
810 /* unsolicited event for HP jack sensing */
811 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
813 if (codec->vendor_id == 0x10ec0880)
817 if (res != ALC880_HP_EVENT)
820 alc_sku_automute(codec);
823 /* additional initialization for ALC888 variants */
824 static void alc888_coef_init(struct hda_codec *codec)
828 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
829 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
830 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
831 if ((tmp & 0xf0) == 2)
833 snd_hda_codec_read(codec, 0x20, 0,
834 AC_VERB_SET_PROC_COEF, 0x830);
837 snd_hda_codec_read(codec, 0x20, 0,
838 AC_VERB_SET_PROC_COEF, 0x3030);
841 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
842 * 31 ~ 16 : Manufacture ID
844 * 7 ~ 0 : Assembly ID
845 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
847 static void alc_subsystem_id(struct hda_codec *codec,
848 unsigned int porta, unsigned int porte,
851 unsigned int ass, tmp, i;
853 struct alc_spec *spec = codec->spec;
855 ass = codec->subsystem_id & 0xffff;
856 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
860 * 31~30 : port conetcivity
863 * 19~16 : Check sum (15:1)
868 if (codec->vendor_id == 0x10ec0260)
870 ass = snd_hda_codec_read(codec, nid, 0,
871 AC_VERB_GET_CONFIG_DEFAULT, 0);
872 if (!(ass & 1) && !(ass & 0x100000))
874 if ((ass >> 30) != 1) /* no physical connection */
879 for (i = 1; i < 16; i++) {
883 if (((ass >> 16) & 0xf) != tmp)
889 * 2 : 0 --> Desktop, 1 --> Laptop
890 * 3~5 : External Amplifier control
893 tmp = (ass & 0x38) >> 3; /* external Amp control */
896 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
899 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
902 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
904 case 5: /* set EAPD output high */
905 switch (codec->vendor_id) {
907 snd_hda_codec_write(codec, 0x0f, 0,
908 AC_VERB_SET_EAPD_BTLENABLE, 2);
909 snd_hda_codec_write(codec, 0x10, 0,
910 AC_VERB_SET_EAPD_BTLENABLE, 2);
921 snd_hda_codec_write(codec, 0x14, 0,
922 AC_VERB_SET_EAPD_BTLENABLE, 2);
923 snd_hda_codec_write(codec, 0x15, 0,
924 AC_VERB_SET_EAPD_BTLENABLE, 2);
927 switch (codec->vendor_id) {
929 snd_hda_codec_write(codec, 0x1a, 0,
930 AC_VERB_SET_COEF_INDEX, 7);
931 tmp = snd_hda_codec_read(codec, 0x1a, 0,
932 AC_VERB_GET_PROC_COEF, 0);
933 snd_hda_codec_write(codec, 0x1a, 0,
934 AC_VERB_SET_COEF_INDEX, 7);
935 snd_hda_codec_write(codec, 0x1a, 0,
936 AC_VERB_SET_PROC_COEF,
945 snd_hda_codec_write(codec, 0x20, 0,
946 AC_VERB_SET_COEF_INDEX, 7);
947 tmp = snd_hda_codec_read(codec, 0x20, 0,
948 AC_VERB_GET_PROC_COEF, 0);
949 snd_hda_codec_write(codec, 0x20, 0,
950 AC_VERB_SET_COEF_INDEX, 7);
951 snd_hda_codec_write(codec, 0x20, 0,
952 AC_VERB_SET_PROC_COEF,
956 /*alc888_coef_init(codec);*/ /* called in alc_init() */
960 snd_hda_codec_write(codec, 0x20, 0,
961 AC_VERB_SET_COEF_INDEX, 7);
962 tmp = snd_hda_codec_read(codec, 0x20, 0,
963 AC_VERB_GET_PROC_COEF, 0);
964 snd_hda_codec_write(codec, 0x20, 0,
965 AC_VERB_SET_COEF_INDEX, 7);
966 snd_hda_codec_write(codec, 0x20, 0,
967 AC_VERB_SET_PROC_COEF,
975 /* is laptop or Desktop and enable the function "Mute internal speaker
976 * when the external headphone out jack is plugged"
981 * 10~8 : Jack location
982 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
984 * 15 : 1 --> enable the function "Mute internal speaker
985 * when the external headphone out jack is plugged"
987 if (!spec->autocfg.speaker_pins[0]) {
988 if (spec->autocfg.line_out_pins[0])
989 spec->autocfg.speaker_pins[0] =
990 spec->autocfg.line_out_pins[0];
995 if (!spec->autocfg.hp_pins[0]) {
996 tmp = (ass >> 11) & 0x3; /* HP to chassis */
998 spec->autocfg.hp_pins[0] = porta;
1000 spec->autocfg.hp_pins[0] = porte;
1002 spec->autocfg.hp_pins[0] = portd;
1007 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1008 AC_VERB_SET_UNSOLICITED_ENABLE,
1009 AC_USRSP_EN | ALC880_HP_EVENT);
1011 spec->unsol_event = alc_sku_unsol_event;
1015 * Fix-up pin default configurations
1023 static void alc_fix_pincfg(struct hda_codec *codec,
1024 const struct snd_pci_quirk *quirk,
1025 const struct alc_pincfg **pinfix)
1027 const struct alc_pincfg *cfg;
1029 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1033 cfg = pinfix[quirk->value];
1034 for (; cfg->nid; cfg++) {
1037 for (i = 0; i < 4; i++) {
1038 snd_hda_codec_write(codec, cfg->nid, 0,
1039 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1047 * ALC880 3-stack model
1049 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1050 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1051 * F-Mic = 0x1b, HP = 0x19
1054 static hda_nid_t alc880_dac_nids[4] = {
1055 /* front, rear, clfe, rear_surr */
1056 0x02, 0x05, 0x04, 0x03
1059 static hda_nid_t alc880_adc_nids[3] = {
1064 /* The datasheet says the node 0x07 is connected from inputs,
1065 * but it shows zero connection in the real implementation on some devices.
1066 * Note: this is a 915GAV bug, fixed on 915GLV
1068 static hda_nid_t alc880_adc_nids_alt[2] = {
1073 #define ALC880_DIGOUT_NID 0x06
1074 #define ALC880_DIGIN_NID 0x0a
1076 static struct hda_input_mux alc880_capture_source = {
1080 { "Front Mic", 0x3 },
1086 /* channel source setting (2/6 channel selection for 3-stack) */
1088 static struct hda_verb alc880_threestack_ch2_init[] = {
1089 /* set line-in to input, mute it */
1090 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1091 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1092 /* set mic-in to input vref 80%, mute it */
1093 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1094 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1099 static struct hda_verb alc880_threestack_ch6_init[] = {
1100 /* set line-in to output, unmute it */
1101 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1102 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1103 /* set mic-in to output, unmute it */
1104 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1105 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1109 static struct hda_channel_mode alc880_threestack_modes[2] = {
1110 { 2, alc880_threestack_ch2_init },
1111 { 6, alc880_threestack_ch6_init },
1114 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1115 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1116 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1117 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1118 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1119 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1120 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1121 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1122 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1123 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1124 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1129 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1130 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1131 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1132 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1136 .name = "Channel Mode",
1137 .info = alc_ch_mode_info,
1138 .get = alc_ch_mode_get,
1139 .put = alc_ch_mode_put,
1144 /* capture mixer elements */
1145 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1146 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1147 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1148 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1149 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1150 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1151 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1154 /* The multiple "Capture Source" controls confuse alsamixer
1155 * So call somewhat different..
1157 /* .name = "Capture Source", */
1158 .name = "Input Source",
1160 .info = alc_mux_enum_info,
1161 .get = alc_mux_enum_get,
1162 .put = alc_mux_enum_put,
1167 /* capture mixer elements (in case NID 0x07 not available) */
1168 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1169 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1170 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1171 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1172 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1174 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1175 /* The multiple "Capture Source" controls confuse alsamixer
1176 * So call somewhat different..
1178 /* .name = "Capture Source", */
1179 .name = "Input Source",
1181 .info = alc_mux_enum_info,
1182 .get = alc_mux_enum_get,
1183 .put = alc_mux_enum_put,
1191 * ALC880 5-stack model
1193 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1195 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1196 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1199 /* additional mixers to alc880_three_stack_mixer */
1200 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1201 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1202 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1206 /* channel source setting (6/8 channel selection for 5-stack) */
1208 static struct hda_verb alc880_fivestack_ch6_init[] = {
1209 /* set line-in to input, mute it */
1210 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1211 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1216 static struct hda_verb alc880_fivestack_ch8_init[] = {
1217 /* set line-in to output, unmute it */
1218 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1219 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1223 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1224 { 6, alc880_fivestack_ch6_init },
1225 { 8, alc880_fivestack_ch8_init },
1230 * ALC880 6-stack model
1232 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1233 * Side = 0x05 (0x0f)
1234 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1235 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1238 static hda_nid_t alc880_6st_dac_nids[4] = {
1239 /* front, rear, clfe, rear_surr */
1240 0x02, 0x03, 0x04, 0x05
1243 static struct hda_input_mux alc880_6stack_capture_source = {
1247 { "Front Mic", 0x1 },
1253 /* fixed 8-channels */
1254 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1258 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1261 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1262 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1263 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1264 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1265 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1266 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1267 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1268 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1269 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1270 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1271 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1272 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1273 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1275 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1276 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1277 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1278 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1280 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1281 .name = "Channel Mode",
1282 .info = alc_ch_mode_info,
1283 .get = alc_ch_mode_get,
1284 .put = alc_ch_mode_put,
1293 * W810 has rear IO for:
1296 * Center/LFE (DAC 04)
1299 * The system also has a pair of internal speakers, and a headphone jack.
1300 * These are both connected to Line2 on the codec, hence to DAC 02.
1302 * There is a variable resistor to control the speaker or headphone
1303 * volume. This is a hardware-only device without a software API.
1305 * Plugging headphones in will disable the internal speakers. This is
1306 * implemented in hardware, not via the driver using jack sense. In
1307 * a similar fashion, plugging into the rear socket marked "front" will
1308 * disable both the speakers and headphones.
1310 * For input, there's a microphone jack, and an "audio in" jack.
1311 * These may not do anything useful with this driver yet, because I
1312 * haven't setup any initialization verbs for these yet...
1315 static hda_nid_t alc880_w810_dac_nids[3] = {
1316 /* front, rear/surround, clfe */
1320 /* fixed 6 channels */
1321 static struct hda_channel_mode alc880_w810_modes[1] = {
1325 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1326 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1327 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1328 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1329 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1330 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1331 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1332 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1333 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1334 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1335 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1343 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1344 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1348 static hda_nid_t alc880_z71v_dac_nids[1] = {
1351 #define ALC880_Z71V_HP_DAC 0x03
1353 /* fixed 2 channels */
1354 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1358 static struct snd_kcontrol_new alc880_z71v_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("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1362 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1363 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1364 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1372 * ALC880 F1734 model
1374 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1375 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1378 static hda_nid_t alc880_f1734_dac_nids[1] = {
1381 #define ALC880_F1734_HP_DAC 0x02
1383 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1384 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1385 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1386 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1387 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1388 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1389 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1390 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1391 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1395 static struct hda_input_mux alc880_f1734_capture_source = {
1407 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1408 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1409 * Mic = 0x18, Line = 0x1a
1412 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1413 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1415 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1417 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1418 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1419 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1420 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1421 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1422 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1423 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1424 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1425 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1426 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1427 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1431 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1432 .name = "Channel Mode",
1433 .info = alc_ch_mode_info,
1434 .get = alc_ch_mode_get,
1435 .put = alc_ch_mode_put,
1441 * ALC880 ASUS W1V model
1443 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1444 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1445 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1448 /* additional mixers to alc880_asus_mixer */
1449 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1450 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1451 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1455 /* additional mixers to alc880_asus_mixer */
1456 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1457 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1458 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1463 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1464 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1465 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1466 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1467 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1468 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1469 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1470 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1471 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1472 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1474 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1475 /* The multiple "Capture Source" controls confuse alsamixer
1476 * So call somewhat different..
1478 /* .name = "Capture Source", */
1479 .name = "Input Source",
1481 .info = alc_mux_enum_info,
1482 .get = alc_mux_enum_get,
1483 .put = alc_mux_enum_put,
1489 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1490 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1491 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1492 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1493 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1494 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1495 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1496 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1497 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1498 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1499 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1500 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1501 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1504 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1505 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1506 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1507 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1509 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1510 .name = "Channel Mode",
1511 .info = alc_ch_mode_info,
1512 .get = alc_ch_mode_get,
1513 .put = alc_ch_mode_put,
1518 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1520 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1521 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1522 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1523 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1524 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1525 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1526 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1527 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1528 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1532 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1533 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1534 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1535 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1536 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1543 * virtual master controls
1547 * slave controls for virtual master
1549 static const char *alc_slave_vols[] = {
1550 "Front Playback Volume",
1551 "Surround Playback Volume",
1552 "Center Playback Volume",
1553 "LFE Playback Volume",
1554 "Side Playback Volume",
1555 "Headphone Playback Volume",
1556 "Speaker Playback Volume",
1557 "Mono Playback Volume",
1558 "Line-Out Playback Volume",
1562 static const char *alc_slave_sws[] = {
1563 "Front Playback Switch",
1564 "Surround Playback Switch",
1565 "Center Playback Switch",
1566 "LFE Playback Switch",
1567 "Side Playback Switch",
1568 "Headphone Playback Switch",
1569 "Speaker Playback Switch",
1570 "Mono Playback Switch",
1571 "IEC958 Playback Switch",
1576 * build control elements
1578 static int alc_build_controls(struct hda_codec *codec)
1580 struct alc_spec *spec = codec->spec;
1584 for (i = 0; i < spec->num_mixers; i++) {
1585 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1590 if (spec->multiout.dig_out_nid) {
1591 err = snd_hda_create_spdif_out_ctls(codec,
1592 spec->multiout.dig_out_nid);
1595 err = snd_hda_create_spdif_share_sw(codec,
1599 spec->multiout.share_spdif = 1;
1601 if (spec->dig_in_nid) {
1602 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1607 /* if we have no master control, let's create it */
1608 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1609 unsigned int vmaster_tlv[4];
1610 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1611 HDA_OUTPUT, vmaster_tlv);
1612 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1613 vmaster_tlv, alc_slave_vols);
1617 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1618 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1619 NULL, alc_slave_sws);
1629 * initialize the codec volumes, etc
1633 * generic initialization of ADC, input mixers and output mixers
1635 static struct hda_verb alc880_volume_init_verbs[] = {
1637 * Unmute ADC0-2 and set the default input to mic-in
1639 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1640 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1641 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1642 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1643 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1644 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1646 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1648 * Note: PASD motherboards uses the Line In 2 as the input for front
1651 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1655 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1656 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1657 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1658 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1661 * Set up output mixers (0x0c - 0x0f)
1663 /* set vol=0 to output mixers */
1664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1666 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1667 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1668 /* set up input amps for analog loopback */
1669 /* Amp Indices: DAC = 0, mixer = 1 */
1670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1671 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1675 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1677 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1683 * 3-stack pin configuration:
1684 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1686 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1688 * preset connection lists of input pins
1689 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1691 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1692 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1693 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1696 * Set pin mode and muting
1698 /* set front pin widgets 0x14 for output */
1699 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1700 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1701 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1702 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1703 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1704 /* Mic2 (as headphone out) for HP output */
1705 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1706 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1707 /* Line In pin widget for input */
1708 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1709 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1710 /* Line2 (as front mic) pin widget for input and vref at 80% */
1711 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1712 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1713 /* CD pin widget for input */
1714 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1720 * 5-stack pin configuration:
1721 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1722 * line-in/side = 0x1a, f-mic = 0x1b
1724 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1726 * preset connection lists of input pins
1727 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1729 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1730 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1733 * Set pin mode and muting
1735 /* set pin widgets 0x14-0x17 for output */
1736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1738 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1739 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1740 /* unmute pins for output (no gain on this amp) */
1741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1743 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1744 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1746 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1747 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1748 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1749 /* Mic2 (as headphone out) for HP output */
1750 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1751 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1752 /* Line In pin widget for input */
1753 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1754 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1755 /* Line2 (as front mic) pin widget for input and vref at 80% */
1756 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1757 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1758 /* CD pin widget for input */
1759 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1765 * W810 pin configuration:
1766 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1768 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1769 /* hphone/speaker input selector: front DAC */
1770 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1776 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1777 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1780 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1786 * Z71V pin configuration:
1787 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1789 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1790 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1791 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1792 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1795 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1796 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1804 * 6-stack pin configuration:
1805 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1806 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1808 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1809 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1813 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1816 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1817 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1818 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1822 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1823 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1824 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1825 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1826 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1827 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1828 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1834 * Uniwill pin configuration:
1835 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1838 static struct hda_verb alc880_uniwill_init_verbs[] = {
1839 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1842 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1843 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1845 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1846 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1847 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1848 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1852 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1854 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1856 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1857 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1858 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1859 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1860 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1861 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1862 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1863 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1864 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1866 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1867 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1874 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1876 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1877 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1881 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1882 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1883 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1887 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1888 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1889 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1892 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1893 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1894 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1895 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1896 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1897 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1899 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1900 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1905 static struct hda_verb alc880_beep_init_verbs[] = {
1906 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1910 /* toggle speaker-output according to the hp-jack state */
1911 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1913 unsigned int present;
1916 present = snd_hda_codec_read(codec, 0x14, 0,
1917 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1918 bits = present ? HDA_AMP_MUTE : 0;
1919 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1920 HDA_AMP_MUTE, bits);
1921 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1922 HDA_AMP_MUTE, bits);
1925 /* auto-toggle front mic */
1926 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1928 unsigned int present;
1931 present = snd_hda_codec_read(codec, 0x18, 0,
1932 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1933 bits = present ? HDA_AMP_MUTE : 0;
1934 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1937 static void alc880_uniwill_automute(struct hda_codec *codec)
1939 alc880_uniwill_hp_automute(codec);
1940 alc880_uniwill_mic_automute(codec);
1943 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1946 /* Looks like the unsol event is incompatible with the standard
1947 * definition. 4bit tag is placed at 28 bit!
1949 switch (res >> 28) {
1950 case ALC880_HP_EVENT:
1951 alc880_uniwill_hp_automute(codec);
1953 case ALC880_MIC_EVENT:
1954 alc880_uniwill_mic_automute(codec);
1959 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1961 unsigned int present;
1964 present = snd_hda_codec_read(codec, 0x14, 0,
1965 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1966 bits = present ? HDA_AMP_MUTE : 0;
1967 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
1970 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1972 unsigned int present;
1974 present = snd_hda_codec_read(codec, 0x21, 0,
1975 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1976 present &= HDA_AMP_VOLMASK;
1977 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1978 HDA_AMP_VOLMASK, present);
1979 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1980 HDA_AMP_VOLMASK, present);
1983 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1986 /* Looks like the unsol event is incompatible with the standard
1987 * definition. 4bit tag is placed at 28 bit!
1989 if ((res >> 28) == ALC880_HP_EVENT)
1990 alc880_uniwill_p53_hp_automute(codec);
1991 if ((res >> 28) == ALC880_DCVOL_EVENT)
1992 alc880_uniwill_p53_dcvol_automute(codec);
1996 * F1734 pin configuration:
1997 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1999 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2000 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2001 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2002 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2003 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2004 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2006 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2007 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2009 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2011 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2012 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2013 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2014 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2015 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2016 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2017 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2018 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2019 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2021 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2022 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2028 * ASUS pin configuration:
2029 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2031 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2032 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2033 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2034 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2035 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2037 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2038 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2039 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2040 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2041 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2042 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2043 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2044 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2046 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2048 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2051 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2052 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2054 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2059 /* Enable GPIO mask and set output */
2060 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2061 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2063 /* Clevo m520g init */
2064 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2065 /* headphone output */
2066 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2068 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2069 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2074 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2075 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2076 /* Mic1 (rear panel) */
2077 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2079 /* Mic2 (front panel) */
2080 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2081 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2083 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2084 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2085 /* change to EAPD mode */
2086 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2087 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2092 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2093 /* change to EAPD mode */
2094 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2095 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2097 /* Headphone output */
2098 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2100 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2101 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2103 /* Line In pin widget for input */
2104 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2105 /* CD pin widget for input */
2106 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2107 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2108 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2110 /* change to EAPD mode */
2111 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2112 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2118 * LG m1 express dual
2121 * Rear Line-In/Out (blue): 0x14
2122 * Build-in Mic-In: 0x15
2124 * HP-Out (green): 0x1b
2125 * Mic-In/Out (red): 0x19
2129 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2130 static hda_nid_t alc880_lg_dac_nids[3] = {
2134 /* seems analog CD is not working */
2135 static struct hda_input_mux alc880_lg_capture_source = {
2140 { "Internal Mic", 0x6 },
2144 /* 2,4,6 channel modes */
2145 static struct hda_verb alc880_lg_ch2_init[] = {
2146 /* set line-in and mic-in to input */
2147 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2148 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2152 static struct hda_verb alc880_lg_ch4_init[] = {
2153 /* set line-in to out and mic-in to input */
2154 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2155 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2159 static struct hda_verb alc880_lg_ch6_init[] = {
2160 /* set line-in and mic-in to output */
2161 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2162 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2166 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2167 { 2, alc880_lg_ch2_init },
2168 { 4, alc880_lg_ch4_init },
2169 { 6, alc880_lg_ch6_init },
2172 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2173 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2174 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2175 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2176 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2177 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2178 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2179 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2180 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2183 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2184 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2185 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2186 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2188 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2189 .name = "Channel Mode",
2190 .info = alc_ch_mode_info,
2191 .get = alc_ch_mode_get,
2192 .put = alc_ch_mode_put,
2197 static struct hda_verb alc880_lg_init_verbs[] = {
2198 /* set capture source to mic-in */
2199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2201 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2202 /* mute all amp mixer inputs */
2203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2205 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2206 /* line-in to input */
2207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2208 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2211 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2213 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2214 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2215 /* mic-in to input */
2216 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2217 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2218 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2220 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2221 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2222 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2224 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2228 /* toggle speaker-output according to the hp-jack state */
2229 static void alc880_lg_automute(struct hda_codec *codec)
2231 unsigned int present;
2234 present = snd_hda_codec_read(codec, 0x1b, 0,
2235 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2236 bits = present ? HDA_AMP_MUTE : 0;
2237 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2238 HDA_AMP_MUTE, bits);
2241 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2243 /* Looks like the unsol event is incompatible with the standard
2244 * definition. 4bit tag is placed at 28 bit!
2246 if ((res >> 28) == 0x01)
2247 alc880_lg_automute(codec);
2256 * Built-in Mic-In: 0x19
2262 static struct hda_input_mux alc880_lg_lw_capture_source = {
2266 { "Internal Mic", 0x1 },
2271 #define alc880_lg_lw_modes alc880_threestack_modes
2273 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2274 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2275 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2276 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2277 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2278 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2279 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2280 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2281 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2283 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2286 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2287 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2289 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2290 .name = "Channel Mode",
2291 .info = alc_ch_mode_info,
2292 .get = alc_ch_mode_get,
2293 .put = alc_ch_mode_put,
2298 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2299 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2300 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2301 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2303 /* set capture source to mic-in */
2304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2309 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2310 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2312 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2313 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2314 /* mic-in to input */
2315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2316 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2318 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2319 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2321 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2325 /* toggle speaker-output according to the hp-jack state */
2326 static void alc880_lg_lw_automute(struct hda_codec *codec)
2328 unsigned int present;
2331 present = snd_hda_codec_read(codec, 0x1b, 0,
2332 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2333 bits = present ? HDA_AMP_MUTE : 0;
2334 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2335 HDA_AMP_MUTE, bits);
2338 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2340 /* Looks like the unsol event is incompatible with the standard
2341 * definition. 4bit tag is placed at 28 bit!
2343 if ((res >> 28) == 0x01)
2344 alc880_lg_lw_automute(codec);
2347 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2348 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2349 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2353 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2357 static struct hda_input_mux alc880_medion_rim_capture_source = {
2361 { "Internal Mic", 0x1 },
2365 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2366 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2368 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2369 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2371 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2373 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2374 /* Mic2 (as headphone out) for HP output */
2375 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2377 /* Internal Speaker */
2378 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2379 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2381 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2382 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2384 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2388 /* toggle speaker-output according to the hp-jack state */
2389 static void alc880_medion_rim_automute(struct hda_codec *codec)
2391 unsigned int present;
2394 present = snd_hda_codec_read(codec, 0x14, 0,
2395 AC_VERB_GET_PIN_SENSE, 0)
2396 & AC_PINSENSE_PRESENCE;
2397 bits = present ? HDA_AMP_MUTE : 0;
2398 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2399 HDA_AMP_MUTE, bits);
2401 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2403 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2406 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2409 /* Looks like the unsol event is incompatible with the standard
2410 * definition. 4bit tag is placed at 28 bit!
2412 if ((res >> 28) == ALC880_HP_EVENT)
2413 alc880_medion_rim_automute(codec);
2416 #ifdef CONFIG_SND_HDA_POWER_SAVE
2417 static struct hda_amp_list alc880_loopbacks[] = {
2418 { 0x0b, HDA_INPUT, 0 },
2419 { 0x0b, HDA_INPUT, 1 },
2420 { 0x0b, HDA_INPUT, 2 },
2421 { 0x0b, HDA_INPUT, 3 },
2422 { 0x0b, HDA_INPUT, 4 },
2426 static struct hda_amp_list alc880_lg_loopbacks[] = {
2427 { 0x0b, HDA_INPUT, 1 },
2428 { 0x0b, HDA_INPUT, 6 },
2429 { 0x0b, HDA_INPUT, 7 },
2438 static int alc_init(struct hda_codec *codec)
2440 struct alc_spec *spec = codec->spec;
2444 if (codec->vendor_id == 0x10ec0888)
2445 alc888_coef_init(codec);
2447 for (i = 0; i < spec->num_init_verbs; i++)
2448 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2450 if (spec->init_hook)
2451 spec->init_hook(codec);
2456 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2458 struct alc_spec *spec = codec->spec;
2460 if (spec->unsol_event)
2461 spec->unsol_event(codec, res);
2464 #ifdef CONFIG_SND_HDA_POWER_SAVE
2465 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2467 struct alc_spec *spec = codec->spec;
2468 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2473 * Analog playback callbacks
2475 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2476 struct hda_codec *codec,
2477 struct snd_pcm_substream *substream)
2479 struct alc_spec *spec = codec->spec;
2480 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2484 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2485 struct hda_codec *codec,
2486 unsigned int stream_tag,
2487 unsigned int format,
2488 struct snd_pcm_substream *substream)
2490 struct alc_spec *spec = codec->spec;
2491 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2492 stream_tag, format, substream);
2495 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2496 struct hda_codec *codec,
2497 struct snd_pcm_substream *substream)
2499 struct alc_spec *spec = codec->spec;
2500 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2506 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2507 struct hda_codec *codec,
2508 struct snd_pcm_substream *substream)
2510 struct alc_spec *spec = codec->spec;
2511 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2514 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2515 struct hda_codec *codec,
2516 unsigned int stream_tag,
2517 unsigned int format,
2518 struct snd_pcm_substream *substream)
2520 struct alc_spec *spec = codec->spec;
2521 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2522 stream_tag, format, substream);
2525 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2526 struct hda_codec *codec,
2527 struct snd_pcm_substream *substream)
2529 struct alc_spec *spec = codec->spec;
2530 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2536 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2537 struct hda_codec *codec,
2538 unsigned int stream_tag,
2539 unsigned int format,
2540 struct snd_pcm_substream *substream)
2542 struct alc_spec *spec = codec->spec;
2544 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2545 stream_tag, 0, format);
2549 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2550 struct hda_codec *codec,
2551 struct snd_pcm_substream *substream)
2553 struct alc_spec *spec = codec->spec;
2555 snd_hda_codec_cleanup_stream(codec,
2556 spec->adc_nids[substream->number + 1]);
2563 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2567 /* NID is set in alc_build_pcms */
2569 .open = alc880_playback_pcm_open,
2570 .prepare = alc880_playback_pcm_prepare,
2571 .cleanup = alc880_playback_pcm_cleanup
2575 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2579 /* NID is set in alc_build_pcms */
2582 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2586 /* NID is set in alc_build_pcms */
2589 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2590 .substreams = 2, /* can be overridden */
2593 /* NID is set in alc_build_pcms */
2595 .prepare = alc880_alt_capture_pcm_prepare,
2596 .cleanup = alc880_alt_capture_pcm_cleanup
2600 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2604 /* NID is set in alc_build_pcms */
2606 .open = alc880_dig_playback_pcm_open,
2607 .close = alc880_dig_playback_pcm_close,
2608 .prepare = alc880_dig_playback_pcm_prepare
2612 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2616 /* NID is set in alc_build_pcms */
2619 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2620 static struct hda_pcm_stream alc_pcm_null_stream = {
2626 static int alc_build_pcms(struct hda_codec *codec)
2628 struct alc_spec *spec = codec->spec;
2629 struct hda_pcm *info = spec->pcm_rec;
2632 codec->num_pcms = 1;
2633 codec->pcm_info = info;
2635 info->name = spec->stream_name_analog;
2636 if (spec->stream_analog_playback) {
2637 if (snd_BUG_ON(!spec->multiout.dac_nids))
2639 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2640 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2642 if (spec->stream_analog_capture) {
2643 if (snd_BUG_ON(!spec->adc_nids))
2645 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2646 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2649 if (spec->channel_mode) {
2650 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2651 for (i = 0; i < spec->num_channel_mode; i++) {
2652 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2653 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2658 /* SPDIF for stream index #1 */
2659 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2660 codec->num_pcms = 2;
2661 info = spec->pcm_rec + 1;
2662 info->name = spec->stream_name_digital;
2663 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2664 if (spec->multiout.dig_out_nid &&
2665 spec->stream_digital_playback) {
2666 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2667 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2669 if (spec->dig_in_nid &&
2670 spec->stream_digital_capture) {
2671 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2672 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2674 /* FIXME: do we need this for all Realtek codec models? */
2675 codec->spdif_status_reset = 1;
2678 /* If the use of more than one ADC is requested for the current
2679 * model, configure a second analog capture-only PCM.
2681 /* Additional Analaog capture for index #2 */
2682 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2683 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2684 codec->num_pcms = 3;
2685 info = spec->pcm_rec + 2;
2686 info->name = spec->stream_name_analog;
2687 if (spec->alt_dac_nid) {
2688 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2689 *spec->stream_analog_alt_playback;
2690 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2693 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2694 alc_pcm_null_stream;
2695 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2697 if (spec->num_adc_nids > 1) {
2698 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2699 *spec->stream_analog_alt_capture;
2700 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2702 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2703 spec->num_adc_nids - 1;
2705 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2706 alc_pcm_null_stream;
2707 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2714 static void alc_free(struct hda_codec *codec)
2716 struct alc_spec *spec = codec->spec;
2722 if (spec->kctl_alloc) {
2723 for (i = 0; i < spec->num_kctl_used; i++)
2724 kfree(spec->kctl_alloc[i].name);
2725 kfree(spec->kctl_alloc);
2728 codec->spec = NULL; /* to be sure */
2733 static struct hda_codec_ops alc_patch_ops = {
2734 .build_controls = alc_build_controls,
2735 .build_pcms = alc_build_pcms,
2738 .unsol_event = alc_unsol_event,
2739 #ifdef CONFIG_SND_HDA_POWER_SAVE
2740 .check_power_status = alc_check_power_status,
2746 * Test configuration for debugging
2748 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2751 #ifdef CONFIG_SND_DEBUG
2752 static hda_nid_t alc880_test_dac_nids[4] = {
2753 0x02, 0x03, 0x04, 0x05
2756 static struct hda_input_mux alc880_test_capture_source = {
2765 { "Surround", 0x6 },
2769 static struct hda_channel_mode alc880_test_modes[4] = {
2776 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2777 struct snd_ctl_elem_info *uinfo)
2779 static char *texts[] = {
2780 "N/A", "Line Out", "HP Out",
2781 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2783 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2785 uinfo->value.enumerated.items = 8;
2786 if (uinfo->value.enumerated.item >= 8)
2787 uinfo->value.enumerated.item = 7;
2788 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2792 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2793 struct snd_ctl_elem_value *ucontrol)
2795 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2796 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2797 unsigned int pin_ctl, item = 0;
2799 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2800 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2801 if (pin_ctl & AC_PINCTL_OUT_EN) {
2802 if (pin_ctl & AC_PINCTL_HP_EN)
2806 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2807 switch (pin_ctl & AC_PINCTL_VREFEN) {
2808 case AC_PINCTL_VREF_HIZ: item = 3; break;
2809 case AC_PINCTL_VREF_50: item = 4; break;
2810 case AC_PINCTL_VREF_GRD: item = 5; break;
2811 case AC_PINCTL_VREF_80: item = 6; break;
2812 case AC_PINCTL_VREF_100: item = 7; break;
2815 ucontrol->value.enumerated.item[0] = item;
2819 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2820 struct snd_ctl_elem_value *ucontrol)
2822 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2823 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2824 static unsigned int ctls[] = {
2825 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2826 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2827 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2828 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2829 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2830 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2832 unsigned int old_ctl, new_ctl;
2834 old_ctl = snd_hda_codec_read(codec, nid, 0,
2835 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2836 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2837 if (old_ctl != new_ctl) {
2839 snd_hda_codec_write_cache(codec, nid, 0,
2840 AC_VERB_SET_PIN_WIDGET_CONTROL,
2842 val = ucontrol->value.enumerated.item[0] >= 3 ?
2844 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2851 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2852 struct snd_ctl_elem_info *uinfo)
2854 static char *texts[] = {
2855 "Front", "Surround", "CLFE", "Side"
2857 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2859 uinfo->value.enumerated.items = 4;
2860 if (uinfo->value.enumerated.item >= 4)
2861 uinfo->value.enumerated.item = 3;
2862 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2866 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2867 struct snd_ctl_elem_value *ucontrol)
2869 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2870 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2873 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2874 ucontrol->value.enumerated.item[0] = sel & 3;
2878 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2879 struct snd_ctl_elem_value *ucontrol)
2881 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2882 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2885 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2886 if (ucontrol->value.enumerated.item[0] != sel) {
2887 sel = ucontrol->value.enumerated.item[0] & 3;
2888 snd_hda_codec_write_cache(codec, nid, 0,
2889 AC_VERB_SET_CONNECT_SEL, sel);
2895 #define PIN_CTL_TEST(xname,nid) { \
2896 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2898 .info = alc_test_pin_ctl_info, \
2899 .get = alc_test_pin_ctl_get, \
2900 .put = alc_test_pin_ctl_put, \
2901 .private_value = nid \
2904 #define PIN_SRC_TEST(xname,nid) { \
2905 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2907 .info = alc_test_pin_src_info, \
2908 .get = alc_test_pin_src_get, \
2909 .put = alc_test_pin_src_put, \
2910 .private_value = nid \
2913 static struct snd_kcontrol_new alc880_test_mixer[] = {
2914 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2915 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2916 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2917 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2918 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2919 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2920 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2921 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2922 PIN_CTL_TEST("Front Pin Mode", 0x14),
2923 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2924 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2925 PIN_CTL_TEST("Side Pin Mode", 0x17),
2926 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2927 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2928 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2929 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2930 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2931 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2932 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2933 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2934 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2935 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2936 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2937 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2938 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2939 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2940 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2941 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2942 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2943 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2945 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2946 .name = "Channel Mode",
2947 .info = alc_ch_mode_info,
2948 .get = alc_ch_mode_get,
2949 .put = alc_ch_mode_put,
2954 static struct hda_verb alc880_test_init_verbs[] = {
2955 /* Unmute inputs of 0x0c - 0x0f */
2956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2959 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2960 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2961 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2962 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2963 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2964 /* Vol output for 0x0c-0x0f */
2965 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2966 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2967 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2968 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2969 /* Set output pins 0x14-0x17 */
2970 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2973 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2974 /* Unmute output pins 0x14-0x17 */
2975 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2977 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2978 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2979 /* Set input pins 0x18-0x1c */
2980 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2981 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2982 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2983 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2984 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2985 /* Mute input pins 0x18-0x1b */
2986 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2987 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2988 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2989 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2991 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2992 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2993 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2994 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2995 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2996 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2997 /* Analog input/passthru */
2998 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2999 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3010 static const char *alc880_models[ALC880_MODEL_LAST] = {
3011 [ALC880_3ST] = "3stack",
3012 [ALC880_TCL_S700] = "tcl",
3013 [ALC880_3ST_DIG] = "3stack-digout",
3014 [ALC880_CLEVO] = "clevo",
3015 [ALC880_5ST] = "5stack",
3016 [ALC880_5ST_DIG] = "5stack-digout",
3017 [ALC880_W810] = "w810",
3018 [ALC880_Z71V] = "z71v",
3019 [ALC880_6ST] = "6stack",
3020 [ALC880_6ST_DIG] = "6stack-digout",
3021 [ALC880_ASUS] = "asus",
3022 [ALC880_ASUS_W1V] = "asus-w1v",
3023 [ALC880_ASUS_DIG] = "asus-dig",
3024 [ALC880_ASUS_DIG2] = "asus-dig2",
3025 [ALC880_UNIWILL_DIG] = "uniwill",
3026 [ALC880_UNIWILL_P53] = "uniwill-p53",
3027 [ALC880_FUJITSU] = "fujitsu",
3028 [ALC880_F1734] = "F1734",
3030 [ALC880_LG_LW] = "lg-lw",
3031 [ALC880_MEDION_RIM] = "medion",
3032 #ifdef CONFIG_SND_DEBUG
3033 [ALC880_TEST] = "test",
3035 [ALC880_AUTO] = "auto",
3038 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3039 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3040 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3041 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3042 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3043 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3044 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3045 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3046 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3047 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3048 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3049 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3050 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3051 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3052 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3053 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3054 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3055 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3056 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3057 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3058 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3059 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3060 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3061 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3062 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3063 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3064 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3065 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3066 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3067 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3068 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3069 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3070 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3071 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3072 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3073 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3074 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3075 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3076 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3077 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3078 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3079 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3080 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3081 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3082 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3083 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3084 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3085 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3086 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3087 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3088 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3089 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3090 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3091 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3092 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3093 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3094 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3095 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3096 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3097 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3098 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3099 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3100 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3101 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3102 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3103 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3104 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3105 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3106 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3107 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3108 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3109 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3114 * ALC880 codec presets
3116 static struct alc_config_preset alc880_presets[] = {
3118 .mixers = { alc880_three_stack_mixer },
3119 .init_verbs = { alc880_volume_init_verbs,
3120 alc880_pin_3stack_init_verbs },
3121 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3122 .dac_nids = alc880_dac_nids,
3123 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3124 .channel_mode = alc880_threestack_modes,
3126 .input_mux = &alc880_capture_source,
3128 [ALC880_3ST_DIG] = {
3129 .mixers = { alc880_three_stack_mixer },
3130 .init_verbs = { alc880_volume_init_verbs,
3131 alc880_pin_3stack_init_verbs },
3132 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3133 .dac_nids = alc880_dac_nids,
3134 .dig_out_nid = ALC880_DIGOUT_NID,
3135 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3136 .channel_mode = alc880_threestack_modes,
3138 .input_mux = &alc880_capture_source,
3140 [ALC880_TCL_S700] = {
3141 .mixers = { alc880_tcl_s700_mixer },
3142 .init_verbs = { alc880_volume_init_verbs,
3143 alc880_pin_tcl_S700_init_verbs,
3144 alc880_gpio2_init_verbs },
3145 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3146 .dac_nids = alc880_dac_nids,
3148 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3149 .channel_mode = alc880_2_jack_modes,
3150 .input_mux = &alc880_capture_source,
3153 .mixers = { alc880_three_stack_mixer,
3154 alc880_five_stack_mixer},
3155 .init_verbs = { alc880_volume_init_verbs,
3156 alc880_pin_5stack_init_verbs },
3157 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3158 .dac_nids = alc880_dac_nids,
3159 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3160 .channel_mode = alc880_fivestack_modes,
3161 .input_mux = &alc880_capture_source,
3163 [ALC880_5ST_DIG] = {
3164 .mixers = { alc880_three_stack_mixer,
3165 alc880_five_stack_mixer },
3166 .init_verbs = { alc880_volume_init_verbs,
3167 alc880_pin_5stack_init_verbs },
3168 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3169 .dac_nids = alc880_dac_nids,
3170 .dig_out_nid = ALC880_DIGOUT_NID,
3171 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3172 .channel_mode = alc880_fivestack_modes,
3173 .input_mux = &alc880_capture_source,
3176 .mixers = { alc880_six_stack_mixer },
3177 .init_verbs = { alc880_volume_init_verbs,
3178 alc880_pin_6stack_init_verbs },
3179 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3180 .dac_nids = alc880_6st_dac_nids,
3181 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3182 .channel_mode = alc880_sixstack_modes,
3183 .input_mux = &alc880_6stack_capture_source,
3185 [ALC880_6ST_DIG] = {
3186 .mixers = { alc880_six_stack_mixer },
3187 .init_verbs = { alc880_volume_init_verbs,
3188 alc880_pin_6stack_init_verbs },
3189 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3190 .dac_nids = alc880_6st_dac_nids,
3191 .dig_out_nid = ALC880_DIGOUT_NID,
3192 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3193 .channel_mode = alc880_sixstack_modes,
3194 .input_mux = &alc880_6stack_capture_source,
3197 .mixers = { alc880_w810_base_mixer },
3198 .init_verbs = { alc880_volume_init_verbs,
3199 alc880_pin_w810_init_verbs,
3200 alc880_gpio2_init_verbs },
3201 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3202 .dac_nids = alc880_w810_dac_nids,
3203 .dig_out_nid = ALC880_DIGOUT_NID,
3204 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3205 .channel_mode = alc880_w810_modes,
3206 .input_mux = &alc880_capture_source,
3209 .mixers = { alc880_z71v_mixer },
3210 .init_verbs = { alc880_volume_init_verbs,
3211 alc880_pin_z71v_init_verbs },
3212 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3213 .dac_nids = alc880_z71v_dac_nids,
3214 .dig_out_nid = ALC880_DIGOUT_NID,
3216 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3217 .channel_mode = alc880_2_jack_modes,
3218 .input_mux = &alc880_capture_source,
3221 .mixers = { alc880_f1734_mixer },
3222 .init_verbs = { alc880_volume_init_verbs,
3223 alc880_pin_f1734_init_verbs },
3224 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3225 .dac_nids = alc880_f1734_dac_nids,
3227 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3228 .channel_mode = alc880_2_jack_modes,
3229 .input_mux = &alc880_f1734_capture_source,
3230 .unsol_event = alc880_uniwill_p53_unsol_event,
3231 .init_hook = alc880_uniwill_p53_hp_automute,
3234 .mixers = { alc880_asus_mixer },
3235 .init_verbs = { alc880_volume_init_verbs,
3236 alc880_pin_asus_init_verbs,
3237 alc880_gpio1_init_verbs },
3238 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3239 .dac_nids = alc880_asus_dac_nids,
3240 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3241 .channel_mode = alc880_asus_modes,
3243 .input_mux = &alc880_capture_source,
3245 [ALC880_ASUS_DIG] = {
3246 .mixers = { alc880_asus_mixer },
3247 .init_verbs = { alc880_volume_init_verbs,
3248 alc880_pin_asus_init_verbs,
3249 alc880_gpio1_init_verbs },
3250 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3251 .dac_nids = alc880_asus_dac_nids,
3252 .dig_out_nid = ALC880_DIGOUT_NID,
3253 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3254 .channel_mode = alc880_asus_modes,
3256 .input_mux = &alc880_capture_source,
3258 [ALC880_ASUS_DIG2] = {
3259 .mixers = { alc880_asus_mixer },
3260 .init_verbs = { alc880_volume_init_verbs,
3261 alc880_pin_asus_init_verbs,
3262 alc880_gpio2_init_verbs }, /* use GPIO2 */
3263 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3264 .dac_nids = alc880_asus_dac_nids,
3265 .dig_out_nid = ALC880_DIGOUT_NID,
3266 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3267 .channel_mode = alc880_asus_modes,
3269 .input_mux = &alc880_capture_source,
3271 [ALC880_ASUS_W1V] = {
3272 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3273 .init_verbs = { alc880_volume_init_verbs,
3274 alc880_pin_asus_init_verbs,
3275 alc880_gpio1_init_verbs },
3276 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3277 .dac_nids = alc880_asus_dac_nids,
3278 .dig_out_nid = ALC880_DIGOUT_NID,
3279 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3280 .channel_mode = alc880_asus_modes,
3282 .input_mux = &alc880_capture_source,
3284 [ALC880_UNIWILL_DIG] = {
3285 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3286 .init_verbs = { alc880_volume_init_verbs,
3287 alc880_pin_asus_init_verbs },
3288 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3289 .dac_nids = alc880_asus_dac_nids,
3290 .dig_out_nid = ALC880_DIGOUT_NID,
3291 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3292 .channel_mode = alc880_asus_modes,
3294 .input_mux = &alc880_capture_source,
3296 [ALC880_UNIWILL] = {
3297 .mixers = { alc880_uniwill_mixer },
3298 .init_verbs = { alc880_volume_init_verbs,
3299 alc880_uniwill_init_verbs },
3300 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3301 .dac_nids = alc880_asus_dac_nids,
3302 .dig_out_nid = ALC880_DIGOUT_NID,
3303 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3304 .channel_mode = alc880_threestack_modes,
3306 .input_mux = &alc880_capture_source,
3307 .unsol_event = alc880_uniwill_unsol_event,
3308 .init_hook = alc880_uniwill_automute,
3310 [ALC880_UNIWILL_P53] = {
3311 .mixers = { alc880_uniwill_p53_mixer },
3312 .init_verbs = { alc880_volume_init_verbs,
3313 alc880_uniwill_p53_init_verbs },
3314 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3315 .dac_nids = alc880_asus_dac_nids,
3316 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3317 .channel_mode = alc880_threestack_modes,
3318 .input_mux = &alc880_capture_source,
3319 .unsol_event = alc880_uniwill_p53_unsol_event,
3320 .init_hook = alc880_uniwill_p53_hp_automute,
3322 [ALC880_FUJITSU] = {
3323 .mixers = { alc880_fujitsu_mixer,
3324 alc880_pcbeep_mixer, },
3325 .init_verbs = { alc880_volume_init_verbs,
3326 alc880_uniwill_p53_init_verbs,
3327 alc880_beep_init_verbs },
3328 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3329 .dac_nids = alc880_dac_nids,
3330 .dig_out_nid = ALC880_DIGOUT_NID,
3331 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3332 .channel_mode = alc880_2_jack_modes,
3333 .input_mux = &alc880_capture_source,
3334 .unsol_event = alc880_uniwill_p53_unsol_event,
3335 .init_hook = alc880_uniwill_p53_hp_automute,
3338 .mixers = { alc880_three_stack_mixer },
3339 .init_verbs = { alc880_volume_init_verbs,
3340 alc880_pin_clevo_init_verbs },
3341 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3342 .dac_nids = alc880_dac_nids,
3344 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3345 .channel_mode = alc880_threestack_modes,
3347 .input_mux = &alc880_capture_source,
3350 .mixers = { alc880_lg_mixer },
3351 .init_verbs = { alc880_volume_init_verbs,
3352 alc880_lg_init_verbs },
3353 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3354 .dac_nids = alc880_lg_dac_nids,
3355 .dig_out_nid = ALC880_DIGOUT_NID,
3356 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3357 .channel_mode = alc880_lg_ch_modes,
3359 .input_mux = &alc880_lg_capture_source,
3360 .unsol_event = alc880_lg_unsol_event,
3361 .init_hook = alc880_lg_automute,
3362 #ifdef CONFIG_SND_HDA_POWER_SAVE
3363 .loopbacks = alc880_lg_loopbacks,
3367 .mixers = { alc880_lg_lw_mixer },
3368 .init_verbs = { alc880_volume_init_verbs,
3369 alc880_lg_lw_init_verbs },
3370 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3371 .dac_nids = alc880_dac_nids,
3372 .dig_out_nid = ALC880_DIGOUT_NID,
3373 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3374 .channel_mode = alc880_lg_lw_modes,
3375 .input_mux = &alc880_lg_lw_capture_source,
3376 .unsol_event = alc880_lg_lw_unsol_event,
3377 .init_hook = alc880_lg_lw_automute,
3379 [ALC880_MEDION_RIM] = {
3380 .mixers = { alc880_medion_rim_mixer },
3381 .init_verbs = { alc880_volume_init_verbs,
3382 alc880_medion_rim_init_verbs,
3383 alc_gpio2_init_verbs },
3384 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3385 .dac_nids = alc880_dac_nids,
3386 .dig_out_nid = ALC880_DIGOUT_NID,
3387 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3388 .channel_mode = alc880_2_jack_modes,
3389 .input_mux = &alc880_medion_rim_capture_source,
3390 .unsol_event = alc880_medion_rim_unsol_event,
3391 .init_hook = alc880_medion_rim_automute,
3393 #ifdef CONFIG_SND_DEBUG
3395 .mixers = { alc880_test_mixer },
3396 .init_verbs = { alc880_test_init_verbs },
3397 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3398 .dac_nids = alc880_test_dac_nids,
3399 .dig_out_nid = ALC880_DIGOUT_NID,
3400 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3401 .channel_mode = alc880_test_modes,
3402 .input_mux = &alc880_test_capture_source,
3408 * Automatic parse of I/O pins from the BIOS configuration
3411 #define NUM_CONTROL_ALLOC 32
3412 #define NUM_VERB_ALLOC 32
3416 ALC_CTL_WIDGET_MUTE,
3419 static struct snd_kcontrol_new alc880_control_templates[] = {
3420 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3421 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3422 HDA_BIND_MUTE(NULL, 0, 0, 0),
3425 /* add dynamic controls */
3426 static int add_control(struct alc_spec *spec, int type, const char *name,
3429 struct snd_kcontrol_new *knew;
3431 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3432 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3434 /* array + terminator */
3435 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3438 if (spec->kctl_alloc) {
3439 memcpy(knew, spec->kctl_alloc,
3440 sizeof(*knew) * spec->num_kctl_alloc);
3441 kfree(spec->kctl_alloc);
3443 spec->kctl_alloc = knew;
3444 spec->num_kctl_alloc = num;
3447 knew = &spec->kctl_alloc[spec->num_kctl_used];
3448 *knew = alc880_control_templates[type];
3449 knew->name = kstrdup(name, GFP_KERNEL);
3452 knew->private_value = val;
3453 spec->num_kctl_used++;
3457 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3458 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3459 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3460 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3461 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3462 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3463 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3464 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3465 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3466 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3467 #define ALC880_PIN_CD_NID 0x1c
3469 /* fill in the dac_nids table from the parsed pin configuration */
3470 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3471 const struct auto_pin_cfg *cfg)
3477 memset(assigned, 0, sizeof(assigned));
3478 spec->multiout.dac_nids = spec->private_dac_nids;
3480 /* check the pins hardwired to audio widget */
3481 for (i = 0; i < cfg->line_outs; i++) {
3482 nid = cfg->line_out_pins[i];
3483 if (alc880_is_fixed_pin(nid)) {
3484 int idx = alc880_fixed_pin_idx(nid);
3485 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3489 /* left pins can be connect to any audio widget */
3490 for (i = 0; i < cfg->line_outs; i++) {
3491 nid = cfg->line_out_pins[i];
3492 if (alc880_is_fixed_pin(nid))
3494 /* search for an empty channel */
3495 for (j = 0; j < cfg->line_outs; j++) {
3497 spec->multiout.dac_nids[i] =
3498 alc880_idx_to_dac(j);
3504 spec->multiout.num_dacs = cfg->line_outs;
3508 /* add playback controls from the parsed DAC table */
3509 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3510 const struct auto_pin_cfg *cfg)
3513 static const char *chname[4] = {
3514 "Front", "Surround", NULL /*CLFE*/, "Side"
3519 for (i = 0; i < cfg->line_outs; i++) {
3520 if (!spec->multiout.dac_nids[i])
3522 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3525 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3526 "Center Playback Volume",
3527 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3531 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3532 "LFE Playback Volume",
3533 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3537 err = add_control(spec, ALC_CTL_BIND_MUTE,
3538 "Center Playback Switch",
3539 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3543 err = add_control(spec, ALC_CTL_BIND_MUTE,
3544 "LFE Playback Switch",
3545 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3550 sprintf(name, "%s Playback Volume", chname[i]);
3551 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3552 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3556 sprintf(name, "%s Playback Switch", chname[i]);
3557 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3558 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3567 /* add playback controls for speaker and HP outputs */
3568 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3578 if (alc880_is_fixed_pin(pin)) {
3579 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3580 /* specify the DAC as the extra output */
3581 if (!spec->multiout.hp_nid)
3582 spec->multiout.hp_nid = nid;
3584 spec->multiout.extra_out_nid[0] = nid;
3585 /* control HP volume/switch on the output mixer amp */
3586 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3587 sprintf(name, "%s Playback Volume", pfx);
3588 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3589 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3592 sprintf(name, "%s Playback Switch", pfx);
3593 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3594 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3597 } else if (alc880_is_multi_pin(pin)) {
3598 /* set manual connection */
3599 /* we have only a switch on HP-out PIN */
3600 sprintf(name, "%s Playback Switch", pfx);
3601 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3602 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3609 /* create input playback/capture controls for the given pin */
3610 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3611 const char *ctlname,
3612 int idx, hda_nid_t mix_nid)
3617 sprintf(name, "%s Playback Volume", ctlname);
3618 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3619 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3622 sprintf(name, "%s Playback Switch", ctlname);
3623 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3624 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3630 /* create playback/capture controls for input pins */
3631 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3632 const struct auto_pin_cfg *cfg)
3634 struct hda_input_mux *imux = &spec->private_imux;
3637 for (i = 0; i < AUTO_PIN_LAST; i++) {
3638 if (alc880_is_input_pin(cfg->input_pins[i])) {
3639 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3640 err = new_analog_input(spec, cfg->input_pins[i],
3641 auto_pin_cfg_labels[i],
3645 imux->items[imux->num_items].label =
3646 auto_pin_cfg_labels[i];
3647 imux->items[imux->num_items].index =
3648 alc880_input_pin_idx(cfg->input_pins[i]);
3655 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3656 unsigned int pin_type)
3658 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3661 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3665 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3666 hda_nid_t nid, int pin_type,
3669 alc_set_pin_output(codec, nid, pin_type);
3670 /* need the manual connection? */
3671 if (alc880_is_multi_pin(nid)) {
3672 struct alc_spec *spec = codec->spec;
3673 int idx = alc880_multi_pin_idx(nid);
3674 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3675 AC_VERB_SET_CONNECT_SEL,
3676 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3680 static int get_pin_type(int line_out_type)
3682 if (line_out_type == AUTO_PIN_HP_OUT)
3688 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3690 struct alc_spec *spec = codec->spec;
3693 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3694 for (i = 0; i < spec->autocfg.line_outs; i++) {
3695 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3696 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3697 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3701 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3703 struct alc_spec *spec = codec->spec;
3706 pin = spec->autocfg.speaker_pins[0];
3707 if (pin) /* connect to front */
3708 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3709 pin = spec->autocfg.hp_pins[0];
3710 if (pin) /* connect to front */
3711 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3714 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3716 struct alc_spec *spec = codec->spec;
3719 for (i = 0; i < AUTO_PIN_LAST; i++) {
3720 hda_nid_t nid = spec->autocfg.input_pins[i];
3721 if (alc880_is_input_pin(nid)) {
3722 snd_hda_codec_write(codec, nid, 0,
3723 AC_VERB_SET_PIN_WIDGET_CONTROL,
3724 i <= AUTO_PIN_FRONT_MIC ?
3725 PIN_VREF80 : PIN_IN);
3726 if (nid != ALC880_PIN_CD_NID)
3727 snd_hda_codec_write(codec, nid, 0,
3728 AC_VERB_SET_AMP_GAIN_MUTE,
3734 /* parse the BIOS configuration and set up the alc_spec */
3735 /* return 1 if successful, 0 if the proper config is not found,
3736 * or a negative error code
3738 static int alc880_parse_auto_config(struct hda_codec *codec)
3740 struct alc_spec *spec = codec->spec;
3742 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3744 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3748 if (!spec->autocfg.line_outs)
3749 return 0; /* can't find valid BIOS pin config */
3751 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3754 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3757 err = alc880_auto_create_extra_out(spec,
3758 spec->autocfg.speaker_pins[0],
3762 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3766 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3770 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3772 if (spec->autocfg.dig_out_pin)
3773 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3774 if (spec->autocfg.dig_in_pin)
3775 spec->dig_in_nid = ALC880_DIGIN_NID;
3777 if (spec->kctl_alloc)
3778 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3780 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3782 spec->num_mux_defs = 1;
3783 spec->input_mux = &spec->private_imux;
3788 /* additional initialization for auto-configuration model */
3789 static void alc880_auto_init(struct hda_codec *codec)
3791 struct alc_spec *spec = codec->spec;
3792 alc880_auto_init_multi_out(codec);
3793 alc880_auto_init_extra_out(codec);
3794 alc880_auto_init_analog_input(codec);
3795 if (spec->unsol_event)
3796 alc_sku_automute(codec);
3800 * OK, here we have finally the patch for ALC880
3803 static int patch_alc880(struct hda_codec *codec)
3805 struct alc_spec *spec;
3809 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3815 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3818 if (board_config < 0) {
3819 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3820 "trying auto-probe from BIOS...\n");
3821 board_config = ALC880_AUTO;
3824 if (board_config == ALC880_AUTO) {
3825 /* automatic parse from the BIOS config */
3826 err = alc880_parse_auto_config(codec);
3832 "hda_codec: Cannot set up configuration "
3833 "from BIOS. Using 3-stack mode...\n");
3834 board_config = ALC880_3ST;
3838 if (board_config != ALC880_AUTO)
3839 setup_preset(spec, &alc880_presets[board_config]);
3841 spec->stream_name_analog = "ALC880 Analog";
3842 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3843 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3844 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3846 spec->stream_name_digital = "ALC880 Digital";
3847 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3848 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3850 if (!spec->adc_nids && spec->input_mux) {
3851 /* check whether NID 0x07 is valid */
3852 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3854 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3855 if (wcap != AC_WID_AUD_IN) {
3856 spec->adc_nids = alc880_adc_nids_alt;
3857 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3858 spec->mixers[spec->num_mixers] =
3859 alc880_capture_alt_mixer;
3862 spec->adc_nids = alc880_adc_nids;
3863 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3864 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3869 spec->vmaster_nid = 0x0c;
3871 codec->patch_ops = alc_patch_ops;
3872 if (board_config == ALC880_AUTO)
3873 spec->init_hook = alc880_auto_init;
3874 #ifdef CONFIG_SND_HDA_POWER_SAVE
3875 if (!spec->loopback.amplist)
3876 spec->loopback.amplist = alc880_loopbacks;
3887 static hda_nid_t alc260_dac_nids[1] = {
3892 static hda_nid_t alc260_adc_nids[1] = {
3897 static hda_nid_t alc260_adc_nids_alt[1] = {
3902 static hda_nid_t alc260_hp_adc_nids[2] = {
3907 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3908 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3910 static hda_nid_t alc260_dual_adc_nids[2] = {
3915 #define ALC260_DIGOUT_NID 0x03
3916 #define ALC260_DIGIN_NID 0x06
3918 static struct hda_input_mux alc260_capture_source = {
3922 { "Front Mic", 0x1 },
3928 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3929 * headphone jack and the internal CD lines since these are the only pins at
3930 * which audio can appear. For flexibility, also allow the option of
3931 * recording the mixer output on the second ADC (ADC0 doesn't have a
3932 * connection to the mixer output).
3934 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3938 { "Mic/Line", 0x0 },
3940 { "Headphone", 0x2 },
3946 { "Mic/Line", 0x0 },
3948 { "Headphone", 0x2 },
3955 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3956 * the Fujitsu S702x, but jacks are marked differently.
3958 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3965 { "Headphone", 0x5 },
3974 { "Headphone", 0x6 },
3980 * This is just place-holder, so there's something for alc_build_pcms to look
3981 * at when it calculates the maximum number of channels. ALC260 has no mixer
3982 * element which allows changing the channel mode, so the verb list is
3985 static struct hda_channel_mode alc260_modes[1] = {
3990 /* Mixer combinations
3992 * basic: base_output + input + pc_beep + capture
3993 * HP: base_output + input + capture_alt
3994 * HP_3013: hp_3013 + input + capture
3995 * fujitsu: fujitsu + capture
3996 * acer: acer + capture
3999 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4000 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4001 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4002 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4003 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4004 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4005 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4009 static struct snd_kcontrol_new alc260_input_mixer[] = {
4010 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4011 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4012 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4013 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4015 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4016 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4021 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4022 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4023 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4027 /* update HP, line and mono out pins according to the master switch */
4028 static void alc260_hp_master_update(struct hda_codec *codec,
4029 hda_nid_t hp, hda_nid_t line,
4032 struct alc_spec *spec = codec->spec;
4033 unsigned int val = spec->master_sw ? PIN_HP : 0;
4034 /* change HP and line-out pins */
4035 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4037 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4039 /* mono (speaker) depending on the HP jack sense */
4040 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4041 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4045 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4046 struct snd_ctl_elem_value *ucontrol)
4048 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4049 struct alc_spec *spec = codec->spec;
4050 *ucontrol->value.integer.value = spec->master_sw;
4054 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4055 struct snd_ctl_elem_value *ucontrol)
4057 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4058 struct alc_spec *spec = codec->spec;
4059 int val = !!*ucontrol->value.integer.value;
4060 hda_nid_t hp, line, mono;
4062 if (val == spec->master_sw)
4064 spec->master_sw = val;
4065 hp = (kcontrol->private_value >> 16) & 0xff;
4066 line = (kcontrol->private_value >> 8) & 0xff;
4067 mono = kcontrol->private_value & 0xff;
4068 alc260_hp_master_update(codec, hp, line, mono);
4072 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4074 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4075 .name = "Master Playback Switch",
4076 .info = snd_ctl_boolean_mono_info,
4077 .get = alc260_hp_master_sw_get,
4078 .put = alc260_hp_master_sw_put,
4079 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4081 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4082 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4083 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4084 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4085 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4087 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4091 static struct hda_verb alc260_hp_unsol_verbs[] = {
4092 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4096 static void alc260_hp_automute(struct hda_codec *codec)
4098 struct alc_spec *spec = codec->spec;
4099 unsigned int present;
4101 present = snd_hda_codec_read(codec, 0x10, 0,
4102 AC_VERB_GET_PIN_SENSE, 0);
4103 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4104 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4107 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4109 if ((res >> 26) == ALC880_HP_EVENT)
4110 alc260_hp_automute(codec);
4113 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4116 .name = "Master Playback Switch",
4117 .info = snd_ctl_boolean_mono_info,
4118 .get = alc260_hp_master_sw_get,
4119 .put = alc260_hp_master_sw_put,
4120 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4122 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4123 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4124 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4125 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4126 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4128 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4129 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4133 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4134 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4138 static void alc260_hp_3013_automute(struct hda_codec *codec)
4140 struct alc_spec *spec = codec->spec;
4141 unsigned int present;
4143 present = snd_hda_codec_read(codec, 0x15, 0,
4144 AC_VERB_GET_PIN_SENSE, 0);
4145 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4146 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4149 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4152 if ((res >> 26) == ALC880_HP_EVENT)
4153 alc260_hp_3013_automute(codec);
4156 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4157 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4159 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4160 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4161 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4162 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4163 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4164 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4165 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4166 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4167 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4168 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4169 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4170 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4171 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4175 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4176 * versions of the ALC260 don't act on requests to enable mic bias from NID
4177 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4178 * datasheet doesn't mention this restriction. At this stage it's not clear
4179 * whether this behaviour is intentional or is a hardware bug in chip
4180 * revisions available in early 2006. Therefore for now allow the
4181 * "Headphone Jack Mode" control to span all choices, but if it turns out
4182 * that the lack of mic bias for this NID is intentional we could change the
4183 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4185 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4186 * don't appear to make the mic bias available from the "line" jack, even
4187 * though the NID used for this jack (0x14) can supply it. The theory is
4188 * that perhaps Acer have included blocking capacitors between the ALC260
4189 * and the output jack. If this turns out to be the case for all such
4190 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4191 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4193 * The C20x Tablet series have a mono internal speaker which is controlled
4194 * via the chip's Mono sum widget and pin complex, so include the necessary
4195 * controls for such models. On models without a "mono speaker" the control
4196 * won't do anything.
4198 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4199 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4200 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4201 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4202 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4204 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4206 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4207 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4209 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4210 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4211 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4212 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4213 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4214 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4215 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4219 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4220 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4222 static struct snd_kcontrol_new alc260_will_mixer[] = {
4223 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4224 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4226 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4227 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4228 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4229 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4230 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4231 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4232 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4233 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4234 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4238 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4239 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4241 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4242 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4243 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4245 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4246 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4247 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4248 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4249 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4250 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4251 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4255 /* capture mixer elements */
4256 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4257 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4258 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4259 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4260 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4262 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4263 /* The multiple "Capture Source" controls confuse alsamixer
4264 * So call somewhat different..
4266 /* .name = "Capture Source", */
4267 .name = "Input Source",
4269 .info = alc_mux_enum_info,
4270 .get = alc_mux_enum_get,
4271 .put = alc_mux_enum_put,
4276 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4277 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4278 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4280 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4281 /* The multiple "Capture Source" controls confuse alsamixer
4282 * So call somewhat different..
4284 /* .name = "Capture Source", */
4285 .name = "Input Source",
4287 .info = alc_mux_enum_info,
4288 .get = alc_mux_enum_get,
4289 .put = alc_mux_enum_put,
4295 * initialization verbs
4297 static struct hda_verb alc260_init_verbs[] = {
4298 /* Line In pin widget for input */
4299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4300 /* CD pin widget for input */
4301 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4302 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4303 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4304 /* Mic2 (front panel) pin widget for input and vref at 80% */
4305 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4306 /* LINE-2 is used for line-out in rear */
4307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4308 /* select line-out */
4309 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4311 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4313 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4315 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4316 /* mute capture amp left and right */
4317 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4318 /* set connection select to line in (default select for this ADC) */
4319 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4320 /* mute capture amp left and right */
4321 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4322 /* set connection select to line in (default select for this ADC) */
4323 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4324 /* set vol=0 Line-Out mixer amp left and right */
4325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4326 /* unmute pin widget amp left and right (no gain on this amp) */
4327 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4328 /* set vol=0 HP mixer amp left and right */
4329 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4330 /* unmute pin widget amp left and right (no gain on this amp) */
4331 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4332 /* set vol=0 Mono mixer amp left and right */
4333 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4334 /* unmute pin widget amp left and right (no gain on this amp) */
4335 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4336 /* unmute LINE-2 out pin */
4337 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4338 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4341 /* mute analog inputs */
4342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4343 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4344 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4345 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4346 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4347 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4348 /* mute Front out path */
4349 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4350 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4351 /* mute Headphone out path */
4352 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4353 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4354 /* mute Mono out path */
4355 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4356 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4360 #if 0 /* should be identical with alc260_init_verbs? */
4361 static struct hda_verb alc260_hp_init_verbs[] = {
4362 /* Headphone and output */
4363 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4365 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4366 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4367 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4368 /* Mic2 (front panel) pin widget for input and vref at 80% */
4369 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4370 /* Line In pin widget for input */
4371 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4372 /* Line-2 pin widget for output */
4373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4374 /* CD pin widget for input */
4375 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4376 /* unmute amp left and right */
4377 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4378 /* set connection select to line in (default select for this ADC) */
4379 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4380 /* unmute Line-Out mixer amp left and right (volume = 0) */
4381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4382 /* mute pin widget amp left and right (no gain on this amp) */
4383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4384 /* unmute HP mixer amp left and right (volume = 0) */
4385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4386 /* mute pin widget amp left and right (no gain on this amp) */
4387 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4388 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4391 /* mute analog inputs */
4392 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4394 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4395 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4396 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4397 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4398 /* Unmute Front out path */
4399 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4400 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4401 /* Unmute Headphone out path */
4402 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4403 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4404 /* Unmute Mono out path */
4405 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4406 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4411 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4412 /* Line out and output */
4413 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4415 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4416 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4417 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4418 /* Mic2 (front panel) pin widget for input and vref at 80% */
4419 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4420 /* Line In pin widget for input */
4421 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4422 /* Headphone pin widget for output */
4423 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4424 /* CD pin widget for input */
4425 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4426 /* unmute amp left and right */
4427 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4428 /* set connection select to line in (default select for this ADC) */
4429 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4430 /* unmute Line-Out mixer amp left and right (volume = 0) */
4431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4432 /* mute pin widget amp left and right (no gain on this amp) */
4433 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4434 /* unmute HP mixer amp left and right (volume = 0) */
4435 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4436 /* mute pin widget amp left and right (no gain on this amp) */
4437 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4438 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4441 /* mute analog inputs */
4442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4444 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4447 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4448 /* Unmute Front out path */
4449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4450 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4451 /* Unmute Headphone out path */
4452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4454 /* Unmute Mono out path */
4455 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4456 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4460 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4461 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4462 * audio = 0x16, internal speaker = 0x10.
4464 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4465 /* Disable all GPIOs */
4466 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4467 /* Internal speaker is connected to headphone pin */
4468 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4469 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4471 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4472 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4473 /* Ensure all other unused pins are disabled and muted. */
4474 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4476 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4477 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4478 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4479 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4480 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4481 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4483 /* Disable digital (SPDIF) pins */
4484 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4485 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4487 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4488 * when acting as an output.
4490 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4492 /* Start with output sum widgets muted and their output gains at min */
4493 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4495 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4497 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4498 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4499 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4500 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4501 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4503 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4504 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4505 /* Unmute Line1 pin widget output buffer since it starts as an output.
4506 * If the pin mode is changed by the user the pin mode control will
4507 * take care of enabling the pin's input/output buffers as needed.
4508 * Therefore there's no need to enable the input buffer at this
4511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4512 /* Unmute input buffer of pin widget used for Line-in (no equiv
4515 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4517 /* Mute capture amp left and right */
4518 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4519 /* Set ADC connection select to match default mixer setting - line
4522 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4524 /* Do the same for the second ADC: mute capture input amp and
4525 * set ADC connection to line in (on mic1 pin)
4527 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4528 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4530 /* Mute all inputs to mixer widget (even unconnected ones) */
4531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4536 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4537 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4538 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4543 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4544 * similar laptops (adapted from Fujitsu init verbs).
4546 static struct hda_verb alc260_acer_init_verbs[] = {
4547 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4548 * the headphone jack. Turn this on and rely on the standard mute
4549 * methods whenever the user wants to turn these outputs off.
4551 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4552 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4553 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4554 /* Internal speaker/Headphone jack is connected to Line-out pin */
4555 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4556 /* Internal microphone/Mic jack is connected to Mic1 pin */
4557 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4558 /* Line In jack is connected to Line1 pin */
4559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4560 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4561 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4562 /* Ensure all other unused pins are disabled and muted. */
4563 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4564 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4565 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4566 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4568 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4569 /* Disable digital (SPDIF) pins */
4570 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4571 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4573 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4574 * bus when acting as outputs.
4576 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4577 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4579 /* Start with output sum widgets muted and their output gains at min */
4580 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4581 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4582 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4583 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4584 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4585 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4586 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4587 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4588 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4590 /* Unmute Line-out pin widget amp left and right
4591 * (no equiv mixer ctrl)
4593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4594 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4595 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4596 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4597 * inputs. If the pin mode is changed by the user the pin mode control
4598 * will take care of enabling the pin's input/output buffers as needed.
4599 * Therefore there's no need to enable the input buffer at this
4602 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4603 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4605 /* Mute capture amp left and right */
4606 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4607 /* Set ADC connection select to match default mixer setting - mic
4610 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4612 /* Do similar with the second ADC: mute capture input amp and
4613 * set ADC connection to mic to match ALSA's default state.
4615 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4616 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4618 /* Mute all inputs to mixer widget (even unconnected ones) */
4619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4623 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4626 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4631 static struct hda_verb alc260_will_verbs[] = {
4632 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4633 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4634 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4635 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4636 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4637 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4641 static struct hda_verb alc260_replacer_672v_verbs[] = {
4642 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4643 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4644 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4646 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4647 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4648 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4650 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4654 /* toggle speaker-output according to the hp-jack state */
4655 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4657 unsigned int present;
4659 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4660 present = snd_hda_codec_read(codec, 0x0f, 0,
4661 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4663 snd_hda_codec_write_cache(codec, 0x01, 0,
4664 AC_VERB_SET_GPIO_DATA, 1);
4665 snd_hda_codec_write_cache(codec, 0x0f, 0,
4666 AC_VERB_SET_PIN_WIDGET_CONTROL,
4669 snd_hda_codec_write_cache(codec, 0x01, 0,
4670 AC_VERB_SET_GPIO_DATA, 0);
4671 snd_hda_codec_write_cache(codec, 0x0f, 0,
4672 AC_VERB_SET_PIN_WIDGET_CONTROL,
4677 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4680 if ((res >> 26) == ALC880_HP_EVENT)
4681 alc260_replacer_672v_automute(codec);
4684 /* Test configuration for debugging, modelled after the ALC880 test
4687 #ifdef CONFIG_SND_DEBUG
4688 static hda_nid_t alc260_test_dac_nids[1] = {
4691 static hda_nid_t alc260_test_adc_nids[2] = {
4694 /* For testing the ALC260, each input MUX needs its own definition since
4695 * the signal assignments are different. This assumes that the first ADC
4698 static struct hda_input_mux alc260_test_capture_sources[2] = {
4702 { "MIC1 pin", 0x0 },
4703 { "MIC2 pin", 0x1 },
4704 { "LINE1 pin", 0x2 },
4705 { "LINE2 pin", 0x3 },
4707 { "LINE-OUT pin", 0x5 },
4708 { "HP-OUT pin", 0x6 },
4714 { "MIC1 pin", 0x0 },
4715 { "MIC2 pin", 0x1 },
4716 { "LINE1 pin", 0x2 },
4717 { "LINE2 pin", 0x3 },
4720 { "LINE-OUT pin", 0x6 },
4721 { "HP-OUT pin", 0x7 },
4725 static struct snd_kcontrol_new alc260_test_mixer[] = {
4726 /* Output driver widgets */
4727 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4728 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4729 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4730 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4731 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4732 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4734 /* Modes for retasking pin widgets
4735 * Note: the ALC260 doesn't seem to act on requests to enable mic
4736 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4737 * mention this restriction. At this stage it's not clear whether
4738 * this behaviour is intentional or is a hardware bug in chip
4739 * revisions available at least up until early 2006. Therefore for
4740 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4741 * choices, but if it turns out that the lack of mic bias for these
4742 * NIDs is intentional we could change their modes from
4743 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4745 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4746 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4747 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4748 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4749 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4750 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4752 /* Loopback mixer controls */
4753 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4754 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4755 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4756 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4757 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4758 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4759 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4760 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4761 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4762 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4763 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4764 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4765 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4766 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4767 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4768 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4770 /* Controls for GPIO pins, assuming they are configured as outputs */
4771 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4772 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4773 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4774 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4776 /* Switches to allow the digital IO pins to be enabled. The datasheet
4777 * is ambigious as to which NID is which; testing on laptops which
4778 * make this output available should provide clarification.
4780 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4781 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4783 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4784 * this output to turn on an external amplifier.
4786 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4787 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4791 static struct hda_verb alc260_test_init_verbs[] = {
4792 /* Enable all GPIOs as outputs with an initial value of 0 */
4793 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4794 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4795 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4797 /* Enable retasking pins as output, initially without power amp */
4798 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4799 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4801 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4802 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4803 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4805 /* Disable digital (SPDIF) pins initially, but users can enable
4806 * them via a mixer switch. In the case of SPDIF-out, this initverb
4807 * payload also sets the generation to 0, output to be in "consumer"
4808 * PCM format, copyright asserted, no pre-emphasis and no validity
4811 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4812 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4814 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4815 * OUT1 sum bus when acting as an output.
4817 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4818 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4819 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4820 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4822 /* Start with output sum widgets muted and their output gains at min */
4823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4825 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4829 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4831 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4833 /* Unmute retasking pin widget output buffers since the default
4834 * state appears to be output. As the pin mode is changed by the
4835 * user the pin mode control will take care of enabling the pin's
4836 * input/output buffers as needed.
4838 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4839 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4842 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4843 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4844 /* Also unmute the mono-out pin widget */
4845 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4847 /* Mute capture amp left and right */
4848 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4849 /* Set ADC connection select to match default mixer setting (mic1
4852 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4854 /* Do the same for the second ADC: mute capture input amp and
4855 * set ADC connection to mic1 pin
4857 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4858 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4860 /* Mute all inputs to mixer widget (even unconnected ones) */
4861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4865 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4868 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4874 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4875 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4877 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4878 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4881 * for BIOS auto-configuration
4884 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4888 unsigned long vol_val, sw_val;
4892 if (nid >= 0x0f && nid < 0x11) {
4893 nid_vol = nid - 0x7;
4894 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4895 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4896 } else if (nid == 0x11) {
4897 nid_vol = nid - 0x7;
4898 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4899 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4900 } else if (nid >= 0x12 && nid <= 0x15) {
4902 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4903 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4907 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4908 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4911 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4912 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4918 /* add playback controls from the parsed DAC table */
4919 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4920 const struct auto_pin_cfg *cfg)
4925 spec->multiout.num_dacs = 1;
4926 spec->multiout.dac_nids = spec->private_dac_nids;
4927 spec->multiout.dac_nids[0] = 0x02;
4929 nid = cfg->line_out_pins[0];
4931 err = alc260_add_playback_controls(spec, nid, "Front");
4936 nid = cfg->speaker_pins[0];
4938 err = alc260_add_playback_controls(spec, nid, "Speaker");
4943 nid = cfg->hp_pins[0];
4945 err = alc260_add_playback_controls(spec, nid, "Headphone");
4952 /* create playback/capture controls for input pins */
4953 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4954 const struct auto_pin_cfg *cfg)
4956 struct hda_input_mux *imux = &spec->private_imux;
4959 for (i = 0; i < AUTO_PIN_LAST; i++) {
4960 if (cfg->input_pins[i] >= 0x12) {
4961 idx = cfg->input_pins[i] - 0x12;
4962 err = new_analog_input(spec, cfg->input_pins[i],
4963 auto_pin_cfg_labels[i], idx,
4967 imux->items[imux->num_items].label =
4968 auto_pin_cfg_labels[i];
4969 imux->items[imux->num_items].index = idx;
4972 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4973 idx = cfg->input_pins[i] - 0x09;
4974 err = new_analog_input(spec, cfg->input_pins[i],
4975 auto_pin_cfg_labels[i], idx,
4979 imux->items[imux->num_items].label =
4980 auto_pin_cfg_labels[i];
4981 imux->items[imux->num_items].index = idx;
4988 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4989 hda_nid_t nid, int pin_type,
4992 alc_set_pin_output(codec, nid, pin_type);
4993 /* need the manual connection? */
4995 int idx = nid - 0x12;
4996 snd_hda_codec_write(codec, idx + 0x0b, 0,
4997 AC_VERB_SET_CONNECT_SEL, sel_idx);
5001 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5003 struct alc_spec *spec = codec->spec;
5006 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5007 nid = spec->autocfg.line_out_pins[0];
5009 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5010 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5013 nid = spec->autocfg.speaker_pins[0];
5015 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5017 nid = spec->autocfg.hp_pins[0];
5019 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5022 #define ALC260_PIN_CD_NID 0x16
5023 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5025 struct alc_spec *spec = codec->spec;
5028 for (i = 0; i < AUTO_PIN_LAST; i++) {
5029 hda_nid_t nid = spec->autocfg.input_pins[i];
5031 snd_hda_codec_write(codec, nid, 0,
5032 AC_VERB_SET_PIN_WIDGET_CONTROL,
5033 i <= AUTO_PIN_FRONT_MIC ?
5034 PIN_VREF80 : PIN_IN);
5035 if (nid != ALC260_PIN_CD_NID)
5036 snd_hda_codec_write(codec, nid, 0,
5037 AC_VERB_SET_AMP_GAIN_MUTE,
5044 * generic initialization of ADC, input mixers and output mixers
5046 static struct hda_verb alc260_volume_init_verbs[] = {
5048 * Unmute ADC0-1 and set the default input to mic-in
5050 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5051 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5052 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5053 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5055 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5057 * Note: PASD motherboards uses the Line In 2 as the input for
5058 * front panel mic (mic 2)
5060 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5061 /* mute analog inputs */
5062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5069 * Set up output mixers (0x08 - 0x0a)
5071 /* set vol=0 to output mixers */
5072 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5074 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5075 /* set up input amps for analog loopback */
5076 /* Amp Indices: DAC = 0, mixer = 1 */
5077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5078 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5080 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5081 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5082 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5087 static int alc260_parse_auto_config(struct hda_codec *codec)
5089 struct alc_spec *spec = codec->spec;
5092 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5094 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5098 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5101 if (!spec->kctl_alloc)
5102 return 0; /* can't find valid BIOS pin config */
5103 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5107 spec->multiout.max_channels = 2;
5109 if (spec->autocfg.dig_out_pin)
5110 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5111 if (spec->kctl_alloc)
5112 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5114 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5116 spec->num_mux_defs = 1;
5117 spec->input_mux = &spec->private_imux;
5119 /* check whether NID 0x04 is valid */
5120 wcap = get_wcaps(codec, 0x04);
5121 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5122 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5123 spec->adc_nids = alc260_adc_nids_alt;
5124 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5125 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5127 spec->adc_nids = alc260_adc_nids;
5128 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5129 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5136 /* additional initialization for auto-configuration model */
5137 static void alc260_auto_init(struct hda_codec *codec)
5139 struct alc_spec *spec = codec->spec;
5140 alc260_auto_init_multi_out(codec);
5141 alc260_auto_init_analog_input(codec);
5142 if (spec->unsol_event)
5143 alc_sku_automute(codec);
5146 #ifdef CONFIG_SND_HDA_POWER_SAVE
5147 static struct hda_amp_list alc260_loopbacks[] = {
5148 { 0x07, HDA_INPUT, 0 },
5149 { 0x07, HDA_INPUT, 1 },
5150 { 0x07, HDA_INPUT, 2 },
5151 { 0x07, HDA_INPUT, 3 },
5152 { 0x07, HDA_INPUT, 4 },
5158 * ALC260 configurations
5160 static const char *alc260_models[ALC260_MODEL_LAST] = {
5161 [ALC260_BASIC] = "basic",
5163 [ALC260_HP_3013] = "hp-3013",
5164 [ALC260_FUJITSU_S702X] = "fujitsu",
5165 [ALC260_ACER] = "acer",
5166 [ALC260_WILL] = "will",
5167 [ALC260_REPLACER_672V] = "replacer",
5168 #ifdef CONFIG_SND_DEBUG
5169 [ALC260_TEST] = "test",
5171 [ALC260_AUTO] = "auto",
5174 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5175 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5176 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5177 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5178 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5179 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5180 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5181 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5182 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5183 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5184 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5185 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5186 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5187 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5188 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5189 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5190 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5191 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5192 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5196 static struct alc_config_preset alc260_presets[] = {
5198 .mixers = { alc260_base_output_mixer,
5200 alc260_pc_beep_mixer,
5201 alc260_capture_mixer },
5202 .init_verbs = { alc260_init_verbs },
5203 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5204 .dac_nids = alc260_dac_nids,
5205 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5206 .adc_nids = alc260_adc_nids,
5207 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5208 .channel_mode = alc260_modes,
5209 .input_mux = &alc260_capture_source,
5212 .mixers = { alc260_hp_output_mixer,
5214 alc260_capture_alt_mixer },
5215 .init_verbs = { alc260_init_verbs,
5216 alc260_hp_unsol_verbs },
5217 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5218 .dac_nids = alc260_dac_nids,
5219 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5220 .adc_nids = alc260_hp_adc_nids,
5221 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5222 .channel_mode = alc260_modes,
5223 .input_mux = &alc260_capture_source,
5224 .unsol_event = alc260_hp_unsol_event,
5225 .init_hook = alc260_hp_automute,
5227 [ALC260_HP_3013] = {
5228 .mixers = { alc260_hp_3013_mixer,
5230 alc260_capture_alt_mixer },
5231 .init_verbs = { alc260_hp_3013_init_verbs,
5232 alc260_hp_3013_unsol_verbs },
5233 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5234 .dac_nids = alc260_dac_nids,
5235 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5236 .adc_nids = alc260_hp_adc_nids,
5237 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5238 .channel_mode = alc260_modes,
5239 .input_mux = &alc260_capture_source,
5240 .unsol_event = alc260_hp_3013_unsol_event,
5241 .init_hook = alc260_hp_3013_automute,
5243 [ALC260_FUJITSU_S702X] = {
5244 .mixers = { alc260_fujitsu_mixer,
5245 alc260_capture_mixer },
5246 .init_verbs = { alc260_fujitsu_init_verbs },
5247 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5248 .dac_nids = alc260_dac_nids,
5249 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5250 .adc_nids = alc260_dual_adc_nids,
5251 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5252 .channel_mode = alc260_modes,
5253 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5254 .input_mux = alc260_fujitsu_capture_sources,
5257 .mixers = { alc260_acer_mixer,
5258 alc260_capture_mixer },
5259 .init_verbs = { alc260_acer_init_verbs },
5260 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5261 .dac_nids = alc260_dac_nids,
5262 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5263 .adc_nids = alc260_dual_adc_nids,
5264 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5265 .channel_mode = alc260_modes,
5266 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5267 .input_mux = alc260_acer_capture_sources,
5270 .mixers = { alc260_will_mixer,
5271 alc260_capture_mixer },
5272 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5273 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5274 .dac_nids = alc260_dac_nids,
5275 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5276 .adc_nids = alc260_adc_nids,
5277 .dig_out_nid = ALC260_DIGOUT_NID,
5278 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5279 .channel_mode = alc260_modes,
5280 .input_mux = &alc260_capture_source,
5282 [ALC260_REPLACER_672V] = {
5283 .mixers = { alc260_replacer_672v_mixer,
5284 alc260_capture_mixer },
5285 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5286 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5287 .dac_nids = alc260_dac_nids,
5288 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5289 .adc_nids = alc260_adc_nids,
5290 .dig_out_nid = ALC260_DIGOUT_NID,
5291 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5292 .channel_mode = alc260_modes,
5293 .input_mux = &alc260_capture_source,
5294 .unsol_event = alc260_replacer_672v_unsol_event,
5295 .init_hook = alc260_replacer_672v_automute,
5297 #ifdef CONFIG_SND_DEBUG
5299 .mixers = { alc260_test_mixer,
5300 alc260_capture_mixer },
5301 .init_verbs = { alc260_test_init_verbs },
5302 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5303 .dac_nids = alc260_test_dac_nids,
5304 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5305 .adc_nids = alc260_test_adc_nids,
5306 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5307 .channel_mode = alc260_modes,
5308 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5309 .input_mux = alc260_test_capture_sources,
5314 static int patch_alc260(struct hda_codec *codec)
5316 struct alc_spec *spec;
5317 int err, board_config;
5319 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5325 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5328 if (board_config < 0) {
5329 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5330 "trying auto-probe from BIOS...\n");
5331 board_config = ALC260_AUTO;
5334 if (board_config == ALC260_AUTO) {
5335 /* automatic parse from the BIOS config */
5336 err = alc260_parse_auto_config(codec);
5342 "hda_codec: Cannot set up configuration "
5343 "from BIOS. Using base mode...\n");
5344 board_config = ALC260_BASIC;
5348 if (board_config != ALC260_AUTO)
5349 setup_preset(spec, &alc260_presets[board_config]);
5351 spec->stream_name_analog = "ALC260 Analog";
5352 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5353 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5355 spec->stream_name_digital = "ALC260 Digital";
5356 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5357 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5359 spec->vmaster_nid = 0x08;
5361 codec->patch_ops = alc_patch_ops;
5362 if (board_config == ALC260_AUTO)
5363 spec->init_hook = alc260_auto_init;
5364 #ifdef CONFIG_SND_HDA_POWER_SAVE
5365 if (!spec->loopback.amplist)
5366 spec->loopback.amplist = alc260_loopbacks;
5376 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5377 * configuration. Each pin widget can choose any input DACs and a mixer.
5378 * Each ADC is connected from a mixer of all inputs. This makes possible
5379 * 6-channel independent captures.
5381 * In addition, an independent DAC for the multi-playback (not used in this
5384 #define ALC882_DIGOUT_NID 0x06
5385 #define ALC882_DIGIN_NID 0x0a
5387 static struct hda_channel_mode alc882_ch_modes[1] = {
5391 static hda_nid_t alc882_dac_nids[4] = {
5392 /* front, rear, clfe, rear_surr */
5393 0x02, 0x03, 0x04, 0x05
5396 /* identical with ALC880 */
5397 #define alc882_adc_nids alc880_adc_nids
5398 #define alc882_adc_nids_alt alc880_adc_nids_alt
5400 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5401 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5404 /* FIXME: should be a matrix-type input source selection */
5406 static struct hda_input_mux alc882_capture_source = {
5410 { "Front Mic", 0x1 },
5415 #define alc882_mux_enum_info alc_mux_enum_info
5416 #define alc882_mux_enum_get alc_mux_enum_get
5418 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5419 struct snd_ctl_elem_value *ucontrol)
5421 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5422 struct alc_spec *spec = codec->spec;
5423 const struct hda_input_mux *imux = spec->input_mux;
5424 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5425 hda_nid_t nid = spec->capsrc_nids ?
5426 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5427 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5428 unsigned int i, idx;
5430 idx = ucontrol->value.enumerated.item[0];
5431 if (idx >= imux->num_items)
5432 idx = imux->num_items - 1;
5433 if (*cur_val == idx)
5435 for (i = 0; i < imux->num_items; i++) {
5436 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5437 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5438 imux->items[i].index,
5448 static struct hda_verb alc882_3ST_ch2_init[] = {
5449 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5450 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5451 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5452 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5459 static struct hda_verb alc882_3ST_ch6_init[] = {
5460 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5461 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5462 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5463 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5464 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5465 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5469 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5470 { 2, alc882_3ST_ch2_init },
5471 { 6, alc882_3ST_ch6_init },
5477 static struct hda_verb alc882_sixstack_ch6_init[] = {
5478 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5479 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5480 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5481 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5488 static struct hda_verb alc882_sixstack_ch8_init[] = {
5489 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5490 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5491 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5492 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5496 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5497 { 6, alc882_sixstack_ch6_init },
5498 { 8, alc882_sixstack_ch8_init },
5502 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5508 static struct hda_verb alc885_mbp_ch2_init[] = {
5509 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5510 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5511 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5518 static struct hda_verb alc885_mbp_ch6_init[] = {
5519 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5520 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5521 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5522 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5523 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5527 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5528 { 2, alc885_mbp_ch2_init },
5529 { 6, alc885_mbp_ch6_init },
5533 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5534 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5536 static struct snd_kcontrol_new alc882_base_mixer[] = {
5537 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5538 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5539 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5540 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5541 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5542 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5543 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5544 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5545 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5546 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5547 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5548 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5549 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5550 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5551 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5553 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5554 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5555 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5556 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5557 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5558 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5559 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5563 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5564 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5565 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5566 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5567 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5568 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5569 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5570 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5571 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5572 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5573 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5576 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5577 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5578 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5579 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5580 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5581 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5582 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5584 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5585 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5586 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5587 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5591 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5592 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5593 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5594 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5595 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5596 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5597 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5598 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5599 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5600 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5601 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5602 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5603 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5604 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5608 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5609 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5611 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5612 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5613 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5614 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5615 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5616 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5617 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5618 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5619 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5620 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5621 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5623 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5624 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5628 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5629 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5630 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5631 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5632 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5633 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5634 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5635 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5637 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5639 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5640 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5644 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5646 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5647 .name = "Channel Mode",
5648 .info = alc_ch_mode_info,
5649 .get = alc_ch_mode_get,
5650 .put = alc_ch_mode_put,
5655 static struct hda_verb alc882_init_verbs[] = {
5656 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5663 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5666 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5667 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5669 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5670 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5671 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5673 /* Front Pin: output 0 (0x0c) */
5674 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5675 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5676 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5677 /* Rear Pin: output 1 (0x0d) */
5678 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5680 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5681 /* CLFE Pin: output 2 (0x0e) */
5682 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5684 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5685 /* Side Pin: output 3 (0x0f) */
5686 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5687 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5688 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5689 /* Mic (rear) pin: input vref at 80% */
5690 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5692 /* Front Mic pin: input vref at 80% */
5693 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5694 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5695 /* Line In pin: input */
5696 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5697 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5698 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5699 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5700 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5701 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5702 /* CD pin widget for input */
5703 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5705 /* FIXME: use matrix-type input source selection */
5706 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5707 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5710 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5715 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5716 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5720 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5722 /* ADC1: mute amp left and right */
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5724 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5725 /* ADC2: mute amp left and right */
5726 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5727 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5728 /* ADC3: mute amp left and right */
5729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5730 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5735 static struct hda_verb alc882_eapd_verbs[] = {
5736 /* change to EAPD mode */
5737 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5738 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5743 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5744 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5745 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5746 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5747 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5748 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5749 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5750 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5754 static struct hda_verb alc882_macpro_init_verbs[] = {
5755 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5759 /* Front Pin: output 0 (0x0c) */
5760 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5761 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5762 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5763 /* Front Mic pin: input vref at 80% */
5764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5766 /* Speaker: output */
5767 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5768 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5769 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5770 /* Headphone output (output 0 - 0x0c) */
5771 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5772 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5773 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5775 /* FIXME: use matrix-type input source selection */
5776 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5777 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5781 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5786 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5791 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5792 /* ADC1: mute amp left and right */
5793 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5794 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5795 /* ADC2: mute amp left and right */
5796 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5797 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5798 /* ADC3: mute amp left and right */
5799 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5800 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5805 /* Macbook Pro rev3 */
5806 static struct hda_verb alc885_mbp3_init_verbs[] = {
5807 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5815 /* Front Pin: output 0 (0x0c) */
5816 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5817 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5818 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5819 /* HP Pin: output 0 (0x0d) */
5820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5821 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5822 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5823 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5824 /* Mic (rear) pin: input vref at 80% */
5825 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5827 /* Front Mic pin: input vref at 80% */
5828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5829 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5830 /* Line In pin: use output 1 when in LineOut mode */
5831 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5832 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5833 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5835 /* FIXME: use matrix-type input source selection */
5836 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5837 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5839 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5840 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5841 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5843 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5844 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5845 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5846 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5849 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5850 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5851 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5852 /* ADC1: mute amp left and right */
5853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5854 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5855 /* ADC2: mute amp left and right */
5856 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5857 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5858 /* ADC3: mute amp left and right */
5859 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5860 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5865 /* iMac 24 mixer. */
5866 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5867 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5868 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5872 /* iMac 24 init verbs. */
5873 static struct hda_verb alc885_imac24_init_verbs[] = {
5874 /* Internal speakers: output 0 (0x0c) */
5875 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5877 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5878 /* Internal speakers: output 0 (0x0c) */
5879 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5881 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5882 /* Headphone: output 0 (0x0c) */
5883 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5885 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5886 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5887 /* Front Mic: input vref at 80% */
5888 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5889 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5893 /* Toggle speaker-output according to the hp-jack state */
5894 static void alc885_imac24_automute(struct hda_codec *codec)
5896 unsigned int present;
5898 present = snd_hda_codec_read(codec, 0x14, 0,
5899 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5900 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5901 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5902 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5903 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5906 /* Processes unsolicited events. */
5907 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5910 /* Headphone insertion or removal. */
5911 if ((res >> 26) == ALC880_HP_EVENT)
5912 alc885_imac24_automute(codec);
5915 static void alc885_mbp3_automute(struct hda_codec *codec)
5917 unsigned int present;
5919 present = snd_hda_codec_read(codec, 0x15, 0,
5920 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5921 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5922 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5923 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5924 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5927 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5930 /* Headphone insertion or removal. */
5931 if ((res >> 26) == ALC880_HP_EVENT)
5932 alc885_mbp3_automute(codec);
5936 static struct hda_verb alc882_targa_verbs[] = {
5937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5938 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5940 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5941 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5943 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5944 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5945 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5947 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5948 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5949 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5950 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5954 /* toggle speaker-output according to the hp-jack state */
5955 static void alc882_targa_automute(struct hda_codec *codec)
5957 unsigned int present;
5959 present = snd_hda_codec_read(codec, 0x14, 0,
5960 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5961 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5962 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5963 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5967 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5969 /* Looks like the unsol event is incompatible with the standard
5970 * definition. 4bit tag is placed at 26 bit!
5972 if (((res >> 26) == ALC880_HP_EVENT)) {
5973 alc882_targa_automute(codec);
5977 static struct hda_verb alc882_asus_a7j_verbs[] = {
5978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5983 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5985 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5987 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5989 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5990 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5991 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5995 static struct hda_verb alc882_asus_a7m_verbs[] = {
5996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5999 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6000 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6001 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6003 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6004 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6005 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6007 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6008 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6009 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6013 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6015 unsigned int gpiostate, gpiomask, gpiodir;
6017 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6018 AC_VERB_GET_GPIO_DATA, 0);
6021 gpiostate |= (1 << pin);
6023 gpiostate &= ~(1 << pin);
6025 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6026 AC_VERB_GET_GPIO_MASK, 0);
6027 gpiomask |= (1 << pin);
6029 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6030 AC_VERB_GET_GPIO_DIRECTION, 0);
6031 gpiodir |= (1 << pin);
6034 snd_hda_codec_write(codec, codec->afg, 0,
6035 AC_VERB_SET_GPIO_MASK, gpiomask);
6036 snd_hda_codec_write(codec, codec->afg, 0,
6037 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6041 snd_hda_codec_write(codec, codec->afg, 0,
6042 AC_VERB_SET_GPIO_DATA, gpiostate);
6045 /* set up GPIO at initialization */
6046 static void alc885_macpro_init_hook(struct hda_codec *codec)
6048 alc882_gpio_mute(codec, 0, 0);
6049 alc882_gpio_mute(codec, 1, 0);
6052 /* set up GPIO and update auto-muting at initialization */
6053 static void alc885_imac24_init_hook(struct hda_codec *codec)
6055 alc885_macpro_init_hook(codec);
6056 alc885_imac24_automute(codec);
6060 * generic initialization of ADC, input mixers and output mixers
6062 static struct hda_verb alc882_auto_init_verbs[] = {
6064 * Unmute ADC0-2 and set the default input to mic-in
6066 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6068 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6070 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6071 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6073 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6075 * Note: PASD motherboards uses the Line In 2 as the input for
6076 * front panel mic (mic 2)
6078 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6086 * Set up output mixers (0x0c - 0x0f)
6088 /* set vol=0 to output mixers */
6089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6090 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6091 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6092 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6093 /* set up input amps for analog loopback */
6094 /* Amp Indices: DAC = 0, mixer = 1 */
6095 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6097 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6098 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6099 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6100 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6101 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6102 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6103 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6104 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6106 /* FIXME: use matrix-type input source selection */
6107 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6108 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6114 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6115 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6116 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6127 /* capture mixer elements */
6128 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6129 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6130 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6131 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6132 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6135 /* The multiple "Capture Source" controls confuse alsamixer
6136 * So call somewhat different..
6138 /* .name = "Capture Source", */
6139 .name = "Input Source",
6141 .info = alc882_mux_enum_info,
6142 .get = alc882_mux_enum_get,
6143 .put = alc882_mux_enum_put,
6148 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6149 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6150 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6151 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6152 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6153 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6154 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6156 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6157 /* The multiple "Capture Source" controls confuse alsamixer
6158 * So call somewhat different..
6160 /* .name = "Capture Source", */
6161 .name = "Input Source",
6163 .info = alc882_mux_enum_info,
6164 .get = alc882_mux_enum_get,
6165 .put = alc882_mux_enum_put,
6170 #ifdef CONFIG_SND_HDA_POWER_SAVE
6171 #define alc882_loopbacks alc880_loopbacks
6174 /* pcm configuration: identiacal with ALC880 */
6175 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6176 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6177 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6178 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6181 * configuration and preset
6183 static const char *alc882_models[ALC882_MODEL_LAST] = {
6184 [ALC882_3ST_DIG] = "3stack-dig",
6185 [ALC882_6ST_DIG] = "6stack-dig",
6186 [ALC882_ARIMA] = "arima",
6187 [ALC882_W2JC] = "w2jc",
6188 [ALC882_TARGA] = "targa",
6189 [ALC882_ASUS_A7J] = "asus-a7j",
6190 [ALC882_ASUS_A7M] = "asus-a7m",
6191 [ALC885_MACPRO] = "macpro",
6192 [ALC885_MBP3] = "mbp3",
6193 [ALC885_IMAC24] = "imac24",
6194 [ALC882_AUTO] = "auto",
6197 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6198 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6199 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6200 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6201 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6202 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6203 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6204 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6205 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6206 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6207 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6208 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6209 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6213 static struct alc_config_preset alc882_presets[] = {
6214 [ALC882_3ST_DIG] = {
6215 .mixers = { alc882_base_mixer },
6216 .init_verbs = { alc882_init_verbs },
6217 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6218 .dac_nids = alc882_dac_nids,
6219 .dig_out_nid = ALC882_DIGOUT_NID,
6220 .dig_in_nid = ALC882_DIGIN_NID,
6221 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6222 .channel_mode = alc882_ch_modes,
6224 .input_mux = &alc882_capture_source,
6226 [ALC882_6ST_DIG] = {
6227 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6228 .init_verbs = { alc882_init_verbs },
6229 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6230 .dac_nids = alc882_dac_nids,
6231 .dig_out_nid = ALC882_DIGOUT_NID,
6232 .dig_in_nid = ALC882_DIGIN_NID,
6233 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6234 .channel_mode = alc882_sixstack_modes,
6235 .input_mux = &alc882_capture_source,
6238 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6239 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6240 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6241 .dac_nids = alc882_dac_nids,
6242 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6243 .channel_mode = alc882_sixstack_modes,
6244 .input_mux = &alc882_capture_source,
6247 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6248 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6249 alc880_gpio1_init_verbs },
6250 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6251 .dac_nids = alc882_dac_nids,
6252 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6253 .channel_mode = alc880_threestack_modes,
6255 .input_mux = &alc882_capture_source,
6256 .dig_out_nid = ALC882_DIGOUT_NID,
6259 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6260 .init_verbs = { alc885_mbp3_init_verbs,
6261 alc880_gpio1_init_verbs },
6262 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6263 .dac_nids = alc882_dac_nids,
6264 .channel_mode = alc885_mbp_6ch_modes,
6265 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6266 .input_mux = &alc882_capture_source,
6267 .dig_out_nid = ALC882_DIGOUT_NID,
6268 .dig_in_nid = ALC882_DIGIN_NID,
6269 .unsol_event = alc885_mbp3_unsol_event,
6270 .init_hook = alc885_mbp3_automute,
6273 .mixers = { alc882_macpro_mixer },
6274 .init_verbs = { alc882_macpro_init_verbs },
6275 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6276 .dac_nids = alc882_dac_nids,
6277 .dig_out_nid = ALC882_DIGOUT_NID,
6278 .dig_in_nid = ALC882_DIGIN_NID,
6279 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6280 .channel_mode = alc882_ch_modes,
6281 .input_mux = &alc882_capture_source,
6282 .init_hook = alc885_macpro_init_hook,
6285 .mixers = { alc885_imac24_mixer },
6286 .init_verbs = { alc885_imac24_init_verbs },
6287 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6288 .dac_nids = alc882_dac_nids,
6289 .dig_out_nid = ALC882_DIGOUT_NID,
6290 .dig_in_nid = ALC882_DIGIN_NID,
6291 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6292 .channel_mode = alc882_ch_modes,
6293 .input_mux = &alc882_capture_source,
6294 .unsol_event = alc885_imac24_unsol_event,
6295 .init_hook = alc885_imac24_init_hook,
6298 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6299 alc882_capture_mixer },
6300 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6301 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6302 .dac_nids = alc882_dac_nids,
6303 .dig_out_nid = ALC882_DIGOUT_NID,
6304 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6305 .adc_nids = alc882_adc_nids,
6306 .capsrc_nids = alc882_capsrc_nids,
6307 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6308 .channel_mode = alc882_3ST_6ch_modes,
6310 .input_mux = &alc882_capture_source,
6311 .unsol_event = alc882_targa_unsol_event,
6312 .init_hook = alc882_targa_automute,
6314 [ALC882_ASUS_A7J] = {
6315 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6316 alc882_capture_mixer },
6317 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6318 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6319 .dac_nids = alc882_dac_nids,
6320 .dig_out_nid = ALC882_DIGOUT_NID,
6321 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6322 .adc_nids = alc882_adc_nids,
6323 .capsrc_nids = alc882_capsrc_nids,
6324 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6325 .channel_mode = alc882_3ST_6ch_modes,
6327 .input_mux = &alc882_capture_source,
6329 [ALC882_ASUS_A7M] = {
6330 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6331 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6332 alc880_gpio1_init_verbs,
6333 alc882_asus_a7m_verbs },
6334 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6335 .dac_nids = alc882_dac_nids,
6336 .dig_out_nid = ALC882_DIGOUT_NID,
6337 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6338 .channel_mode = alc880_threestack_modes,
6340 .input_mux = &alc882_capture_source,
6349 PINFIX_ABIT_AW9D_MAX
6352 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6353 { 0x15, 0x01080104 }, /* side */
6354 { 0x16, 0x01011012 }, /* rear */
6355 { 0x17, 0x01016011 }, /* clfe */
6359 static const struct alc_pincfg *alc882_pin_fixes[] = {
6360 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6363 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6364 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6369 * BIOS auto configuration
6371 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6372 hda_nid_t nid, int pin_type,
6376 struct alc_spec *spec = codec->spec;
6379 alc_set_pin_output(codec, nid, pin_type);
6380 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6383 idx = spec->multiout.dac_nids[dac_idx] - 2;
6384 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6388 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6390 struct alc_spec *spec = codec->spec;
6393 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6394 for (i = 0; i <= HDA_SIDE; i++) {
6395 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6396 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6398 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6403 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6405 struct alc_spec *spec = codec->spec;
6408 pin = spec->autocfg.hp_pins[0];
6409 if (pin) /* connect to front */
6411 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6412 pin = spec->autocfg.speaker_pins[0];
6414 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6417 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6418 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6420 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6422 struct alc_spec *spec = codec->spec;
6425 for (i = 0; i < AUTO_PIN_LAST; i++) {
6426 hda_nid_t nid = spec->autocfg.input_pins[i];
6431 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6432 unsigned int pincap;
6433 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6434 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6438 snd_hda_codec_write(codec, nid, 0,
6439 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6440 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6441 snd_hda_codec_write(codec, nid, 0,
6442 AC_VERB_SET_AMP_GAIN_MUTE,
6447 static void alc882_auto_init_input_src(struct hda_codec *codec)
6449 struct alc_spec *spec = codec->spec;
6450 const struct hda_input_mux *imux = spec->input_mux;
6453 for (c = 0; c < spec->num_adc_nids; c++) {
6454 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6455 hda_nid_t nid = spec->capsrc_nids[c];
6456 int conns, mute, idx, item;
6458 conns = snd_hda_get_connections(codec, nid, conn_list,
6459 ARRAY_SIZE(conn_list));
6462 for (idx = 0; idx < conns; idx++) {
6463 /* if the current connection is the selected one,
6464 * unmute it as default - otherwise mute it
6466 mute = AMP_IN_MUTE(idx);
6467 for (item = 0; item < imux->num_items; item++) {
6468 if (imux->items[item].index == idx) {
6469 if (spec->cur_mux[c] == item)
6470 mute = AMP_IN_UNMUTE(idx);
6474 snd_hda_codec_write(codec, nid, 0,
6475 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6480 /* add mic boosts if needed */
6481 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6483 struct alc_spec *spec = codec->spec;
6487 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6488 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6489 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6491 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6495 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6496 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6497 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6499 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6506 /* almost identical with ALC880 parser... */
6507 static int alc882_parse_auto_config(struct hda_codec *codec)
6509 struct alc_spec *spec = codec->spec;
6510 int err = alc880_parse_auto_config(codec);
6515 return 0; /* no config found */
6517 err = alc_auto_add_mic_boost(codec);
6521 /* hack - override the init verbs */
6522 spec->init_verbs[0] = alc882_auto_init_verbs;
6524 return 1; /* config found */
6527 /* additional initialization for auto-configuration model */
6528 static void alc882_auto_init(struct hda_codec *codec)
6530 struct alc_spec *spec = codec->spec;
6531 alc882_auto_init_multi_out(codec);
6532 alc882_auto_init_hp_out(codec);
6533 alc882_auto_init_analog_input(codec);
6534 alc882_auto_init_input_src(codec);
6535 if (spec->unsol_event)
6536 alc_sku_automute(codec);
6539 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6541 static int patch_alc882(struct hda_codec *codec)
6543 struct alc_spec *spec;
6544 int err, board_config;
6546 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6552 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6556 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6557 /* Pick up systems that don't supply PCI SSID */
6558 switch (codec->subsystem_id) {
6559 case 0x106b0c00: /* Mac Pro */
6560 board_config = ALC885_MACPRO;
6562 case 0x106b1000: /* iMac 24 */
6563 board_config = ALC885_IMAC24;
6565 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6566 case 0x106b2c00: /* Macbook Pro rev3 */
6567 case 0x106b3600: /* Macbook 3.1 */
6568 board_config = ALC885_MBP3;
6571 /* ALC889A is handled better as ALC888-compatible */
6572 if (codec->revision_id == 0x100103) {
6574 return patch_alc883(codec);
6576 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6577 "trying auto-probe from BIOS...\n");
6578 board_config = ALC882_AUTO;
6582 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6584 if (board_config == ALC882_AUTO) {
6585 /* automatic parse from the BIOS config */
6586 err = alc882_parse_auto_config(codec);
6592 "hda_codec: Cannot set up configuration "
6593 "from BIOS. Using base mode...\n");
6594 board_config = ALC882_3ST_DIG;
6598 if (board_config != ALC882_AUTO)
6599 setup_preset(spec, &alc882_presets[board_config]);
6601 if (codec->vendor_id == 0x10ec0885) {
6602 spec->stream_name_analog = "ALC885 Analog";
6603 spec->stream_name_digital = "ALC885 Digital";
6605 spec->stream_name_analog = "ALC882 Analog";
6606 spec->stream_name_digital = "ALC882 Digital";
6609 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6610 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6611 /* FIXME: setup DAC5 */
6612 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6613 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6615 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6616 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6618 if (!spec->adc_nids && spec->input_mux) {
6619 /* check whether NID 0x07 is valid */
6620 unsigned int wcap = get_wcaps(codec, 0x07);
6622 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6623 if (wcap != AC_WID_AUD_IN) {
6624 spec->adc_nids = alc882_adc_nids_alt;
6625 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6626 spec->capsrc_nids = alc882_capsrc_nids_alt;
6627 spec->mixers[spec->num_mixers] =
6628 alc882_capture_alt_mixer;
6631 spec->adc_nids = alc882_adc_nids;
6632 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6633 spec->capsrc_nids = alc882_capsrc_nids;
6634 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6639 spec->vmaster_nid = 0x0c;
6641 codec->patch_ops = alc_patch_ops;
6642 if (board_config == ALC882_AUTO)
6643 spec->init_hook = alc882_auto_init;
6644 #ifdef CONFIG_SND_HDA_POWER_SAVE
6645 if (!spec->loopback.amplist)
6646 spec->loopback.amplist = alc882_loopbacks;
6655 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6656 * configuration. Each pin widget can choose any input DACs and a mixer.
6657 * Each ADC is connected from a mixer of all inputs. This makes possible
6658 * 6-channel independent captures.
6660 * In addition, an independent DAC for the multi-playback (not used in this
6663 #define ALC883_DIGOUT_NID 0x06
6664 #define ALC883_DIGIN_NID 0x0a
6666 static hda_nid_t alc883_dac_nids[4] = {
6667 /* front, rear, clfe, rear_surr */
6668 0x02, 0x03, 0x04, 0x05
6671 static hda_nid_t alc883_adc_nids[2] = {
6676 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6679 /* FIXME: should be a matrix-type input source selection */
6681 static struct hda_input_mux alc883_capture_source = {
6685 { "Front Mic", 0x1 },
6691 static struct hda_input_mux alc883_3stack_6ch_intel = {
6695 { "Front Mic", 0x0 },
6701 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6709 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6719 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6727 #define alc883_mux_enum_info alc_mux_enum_info
6728 #define alc883_mux_enum_get alc_mux_enum_get
6729 /* ALC883 has the ALC882-type input selection */
6730 #define alc883_mux_enum_put alc882_mux_enum_put
6735 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6742 static struct hda_verb alc883_3ST_ch2_init[] = {
6743 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6744 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6745 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6746 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6753 static struct hda_verb alc883_3ST_ch4_init[] = {
6754 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6755 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6756 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6757 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6758 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6765 static struct hda_verb alc883_3ST_ch6_init[] = {
6766 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6767 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6768 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6769 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6770 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6771 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6775 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6776 { 2, alc883_3ST_ch2_init },
6777 { 4, alc883_3ST_ch4_init },
6778 { 6, alc883_3ST_ch6_init },
6784 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6785 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6786 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6787 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6788 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6795 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6796 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6797 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6798 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6800 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6807 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6808 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6809 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6810 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6811 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6812 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6813 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6817 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6818 { 2, alc883_3ST_ch2_intel_init },
6819 { 4, alc883_3ST_ch4_intel_init },
6820 { 6, alc883_3ST_ch6_intel_init },
6826 static struct hda_verb alc883_sixstack_ch6_init[] = {
6827 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6828 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6829 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6830 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6837 static struct hda_verb alc883_sixstack_ch8_init[] = {
6838 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6839 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6840 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6841 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6845 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6846 { 6, alc883_sixstack_ch6_init },
6847 { 8, alc883_sixstack_ch8_init },
6850 static struct hda_verb alc883_medion_eapd_verbs[] = {
6851 /* eanable EAPD on medion laptop */
6852 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6853 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6857 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6858 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6861 static struct snd_kcontrol_new alc883_base_mixer[] = {
6862 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6863 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6864 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6865 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6866 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6867 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6868 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6869 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6870 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6871 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6873 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6874 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6875 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6876 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6878 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6880 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6881 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6882 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6883 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6884 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6885 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6886 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6887 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6888 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6890 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6891 /* .name = "Capture Source", */
6892 .name = "Input Source",
6894 .info = alc883_mux_enum_info,
6895 .get = alc883_mux_enum_get,
6896 .put = alc883_mux_enum_put,
6901 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6902 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6903 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6904 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6905 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6906 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6907 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6910 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6911 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6912 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6913 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6914 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6915 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6916 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6917 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6918 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6921 /* .name = "Capture Source", */
6922 .name = "Input Source",
6924 .info = alc883_mux_enum_info,
6925 .get = alc883_mux_enum_get,
6926 .put = alc883_mux_enum_put,
6931 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6932 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6933 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6934 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6935 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6936 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6937 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6939 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6940 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6941 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6942 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6943 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6944 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6945 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6947 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6948 /* .name = "Capture Source", */
6949 .name = "Input Source",
6951 .info = alc883_mux_enum_info,
6952 .get = alc883_mux_enum_get,
6953 .put = alc883_mux_enum_put,
6958 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6959 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6960 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6961 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6962 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6964 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6965 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6966 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6967 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6968 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6969 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6970 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6971 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6972 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6974 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6975 /* .name = "Capture Source", */
6976 .name = "Input Source",
6978 .info = alc883_mux_enum_info,
6979 .get = alc883_mux_enum_get,
6980 .put = alc883_mux_enum_put,
6985 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6986 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6987 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6997 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6998 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6999 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7000 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7001 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7002 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7003 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7004 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7007 /* .name = "Capture Source", */
7008 .name = "Input Source",
7010 .info = alc883_mux_enum_info,
7011 .get = alc883_mux_enum_get,
7012 .put = alc883_mux_enum_put,
7017 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7018 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7019 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7020 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7021 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7022 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7023 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7024 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7025 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7026 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7027 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7028 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7029 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7030 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7035 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7036 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7037 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7038 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7039 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7040 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7041 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7042 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7044 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7045 /* .name = "Capture Source", */
7046 .name = "Input Source",
7048 .info = alc883_mux_enum_info,
7049 .get = alc883_mux_enum_get,
7050 .put = alc883_mux_enum_put,
7055 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7056 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7057 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7058 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7059 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7060 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7062 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7063 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7064 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7066 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7067 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7068 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7069 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7071 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7073 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7074 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7075 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7076 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7077 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7078 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7079 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7080 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7081 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7083 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7084 /* .name = "Capture Source", */
7085 .name = "Input Source",
7087 .info = alc883_mux_enum_info,
7088 .get = alc883_mux_enum_get,
7089 .put = alc883_mux_enum_put,
7094 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7095 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7096 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7098 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7099 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7100 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7101 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7102 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7109 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7110 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7111 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7112 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7114 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7115 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7116 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7117 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7121 /* .name = "Capture Source", */
7122 .name = "Input Source",
7124 .info = alc883_mux_enum_info,
7125 .get = alc883_mux_enum_get,
7126 .put = alc883_mux_enum_put,
7131 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7132 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7134 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7135 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7136 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7137 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7138 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7139 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7140 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7149 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7150 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7151 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7154 /* .name = "Capture Source", */
7155 .name = "Input Source",
7157 .info = alc883_mux_enum_info,
7158 .get = alc883_mux_enum_get,
7159 .put = alc883_mux_enum_put,
7164 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7167 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7168 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7169 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7171 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7173 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7174 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7175 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7176 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7177 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7178 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7179 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7181 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7182 /* .name = "Capture Source", */
7183 .name = "Input Source",
7185 .info = alc883_mux_enum_info,
7186 .get = alc883_mux_enum_get,
7187 .put = alc883_mux_enum_put,
7192 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7193 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7194 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7195 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7196 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7199 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7201 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7202 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7204 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7205 /* .name = "Capture Source", */
7206 .name = "Input Source",
7208 .info = alc883_mux_enum_info,
7209 .get = alc883_mux_enum_get,
7210 .put = alc883_mux_enum_put,
7215 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7216 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7217 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7223 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7224 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7225 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7226 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7227 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7228 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7230 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7231 /* .name = "Capture Source", */
7232 .name = "Input Source",
7234 .info = alc883_mux_enum_info,
7235 .get = alc883_mux_enum_get,
7236 .put = alc883_mux_enum_put,
7241 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7243 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7244 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7245 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7246 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7247 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7248 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7250 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7251 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7252 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7253 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7254 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7256 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7257 /* .name = "Capture Source", */
7258 .name = "Input Source",
7260 .info = alc883_mux_enum_info,
7261 .get = alc883_mux_enum_get,
7262 .put = alc883_mux_enum_put,
7267 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7268 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7269 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7270 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7271 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7272 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7273 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7274 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7275 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7276 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7277 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7278 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7279 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7281 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7282 /* .name = "Capture Source", */
7283 .name = "Input Source",
7285 .info = alc883_mux_enum_info,
7286 .get = alc883_mux_enum_get,
7287 .put = alc883_mux_enum_put,
7292 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7294 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7295 .name = "Channel Mode",
7296 .info = alc_ch_mode_info,
7297 .get = alc_ch_mode_get,
7298 .put = alc_ch_mode_put,
7303 static struct hda_verb alc883_init_verbs[] = {
7304 /* ADC1: mute amp left and right */
7305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7306 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7307 /* ADC2: mute amp left and right */
7308 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7309 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7310 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7321 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7325 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7327 /* mute analog input loopbacks */
7328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7332 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7334 /* Front Pin: output 0 (0x0c) */
7335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7336 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7337 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7338 /* Rear Pin: output 1 (0x0d) */
7339 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7341 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7342 /* CLFE Pin: output 2 (0x0e) */
7343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7344 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7345 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7346 /* Side Pin: output 3 (0x0f) */
7347 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7348 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7349 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7350 /* Mic (rear) pin: input vref at 80% */
7351 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7353 /* Front Mic pin: input vref at 80% */
7354 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7355 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7356 /* Line In pin: input */
7357 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7359 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7360 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7361 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7362 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7363 /* CD pin widget for input */
7364 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7366 /* FIXME: use matrix-type input source selection */
7367 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7377 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7381 /* toggle speaker-output according to the hp-jack state */
7382 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7384 unsigned int present;
7386 present = snd_hda_codec_read(codec, 0x15, 0,
7387 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7388 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7389 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7390 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7391 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7394 /* auto-toggle front mic */
7396 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7398 unsigned int present;
7401 present = snd_hda_codec_read(codec, 0x18, 0,
7402 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7403 bits = present ? HDA_AMP_MUTE : 0;
7404 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7408 static void alc883_mitac_automute(struct hda_codec *codec)
7410 alc883_mitac_hp_automute(codec);
7411 /* alc883_mitac_mic_automute(codec); */
7414 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7417 switch (res >> 26) {
7418 case ALC880_HP_EVENT:
7419 alc883_mitac_hp_automute(codec);
7421 case ALC880_MIC_EVENT:
7422 /* alc883_mitac_mic_automute(codec); */
7427 static struct hda_verb alc883_mitac_verbs[] = {
7429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7432 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7433 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7435 /* enable unsolicited event */
7436 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7437 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7442 static struct hda_verb alc883_clevo_m720_verbs[] = {
7444 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7447 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7448 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7450 /* enable unsolicited event */
7451 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7452 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7457 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7459 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7460 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7465 /* enable unsolicited event */
7466 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7471 static struct hda_verb alc883_tagra_verbs[] = {
7472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7475 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7476 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7478 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7479 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7480 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7482 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7483 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7484 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7485 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7490 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7491 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7492 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7493 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7497 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7498 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7500 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7505 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7508 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7509 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7510 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7514 static struct hda_verb alc883_haier_w66_verbs[] = {
7515 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7516 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7518 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7520 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7521 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7522 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7523 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7527 static struct hda_verb alc888_3st_hp_verbs[] = {
7528 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7529 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7530 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7534 static struct hda_verb alc888_6st_dell_verbs[] = {
7535 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7539 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7540 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7541 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7542 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7543 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7547 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7548 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7549 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7550 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7551 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7555 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7556 { 2, alc888_3st_hp_2ch_init },
7557 { 6, alc888_3st_hp_6ch_init },
7560 /* toggle front-jack and RCA according to the hp-jack state */
7561 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7563 unsigned int present;
7565 present = snd_hda_codec_read(codec, 0x1b, 0,
7566 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7567 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7568 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7569 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7570 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7573 /* toggle RCA according to the front-jack state */
7574 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7576 unsigned int present;
7578 present = snd_hda_codec_read(codec, 0x14, 0,
7579 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7580 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7581 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7584 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7587 if ((res >> 26) == ALC880_HP_EVENT)
7588 alc888_lenovo_ms7195_front_automute(codec);
7589 if ((res >> 26) == ALC880_FRONT_EVENT)
7590 alc888_lenovo_ms7195_rca_automute(codec);
7593 static struct hda_verb alc883_medion_md2_verbs[] = {
7594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7595 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7597 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7599 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7603 /* toggle speaker-output according to the hp-jack state */
7604 static void alc883_medion_md2_automute(struct hda_codec *codec)
7606 unsigned int present;
7608 present = snd_hda_codec_read(codec, 0x14, 0,
7609 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7610 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7611 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7614 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7617 if ((res >> 26) == ALC880_HP_EVENT)
7618 alc883_medion_md2_automute(codec);
7621 /* toggle speaker-output according to the hp-jack state */
7622 static void alc883_tagra_automute(struct hda_codec *codec)
7624 unsigned int present;
7627 present = snd_hda_codec_read(codec, 0x14, 0,
7628 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7629 bits = present ? HDA_AMP_MUTE : 0;
7630 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7631 HDA_AMP_MUTE, bits);
7632 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7636 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7638 if ((res >> 26) == ALC880_HP_EVENT)
7639 alc883_tagra_automute(codec);
7642 /* toggle speaker-output according to the hp-jack state */
7643 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7645 unsigned int present;
7648 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7649 & AC_PINSENSE_PRESENCE;
7650 bits = present ? HDA_AMP_MUTE : 0;
7651 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7652 HDA_AMP_MUTE, bits);
7655 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7657 unsigned int present;
7659 present = snd_hda_codec_read(codec, 0x18, 0,
7660 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7661 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7662 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7665 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7667 alc883_clevo_m720_hp_automute(codec);
7668 alc883_clevo_m720_mic_automute(codec);
7671 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7674 switch (res >> 26) {
7675 case ALC880_HP_EVENT:
7676 alc883_clevo_m720_hp_automute(codec);
7678 case ALC880_MIC_EVENT:
7679 alc883_clevo_m720_mic_automute(codec);
7684 /* toggle speaker-output according to the hp-jack state */
7685 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7687 unsigned int present;
7690 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7691 & AC_PINSENSE_PRESENCE;
7692 bits = present ? HDA_AMP_MUTE : 0;
7693 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7694 HDA_AMP_MUTE, bits);
7697 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7700 if ((res >> 26) == ALC880_HP_EVENT)
7701 alc883_2ch_fujitsu_pi2515_automute(codec);
7704 static void alc883_haier_w66_automute(struct hda_codec *codec)
7706 unsigned int present;
7709 present = snd_hda_codec_read(codec, 0x1b, 0,
7710 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7711 bits = present ? 0x80 : 0;
7712 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7716 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7719 if ((res >> 26) == ALC880_HP_EVENT)
7720 alc883_haier_w66_automute(codec);
7723 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7725 unsigned int present;
7728 present = snd_hda_codec_read(codec, 0x14, 0,
7729 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7730 bits = present ? HDA_AMP_MUTE : 0;
7731 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7732 HDA_AMP_MUTE, bits);
7735 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7737 unsigned int present;
7740 present = snd_hda_codec_read(codec, 0x1b, 0,
7741 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7742 bits = present ? HDA_AMP_MUTE : 0;
7743 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7744 HDA_AMP_MUTE, bits);
7745 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7746 HDA_AMP_MUTE, bits);
7749 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7752 if ((res >> 26) == ALC880_HP_EVENT)
7753 alc883_lenovo_101e_all_automute(codec);
7754 if ((res >> 26) == ALC880_FRONT_EVENT)
7755 alc883_lenovo_101e_ispeaker_automute(codec);
7758 /* toggle speaker-output according to the hp-jack state */
7759 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7761 unsigned int present;
7763 present = snd_hda_codec_read(codec, 0x14, 0,
7764 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7765 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7766 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7767 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7768 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7771 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7774 if ((res >> 26) == ALC880_HP_EVENT)
7775 alc883_acer_aspire_automute(codec);
7778 static struct hda_verb alc883_acer_eapd_verbs[] = {
7779 /* HP Pin: output 0 (0x0c) */
7780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7781 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7782 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7783 /* Front Pin: output 0 (0x0c) */
7784 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7785 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7786 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7787 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7788 /* eanable EAPD on medion laptop */
7789 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7790 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7791 /* enable unsolicited event */
7792 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7796 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7798 unsigned int present;
7800 present = snd_hda_codec_read(codec, 0x1b, 0,
7801 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7802 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7803 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7804 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7805 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7806 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7807 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7808 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7809 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7812 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7815 switch (res >> 26) {
7816 case ALC880_HP_EVENT:
7817 printk("hp_event\n");
7818 alc888_6st_dell_front_automute(codec);
7824 * generic initialization of ADC, input mixers and output mixers
7826 static struct hda_verb alc883_auto_init_verbs[] = {
7828 * Unmute ADC0-2 and set the default input to mic-in
7830 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7831 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7832 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7833 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7835 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7837 * Note: PASD motherboards uses the Line In 2 as the input for
7838 * front panel mic (mic 2)
7840 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7844 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7848 * Set up output mixers (0x0c - 0x0f)
7850 /* set vol=0 to output mixers */
7851 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7852 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7854 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7855 /* set up input amps for analog loopback */
7856 /* Amp Indices: DAC = 0, mixer = 1 */
7857 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7858 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7859 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7860 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7861 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7862 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7863 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7864 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7865 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7866 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7868 /* FIXME: use matrix-type input source selection */
7869 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7871 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7873 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7874 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7875 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7879 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7880 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7886 /* capture mixer elements */
7887 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7888 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7889 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7890 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7891 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7894 /* The multiple "Capture Source" controls confuse alsamixer
7895 * So call somewhat different..
7897 /* .name = "Capture Source", */
7898 .name = "Input Source",
7900 .info = alc882_mux_enum_info,
7901 .get = alc882_mux_enum_get,
7902 .put = alc882_mux_enum_put,
7907 #ifdef CONFIG_SND_HDA_POWER_SAVE
7908 #define alc883_loopbacks alc880_loopbacks
7911 /* pcm configuration: identiacal with ALC880 */
7912 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7913 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7914 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7915 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7916 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7919 * configuration and preset
7921 static const char *alc883_models[ALC883_MODEL_LAST] = {
7922 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7923 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7924 [ALC883_3ST_6ch] = "3stack-6ch",
7925 [ALC883_6ST_DIG] = "6stack-dig",
7926 [ALC883_TARGA_DIG] = "targa-dig",
7927 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7928 [ALC883_ACER] = "acer",
7929 [ALC883_ACER_ASPIRE] = "acer-aspire",
7930 [ALC883_MEDION] = "medion",
7931 [ALC883_MEDION_MD2] = "medion-md2",
7932 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7933 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7934 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7935 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7936 [ALC883_HAIER_W66] = "haier-w66",
7937 [ALC888_3ST_HP] = "3stack-hp",
7938 [ALC888_6ST_DELL] = "6stack-dell",
7939 [ALC883_MITAC] = "mitac",
7940 [ALC883_CLEVO_M720] = "clevo-m720",
7941 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7942 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
7943 [ALC883_AUTO] = "auto",
7946 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7947 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7948 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7949 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7950 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7951 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
7952 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7953 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7954 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7955 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7956 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7957 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7958 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7959 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7960 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7961 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7962 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7963 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7964 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7965 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7966 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7967 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7968 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7969 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7970 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7971 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7972 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7973 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7974 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7975 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7976 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7977 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7978 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7979 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7980 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7981 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7982 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7983 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7984 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7985 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7986 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7987 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7988 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7989 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7990 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7991 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7992 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7993 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7994 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7995 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7996 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7997 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7998 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7999 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8000 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8001 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8002 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8003 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8007 static struct alc_config_preset alc883_presets[] = {
8008 [ALC883_3ST_2ch_DIG] = {
8009 .mixers = { alc883_3ST_2ch_mixer },
8010 .init_verbs = { alc883_init_verbs },
8011 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8012 .dac_nids = alc883_dac_nids,
8013 .dig_out_nid = ALC883_DIGOUT_NID,
8014 .dig_in_nid = ALC883_DIGIN_NID,
8015 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8016 .channel_mode = alc883_3ST_2ch_modes,
8017 .input_mux = &alc883_capture_source,
8019 [ALC883_3ST_6ch_DIG] = {
8020 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8021 .init_verbs = { alc883_init_verbs },
8022 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8023 .dac_nids = alc883_dac_nids,
8024 .dig_out_nid = ALC883_DIGOUT_NID,
8025 .dig_in_nid = ALC883_DIGIN_NID,
8026 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8027 .channel_mode = alc883_3ST_6ch_modes,
8029 .input_mux = &alc883_capture_source,
8031 [ALC883_3ST_6ch] = {
8032 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8033 .init_verbs = { alc883_init_verbs },
8034 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8035 .dac_nids = alc883_dac_nids,
8036 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8037 .channel_mode = alc883_3ST_6ch_modes,
8039 .input_mux = &alc883_capture_source,
8041 [ALC883_3ST_6ch_INTEL] = {
8042 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8043 .init_verbs = { alc883_init_verbs },
8044 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8045 .dac_nids = alc883_dac_nids,
8046 .dig_out_nid = ALC883_DIGOUT_NID,
8047 .dig_in_nid = ALC883_DIGIN_NID,
8048 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8049 .channel_mode = alc883_3ST_6ch_intel_modes,
8051 .input_mux = &alc883_3stack_6ch_intel,
8053 [ALC883_6ST_DIG] = {
8054 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8055 .init_verbs = { alc883_init_verbs },
8056 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8057 .dac_nids = alc883_dac_nids,
8058 .dig_out_nid = ALC883_DIGOUT_NID,
8059 .dig_in_nid = ALC883_DIGIN_NID,
8060 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8061 .channel_mode = alc883_sixstack_modes,
8062 .input_mux = &alc883_capture_source,
8064 [ALC883_TARGA_DIG] = {
8065 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8066 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8067 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8068 .dac_nids = alc883_dac_nids,
8069 .dig_out_nid = ALC883_DIGOUT_NID,
8070 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8071 .channel_mode = alc883_3ST_6ch_modes,
8073 .input_mux = &alc883_capture_source,
8074 .unsol_event = alc883_tagra_unsol_event,
8075 .init_hook = alc883_tagra_automute,
8077 [ALC883_TARGA_2ch_DIG] = {
8078 .mixers = { alc883_tagra_2ch_mixer},
8079 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8080 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8081 .dac_nids = alc883_dac_nids,
8082 .dig_out_nid = ALC883_DIGOUT_NID,
8083 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8084 .channel_mode = alc883_3ST_2ch_modes,
8085 .input_mux = &alc883_capture_source,
8086 .unsol_event = alc883_tagra_unsol_event,
8087 .init_hook = alc883_tagra_automute,
8090 .mixers = { alc883_base_mixer },
8091 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8092 * and the headphone jack. Turn this on and rely on the
8093 * standard mute methods whenever the user wants to turn
8094 * these outputs off.
8096 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8097 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8098 .dac_nids = alc883_dac_nids,
8099 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8100 .channel_mode = alc883_3ST_2ch_modes,
8101 .input_mux = &alc883_capture_source,
8103 [ALC883_ACER_ASPIRE] = {
8104 .mixers = { alc883_acer_aspire_mixer },
8105 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8106 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8107 .dac_nids = alc883_dac_nids,
8108 .dig_out_nid = ALC883_DIGOUT_NID,
8109 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8110 .channel_mode = alc883_3ST_2ch_modes,
8111 .input_mux = &alc883_capture_source,
8112 .unsol_event = alc883_acer_aspire_unsol_event,
8113 .init_hook = alc883_acer_aspire_automute,
8116 .mixers = { alc883_fivestack_mixer,
8117 alc883_chmode_mixer },
8118 .init_verbs = { alc883_init_verbs,
8119 alc883_medion_eapd_verbs },
8120 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8121 .dac_nids = alc883_dac_nids,
8122 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8123 .channel_mode = alc883_sixstack_modes,
8124 .input_mux = &alc883_capture_source,
8126 [ALC883_MEDION_MD2] = {
8127 .mixers = { alc883_medion_md2_mixer},
8128 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8129 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8130 .dac_nids = alc883_dac_nids,
8131 .dig_out_nid = ALC883_DIGOUT_NID,
8132 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8133 .channel_mode = alc883_3ST_2ch_modes,
8134 .input_mux = &alc883_capture_source,
8135 .unsol_event = alc883_medion_md2_unsol_event,
8136 .init_hook = alc883_medion_md2_automute,
8138 [ALC883_LAPTOP_EAPD] = {
8139 .mixers = { alc883_base_mixer },
8140 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8141 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8142 .dac_nids = alc883_dac_nids,
8143 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8144 .channel_mode = alc883_3ST_2ch_modes,
8145 .input_mux = &alc883_capture_source,
8147 [ALC883_CLEVO_M720] = {
8148 .mixers = { alc883_clevo_m720_mixer },
8149 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8150 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8151 .dac_nids = alc883_dac_nids,
8152 .dig_out_nid = ALC883_DIGOUT_NID,
8153 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8154 .channel_mode = alc883_3ST_2ch_modes,
8155 .input_mux = &alc883_capture_source,
8156 .unsol_event = alc883_clevo_m720_unsol_event,
8157 .init_hook = alc883_clevo_m720_automute,
8159 [ALC883_LENOVO_101E_2ch] = {
8160 .mixers = { alc883_lenovo_101e_2ch_mixer},
8161 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8162 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8163 .dac_nids = alc883_dac_nids,
8164 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8165 .channel_mode = alc883_3ST_2ch_modes,
8166 .input_mux = &alc883_lenovo_101e_capture_source,
8167 .unsol_event = alc883_lenovo_101e_unsol_event,
8168 .init_hook = alc883_lenovo_101e_all_automute,
8170 [ALC883_LENOVO_NB0763] = {
8171 .mixers = { alc883_lenovo_nb0763_mixer },
8172 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8173 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8174 .dac_nids = alc883_dac_nids,
8175 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8176 .channel_mode = alc883_3ST_2ch_modes,
8178 .input_mux = &alc883_lenovo_nb0763_capture_source,
8179 .unsol_event = alc883_medion_md2_unsol_event,
8180 .init_hook = alc883_medion_md2_automute,
8182 [ALC888_LENOVO_MS7195_DIG] = {
8183 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8184 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8185 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8186 .dac_nids = alc883_dac_nids,
8187 .dig_out_nid = ALC883_DIGOUT_NID,
8188 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8189 .channel_mode = alc883_3ST_6ch_modes,
8191 .input_mux = &alc883_capture_source,
8192 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8193 .init_hook = alc888_lenovo_ms7195_front_automute,
8195 [ALC883_HAIER_W66] = {
8196 .mixers = { alc883_tagra_2ch_mixer},
8197 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8198 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8199 .dac_nids = alc883_dac_nids,
8200 .dig_out_nid = ALC883_DIGOUT_NID,
8201 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8202 .channel_mode = alc883_3ST_2ch_modes,
8203 .input_mux = &alc883_capture_source,
8204 .unsol_event = alc883_haier_w66_unsol_event,
8205 .init_hook = alc883_haier_w66_automute,
8208 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8209 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8210 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8211 .dac_nids = alc883_dac_nids,
8212 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8213 .channel_mode = alc888_3st_hp_modes,
8215 .input_mux = &alc883_capture_source,
8217 [ALC888_6ST_DELL] = {
8218 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8219 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8220 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8221 .dac_nids = alc883_dac_nids,
8222 .dig_out_nid = ALC883_DIGOUT_NID,
8223 .dig_in_nid = ALC883_DIGIN_NID,
8224 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8225 .channel_mode = alc883_sixstack_modes,
8226 .input_mux = &alc883_capture_source,
8227 .unsol_event = alc888_6st_dell_unsol_event,
8228 .init_hook = alc888_6st_dell_front_automute,
8231 .mixers = { alc883_mitac_mixer },
8232 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8234 .dac_nids = alc883_dac_nids,
8235 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8236 .channel_mode = alc883_3ST_2ch_modes,
8237 .input_mux = &alc883_capture_source,
8238 .unsol_event = alc883_mitac_unsol_event,
8239 .init_hook = alc883_mitac_automute,
8241 [ALC883_FUJITSU_PI2515] = {
8242 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8243 .init_verbs = { alc883_init_verbs,
8244 alc883_2ch_fujitsu_pi2515_verbs},
8245 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8246 .dac_nids = alc883_dac_nids,
8247 .dig_out_nid = ALC883_DIGOUT_NID,
8248 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8249 .channel_mode = alc883_3ST_2ch_modes,
8250 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8251 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8252 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8258 * BIOS auto configuration
8260 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8261 hda_nid_t nid, int pin_type,
8265 struct alc_spec *spec = codec->spec;
8268 alc_set_pin_output(codec, nid, pin_type);
8269 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8272 idx = spec->multiout.dac_nids[dac_idx] - 2;
8273 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8277 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8279 struct alc_spec *spec = codec->spec;
8282 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8283 for (i = 0; i <= HDA_SIDE; i++) {
8284 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8285 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8287 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8292 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8294 struct alc_spec *spec = codec->spec;
8297 pin = spec->autocfg.hp_pins[0];
8298 if (pin) /* connect to front */
8300 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8301 pin = spec->autocfg.speaker_pins[0];
8303 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8306 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8307 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8309 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8311 struct alc_spec *spec = codec->spec;
8314 for (i = 0; i < AUTO_PIN_LAST; i++) {
8315 hda_nid_t nid = spec->autocfg.input_pins[i];
8316 if (alc883_is_input_pin(nid)) {
8317 snd_hda_codec_write(codec, nid, 0,
8318 AC_VERB_SET_PIN_WIDGET_CONTROL,
8319 (i <= AUTO_PIN_FRONT_MIC ?
8320 PIN_VREF80 : PIN_IN));
8321 if (nid != ALC883_PIN_CD_NID)
8322 snd_hda_codec_write(codec, nid, 0,
8323 AC_VERB_SET_AMP_GAIN_MUTE,
8329 #define alc883_auto_init_input_src alc882_auto_init_input_src
8331 /* almost identical with ALC880 parser... */
8332 static int alc883_parse_auto_config(struct hda_codec *codec)
8334 struct alc_spec *spec = codec->spec;
8335 int err = alc880_parse_auto_config(codec);
8340 return 0; /* no config found */
8342 err = alc_auto_add_mic_boost(codec);
8346 /* hack - override the init verbs */
8347 spec->init_verbs[0] = alc883_auto_init_verbs;
8348 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8351 return 1; /* config found */
8354 /* additional initialization for auto-configuration model */
8355 static void alc883_auto_init(struct hda_codec *codec)
8357 struct alc_spec *spec = codec->spec;
8358 alc883_auto_init_multi_out(codec);
8359 alc883_auto_init_hp_out(codec);
8360 alc883_auto_init_analog_input(codec);
8361 alc883_auto_init_input_src(codec);
8362 if (spec->unsol_event)
8363 alc_sku_automute(codec);
8366 static int patch_alc883(struct hda_codec *codec)
8368 struct alc_spec *spec;
8369 int err, board_config;
8371 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8377 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8379 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8382 if (board_config < 0) {
8383 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8384 "trying auto-probe from BIOS...\n");
8385 board_config = ALC883_AUTO;
8388 if (board_config == ALC883_AUTO) {
8389 /* automatic parse from the BIOS config */
8390 err = alc883_parse_auto_config(codec);
8396 "hda_codec: Cannot set up configuration "
8397 "from BIOS. Using base mode...\n");
8398 board_config = ALC883_3ST_2ch_DIG;
8402 if (board_config != ALC883_AUTO)
8403 setup_preset(spec, &alc883_presets[board_config]);
8405 switch (codec->vendor_id) {
8407 spec->stream_name_analog = "ALC888 Analog";
8408 spec->stream_name_digital = "ALC888 Digital";
8411 spec->stream_name_analog = "ALC889 Analog";
8412 spec->stream_name_digital = "ALC889 Digital";
8415 spec->stream_name_analog = "ALC883 Analog";
8416 spec->stream_name_digital = "ALC883 Digital";
8420 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8421 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8422 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8424 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8425 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8427 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8428 spec->adc_nids = alc883_adc_nids;
8429 spec->capsrc_nids = alc883_capsrc_nids;
8431 spec->vmaster_nid = 0x0c;
8433 codec->patch_ops = alc_patch_ops;
8434 if (board_config == ALC883_AUTO)
8435 spec->init_hook = alc883_auto_init;
8437 #ifdef CONFIG_SND_HDA_POWER_SAVE
8438 if (!spec->loopback.amplist)
8439 spec->loopback.amplist = alc883_loopbacks;
8449 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8450 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8452 #define alc262_dac_nids alc260_dac_nids
8453 #define alc262_adc_nids alc882_adc_nids
8454 #define alc262_adc_nids_alt alc882_adc_nids_alt
8455 #define alc262_capsrc_nids alc882_capsrc_nids
8456 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8458 #define alc262_modes alc260_modes
8459 #define alc262_capture_source alc882_capture_source
8461 static struct snd_kcontrol_new alc262_base_mixer[] = {
8462 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8463 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8464 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8465 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8466 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8467 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8470 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8471 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8472 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8473 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8474 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8475 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8476 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8478 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8479 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8483 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8484 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8485 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8486 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8487 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8488 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8489 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8492 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8493 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8494 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8495 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8496 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8497 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8498 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8499 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8503 /* update HP, line and mono-out pins according to the master switch */
8504 static void alc262_hp_master_update(struct hda_codec *codec)
8506 struct alc_spec *spec = codec->spec;
8507 int val = spec->master_sw;
8510 snd_hda_codec_write_cache(codec, 0x1b, 0,
8511 AC_VERB_SET_PIN_WIDGET_CONTROL,
8513 snd_hda_codec_write_cache(codec, 0x15, 0,
8514 AC_VERB_SET_PIN_WIDGET_CONTROL,
8516 /* mono (speaker) depending on the HP jack sense */
8517 val = val && !spec->jack_present;
8518 snd_hda_codec_write_cache(codec, 0x16, 0,
8519 AC_VERB_SET_PIN_WIDGET_CONTROL,
8523 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8525 struct alc_spec *spec = codec->spec;
8526 unsigned int presence;
8527 presence = snd_hda_codec_read(codec, 0x1b, 0,
8528 AC_VERB_GET_PIN_SENSE, 0);
8529 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8530 alc262_hp_master_update(codec);
8533 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8535 if ((res >> 26) != ALC880_HP_EVENT)
8537 alc262_hp_bpc_automute(codec);
8540 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8542 struct alc_spec *spec = codec->spec;
8543 unsigned int presence;
8544 presence = snd_hda_codec_read(codec, 0x15, 0,
8545 AC_VERB_GET_PIN_SENSE, 0);
8546 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8547 alc262_hp_master_update(codec);
8550 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8553 if ((res >> 26) != ALC880_HP_EVENT)
8555 alc262_hp_wildwest_automute(codec);
8558 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8559 struct snd_ctl_elem_value *ucontrol)
8561 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8562 struct alc_spec *spec = codec->spec;
8563 *ucontrol->value.integer.value = spec->master_sw;
8567 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8568 struct snd_ctl_elem_value *ucontrol)
8570 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8571 struct alc_spec *spec = codec->spec;
8572 int val = !!*ucontrol->value.integer.value;
8574 if (val == spec->master_sw)
8576 spec->master_sw = val;
8577 alc262_hp_master_update(codec);
8581 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8583 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8584 .name = "Master Playback Switch",
8585 .info = snd_ctl_boolean_mono_info,
8586 .get = alc262_hp_master_sw_get,
8587 .put = alc262_hp_master_sw_put,
8589 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8590 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8591 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8592 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8594 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8596 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8597 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8598 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8599 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8601 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8602 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8603 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8604 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8605 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8606 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8607 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8608 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8609 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8613 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8615 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8616 .name = "Master Playback Switch",
8617 .info = snd_ctl_boolean_mono_info,
8618 .get = alc262_hp_master_sw_get,
8619 .put = alc262_hp_master_sw_put,
8621 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8622 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8623 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8624 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8625 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8627 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8630 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8631 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8632 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8633 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8634 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8635 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8636 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8637 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8641 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8642 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8643 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8644 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8648 /* mute/unmute internal speaker according to the hp jack and mute state */
8649 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8651 struct alc_spec *spec = codec->spec;
8653 if (force || !spec->sense_updated) {
8654 unsigned int present;
8655 present = snd_hda_codec_read(codec, 0x15, 0,
8656 AC_VERB_GET_PIN_SENSE, 0);
8657 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8658 spec->sense_updated = 1;
8660 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8661 spec->jack_present ? HDA_AMP_MUTE : 0);
8664 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8667 if ((res >> 26) != ALC880_HP_EVENT)
8669 alc262_hp_t5735_automute(codec, 1);
8672 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8674 alc262_hp_t5735_automute(codec, 1);
8677 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8678 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8679 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8680 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8684 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8688 static struct hda_verb alc262_hp_t5735_verbs[] = {
8689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8692 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8696 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8697 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8698 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8699 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8700 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8701 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8702 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8706 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8707 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8708 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8709 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8711 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8712 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8714 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8715 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8716 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8720 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8727 /* bind hp and internal speaker mute (with plug check) */
8728 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8729 struct snd_ctl_elem_value *ucontrol)
8731 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8732 long *valp = ucontrol->value.integer.value;
8735 /* change hp mute */
8736 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8738 valp[0] ? 0 : HDA_AMP_MUTE);
8739 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8741 valp[1] ? 0 : HDA_AMP_MUTE);
8743 /* change speaker according to HP jack state */
8744 struct alc_spec *spec = codec->spec;
8746 if (spec->jack_present)
8747 mute = HDA_AMP_MUTE;
8749 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8751 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8752 HDA_AMP_MUTE, mute);
8757 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8758 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8760 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8761 .name = "Master Playback Switch",
8762 .info = snd_hda_mixer_amp_switch_info,
8763 .get = snd_hda_mixer_amp_switch_get,
8764 .put = alc262_sony_master_sw_put,
8765 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8769 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8770 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8774 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8775 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8776 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8777 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8780 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8781 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8785 #define alc262_capture_mixer alc882_capture_mixer
8786 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8789 * generic initialization of ADC, input mixers and output mixers
8791 static struct hda_verb alc262_init_verbs[] = {
8793 * Unmute ADC0-2 and set the default input to mic-in
8795 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8796 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8797 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8798 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8799 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8800 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8802 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8804 * Note: PASD motherboards uses the Line In 2 as the input for
8805 * front panel mic (mic 2)
8807 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8808 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8809 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8810 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8811 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8812 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8815 * Set up output mixers (0x0c - 0x0e)
8817 /* set vol=0 to output mixers */
8818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8819 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8821 /* set up input amps for analog loopback */
8822 /* Amp Indices: DAC = 0, mixer = 1 */
8823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8824 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8826 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8827 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8828 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8830 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8831 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8832 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8833 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8834 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8835 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8837 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8839 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8840 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8841 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8843 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8844 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8846 /* FIXME: use matrix-type input source selection */
8847 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8848 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8850 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8851 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8852 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8855 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8856 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8861 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8867 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8868 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8869 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8873 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8874 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8875 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8876 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8878 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8879 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8883 static struct hda_verb alc262_sony_unsol_verbs[] = {
8884 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8885 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8886 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8888 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8889 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8893 /* mute/unmute internal speaker according to the hp jack and mute state */
8894 static void alc262_hippo_automute(struct hda_codec *codec)
8896 struct alc_spec *spec = codec->spec;
8898 unsigned int present;
8900 /* need to execute and sync at first */
8901 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8902 present = snd_hda_codec_read(codec, 0x15, 0,
8903 AC_VERB_GET_PIN_SENSE, 0);
8904 spec->jack_present = (present & 0x80000000) != 0;
8905 if (spec->jack_present) {
8906 /* mute internal speaker */
8907 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8908 HDA_AMP_MUTE, HDA_AMP_MUTE);
8910 /* unmute internal speaker if necessary */
8911 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8912 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8913 HDA_AMP_MUTE, mute);
8917 /* unsolicited event for HP jack sensing */
8918 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8921 if ((res >> 26) != ALC880_HP_EVENT)
8923 alc262_hippo_automute(codec);
8926 static void alc262_hippo1_automute(struct hda_codec *codec)
8929 unsigned int present;
8931 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8932 present = snd_hda_codec_read(codec, 0x1b, 0,
8933 AC_VERB_GET_PIN_SENSE, 0);
8934 present = (present & 0x80000000) != 0;
8936 /* mute internal speaker */
8937 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8938 HDA_AMP_MUTE, HDA_AMP_MUTE);
8940 /* unmute internal speaker if necessary */
8941 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8942 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8943 HDA_AMP_MUTE, mute);
8947 /* unsolicited event for HP jack sensing */
8948 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8951 if ((res >> 26) != ALC880_HP_EVENT)
8953 alc262_hippo1_automute(codec);
8959 * 0x16 = internal speaker
8960 * 0x18 = external mic
8963 static struct snd_kcontrol_new alc262_nec_mixer[] = {
8964 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8965 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
8967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8968 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8969 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8971 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8976 static struct hda_verb alc262_nec_verbs[] = {
8977 /* Unmute Speaker */
8978 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8981 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8982 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8984 /* External mic to headphone */
8985 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8986 /* External mic to speaker */
8987 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8993 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8994 * 0x1b = port replicator headphone out
8997 #define ALC_HP_EVENT 0x37
8999 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9000 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9002 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9003 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9007 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9008 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9009 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9013 static struct hda_input_mux alc262_fujitsu_capture_source = {
9022 static struct hda_input_mux alc262_HP_capture_source = {
9026 { "Front Mic", 0x1 },
9033 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9037 { "Front Mic", 0x2 },
9043 /* mute/unmute internal speaker according to the hp jacks and mute state */
9044 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9046 struct alc_spec *spec = codec->spec;
9049 if (force || !spec->sense_updated) {
9050 unsigned int present;
9051 /* need to execute and sync at first */
9052 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9053 /* check laptop HP jack */
9054 present = snd_hda_codec_read(codec, 0x14, 0,
9055 AC_VERB_GET_PIN_SENSE, 0);
9056 /* need to execute and sync at first */
9057 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9058 /* check docking HP jack */
9059 present |= snd_hda_codec_read(codec, 0x1b, 0,
9060 AC_VERB_GET_PIN_SENSE, 0);
9061 if (present & AC_PINSENSE_PRESENCE)
9062 spec->jack_present = 1;
9064 spec->jack_present = 0;
9065 spec->sense_updated = 1;
9067 /* unmute internal speaker only if both HPs are unplugged and
9068 * master switch is on
9070 if (spec->jack_present)
9071 mute = HDA_AMP_MUTE;
9073 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9074 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9075 HDA_AMP_MUTE, mute);
9078 /* unsolicited event for HP jack sensing */
9079 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9082 if ((res >> 26) != ALC_HP_EVENT)
9084 alc262_fujitsu_automute(codec, 1);
9087 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9089 alc262_fujitsu_automute(codec, 1);
9092 /* bind volumes of both NID 0x0c and 0x0d */
9093 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9094 .ops = &snd_hda_bind_vol,
9096 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9097 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9102 /* mute/unmute internal speaker according to the hp jack and mute state */
9103 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9105 struct alc_spec *spec = codec->spec;
9108 if (force || !spec->sense_updated) {
9109 unsigned int present_int_hp;
9110 /* need to execute and sync at first */
9111 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9112 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9113 AC_VERB_GET_PIN_SENSE, 0);
9114 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9115 spec->sense_updated = 1;
9117 if (spec->jack_present) {
9118 /* mute internal speaker */
9119 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9120 HDA_AMP_MUTE, HDA_AMP_MUTE);
9121 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9122 HDA_AMP_MUTE, HDA_AMP_MUTE);
9124 /* unmute internal speaker if necessary */
9125 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9126 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9127 HDA_AMP_MUTE, mute);
9128 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9129 HDA_AMP_MUTE, mute);
9133 /* unsolicited event for HP jack sensing */
9134 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9137 if ((res >> 26) != ALC_HP_EVENT)
9139 alc262_lenovo_3000_automute(codec, 1);
9142 /* bind hp and internal speaker mute (with plug check) */
9143 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9144 struct snd_ctl_elem_value *ucontrol)
9146 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9147 long *valp = ucontrol->value.integer.value;
9150 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9152 valp ? 0 : HDA_AMP_MUTE);
9153 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9155 valp ? 0 : HDA_AMP_MUTE);
9158 alc262_fujitsu_automute(codec, 0);
9162 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9163 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9166 .name = "Master Playback Switch",
9167 .info = snd_hda_mixer_amp_switch_info,
9168 .get = snd_hda_mixer_amp_switch_get,
9169 .put = alc262_fujitsu_master_sw_put,
9170 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9172 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9173 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9174 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9175 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9176 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9179 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9180 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9181 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9185 /* bind hp and internal speaker mute (with plug check) */
9186 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9187 struct snd_ctl_elem_value *ucontrol)
9189 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9190 long *valp = ucontrol->value.integer.value;
9193 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9195 valp ? 0 : HDA_AMP_MUTE);
9198 alc262_lenovo_3000_automute(codec, 0);
9202 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9203 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9206 .name = "Master Playback Switch",
9207 .info = snd_hda_mixer_amp_switch_info,
9208 .get = snd_hda_mixer_amp_switch_get,
9209 .put = alc262_lenovo_3000_master_sw_put,
9210 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9212 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9213 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9214 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9217 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9218 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9219 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9223 /* additional init verbs for Benq laptops */
9224 static struct hda_verb alc262_EAPD_verbs[] = {
9225 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9226 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9230 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9231 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9232 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9234 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9235 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9239 /* Samsung Q1 Ultra Vista model setup */
9240 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9241 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9242 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9245 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9246 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9250 static struct hda_verb alc262_ultra_verbs[] = {
9252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9257 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9259 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9261 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9262 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9263 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9264 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9265 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9269 /* ADC, choose mic */
9270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9271 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9272 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9273 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9283 /* mute/unmute internal speaker according to the hp jack and mute state */
9284 static void alc262_ultra_automute(struct hda_codec *codec)
9286 struct alc_spec *spec = codec->spec;
9290 /* auto-mute only when HP is used as HP */
9291 if (!spec->cur_mux[0]) {
9292 unsigned int present;
9293 /* need to execute and sync at first */
9294 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9295 present = snd_hda_codec_read(codec, 0x15, 0,
9296 AC_VERB_GET_PIN_SENSE, 0);
9297 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9298 if (spec->jack_present)
9299 mute = HDA_AMP_MUTE;
9301 /* mute/unmute internal speaker */
9302 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9303 HDA_AMP_MUTE, mute);
9304 /* mute/unmute HP */
9305 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9306 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9309 /* unsolicited event for HP jack sensing */
9310 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9313 if ((res >> 26) != ALC880_HP_EVENT)
9315 alc262_ultra_automute(codec);
9318 static struct hda_input_mux alc262_ultra_capture_source = {
9322 { "Headphone", 0x7 },
9326 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9327 struct snd_ctl_elem_value *ucontrol)
9329 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9330 struct alc_spec *spec = codec->spec;
9333 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9336 /* reprogram the HP pin as mic or HP according to the input source */
9337 snd_hda_codec_write_cache(codec, 0x15, 0,
9338 AC_VERB_SET_PIN_WIDGET_CONTROL,
9339 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9340 alc262_ultra_automute(codec); /* mute/unmute HP */
9344 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9345 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9346 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9348 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9349 .name = "Capture Source",
9350 .info = alc882_mux_enum_info,
9351 .get = alc882_mux_enum_get,
9352 .put = alc262_ultra_mux_enum_put,
9357 /* add playback controls from the parsed DAC table */
9358 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9359 const struct auto_pin_cfg *cfg)
9364 spec->multiout.num_dacs = 1; /* only use one dac */
9365 spec->multiout.dac_nids = spec->private_dac_nids;
9366 spec->multiout.dac_nids[0] = 2;
9368 nid = cfg->line_out_pins[0];
9370 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9371 "Front Playback Volume",
9372 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9375 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9376 "Front Playback Switch",
9377 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9382 nid = cfg->speaker_pins[0];
9385 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9386 "Speaker Playback Volume",
9387 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9391 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9392 "Speaker Playback Switch",
9393 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9398 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9399 "Speaker Playback Switch",
9400 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9406 nid = cfg->hp_pins[0];
9408 /* spec->multiout.hp_nid = 2; */
9410 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9411 "Headphone Playback Volume",
9412 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9416 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9417 "Headphone Playback Switch",
9418 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9423 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9424 "Headphone Playback Switch",
9425 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9434 /* identical with ALC880 */
9435 #define alc262_auto_create_analog_input_ctls \
9436 alc880_auto_create_analog_input_ctls
9439 * generic initialization of ADC, input mixers and output mixers
9441 static struct hda_verb alc262_volume_init_verbs[] = {
9443 * Unmute ADC0-2 and set the default input to mic-in
9445 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9447 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9448 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9449 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9452 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9454 * Note: PASD motherboards uses the Line In 2 as the input for
9455 * front panel mic (mic 2)
9457 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9465 * Set up output mixers (0x0c - 0x0f)
9467 /* set vol=0 to output mixers */
9468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9472 /* set up input amps for analog loopback */
9473 /* Amp Indices: DAC = 0, mixer = 1 */
9474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9478 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9479 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9481 /* FIXME: use matrix-type input source selection */
9482 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9483 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9484 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9485 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9487 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9492 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9497 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9502 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9504 * Unmute ADC0-2 and set the default input to mic-in
9506 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9508 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9510 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9513 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9515 * Note: PASD motherboards uses the Line In 2 as the input for
9516 * front panel mic (mic 2)
9518 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9528 * Set up output mixers (0x0c - 0x0e)
9530 /* set vol=0 to output mixers */
9531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9532 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9533 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9535 /* set up input amps for analog loopback */
9536 /* Amp Indices: DAC = 0, mixer = 1 */
9537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9539 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9540 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9544 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9546 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9548 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9551 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9552 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9554 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9556 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9557 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9558 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9561 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9562 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9563 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9564 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9565 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9568 /* FIXME: use matrix-type input source selection */
9569 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9570 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9577 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9583 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9584 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9586 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9591 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9593 * Unmute ADC0-2 and set the default input to mic-in
9595 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9597 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9598 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9599 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9602 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9604 * Note: PASD motherboards uses the Line In 2 as the input for front
9607 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9617 * Set up output mixers (0x0c - 0x0e)
9619 /* set vol=0 to output mixers */
9620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9624 /* set up input amps for analog loopback */
9625 /* Amp Indices: DAC = 0, mixer = 1 */
9626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9635 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9636 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9637 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9638 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9639 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9640 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9642 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9645 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9646 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9648 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9649 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9650 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9651 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9652 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9653 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9655 /* FIXME: use matrix-type input source selection */
9656 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9657 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9663 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9671 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9672 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9676 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9678 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9679 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9682 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9687 #ifdef CONFIG_SND_HDA_POWER_SAVE
9688 #define alc262_loopbacks alc880_loopbacks
9691 /* pcm configuration: identiacal with ALC880 */
9692 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9693 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9694 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9695 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9698 * BIOS auto configuration
9700 static int alc262_parse_auto_config(struct hda_codec *codec)
9702 struct alc_spec *spec = codec->spec;
9704 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9706 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9710 if (!spec->autocfg.line_outs)
9711 return 0; /* can't find valid BIOS pin config */
9712 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9715 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9719 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9721 if (spec->autocfg.dig_out_pin)
9722 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9723 if (spec->autocfg.dig_in_pin)
9724 spec->dig_in_nid = ALC262_DIGIN_NID;
9726 if (spec->kctl_alloc)
9727 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9729 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9730 spec->num_mux_defs = 1;
9731 spec->input_mux = &spec->private_imux;
9733 err = alc_auto_add_mic_boost(codec);
9740 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9741 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9742 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9743 #define alc262_auto_init_input_src alc882_auto_init_input_src
9746 /* init callback for auto-configuration model -- overriding the default init */
9747 static void alc262_auto_init(struct hda_codec *codec)
9749 struct alc_spec *spec = codec->spec;
9750 alc262_auto_init_multi_out(codec);
9751 alc262_auto_init_hp_out(codec);
9752 alc262_auto_init_analog_input(codec);
9753 alc262_auto_init_input_src(codec);
9754 if (spec->unsol_event)
9755 alc_sku_automute(codec);
9759 * configuration and preset
9761 static const char *alc262_models[ALC262_MODEL_LAST] = {
9762 [ALC262_BASIC] = "basic",
9763 [ALC262_HIPPO] = "hippo",
9764 [ALC262_HIPPO_1] = "hippo_1",
9765 [ALC262_FUJITSU] = "fujitsu",
9766 [ALC262_HP_BPC] = "hp-bpc",
9767 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9768 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9769 [ALC262_HP_RP5700] = "hp-rp5700",
9770 [ALC262_BENQ_ED8] = "benq",
9771 [ALC262_BENQ_T31] = "benq-t31",
9772 [ALC262_SONY_ASSAMD] = "sony-assamd",
9773 [ALC262_ULTRA] = "ultra",
9774 [ALC262_LENOVO_3000] = "lenovo-3000",
9775 [ALC262_NEC] = "nec",
9776 [ALC262_AUTO] = "auto",
9779 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9780 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9781 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
9782 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9783 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9784 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9785 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9786 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9787 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9788 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9789 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9790 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9791 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9792 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9793 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9794 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9795 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9796 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9797 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9798 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9799 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9800 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9801 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9802 ALC262_HP_TC_T5735),
9803 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9804 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9805 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9806 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9807 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9808 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9809 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9810 ALC262_SONY_ASSAMD),
9811 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9812 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9813 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9814 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9815 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9816 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9817 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9818 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9822 static struct alc_config_preset alc262_presets[] = {
9824 .mixers = { alc262_base_mixer },
9825 .init_verbs = { alc262_init_verbs },
9826 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9827 .dac_nids = alc262_dac_nids,
9829 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9830 .channel_mode = alc262_modes,
9831 .input_mux = &alc262_capture_source,
9834 .mixers = { alc262_base_mixer },
9835 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9836 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9837 .dac_nids = alc262_dac_nids,
9839 .dig_out_nid = ALC262_DIGOUT_NID,
9840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9841 .channel_mode = alc262_modes,
9842 .input_mux = &alc262_capture_source,
9843 .unsol_event = alc262_hippo_unsol_event,
9844 .init_hook = alc262_hippo_automute,
9846 [ALC262_HIPPO_1] = {
9847 .mixers = { alc262_hippo1_mixer },
9848 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9849 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9850 .dac_nids = alc262_dac_nids,
9852 .dig_out_nid = ALC262_DIGOUT_NID,
9853 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9854 .channel_mode = alc262_modes,
9855 .input_mux = &alc262_capture_source,
9856 .unsol_event = alc262_hippo1_unsol_event,
9857 .init_hook = alc262_hippo1_automute,
9859 [ALC262_FUJITSU] = {
9860 .mixers = { alc262_fujitsu_mixer },
9861 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9862 alc262_fujitsu_unsol_verbs },
9863 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9864 .dac_nids = alc262_dac_nids,
9866 .dig_out_nid = ALC262_DIGOUT_NID,
9867 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9868 .channel_mode = alc262_modes,
9869 .input_mux = &alc262_fujitsu_capture_source,
9870 .unsol_event = alc262_fujitsu_unsol_event,
9871 .init_hook = alc262_fujitsu_init_hook,
9874 .mixers = { alc262_HP_BPC_mixer },
9875 .init_verbs = { alc262_HP_BPC_init_verbs },
9876 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9877 .dac_nids = alc262_dac_nids,
9879 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9880 .channel_mode = alc262_modes,
9881 .input_mux = &alc262_HP_capture_source,
9882 .unsol_event = alc262_hp_bpc_unsol_event,
9883 .init_hook = alc262_hp_bpc_automute,
9885 [ALC262_HP_BPC_D7000_WF] = {
9886 .mixers = { alc262_HP_BPC_WildWest_mixer },
9887 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9888 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9889 .dac_nids = alc262_dac_nids,
9891 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9892 .channel_mode = alc262_modes,
9893 .input_mux = &alc262_HP_D7000_capture_source,
9894 .unsol_event = alc262_hp_wildwest_unsol_event,
9895 .init_hook = alc262_hp_wildwest_automute,
9897 [ALC262_HP_BPC_D7000_WL] = {
9898 .mixers = { alc262_HP_BPC_WildWest_mixer,
9899 alc262_HP_BPC_WildWest_option_mixer },
9900 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9901 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9902 .dac_nids = alc262_dac_nids,
9904 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9905 .channel_mode = alc262_modes,
9906 .input_mux = &alc262_HP_D7000_capture_source,
9907 .unsol_event = alc262_hp_wildwest_unsol_event,
9908 .init_hook = alc262_hp_wildwest_automute,
9910 [ALC262_HP_TC_T5735] = {
9911 .mixers = { alc262_hp_t5735_mixer },
9912 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9913 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9914 .dac_nids = alc262_dac_nids,
9916 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9917 .channel_mode = alc262_modes,
9918 .input_mux = &alc262_capture_source,
9919 .unsol_event = alc262_hp_t5735_unsol_event,
9920 .init_hook = alc262_hp_t5735_init_hook,
9922 [ALC262_HP_RP5700] = {
9923 .mixers = { alc262_hp_rp5700_mixer },
9924 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9925 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9926 .dac_nids = alc262_dac_nids,
9927 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9928 .channel_mode = alc262_modes,
9929 .input_mux = &alc262_hp_rp5700_capture_source,
9931 [ALC262_BENQ_ED8] = {
9932 .mixers = { alc262_base_mixer },
9933 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9934 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9935 .dac_nids = alc262_dac_nids,
9937 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9938 .channel_mode = alc262_modes,
9939 .input_mux = &alc262_capture_source,
9941 [ALC262_SONY_ASSAMD] = {
9942 .mixers = { alc262_sony_mixer },
9943 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9944 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9945 .dac_nids = alc262_dac_nids,
9947 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9948 .channel_mode = alc262_modes,
9949 .input_mux = &alc262_capture_source,
9950 .unsol_event = alc262_hippo_unsol_event,
9951 .init_hook = alc262_hippo_automute,
9953 [ALC262_BENQ_T31] = {
9954 .mixers = { alc262_benq_t31_mixer },
9955 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9956 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9957 .dac_nids = alc262_dac_nids,
9959 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9960 .channel_mode = alc262_modes,
9961 .input_mux = &alc262_capture_source,
9962 .unsol_event = alc262_hippo_unsol_event,
9963 .init_hook = alc262_hippo_automute,
9966 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9967 .init_verbs = { alc262_ultra_verbs },
9968 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9969 .dac_nids = alc262_dac_nids,
9970 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9971 .channel_mode = alc262_modes,
9972 .input_mux = &alc262_ultra_capture_source,
9973 .adc_nids = alc262_adc_nids, /* ADC0 */
9974 .capsrc_nids = alc262_capsrc_nids,
9975 .num_adc_nids = 1, /* single ADC */
9976 .unsol_event = alc262_ultra_unsol_event,
9977 .init_hook = alc262_ultra_automute,
9979 [ALC262_LENOVO_3000] = {
9980 .mixers = { alc262_lenovo_3000_mixer },
9981 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9982 alc262_lenovo_3000_unsol_verbs },
9983 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9984 .dac_nids = alc262_dac_nids,
9986 .dig_out_nid = ALC262_DIGOUT_NID,
9987 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9988 .channel_mode = alc262_modes,
9989 .input_mux = &alc262_fujitsu_capture_source,
9990 .unsol_event = alc262_lenovo_3000_unsol_event,
9993 .mixers = { alc262_nec_mixer },
9994 .init_verbs = { alc262_nec_verbs },
9995 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9996 .dac_nids = alc262_dac_nids,
9998 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9999 .channel_mode = alc262_modes,
10000 .input_mux = &alc262_capture_source,
10004 static int patch_alc262(struct hda_codec *codec)
10006 struct alc_spec *spec;
10010 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10014 codec->spec = spec;
10016 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10021 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10022 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10023 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10024 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10028 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10030 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10034 if (board_config < 0) {
10035 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10036 "trying auto-probe from BIOS...\n");
10037 board_config = ALC262_AUTO;
10040 if (board_config == ALC262_AUTO) {
10041 /* automatic parse from the BIOS config */
10042 err = alc262_parse_auto_config(codec);
10048 "hda_codec: Cannot set up configuration "
10049 "from BIOS. Using base mode...\n");
10050 board_config = ALC262_BASIC;
10054 if (board_config != ALC262_AUTO)
10055 setup_preset(spec, &alc262_presets[board_config]);
10057 spec->stream_name_analog = "ALC262 Analog";
10058 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10059 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10061 spec->stream_name_digital = "ALC262 Digital";
10062 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10063 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10065 if (!spec->adc_nids && spec->input_mux) {
10066 /* check whether NID 0x07 is valid */
10067 unsigned int wcap = get_wcaps(codec, 0x07);
10070 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10071 if (wcap != AC_WID_AUD_IN) {
10072 spec->adc_nids = alc262_adc_nids_alt;
10073 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10074 spec->capsrc_nids = alc262_capsrc_nids_alt;
10075 spec->mixers[spec->num_mixers] =
10076 alc262_capture_alt_mixer;
10077 spec->num_mixers++;
10079 spec->adc_nids = alc262_adc_nids;
10080 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10081 spec->capsrc_nids = alc262_capsrc_nids;
10082 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
10083 spec->num_mixers++;
10087 spec->vmaster_nid = 0x0c;
10089 codec->patch_ops = alc_patch_ops;
10090 if (board_config == ALC262_AUTO)
10091 spec->init_hook = alc262_auto_init;
10092 #ifdef CONFIG_SND_HDA_POWER_SAVE
10093 if (!spec->loopback.amplist)
10094 spec->loopback.amplist = alc262_loopbacks;
10101 * ALC268 channel source setting (2 channel)
10103 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10104 #define alc268_modes alc260_modes
10106 static hda_nid_t alc268_dac_nids[2] = {
10111 static hda_nid_t alc268_adc_nids[2] = {
10116 static hda_nid_t alc268_adc_nids_alt[1] = {
10121 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10123 static struct snd_kcontrol_new alc268_base_mixer[] = {
10124 /* output mixer control */
10125 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10126 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10127 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10129 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10130 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10131 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10135 /* bind Beep switches of both NID 0x0f and 0x10 */
10136 static struct hda_bind_ctls alc268_bind_beep_sw = {
10137 .ops = &snd_hda_bind_sw,
10139 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10140 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10145 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10146 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10147 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10151 static struct hda_verb alc268_eapd_verbs[] = {
10152 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10153 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10157 /* Toshiba specific */
10158 #define alc268_toshiba_automute alc262_hippo_automute
10160 static struct hda_verb alc268_toshiba_verbs[] = {
10161 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10165 /* Acer specific */
10166 /* bind volumes of both NID 0x02 and 0x03 */
10167 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10168 .ops = &snd_hda_bind_vol,
10170 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10171 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10176 /* mute/unmute internal speaker according to the hp jack and mute state */
10177 static void alc268_acer_automute(struct hda_codec *codec, int force)
10179 struct alc_spec *spec = codec->spec;
10182 if (force || !spec->sense_updated) {
10183 unsigned int present;
10184 present = snd_hda_codec_read(codec, 0x14, 0,
10185 AC_VERB_GET_PIN_SENSE, 0);
10186 spec->jack_present = (present & 0x80000000) != 0;
10187 spec->sense_updated = 1;
10189 if (spec->jack_present)
10190 mute = HDA_AMP_MUTE; /* mute internal speaker */
10191 else /* unmute internal speaker if necessary */
10192 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10193 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10194 HDA_AMP_MUTE, mute);
10198 /* bind hp and internal speaker mute (with plug check) */
10199 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10200 struct snd_ctl_elem_value *ucontrol)
10202 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10203 long *valp = ucontrol->value.integer.value;
10206 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10208 valp[0] ? 0 : HDA_AMP_MUTE);
10209 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10211 valp[1] ? 0 : HDA_AMP_MUTE);
10213 alc268_acer_automute(codec, 0);
10217 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10218 /* output mixer control */
10219 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10222 .name = "Master Playback Switch",
10223 .info = snd_hda_mixer_amp_switch_info,
10224 .get = snd_hda_mixer_amp_switch_get,
10225 .put = alc268_acer_master_sw_put,
10226 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10228 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10229 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10230 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10234 static struct hda_verb alc268_acer_verbs[] = {
10235 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10236 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10238 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10239 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10240 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10241 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10245 /* unsolicited event for HP jack sensing */
10246 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10249 if ((res >> 26) != ALC880_HP_EVENT)
10251 alc268_toshiba_automute(codec);
10254 static void alc268_acer_unsol_event(struct hda_codec *codec,
10257 if ((res >> 26) != ALC880_HP_EVENT)
10259 alc268_acer_automute(codec, 1);
10262 static void alc268_acer_init_hook(struct hda_codec *codec)
10264 alc268_acer_automute(codec, 1);
10267 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10268 /* output mixer control */
10269 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10270 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10271 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10274 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10278 static struct hda_verb alc268_dell_verbs[] = {
10279 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10281 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10285 /* mute/unmute internal speaker according to the hp jack and mute state */
10286 static void alc268_dell_automute(struct hda_codec *codec)
10288 unsigned int present;
10291 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10292 if (present & 0x80000000)
10293 mute = HDA_AMP_MUTE;
10295 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10296 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10297 HDA_AMP_MUTE, mute);
10300 static void alc268_dell_unsol_event(struct hda_codec *codec,
10303 if ((res >> 26) != ALC880_HP_EVENT)
10305 alc268_dell_automute(codec);
10308 #define alc268_dell_init_hook alc268_dell_automute
10310 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10311 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10312 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10313 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10315 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10316 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10317 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10318 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10322 static struct hda_verb alc267_quanta_il1_verbs[] = {
10323 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10324 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10328 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10330 unsigned int present;
10332 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10333 & AC_PINSENSE_PRESENCE;
10334 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10335 present ? 0 : PIN_OUT);
10338 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10340 unsigned int present;
10342 present = snd_hda_codec_read(codec, 0x18, 0,
10343 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10344 snd_hda_codec_write(codec, 0x23, 0,
10345 AC_VERB_SET_CONNECT_SEL,
10346 present ? 0x00 : 0x01);
10349 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10351 alc267_quanta_il1_hp_automute(codec);
10352 alc267_quanta_il1_mic_automute(codec);
10355 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10358 switch (res >> 26) {
10359 case ALC880_HP_EVENT:
10360 alc267_quanta_il1_hp_automute(codec);
10362 case ALC880_MIC_EVENT:
10363 alc267_quanta_il1_mic_automute(codec);
10369 * generic initialization of ADC, input mixers and output mixers
10371 static struct hda_verb alc268_base_init_verbs[] = {
10372 /* Unmute DAC0-1 and set vol = 0 */
10373 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10374 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10375 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10376 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10377 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10378 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10381 * Set up output mixers (0x0c - 0x0e)
10383 /* set vol=0 to output mixers */
10384 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10387 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10390 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10392 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10394 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10395 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10396 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10397 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10398 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10399 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10401 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10403 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10404 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10405 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10407 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10409 /* set PCBEEP vol = 0, mute connections */
10410 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10412 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10414 /* Unmute Selector 23h,24h and set the default input to mic-in */
10416 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10418 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10425 * generic initialization of ADC, input mixers and output mixers
10427 static struct hda_verb alc268_volume_init_verbs[] = {
10428 /* set output DAC */
10429 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10430 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10431 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10432 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10435 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10436 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10437 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10438 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10441 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10442 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10443 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10444 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10446 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10447 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10448 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10449 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10451 /* set PCBEEP vol = 0, mute connections */
10452 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10454 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10459 #define alc268_mux_enum_info alc_mux_enum_info
10460 #define alc268_mux_enum_get alc_mux_enum_get
10461 #define alc268_mux_enum_put alc_mux_enum_put
10463 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10464 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10465 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10468 /* The multiple "Capture Source" controls confuse alsamixer
10469 * So call somewhat different..
10471 /* .name = "Capture Source", */
10472 .name = "Input Source",
10474 .info = alc268_mux_enum_info,
10475 .get = alc268_mux_enum_get,
10476 .put = alc268_mux_enum_put,
10481 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10482 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10483 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10484 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10485 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10487 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10488 /* The multiple "Capture Source" controls confuse alsamixer
10489 * So call somewhat different..
10491 /* .name = "Capture Source", */
10492 .name = "Input Source",
10494 .info = alc268_mux_enum_info,
10495 .get = alc268_mux_enum_get,
10496 .put = alc268_mux_enum_put,
10501 static struct hda_input_mux alc268_capture_source = {
10505 { "Front Mic", 0x1 },
10511 static struct hda_input_mux alc268_acer_capture_source = {
10515 { "Internal Mic", 0x6 },
10520 #ifdef CONFIG_SND_DEBUG
10521 static struct snd_kcontrol_new alc268_test_mixer[] = {
10522 /* Volume widgets */
10523 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10524 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10525 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10526 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10527 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10528 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10529 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10530 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10531 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10532 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10533 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10534 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10535 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10536 /* The below appears problematic on some hardwares */
10537 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10538 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10539 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10540 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10541 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10543 /* Modes for retasking pin widgets */
10544 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10545 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10546 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10547 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10549 /* Controls for GPIO pins, assuming they are configured as outputs */
10550 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10551 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10552 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10553 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10555 /* Switches to allow the digital SPDIF output pin to be enabled.
10556 * The ALC268 does not have an SPDIF input.
10558 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10560 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10561 * this output to turn on an external amplifier.
10563 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10564 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10570 /* create input playback/capture controls for the given pin */
10571 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10572 const char *ctlname, int idx)
10577 sprintf(name, "%s Playback Volume", ctlname);
10579 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10580 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10584 } else if (nid == 0x15) {
10585 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10586 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10592 sprintf(name, "%s Playback Switch", ctlname);
10593 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10594 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10600 /* add playback controls from the parsed DAC table */
10601 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10602 const struct auto_pin_cfg *cfg)
10607 spec->multiout.num_dacs = 2; /* only use one dac */
10608 spec->multiout.dac_nids = spec->private_dac_nids;
10609 spec->multiout.dac_nids[0] = 2;
10610 spec->multiout.dac_nids[1] = 3;
10612 nid = cfg->line_out_pins[0];
10614 alc268_new_analog_output(spec, nid, "Front", 0);
10616 nid = cfg->speaker_pins[0];
10618 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10619 "Speaker Playback Volume",
10620 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10624 nid = cfg->hp_pins[0];
10626 alc268_new_analog_output(spec, nid, "Headphone", 0);
10628 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10630 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10631 "Mono Playback Switch",
10632 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10639 /* create playback/capture controls for input pins */
10640 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10641 const struct auto_pin_cfg *cfg)
10643 struct hda_input_mux *imux = &spec->private_imux;
10646 for (i = 0; i < AUTO_PIN_LAST; i++) {
10647 switch(cfg->input_pins[i]) {
10649 idx1 = 0; /* Mic 1 */
10652 idx1 = 1; /* Mic 2 */
10655 idx1 = 2; /* Line In */
10662 idx1 = 6; /* digital mics */
10667 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10668 imux->items[imux->num_items].index = idx1;
10674 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10676 struct alc_spec *spec = codec->spec;
10677 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10678 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10679 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10680 unsigned int dac_vol1, dac_vol2;
10683 snd_hda_codec_write(codec, speaker_nid, 0,
10684 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10685 snd_hda_codec_write(codec, 0x0f, 0,
10686 AC_VERB_SET_AMP_GAIN_MUTE,
10688 snd_hda_codec_write(codec, 0x10, 0,
10689 AC_VERB_SET_AMP_GAIN_MUTE,
10692 snd_hda_codec_write(codec, 0x0f, 0,
10693 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10694 snd_hda_codec_write(codec, 0x10, 0,
10695 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10698 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10699 if (line_nid == 0x14)
10700 dac_vol2 = AMP_OUT_ZERO;
10701 else if (line_nid == 0x15)
10702 dac_vol1 = AMP_OUT_ZERO;
10703 if (hp_nid == 0x14)
10704 dac_vol2 = AMP_OUT_ZERO;
10705 else if (hp_nid == 0x15)
10706 dac_vol1 = AMP_OUT_ZERO;
10707 if (line_nid != 0x16 || hp_nid != 0x16 ||
10708 spec->autocfg.line_out_pins[1] != 0x16 ||
10709 spec->autocfg.line_out_pins[2] != 0x16)
10710 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10712 snd_hda_codec_write(codec, 0x02, 0,
10713 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10714 snd_hda_codec_write(codec, 0x03, 0,
10715 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10718 /* pcm configuration: identiacal with ALC880 */
10719 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10720 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10721 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10722 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10725 * BIOS auto configuration
10727 static int alc268_parse_auto_config(struct hda_codec *codec)
10729 struct alc_spec *spec = codec->spec;
10731 static hda_nid_t alc268_ignore[] = { 0 };
10733 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10737 if (!spec->autocfg.line_outs)
10738 return 0; /* can't find valid BIOS pin config */
10740 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10743 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10747 spec->multiout.max_channels = 2;
10749 /* digital only support output */
10750 if (spec->autocfg.dig_out_pin)
10751 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10753 if (spec->kctl_alloc)
10754 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10756 if (spec->autocfg.speaker_pins[0] != 0x1d)
10757 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10759 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10760 spec->num_mux_defs = 1;
10761 spec->input_mux = &spec->private_imux;
10763 err = alc_auto_add_mic_boost(codec);
10770 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10771 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10772 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10774 /* init callback for auto-configuration model -- overriding the default init */
10775 static void alc268_auto_init(struct hda_codec *codec)
10777 struct alc_spec *spec = codec->spec;
10778 alc268_auto_init_multi_out(codec);
10779 alc268_auto_init_hp_out(codec);
10780 alc268_auto_init_mono_speaker_out(codec);
10781 alc268_auto_init_analog_input(codec);
10782 if (spec->unsol_event)
10783 alc_sku_automute(codec);
10787 * configuration and preset
10789 static const char *alc268_models[ALC268_MODEL_LAST] = {
10790 [ALC267_QUANTA_IL1] = "quanta-il1",
10791 [ALC268_3ST] = "3stack",
10792 [ALC268_TOSHIBA] = "toshiba",
10793 [ALC268_ACER] = "acer",
10794 [ALC268_DELL] = "dell",
10795 [ALC268_ZEPTO] = "zepto",
10796 #ifdef CONFIG_SND_DEBUG
10797 [ALC268_TEST] = "test",
10799 [ALC268_AUTO] = "auto",
10802 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10803 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10804 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10805 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10806 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10807 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10808 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10809 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10810 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10811 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10812 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10813 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10814 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10815 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10816 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10820 static struct alc_config_preset alc268_presets[] = {
10821 [ALC267_QUANTA_IL1] = {
10822 .mixers = { alc267_quanta_il1_mixer },
10823 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10824 alc267_quanta_il1_verbs },
10825 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10826 .dac_nids = alc268_dac_nids,
10827 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10828 .adc_nids = alc268_adc_nids_alt,
10830 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10831 .channel_mode = alc268_modes,
10832 .input_mux = &alc268_capture_source,
10833 .unsol_event = alc267_quanta_il1_unsol_event,
10834 .init_hook = alc267_quanta_il1_automute,
10837 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10838 alc268_beep_mixer },
10839 .init_verbs = { alc268_base_init_verbs },
10840 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10841 .dac_nids = alc268_dac_nids,
10842 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10843 .adc_nids = alc268_adc_nids_alt,
10844 .capsrc_nids = alc268_capsrc_nids,
10846 .dig_out_nid = ALC268_DIGOUT_NID,
10847 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10848 .channel_mode = alc268_modes,
10849 .input_mux = &alc268_capture_source,
10851 [ALC268_TOSHIBA] = {
10852 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10853 alc268_beep_mixer },
10854 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10855 alc268_toshiba_verbs },
10856 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10857 .dac_nids = alc268_dac_nids,
10858 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10859 .adc_nids = alc268_adc_nids_alt,
10860 .capsrc_nids = alc268_capsrc_nids,
10862 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10863 .channel_mode = alc268_modes,
10864 .input_mux = &alc268_capture_source,
10865 .unsol_event = alc268_toshiba_unsol_event,
10866 .init_hook = alc268_toshiba_automute,
10869 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10870 alc268_beep_mixer },
10871 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10872 alc268_acer_verbs },
10873 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10874 .dac_nids = alc268_dac_nids,
10875 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10876 .adc_nids = alc268_adc_nids_alt,
10877 .capsrc_nids = alc268_capsrc_nids,
10879 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10880 .channel_mode = alc268_modes,
10881 .input_mux = &alc268_acer_capture_source,
10882 .unsol_event = alc268_acer_unsol_event,
10883 .init_hook = alc268_acer_init_hook,
10886 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10887 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10888 alc268_dell_verbs },
10889 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10890 .dac_nids = alc268_dac_nids,
10892 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10893 .channel_mode = alc268_modes,
10894 .unsol_event = alc268_dell_unsol_event,
10895 .init_hook = alc268_dell_init_hook,
10896 .input_mux = &alc268_capture_source,
10899 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10900 alc268_beep_mixer },
10901 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10902 alc268_toshiba_verbs },
10903 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10904 .dac_nids = alc268_dac_nids,
10905 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10906 .adc_nids = alc268_adc_nids_alt,
10907 .capsrc_nids = alc268_capsrc_nids,
10909 .dig_out_nid = ALC268_DIGOUT_NID,
10910 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10911 .channel_mode = alc268_modes,
10912 .input_mux = &alc268_capture_source,
10913 .unsol_event = alc268_toshiba_unsol_event,
10914 .init_hook = alc268_toshiba_automute
10916 #ifdef CONFIG_SND_DEBUG
10918 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10919 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10920 alc268_volume_init_verbs },
10921 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10922 .dac_nids = alc268_dac_nids,
10923 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10924 .adc_nids = alc268_adc_nids_alt,
10925 .capsrc_nids = alc268_capsrc_nids,
10927 .dig_out_nid = ALC268_DIGOUT_NID,
10928 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10929 .channel_mode = alc268_modes,
10930 .input_mux = &alc268_capture_source,
10935 static int patch_alc268(struct hda_codec *codec)
10937 struct alc_spec *spec;
10941 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10945 codec->spec = spec;
10947 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10951 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10952 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10953 "trying auto-probe from BIOS...\n");
10954 board_config = ALC268_AUTO;
10957 if (board_config == ALC268_AUTO) {
10958 /* automatic parse from the BIOS config */
10959 err = alc268_parse_auto_config(codec);
10965 "hda_codec: Cannot set up configuration "
10966 "from BIOS. Using base mode...\n");
10967 board_config = ALC268_3ST;
10971 if (board_config != ALC268_AUTO)
10972 setup_preset(spec, &alc268_presets[board_config]);
10974 if (codec->vendor_id == 0x10ec0267) {
10975 spec->stream_name_analog = "ALC267 Analog";
10976 spec->stream_name_digital = "ALC267 Digital";
10978 spec->stream_name_analog = "ALC268 Analog";
10979 spec->stream_name_digital = "ALC268 Digital";
10982 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10983 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10984 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10986 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10988 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10989 /* override the amp caps for beep generator */
10990 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10991 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10992 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10993 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10994 (0 << AC_AMPCAP_MUTE_SHIFT));
10996 if (!spec->adc_nids && spec->input_mux) {
10997 /* check whether NID 0x07 is valid */
10998 unsigned int wcap = get_wcaps(codec, 0x07);
11002 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11003 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11004 spec->adc_nids = alc268_adc_nids_alt;
11005 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11006 spec->mixers[spec->num_mixers] =
11007 alc268_capture_alt_mixer;
11008 spec->num_mixers++;
11010 spec->adc_nids = alc268_adc_nids;
11011 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11012 spec->mixers[spec->num_mixers] =
11013 alc268_capture_mixer;
11014 spec->num_mixers++;
11016 spec->capsrc_nids = alc268_capsrc_nids;
11017 /* set default input source */
11018 for (i = 0; i < spec->num_adc_nids; i++)
11019 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11020 0, AC_VERB_SET_CONNECT_SEL,
11021 spec->input_mux->items[0].index);
11024 spec->vmaster_nid = 0x02;
11026 codec->patch_ops = alc_patch_ops;
11027 if (board_config == ALC268_AUTO)
11028 spec->init_hook = alc268_auto_init;
11034 * ALC269 channel source setting (2 channel)
11036 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11038 #define alc269_dac_nids alc260_dac_nids
11040 static hda_nid_t alc269_adc_nids[1] = {
11045 static hda_nid_t alc269_capsrc_nids[1] = {
11049 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11053 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11061 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11069 #define alc269_modes alc260_modes
11070 #define alc269_capture_source alc880_lg_lw_capture_source
11072 static struct snd_kcontrol_new alc269_base_mixer[] = {
11073 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11074 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11075 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11076 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11077 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11078 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11079 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11080 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11082 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11083 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11084 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11085 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11086 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11090 /* bind volumes of both NID 0x0c and 0x0d */
11091 static struct hda_bind_ctls alc269_epc_bind_vol = {
11092 .ops = &snd_hda_bind_vol,
11094 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11095 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11100 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11101 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11102 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11103 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11107 /* capture mixer elements */
11108 static struct snd_kcontrol_new alc269_capture_mixer[] = {
11109 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11110 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11112 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11113 /* The multiple "Capture Source" controls confuse alsamixer
11114 * So call somewhat different..
11116 /* .name = "Capture Source", */
11117 .name = "Input Source",
11119 .info = alc_mux_enum_info,
11120 .get = alc_mux_enum_get,
11121 .put = alc_mux_enum_put,
11126 /* capture mixer elements */
11127 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11128 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11129 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11134 static struct snd_kcontrol_new alc269_beep_mixer[] = {
11135 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11136 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11141 * generic initialization of ADC, input mixers and output mixers
11143 static struct hda_verb alc269_init_verbs[] = {
11145 * Unmute ADC0 and set the default input to mic-in
11147 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11149 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11150 * analog-loopback mixer widget
11151 * Note: PASD motherboards uses the Line In 2 as the input for
11152 * front panel mic (mic 2)
11154 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11159 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11162 * Set up output mixers (0x0c - 0x0e)
11164 /* set vol=0 to output mixers */
11165 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11166 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11168 /* set up input amps for analog loopback */
11169 /* Amp Indices: DAC = 0, mixer = 1 */
11170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11171 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11173 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11174 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11175 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11179 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11180 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11181 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11183 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11185 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11187 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11191 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11193 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11194 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11196 /* FIXME: use matrix-type input source selection */
11197 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11198 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11201 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11202 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11205 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11206 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11210 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11212 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
11213 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11214 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
11215 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11216 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11217 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11221 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11222 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11223 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
11224 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11225 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
11226 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11227 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11231 /* toggle speaker-output according to the hp-jack state */
11232 static void alc269_speaker_automute(struct hda_codec *codec)
11234 unsigned int present;
11237 present = snd_hda_codec_read(codec, 0x15, 0,
11238 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11239 bits = present ? AMP_IN_MUTE(0) : 0;
11240 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11241 AMP_IN_MUTE(0), bits);
11242 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11243 AMP_IN_MUTE(0), bits);
11246 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11248 unsigned int present;
11250 present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0)
11251 & AC_PINSENSE_PRESENCE;
11252 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11256 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11258 unsigned int present;
11260 present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0)
11261 & AC_PINSENSE_PRESENCE;
11262 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11263 present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0));
11264 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11265 present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1));
11268 /* unsolicited event for HP jack sensing */
11269 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11272 if ((res >> 26) == ALC880_HP_EVENT)
11273 alc269_speaker_automute(codec);
11275 if ((res >> 26) == ALC880_MIC_EVENT)
11276 alc269_eeepc_dmic_automute(codec);
11279 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11281 alc269_speaker_automute(codec);
11282 alc269_eeepc_dmic_automute(codec);
11285 /* unsolicited event for HP jack sensing */
11286 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
11289 if ((res >> 26) == ALC880_HP_EVENT)
11290 alc269_speaker_automute(codec);
11292 if ((res >> 26) == ALC880_MIC_EVENT)
11293 alc269_eeepc_amic_automute(codec);
11296 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
11298 alc269_speaker_automute(codec);
11299 alc269_eeepc_amic_automute(codec);
11302 /* add playback controls from the parsed DAC table */
11303 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11304 const struct auto_pin_cfg *cfg)
11309 spec->multiout.num_dacs = 1; /* only use one dac */
11310 spec->multiout.dac_nids = spec->private_dac_nids;
11311 spec->multiout.dac_nids[0] = 2;
11313 nid = cfg->line_out_pins[0];
11315 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11316 "Front Playback Volume",
11317 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
11320 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11321 "Front Playback Switch",
11322 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11327 nid = cfg->speaker_pins[0];
11329 if (!cfg->line_out_pins[0]) {
11330 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11331 "Speaker Playback Volume",
11332 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11338 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11339 "Speaker Playback Switch",
11340 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11345 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11346 "Speaker Playback Switch",
11347 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11353 nid = cfg->hp_pins[0];
11355 /* spec->multiout.hp_nid = 2; */
11356 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
11357 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11358 "Headphone Playback Volume",
11359 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11365 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11366 "Headphone Playback Switch",
11367 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11372 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11373 "Headphone Playback Switch",
11374 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11383 #define alc269_auto_create_analog_input_ctls \
11384 alc880_auto_create_analog_input_ctls
11386 #ifdef CONFIG_SND_HDA_POWER_SAVE
11387 #define alc269_loopbacks alc880_loopbacks
11390 /* pcm configuration: identiacal with ALC880 */
11391 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11392 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11393 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11394 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
11397 * BIOS auto configuration
11399 static int alc269_parse_auto_config(struct hda_codec *codec)
11401 struct alc_spec *spec = codec->spec;
11403 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
11405 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11410 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
11413 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
11417 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11419 if (spec->autocfg.dig_out_pin)
11420 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
11422 if (spec->kctl_alloc)
11423 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11425 /* create a beep mixer control if the pin 0x1d isn't assigned */
11426 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
11427 if (spec->autocfg.input_pins[i] == 0x1d)
11429 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
11430 spec->mixers[spec->num_mixers++] = alc269_beep_mixer;
11432 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
11433 spec->num_mux_defs = 1;
11434 spec->input_mux = &spec->private_imux;
11435 /* set default input source */
11436 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
11437 0, AC_VERB_SET_CONNECT_SEL,
11438 spec->input_mux->items[0].index);
11440 err = alc_auto_add_mic_boost(codec);
11444 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
11445 spec->num_mixers++;
11450 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11451 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11452 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11455 /* init callback for auto-configuration model -- overriding the default init */
11456 static void alc269_auto_init(struct hda_codec *codec)
11458 struct alc_spec *spec = codec->spec;
11459 alc269_auto_init_multi_out(codec);
11460 alc269_auto_init_hp_out(codec);
11461 alc269_auto_init_analog_input(codec);
11462 if (spec->unsol_event)
11463 alc_sku_automute(codec);
11467 * configuration and preset
11469 static const char *alc269_models[ALC269_MODEL_LAST] = {
11470 [ALC269_BASIC] = "basic",
11473 static struct snd_pci_quirk alc269_cfg_tbl[] = {
11474 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11475 ALC269_ASUS_EEEPC_P703),
11476 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
11477 ALC269_ASUS_EEEPC_P901),
11481 static struct alc_config_preset alc269_presets[] = {
11483 .mixers = { alc269_base_mixer, alc269_capture_mixer },
11484 .init_verbs = { alc269_init_verbs },
11485 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11486 .dac_nids = alc269_dac_nids,
11488 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11489 .channel_mode = alc269_modes,
11490 .input_mux = &alc269_capture_source,
11492 [ALC269_ASUS_EEEPC_P703] = {
11493 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer },
11494 .init_verbs = { alc269_init_verbs,
11495 alc269_eeepc_amic_init_verbs },
11496 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11497 .dac_nids = alc269_dac_nids,
11499 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11500 .channel_mode = alc269_modes,
11501 .input_mux = &alc269_eeepc_amic_capture_source,
11502 .unsol_event = alc269_eeepc_amic_unsol_event,
11503 .init_hook = alc269_eeepc_amic_inithook,
11505 [ALC269_ASUS_EEEPC_P901] = {
11506 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer},
11507 .init_verbs = { alc269_init_verbs,
11508 alc269_eeepc_dmic_init_verbs },
11509 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11510 .dac_nids = alc269_dac_nids,
11512 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11513 .channel_mode = alc269_modes,
11514 .input_mux = &alc269_eeepc_dmic_capture_source,
11515 .unsol_event = alc269_eeepc_dmic_unsol_event,
11516 .init_hook = alc269_eeepc_dmic_inithook,
11520 static int patch_alc269(struct hda_codec *codec)
11522 struct alc_spec *spec;
11526 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11530 codec->spec = spec;
11532 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11534 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
11538 if (board_config < 0) {
11539 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
11540 "trying auto-probe from BIOS...\n");
11541 board_config = ALC269_AUTO;
11544 if (board_config == ALC269_AUTO) {
11545 /* automatic parse from the BIOS config */
11546 err = alc269_parse_auto_config(codec);
11552 "hda_codec: Cannot set up configuration "
11553 "from BIOS. Using base mode...\n");
11554 board_config = ALC269_BASIC;
11558 if (board_config != ALC269_AUTO)
11559 setup_preset(spec, &alc269_presets[board_config]);
11561 spec->stream_name_analog = "ALC269 Analog";
11562 spec->stream_analog_playback = &alc269_pcm_analog_playback;
11563 spec->stream_analog_capture = &alc269_pcm_analog_capture;
11565 spec->stream_name_digital = "ALC269 Digital";
11566 spec->stream_digital_playback = &alc269_pcm_digital_playback;
11567 spec->stream_digital_capture = &alc269_pcm_digital_capture;
11569 spec->adc_nids = alc269_adc_nids;
11570 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
11571 spec->capsrc_nids = alc269_capsrc_nids;
11573 codec->patch_ops = alc_patch_ops;
11574 if (board_config == ALC269_AUTO)
11575 spec->init_hook = alc269_auto_init;
11576 #ifdef CONFIG_SND_HDA_POWER_SAVE
11577 if (!spec->loopback.amplist)
11578 spec->loopback.amplist = alc269_loopbacks;
11585 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11589 * set the path ways for 2 channel output
11590 * need to set the codec line out and mic 1 pin widgets to inputs
11592 static struct hda_verb alc861_threestack_ch2_init[] = {
11593 /* set pin widget 1Ah (line in) for input */
11594 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11595 /* set pin widget 18h (mic1/2) for input, for mic also enable
11598 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11600 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11602 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11603 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11609 * need to set the codec line out and mic 1 pin widgets to outputs
11611 static struct hda_verb alc861_threestack_ch6_init[] = {
11612 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11613 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11614 /* set pin widget 18h (mic1) for output (CLFE)*/
11615 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11617 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11618 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11620 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11622 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11623 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11628 static struct hda_channel_mode alc861_threestack_modes[2] = {
11629 { 2, alc861_threestack_ch2_init },
11630 { 6, alc861_threestack_ch6_init },
11632 /* Set mic1 as input and unmute the mixer */
11633 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11634 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11635 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11638 /* Set mic1 as output and mute mixer */
11639 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11640 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11641 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11645 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11646 { 2, alc861_uniwill_m31_ch2_init },
11647 { 4, alc861_uniwill_m31_ch4_init },
11650 /* Set mic1 and line-in as input and unmute the mixer */
11651 static struct hda_verb alc861_asus_ch2_init[] = {
11652 /* set pin widget 1Ah (line in) for input */
11653 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11654 /* set pin widget 18h (mic1/2) for input, for mic also enable
11657 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11659 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11661 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11662 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11666 /* Set mic1 nad line-in as output and mute mixer */
11667 static struct hda_verb alc861_asus_ch6_init[] = {
11668 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11669 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11670 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11671 /* set pin widget 18h (mic1) for output (CLFE)*/
11672 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11673 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11674 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11675 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11677 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11679 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11680 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11685 static struct hda_channel_mode alc861_asus_modes[2] = {
11686 { 2, alc861_asus_ch2_init },
11687 { 6, alc861_asus_ch6_init },
11692 static struct snd_kcontrol_new alc861_base_mixer[] = {
11693 /* output mixer control */
11694 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11695 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11696 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11697 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11698 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11700 /*Input mixer control */
11701 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11702 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11703 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11704 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11705 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11706 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11708 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11709 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11710 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11712 /* Capture mixer control */
11713 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11714 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11717 .name = "Capture Source",
11719 .info = alc_mux_enum_info,
11720 .get = alc_mux_enum_get,
11721 .put = alc_mux_enum_put,
11726 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11727 /* output mixer control */
11728 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11729 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11730 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11731 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11732 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11734 /* Input mixer control */
11735 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11736 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11737 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11738 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11739 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11740 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11742 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11743 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11744 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11746 /* Capture mixer control */
11747 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11748 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11750 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11751 .name = "Capture Source",
11753 .info = alc_mux_enum_info,
11754 .get = alc_mux_enum_get,
11755 .put = alc_mux_enum_put,
11758 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11759 .name = "Channel Mode",
11760 .info = alc_ch_mode_info,
11761 .get = alc_ch_mode_get,
11762 .put = alc_ch_mode_put,
11763 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11768 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11769 /* output mixer control */
11770 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11772 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11774 /*Capture mixer control */
11775 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11776 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11778 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11779 .name = "Capture Source",
11781 .info = alc_mux_enum_info,
11782 .get = alc_mux_enum_get,
11783 .put = alc_mux_enum_put,
11789 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11790 /* output mixer control */
11791 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11792 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11793 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11794 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11795 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11797 /* Input mixer control */
11798 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11799 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11800 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11801 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11802 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11803 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11805 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11806 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11807 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11809 /* Capture mixer control */
11810 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11811 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11813 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11814 .name = "Capture Source",
11816 .info = alc_mux_enum_info,
11817 .get = alc_mux_enum_get,
11818 .put = alc_mux_enum_put,
11821 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11822 .name = "Channel Mode",
11823 .info = alc_ch_mode_info,
11824 .get = alc_ch_mode_get,
11825 .put = alc_ch_mode_put,
11826 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11831 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11832 /* output mixer control */
11833 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11834 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11835 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11836 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11837 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11839 /* Input mixer control */
11840 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11841 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11842 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11843 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11844 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11845 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11847 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11848 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11849 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11851 /* Capture mixer control */
11852 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11853 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11855 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11856 .name = "Capture Source",
11858 .info = alc_mux_enum_info,
11859 .get = alc_mux_enum_get,
11860 .put = alc_mux_enum_put,
11863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11864 .name = "Channel Mode",
11865 .info = alc_ch_mode_info,
11866 .get = alc_ch_mode_get,
11867 .put = alc_ch_mode_put,
11868 .private_value = ARRAY_SIZE(alc861_asus_modes),
11873 /* additional mixer */
11874 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11875 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11876 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11877 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11878 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11883 * generic initialization of ADC, input mixers and output mixers
11885 static struct hda_verb alc861_base_init_verbs[] = {
11887 * Unmute ADC0 and set the default input to mic-in
11889 /* port-A for surround (rear panel) */
11890 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11891 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11892 /* port-B for mic-in (rear panel) with vref */
11893 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11894 /* port-C for line-in (rear panel) */
11895 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11896 /* port-D for Front */
11897 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11898 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11899 /* port-E for HP out (front panel) */
11900 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11901 /* route front PCM to HP */
11902 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11903 /* port-F for mic-in (front panel) with vref */
11904 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11905 /* port-G for CLFE (rear panel) */
11906 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11907 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11908 /* port-H for side (rear panel) */
11909 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11910 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11912 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11913 /* route front mic to ADC1*/
11914 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11915 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11917 /* Unmute DAC0~3 & spdif out*/
11918 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11919 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11920 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11921 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11922 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11924 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11925 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11926 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11927 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11928 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11930 /* Unmute Stereo Mixer 15 */
11931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11934 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11936 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11937 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11938 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11939 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11940 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11941 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11943 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11944 /* hp used DAC 3 (Front) */
11945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11946 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11951 static struct hda_verb alc861_threestack_init_verbs[] = {
11953 * Unmute ADC0 and set the default input to mic-in
11955 /* port-A for surround (rear panel) */
11956 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11957 /* port-B for mic-in (rear panel) with vref */
11958 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11959 /* port-C for line-in (rear panel) */
11960 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11961 /* port-D for Front */
11962 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11963 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11964 /* port-E for HP out (front panel) */
11965 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11966 /* route front PCM to HP */
11967 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11968 /* port-F for mic-in (front panel) with vref */
11969 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11970 /* port-G for CLFE (rear panel) */
11971 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11972 /* port-H for side (rear panel) */
11973 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11975 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11976 /* route front mic to ADC1*/
11977 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11978 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11979 /* Unmute DAC0~3 & spdif out*/
11980 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11981 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11982 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11983 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11984 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11986 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11987 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11988 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11989 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11990 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11992 /* Unmute Stereo Mixer 15 */
11993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11998 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11999 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12000 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12001 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12003 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12004 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12005 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12006 /* hp used DAC 3 (Front) */
12007 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12008 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12012 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
12014 * Unmute ADC0 and set the default input to mic-in
12016 /* port-A for surround (rear panel) */
12017 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12018 /* port-B for mic-in (rear panel) with vref */
12019 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12020 /* port-C for line-in (rear panel) */
12021 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12022 /* port-D for Front */
12023 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12024 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12025 /* port-E for HP out (front panel) */
12026 /* this has to be set to VREF80 */
12027 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12028 /* route front PCM to HP */
12029 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12030 /* port-F for mic-in (front panel) with vref */
12031 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12032 /* port-G for CLFE (rear panel) */
12033 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12034 /* port-H for side (rear panel) */
12035 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12037 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12038 /* route front mic to ADC1*/
12039 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12040 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12041 /* Unmute DAC0~3 & spdif out*/
12042 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12043 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12044 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12045 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12046 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12048 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12049 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12050 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12051 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12052 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12054 /* Unmute Stereo Mixer 15 */
12055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12060 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12061 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12062 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12063 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12064 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12065 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12066 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12067 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12068 /* hp used DAC 3 (Front) */
12069 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12070 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12074 static struct hda_verb alc861_asus_init_verbs[] = {
12076 * Unmute ADC0 and set the default input to mic-in
12078 /* port-A for surround (rear panel)
12079 * according to codec#0 this is the HP jack
12081 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12082 /* route front PCM to HP */
12083 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12084 /* port-B for mic-in (rear panel) with vref */
12085 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12086 /* port-C for line-in (rear panel) */
12087 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12088 /* port-D for Front */
12089 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12090 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12091 /* port-E for HP out (front panel) */
12092 /* this has to be set to VREF80 */
12093 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12094 /* route front PCM to HP */
12095 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12096 /* port-F for mic-in (front panel) with vref */
12097 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12098 /* port-G for CLFE (rear panel) */
12099 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12100 /* port-H for side (rear panel) */
12101 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12103 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12104 /* route front mic to ADC1*/
12105 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12106 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12107 /* Unmute DAC0~3 & spdif out*/
12108 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12109 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12110 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12111 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12113 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12114 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12115 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12116 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12117 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12119 /* Unmute Stereo Mixer 15 */
12120 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12122 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12123 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12125 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12126 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12127 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12128 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12129 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12130 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12131 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12132 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12133 /* hp used DAC 3 (Front) */
12134 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12135 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12139 /* additional init verbs for ASUS laptops */
12140 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
12141 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
12142 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
12147 * generic initialization of ADC, input mixers and output mixers
12149 static struct hda_verb alc861_auto_init_verbs[] = {
12151 * Unmute ADC0 and set the default input to mic-in
12153 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12156 /* Unmute DAC0~3 & spdif out*/
12157 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12158 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12159 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12160 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12163 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12164 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12165 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12166 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12167 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12169 /* Unmute Stereo Mixer 15 */
12170 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
12175 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12176 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12177 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12178 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12179 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12180 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12181 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12182 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12184 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12186 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12187 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12188 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12189 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12191 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12193 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
12198 static struct hda_verb alc861_toshiba_init_verbs[] = {
12199 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12204 /* toggle speaker-output according to the hp-jack state */
12205 static void alc861_toshiba_automute(struct hda_codec *codec)
12207 unsigned int present;
12209 present = snd_hda_codec_read(codec, 0x0f, 0,
12210 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12211 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
12212 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12213 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
12214 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
12217 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
12220 if ((res >> 26) == ALC880_HP_EVENT)
12221 alc861_toshiba_automute(codec);
12224 /* pcm configuration: identiacal with ALC880 */
12225 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
12226 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
12227 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
12228 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
12231 #define ALC861_DIGOUT_NID 0x07
12233 static struct hda_channel_mode alc861_8ch_modes[1] = {
12237 static hda_nid_t alc861_dac_nids[4] = {
12238 /* front, surround, clfe, side */
12239 0x03, 0x06, 0x05, 0x04
12242 static hda_nid_t alc660_dac_nids[3] = {
12243 /* front, clfe, surround */
12247 static hda_nid_t alc861_adc_nids[1] = {
12252 static struct hda_input_mux alc861_capture_source = {
12256 { "Front Mic", 0x3 },
12263 /* fill in the dac_nids table from the parsed pin configuration */
12264 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
12265 const struct auto_pin_cfg *cfg)
12270 spec->multiout.dac_nids = spec->private_dac_nids;
12271 for (i = 0; i < cfg->line_outs; i++) {
12272 nid = cfg->line_out_pins[i];
12274 if (i >= ARRAY_SIZE(alc861_dac_nids))
12276 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
12279 spec->multiout.num_dacs = cfg->line_outs;
12283 /* add playback controls from the parsed DAC table */
12284 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
12285 const struct auto_pin_cfg *cfg)
12288 static const char *chname[4] = {
12289 "Front", "Surround", NULL /*CLFE*/, "Side"
12294 for (i = 0; i < cfg->line_outs; i++) {
12295 nid = spec->multiout.dac_nids[i];
12300 err = add_control(spec, ALC_CTL_BIND_MUTE,
12301 "Center Playback Switch",
12302 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12306 err = add_control(spec, ALC_CTL_BIND_MUTE,
12307 "LFE Playback Switch",
12308 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12313 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
12315 if (nid == alc861_dac_nids[idx])
12317 sprintf(name, "%s Playback Switch", chname[idx]);
12318 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12319 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12328 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
12336 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
12338 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12339 "Headphone Playback Switch",
12340 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12343 spec->multiout.hp_nid = nid;
12348 /* create playback/capture controls for input pins */
12349 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
12350 const struct auto_pin_cfg *cfg)
12352 struct hda_input_mux *imux = &spec->private_imux;
12353 int i, err, idx, idx1;
12355 for (i = 0; i < AUTO_PIN_LAST; i++) {
12356 switch (cfg->input_pins[i]) {
12359 idx = 2; /* Line In */
12363 idx = 2; /* Line In */
12367 idx = 1; /* Mic In */
12371 idx = 1; /* Mic In */
12381 err = new_analog_input(spec, cfg->input_pins[i],
12382 auto_pin_cfg_labels[i], idx, 0x15);
12386 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12387 imux->items[imux->num_items].index = idx1;
12393 static struct snd_kcontrol_new alc861_capture_mixer[] = {
12394 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12395 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12398 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12399 /* The multiple "Capture Source" controls confuse alsamixer
12400 * So call somewhat different..
12402 /* .name = "Capture Source", */
12403 .name = "Input Source",
12405 .info = alc_mux_enum_info,
12406 .get = alc_mux_enum_get,
12407 .put = alc_mux_enum_put,
12412 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
12414 int pin_type, int dac_idx)
12416 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12418 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12422 static void alc861_auto_init_multi_out(struct hda_codec *codec)
12424 struct alc_spec *spec = codec->spec;
12427 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
12428 for (i = 0; i < spec->autocfg.line_outs; i++) {
12429 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12430 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12432 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
12433 spec->multiout.dac_nids[i]);
12437 static void alc861_auto_init_hp_out(struct hda_codec *codec)
12439 struct alc_spec *spec = codec->spec;
12442 pin = spec->autocfg.hp_pins[0];
12443 if (pin) /* connect to front */
12444 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
12445 spec->multiout.dac_nids[0]);
12446 pin = spec->autocfg.speaker_pins[0];
12448 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12451 static void alc861_auto_init_analog_input(struct hda_codec *codec)
12453 struct alc_spec *spec = codec->spec;
12456 for (i = 0; i < AUTO_PIN_LAST; i++) {
12457 hda_nid_t nid = spec->autocfg.input_pins[i];
12458 if (nid >= 0x0c && nid <= 0x11) {
12459 snd_hda_codec_write(codec, nid, 0,
12460 AC_VERB_SET_PIN_WIDGET_CONTROL,
12461 i <= AUTO_PIN_FRONT_MIC ?
12462 PIN_VREF80 : PIN_IN);
12467 /* parse the BIOS configuration and set up the alc_spec */
12468 /* return 1 if successful, 0 if the proper config is not found,
12469 * or a negative error code
12471 static int alc861_parse_auto_config(struct hda_codec *codec)
12473 struct alc_spec *spec = codec->spec;
12475 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12477 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12481 if (!spec->autocfg.line_outs)
12482 return 0; /* can't find valid BIOS pin config */
12484 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
12487 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
12490 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
12493 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
12497 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12499 if (spec->autocfg.dig_out_pin)
12500 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
12502 if (spec->kctl_alloc)
12503 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12505 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
12507 spec->num_mux_defs = 1;
12508 spec->input_mux = &spec->private_imux;
12510 spec->adc_nids = alc861_adc_nids;
12511 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
12512 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
12513 spec->num_mixers++;
12518 /* additional initialization for auto-configuration model */
12519 static void alc861_auto_init(struct hda_codec *codec)
12521 struct alc_spec *spec = codec->spec;
12522 alc861_auto_init_multi_out(codec);
12523 alc861_auto_init_hp_out(codec);
12524 alc861_auto_init_analog_input(codec);
12525 if (spec->unsol_event)
12526 alc_sku_automute(codec);
12529 #ifdef CONFIG_SND_HDA_POWER_SAVE
12530 static struct hda_amp_list alc861_loopbacks[] = {
12531 { 0x15, HDA_INPUT, 0 },
12532 { 0x15, HDA_INPUT, 1 },
12533 { 0x15, HDA_INPUT, 2 },
12534 { 0x15, HDA_INPUT, 3 },
12541 * configuration and preset
12543 static const char *alc861_models[ALC861_MODEL_LAST] = {
12544 [ALC861_3ST] = "3stack",
12545 [ALC660_3ST] = "3stack-660",
12546 [ALC861_3ST_DIG] = "3stack-dig",
12547 [ALC861_6ST_DIG] = "6stack-dig",
12548 [ALC861_UNIWILL_M31] = "uniwill-m31",
12549 [ALC861_TOSHIBA] = "toshiba",
12550 [ALC861_ASUS] = "asus",
12551 [ALC861_ASUS_LAPTOP] = "asus-laptop",
12552 [ALC861_AUTO] = "auto",
12555 static struct snd_pci_quirk alc861_cfg_tbl[] = {
12556 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
12557 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12558 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12559 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
12560 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
12561 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
12562 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
12563 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12564 * Any other models that need this preset?
12566 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12567 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
12568 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
12569 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
12570 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
12571 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
12572 /* FIXME: the below seems conflict */
12573 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12574 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
12575 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
12579 static struct alc_config_preset alc861_presets[] = {
12581 .mixers = { alc861_3ST_mixer },
12582 .init_verbs = { alc861_threestack_init_verbs },
12583 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12584 .dac_nids = alc861_dac_nids,
12585 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12586 .channel_mode = alc861_threestack_modes,
12588 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12589 .adc_nids = alc861_adc_nids,
12590 .input_mux = &alc861_capture_source,
12592 [ALC861_3ST_DIG] = {
12593 .mixers = { alc861_base_mixer },
12594 .init_verbs = { alc861_threestack_init_verbs },
12595 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12596 .dac_nids = alc861_dac_nids,
12597 .dig_out_nid = ALC861_DIGOUT_NID,
12598 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12599 .channel_mode = alc861_threestack_modes,
12601 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12602 .adc_nids = alc861_adc_nids,
12603 .input_mux = &alc861_capture_source,
12605 [ALC861_6ST_DIG] = {
12606 .mixers = { alc861_base_mixer },
12607 .init_verbs = { alc861_base_init_verbs },
12608 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12609 .dac_nids = alc861_dac_nids,
12610 .dig_out_nid = ALC861_DIGOUT_NID,
12611 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12612 .channel_mode = alc861_8ch_modes,
12613 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12614 .adc_nids = alc861_adc_nids,
12615 .input_mux = &alc861_capture_source,
12618 .mixers = { alc861_3ST_mixer },
12619 .init_verbs = { alc861_threestack_init_verbs },
12620 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12621 .dac_nids = alc660_dac_nids,
12622 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12623 .channel_mode = alc861_threestack_modes,
12625 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12626 .adc_nids = alc861_adc_nids,
12627 .input_mux = &alc861_capture_source,
12629 [ALC861_UNIWILL_M31] = {
12630 .mixers = { alc861_uniwill_m31_mixer },
12631 .init_verbs = { alc861_uniwill_m31_init_verbs },
12632 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12633 .dac_nids = alc861_dac_nids,
12634 .dig_out_nid = ALC861_DIGOUT_NID,
12635 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12636 .channel_mode = alc861_uniwill_m31_modes,
12638 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12639 .adc_nids = alc861_adc_nids,
12640 .input_mux = &alc861_capture_source,
12642 [ALC861_TOSHIBA] = {
12643 .mixers = { alc861_toshiba_mixer },
12644 .init_verbs = { alc861_base_init_verbs,
12645 alc861_toshiba_init_verbs },
12646 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12647 .dac_nids = alc861_dac_nids,
12648 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12649 .channel_mode = alc883_3ST_2ch_modes,
12650 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12651 .adc_nids = alc861_adc_nids,
12652 .input_mux = &alc861_capture_source,
12653 .unsol_event = alc861_toshiba_unsol_event,
12654 .init_hook = alc861_toshiba_automute,
12657 .mixers = { alc861_asus_mixer },
12658 .init_verbs = { alc861_asus_init_verbs },
12659 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12660 .dac_nids = alc861_dac_nids,
12661 .dig_out_nid = ALC861_DIGOUT_NID,
12662 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12663 .channel_mode = alc861_asus_modes,
12666 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12667 .adc_nids = alc861_adc_nids,
12668 .input_mux = &alc861_capture_source,
12670 [ALC861_ASUS_LAPTOP] = {
12671 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12672 .init_verbs = { alc861_asus_init_verbs,
12673 alc861_asus_laptop_init_verbs },
12674 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12675 .dac_nids = alc861_dac_nids,
12676 .dig_out_nid = ALC861_DIGOUT_NID,
12677 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12678 .channel_mode = alc883_3ST_2ch_modes,
12680 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12681 .adc_nids = alc861_adc_nids,
12682 .input_mux = &alc861_capture_source,
12687 static int patch_alc861(struct hda_codec *codec)
12689 struct alc_spec *spec;
12693 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12697 codec->spec = spec;
12699 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12703 if (board_config < 0) {
12704 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12705 "trying auto-probe from BIOS...\n");
12706 board_config = ALC861_AUTO;
12709 if (board_config == ALC861_AUTO) {
12710 /* automatic parse from the BIOS config */
12711 err = alc861_parse_auto_config(codec);
12717 "hda_codec: Cannot set up configuration "
12718 "from BIOS. Using base mode...\n");
12719 board_config = ALC861_3ST_DIG;
12723 if (board_config != ALC861_AUTO)
12724 setup_preset(spec, &alc861_presets[board_config]);
12726 spec->stream_name_analog = "ALC861 Analog";
12727 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12728 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12730 spec->stream_name_digital = "ALC861 Digital";
12731 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12732 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12734 spec->vmaster_nid = 0x03;
12736 codec->patch_ops = alc_patch_ops;
12737 if (board_config == ALC861_AUTO)
12738 spec->init_hook = alc861_auto_init;
12739 #ifdef CONFIG_SND_HDA_POWER_SAVE
12740 if (!spec->loopback.amplist)
12741 spec->loopback.amplist = alc861_loopbacks;
12748 * ALC861-VD support
12752 * In addition, an independent DAC
12754 #define ALC861VD_DIGOUT_NID 0x06
12756 static hda_nid_t alc861vd_dac_nids[4] = {
12757 /* front, surr, clfe, side surr */
12758 0x02, 0x03, 0x04, 0x05
12761 /* dac_nids for ALC660vd are in a different order - according to
12762 * Realtek's driver.
12763 * This should probably tesult in a different mixer for 6stack models
12764 * of ALC660vd codecs, but for now there is only 3stack mixer
12765 * - and it is the same as in 861vd.
12766 * adc_nids in ALC660vd are (is) the same as in 861vd
12768 static hda_nid_t alc660vd_dac_nids[3] = {
12769 /* front, rear, clfe, rear_surr */
12773 static hda_nid_t alc861vd_adc_nids[1] = {
12778 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12781 /* FIXME: should be a matrix-type input source selection */
12782 static struct hda_input_mux alc861vd_capture_source = {
12786 { "Front Mic", 0x1 },
12792 static struct hda_input_mux alc861vd_dallas_capture_source = {
12795 { "Ext Mic", 0x0 },
12796 { "Int Mic", 0x1 },
12800 static struct hda_input_mux alc861vd_hp_capture_source = {
12803 { "Front Mic", 0x0 },
12804 { "ATAPI Mic", 0x1 },
12808 #define alc861vd_mux_enum_info alc_mux_enum_info
12809 #define alc861vd_mux_enum_get alc_mux_enum_get
12810 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12811 #define alc861vd_mux_enum_put alc882_mux_enum_put
12816 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12823 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12824 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12825 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12826 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12827 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12834 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12835 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12836 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12837 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12838 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12842 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12843 { 6, alc861vd_6stack_ch6_init },
12844 { 8, alc861vd_6stack_ch8_init },
12847 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12849 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12850 .name = "Channel Mode",
12851 .info = alc_ch_mode_info,
12852 .get = alc_ch_mode_get,
12853 .put = alc_ch_mode_put,
12858 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12859 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12860 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12864 /* The multiple "Capture Source" controls confuse alsamixer
12865 * So call somewhat different..
12867 /* .name = "Capture Source", */
12868 .name = "Input Source",
12870 .info = alc861vd_mux_enum_info,
12871 .get = alc861vd_mux_enum_get,
12872 .put = alc861vd_mux_enum_put,
12877 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12878 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12880 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12881 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12882 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12884 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12885 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12887 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12891 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12892 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12894 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12895 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12899 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12903 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12904 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12907 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12908 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12910 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12911 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12913 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12914 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12919 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12920 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12921 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12925 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12927 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12929 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12930 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12933 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12934 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12936 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12937 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12939 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12940 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12945 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12946 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12947 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12948 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12952 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12956 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12957 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12958 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12960 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12961 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12966 /* Pin assignment: Speaker=0x14, HP = 0x15,
12967 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12969 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12971 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12973 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12974 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12975 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12976 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12977 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12978 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12979 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12980 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12981 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12985 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12986 * Front Mic=0x18, ATAPI Mic = 0x19,
12988 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12989 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12990 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12991 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12992 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12993 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12994 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12995 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12996 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13002 * generic initialization of ADC, input mixers and output mixers
13004 static struct hda_verb alc861vd_volume_init_verbs[] = {
13006 * Unmute ADC0 and set the default input to mic-in
13008 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13009 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13011 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13012 * the analog-loopback mixer widget
13014 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13017 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13018 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13019 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13021 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13023 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13024 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13025 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13028 * Set up output mixers (0x02 - 0x05)
13030 /* set vol=0 to output mixers */
13031 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13032 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13033 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13034 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13036 /* set up input amps for analog loopback */
13037 /* Amp Indices: DAC = 0, mixer = 1 */
13038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13040 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13041 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13042 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13043 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13044 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13045 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13051 * 3-stack pin configuration:
13052 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13054 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13056 * Set pin mode and muting
13058 /* set front pin widgets 0x14 for output */
13059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13060 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13061 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13063 /* Mic (rear) pin: input vref at 80% */
13064 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13065 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13066 /* Front Mic pin: input vref at 80% */
13067 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13068 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13069 /* Line In pin: input */
13070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13072 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13074 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13075 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13076 /* CD pin widget for input */
13077 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13083 * 6-stack pin configuration:
13085 static struct hda_verb alc861vd_6stack_init_verbs[] = {
13087 * Set pin mode and muting
13089 /* set front pin widgets 0x14 for output */
13090 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13091 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13092 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13094 /* Rear Pin: output 1 (0x0d) */
13095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13096 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13098 /* CLFE Pin: output 2 (0x0e) */
13099 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13100 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13101 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13102 /* Side Pin: output 3 (0x0f) */
13103 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13104 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13105 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13107 /* Mic (rear) pin: input vref at 80% */
13108 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13109 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13110 /* Front Mic pin: input vref at 80% */
13111 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13112 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13113 /* Line In pin: input */
13114 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13115 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13116 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13117 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13118 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13119 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13120 /* CD pin widget for input */
13121 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13126 static struct hda_verb alc861vd_eapd_verbs[] = {
13127 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13131 static struct hda_verb alc660vd_eapd_verbs[] = {
13132 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13133 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13137 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13140 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13141 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13142 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13146 /* toggle speaker-output according to the hp-jack state */
13147 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
13149 unsigned int present;
13150 unsigned char bits;
13152 present = snd_hda_codec_read(codec, 0x1b, 0,
13153 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13154 bits = present ? HDA_AMP_MUTE : 0;
13155 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13156 HDA_AMP_MUTE, bits);
13159 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
13161 unsigned int present;
13162 unsigned char bits;
13164 present = snd_hda_codec_read(codec, 0x18, 0,
13165 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13166 bits = present ? HDA_AMP_MUTE : 0;
13167 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
13168 HDA_AMP_MUTE, bits);
13171 static void alc861vd_lenovo_automute(struct hda_codec *codec)
13173 alc861vd_lenovo_hp_automute(codec);
13174 alc861vd_lenovo_mic_automute(codec);
13177 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
13180 switch (res >> 26) {
13181 case ALC880_HP_EVENT:
13182 alc861vd_lenovo_hp_automute(codec);
13184 case ALC880_MIC_EVENT:
13185 alc861vd_lenovo_mic_automute(codec);
13190 static struct hda_verb alc861vd_dallas_verbs[] = {
13191 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13192 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13193 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13194 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13197 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13198 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13199 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13200 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13201 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13202 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13203 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13206 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13207 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13208 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13209 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13210 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13211 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13212 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13214 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13215 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13216 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13217 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13218 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13219 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13220 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13221 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13225 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13226 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13228 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13229 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13230 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13235 /* toggle speaker-output according to the hp-jack state */
13236 static void alc861vd_dallas_automute(struct hda_codec *codec)
13238 unsigned int present;
13240 present = snd_hda_codec_read(codec, 0x15, 0,
13241 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13242 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13243 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13246 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
13248 if ((res >> 26) == ALC880_HP_EVENT)
13249 alc861vd_dallas_automute(codec);
13252 #ifdef CONFIG_SND_HDA_POWER_SAVE
13253 #define alc861vd_loopbacks alc880_loopbacks
13256 /* pcm configuration: identiacal with ALC880 */
13257 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
13258 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
13259 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
13260 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
13263 * configuration and preset
13265 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
13266 [ALC660VD_3ST] = "3stack-660",
13267 [ALC660VD_3ST_DIG] = "3stack-660-digout",
13268 [ALC861VD_3ST] = "3stack",
13269 [ALC861VD_3ST_DIG] = "3stack-digout",
13270 [ALC861VD_6ST_DIG] = "6stack-digout",
13271 [ALC861VD_LENOVO] = "lenovo",
13272 [ALC861VD_DALLAS] = "dallas",
13273 [ALC861VD_HP] = "hp",
13274 [ALC861VD_AUTO] = "auto",
13277 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
13278 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
13279 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
13280 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
13281 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
13282 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO),
13283 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
13284 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
13285 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
13286 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
13287 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
13288 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
13289 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
13290 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
13291 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
13292 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
13293 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
13294 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
13298 static struct alc_config_preset alc861vd_presets[] = {
13300 .mixers = { alc861vd_3st_mixer },
13301 .init_verbs = { alc861vd_volume_init_verbs,
13302 alc861vd_3stack_init_verbs },
13303 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13304 .dac_nids = alc660vd_dac_nids,
13305 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13306 .channel_mode = alc861vd_3stack_2ch_modes,
13307 .input_mux = &alc861vd_capture_source,
13309 [ALC660VD_3ST_DIG] = {
13310 .mixers = { alc861vd_3st_mixer },
13311 .init_verbs = { alc861vd_volume_init_verbs,
13312 alc861vd_3stack_init_verbs },
13313 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13314 .dac_nids = alc660vd_dac_nids,
13315 .dig_out_nid = ALC861VD_DIGOUT_NID,
13316 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13317 .channel_mode = alc861vd_3stack_2ch_modes,
13318 .input_mux = &alc861vd_capture_source,
13321 .mixers = { alc861vd_3st_mixer },
13322 .init_verbs = { alc861vd_volume_init_verbs,
13323 alc861vd_3stack_init_verbs },
13324 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13325 .dac_nids = alc861vd_dac_nids,
13326 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13327 .channel_mode = alc861vd_3stack_2ch_modes,
13328 .input_mux = &alc861vd_capture_source,
13330 [ALC861VD_3ST_DIG] = {
13331 .mixers = { alc861vd_3st_mixer },
13332 .init_verbs = { alc861vd_volume_init_verbs,
13333 alc861vd_3stack_init_verbs },
13334 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13335 .dac_nids = alc861vd_dac_nids,
13336 .dig_out_nid = ALC861VD_DIGOUT_NID,
13337 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13338 .channel_mode = alc861vd_3stack_2ch_modes,
13339 .input_mux = &alc861vd_capture_source,
13341 [ALC861VD_6ST_DIG] = {
13342 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
13343 .init_verbs = { alc861vd_volume_init_verbs,
13344 alc861vd_6stack_init_verbs },
13345 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13346 .dac_nids = alc861vd_dac_nids,
13347 .dig_out_nid = ALC861VD_DIGOUT_NID,
13348 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
13349 .channel_mode = alc861vd_6stack_modes,
13350 .input_mux = &alc861vd_capture_source,
13352 [ALC861VD_LENOVO] = {
13353 .mixers = { alc861vd_lenovo_mixer },
13354 .init_verbs = { alc861vd_volume_init_verbs,
13355 alc861vd_3stack_init_verbs,
13356 alc861vd_eapd_verbs,
13357 alc861vd_lenovo_unsol_verbs },
13358 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13359 .dac_nids = alc660vd_dac_nids,
13360 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13361 .channel_mode = alc861vd_3stack_2ch_modes,
13362 .input_mux = &alc861vd_capture_source,
13363 .unsol_event = alc861vd_lenovo_unsol_event,
13364 .init_hook = alc861vd_lenovo_automute,
13366 [ALC861VD_DALLAS] = {
13367 .mixers = { alc861vd_dallas_mixer },
13368 .init_verbs = { alc861vd_dallas_verbs },
13369 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13370 .dac_nids = alc861vd_dac_nids,
13371 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13372 .channel_mode = alc861vd_3stack_2ch_modes,
13373 .input_mux = &alc861vd_dallas_capture_source,
13374 .unsol_event = alc861vd_dallas_unsol_event,
13375 .init_hook = alc861vd_dallas_automute,
13378 .mixers = { alc861vd_hp_mixer },
13379 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
13380 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13381 .dac_nids = alc861vd_dac_nids,
13382 .dig_out_nid = ALC861VD_DIGOUT_NID,
13383 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13384 .channel_mode = alc861vd_3stack_2ch_modes,
13385 .input_mux = &alc861vd_hp_capture_source,
13386 .unsol_event = alc861vd_dallas_unsol_event,
13387 .init_hook = alc861vd_dallas_automute,
13392 * BIOS auto configuration
13394 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
13395 hda_nid_t nid, int pin_type, int dac_idx)
13397 alc_set_pin_output(codec, nid, pin_type);
13400 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
13402 struct alc_spec *spec = codec->spec;
13405 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13406 for (i = 0; i <= HDA_SIDE; i++) {
13407 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13408 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13410 alc861vd_auto_set_output_and_unmute(codec, nid,
13416 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
13418 struct alc_spec *spec = codec->spec;
13421 pin = spec->autocfg.hp_pins[0];
13422 if (pin) /* connect to front and use dac 0 */
13423 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13424 pin = spec->autocfg.speaker_pins[0];
13426 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13429 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13430 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13432 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
13434 struct alc_spec *spec = codec->spec;
13437 for (i = 0; i < AUTO_PIN_LAST; i++) {
13438 hda_nid_t nid = spec->autocfg.input_pins[i];
13439 if (alc861vd_is_input_pin(nid)) {
13440 snd_hda_codec_write(codec, nid, 0,
13441 AC_VERB_SET_PIN_WIDGET_CONTROL,
13442 i <= AUTO_PIN_FRONT_MIC ?
13443 PIN_VREF80 : PIN_IN);
13444 if (nid != ALC861VD_PIN_CD_NID)
13445 snd_hda_codec_write(codec, nid, 0,
13446 AC_VERB_SET_AMP_GAIN_MUTE,
13452 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
13454 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13455 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13457 /* add playback controls from the parsed DAC table */
13458 /* Based on ALC880 version. But ALC861VD has separate,
13459 * different NIDs for mute/unmute switch and volume control */
13460 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
13461 const struct auto_pin_cfg *cfg)
13464 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
13465 hda_nid_t nid_v, nid_s;
13468 for (i = 0; i < cfg->line_outs; i++) {
13469 if (!spec->multiout.dac_nids[i])
13471 nid_v = alc861vd_idx_to_mixer_vol(
13473 spec->multiout.dac_nids[i]));
13474 nid_s = alc861vd_idx_to_mixer_switch(
13476 spec->multiout.dac_nids[i]));
13480 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13481 "Center Playback Volume",
13482 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
13486 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13487 "LFE Playback Volume",
13488 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
13492 err = add_control(spec, ALC_CTL_BIND_MUTE,
13493 "Center Playback Switch",
13494 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
13498 err = add_control(spec, ALC_CTL_BIND_MUTE,
13499 "LFE Playback Switch",
13500 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
13505 sprintf(name, "%s Playback Volume", chname[i]);
13506 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13507 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
13511 sprintf(name, "%s Playback Switch", chname[i]);
13512 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13513 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
13522 /* add playback controls for speaker and HP outputs */
13523 /* Based on ALC880 version. But ALC861VD has separate,
13524 * different NIDs for mute/unmute switch and volume control */
13525 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
13526 hda_nid_t pin, const char *pfx)
13528 hda_nid_t nid_v, nid_s;
13535 if (alc880_is_fixed_pin(pin)) {
13536 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13537 /* specify the DAC as the extra output */
13538 if (!spec->multiout.hp_nid)
13539 spec->multiout.hp_nid = nid_v;
13541 spec->multiout.extra_out_nid[0] = nid_v;
13542 /* control HP volume/switch on the output mixer amp */
13543 nid_v = alc861vd_idx_to_mixer_vol(
13544 alc880_fixed_pin_idx(pin));
13545 nid_s = alc861vd_idx_to_mixer_switch(
13546 alc880_fixed_pin_idx(pin));
13548 sprintf(name, "%s Playback Volume", pfx);
13549 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13550 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
13553 sprintf(name, "%s Playback Switch", pfx);
13554 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13555 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
13558 } else if (alc880_is_multi_pin(pin)) {
13559 /* set manual connection */
13560 /* we have only a switch on HP-out PIN */
13561 sprintf(name, "%s Playback Switch", pfx);
13562 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13563 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13570 /* parse the BIOS configuration and set up the alc_spec
13571 * return 1 if successful, 0 if the proper config is not found,
13572 * or a negative error code
13573 * Based on ALC880 version - had to change it to override
13574 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13575 static int alc861vd_parse_auto_config(struct hda_codec *codec)
13577 struct alc_spec *spec = codec->spec;
13579 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
13581 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13585 if (!spec->autocfg.line_outs)
13586 return 0; /* can't find valid BIOS pin config */
13588 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13591 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
13594 err = alc861vd_auto_create_extra_out(spec,
13595 spec->autocfg.speaker_pins[0],
13599 err = alc861vd_auto_create_extra_out(spec,
13600 spec->autocfg.hp_pins[0],
13604 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
13608 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13610 if (spec->autocfg.dig_out_pin)
13611 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13613 if (spec->kctl_alloc)
13614 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13616 spec->init_verbs[spec->num_init_verbs++]
13617 = alc861vd_volume_init_verbs;
13619 spec->num_mux_defs = 1;
13620 spec->input_mux = &spec->private_imux;
13622 err = alc_auto_add_mic_boost(codec);
13629 /* additional initialization for auto-configuration model */
13630 static void alc861vd_auto_init(struct hda_codec *codec)
13632 struct alc_spec *spec = codec->spec;
13633 alc861vd_auto_init_multi_out(codec);
13634 alc861vd_auto_init_hp_out(codec);
13635 alc861vd_auto_init_analog_input(codec);
13636 alc861vd_auto_init_input_src(codec);
13637 if (spec->unsol_event)
13638 alc_sku_automute(codec);
13641 static int patch_alc861vd(struct hda_codec *codec)
13643 struct alc_spec *spec;
13644 int err, board_config;
13646 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13650 codec->spec = spec;
13652 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13656 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13657 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13658 "ALC861VD, trying auto-probe from BIOS...\n");
13659 board_config = ALC861VD_AUTO;
13662 if (board_config == ALC861VD_AUTO) {
13663 /* automatic parse from the BIOS config */
13664 err = alc861vd_parse_auto_config(codec);
13670 "hda_codec: Cannot set up configuration "
13671 "from BIOS. Using base mode...\n");
13672 board_config = ALC861VD_3ST;
13676 if (board_config != ALC861VD_AUTO)
13677 setup_preset(spec, &alc861vd_presets[board_config]);
13679 if (codec->vendor_id == 0x10ec0660) {
13680 spec->stream_name_analog = "ALC660-VD Analog";
13681 spec->stream_name_digital = "ALC660-VD Digital";
13682 /* always turn on EAPD */
13683 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
13685 spec->stream_name_analog = "ALC861VD Analog";
13686 spec->stream_name_digital = "ALC861VD Digital";
13689 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13690 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13692 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13693 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13695 spec->adc_nids = alc861vd_adc_nids;
13696 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13697 spec->capsrc_nids = alc861vd_capsrc_nids;
13699 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13700 spec->num_mixers++;
13702 spec->vmaster_nid = 0x02;
13704 codec->patch_ops = alc_patch_ops;
13706 if (board_config == ALC861VD_AUTO)
13707 spec->init_hook = alc861vd_auto_init;
13708 #ifdef CONFIG_SND_HDA_POWER_SAVE
13709 if (!spec->loopback.amplist)
13710 spec->loopback.amplist = alc861vd_loopbacks;
13719 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13720 * configuration. Each pin widget can choose any input DACs and a mixer.
13721 * Each ADC is connected from a mixer of all inputs. This makes possible
13722 * 6-channel independent captures.
13724 * In addition, an independent DAC for the multi-playback (not used in this
13727 #define ALC662_DIGOUT_NID 0x06
13728 #define ALC662_DIGIN_NID 0x0a
13730 static hda_nid_t alc662_dac_nids[4] = {
13731 /* front, rear, clfe, rear_surr */
13735 static hda_nid_t alc662_adc_nids[1] = {
13740 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13743 /* FIXME: should be a matrix-type input source selection */
13744 static struct hda_input_mux alc662_capture_source = {
13748 { "Front Mic", 0x1 },
13754 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13762 static struct hda_input_mux alc662_eeepc_capture_source = {
13770 static struct hda_input_mux alc663_capture_source = {
13774 { "Front Mic", 0x1 },
13779 static struct hda_input_mux alc663_m51va_capture_source = {
13782 { "Ext-Mic", 0x0 },
13787 #define alc662_mux_enum_info alc_mux_enum_info
13788 #define alc662_mux_enum_get alc_mux_enum_get
13789 #define alc662_mux_enum_put alc882_mux_enum_put
13794 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13801 static struct hda_verb alc662_3ST_ch2_init[] = {
13802 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13803 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13804 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13805 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13812 static struct hda_verb alc662_3ST_ch6_init[] = {
13813 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13814 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13815 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13816 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13817 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13818 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13822 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13823 { 2, alc662_3ST_ch2_init },
13824 { 6, alc662_3ST_ch6_init },
13830 static struct hda_verb alc662_sixstack_ch6_init[] = {
13831 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13832 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13833 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13840 static struct hda_verb alc662_sixstack_ch8_init[] = {
13841 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13842 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13843 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13847 static struct hda_channel_mode alc662_5stack_modes[2] = {
13848 { 2, alc662_sixstack_ch6_init },
13849 { 6, alc662_sixstack_ch8_init },
13852 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13853 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13856 static struct snd_kcontrol_new alc662_base_mixer[] = {
13857 /* output mixer control */
13858 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13859 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13860 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13861 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13862 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13863 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13864 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13865 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13868 /*Input mixer control */
13869 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13870 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13871 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13872 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13873 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13874 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13880 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13881 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13882 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13883 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13884 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13885 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13886 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13887 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13889 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13890 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13891 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13892 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13893 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13897 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13898 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13899 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13900 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13901 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13902 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13903 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13904 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13905 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13906 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13907 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13908 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13909 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13910 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13913 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13914 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13915 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13916 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13920 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13921 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13922 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13923 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13924 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13926 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13927 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13933 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13934 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13936 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13937 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13939 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13940 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13941 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13943 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13944 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13945 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13949 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13950 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13951 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13952 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13953 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13954 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13955 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13956 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13957 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13958 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13959 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13960 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13961 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13963 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13967 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
13968 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13969 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13973 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT),
13977 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
13978 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13979 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13980 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13981 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13984 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13985 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13986 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13987 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13991 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
13992 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13993 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13998 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13999 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14000 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14001 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14005 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
14007 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14008 .name = "Channel Mode",
14009 .info = alc_ch_mode_info,
14010 .get = alc_ch_mode_get,
14011 .put = alc_ch_mode_put,
14016 static struct hda_verb alc662_init_verbs[] = {
14017 /* ADC: mute amp left and right */
14018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14019 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14020 /* Front mixer: unmute input/output amp left and right (volume = 0) */
14022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14028 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14030 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14031 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14032 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14035 /* Front Pin: output 0 (0x0c) */
14036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14037 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14039 /* Rear Pin: output 1 (0x0d) */
14040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14043 /* CLFE Pin: output 2 (0x0e) */
14044 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14045 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14047 /* Mic (rear) pin: input vref at 80% */
14048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14050 /* Front Mic pin: input vref at 80% */
14051 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14052 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14053 /* Line In pin: input */
14054 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14056 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14057 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14058 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14059 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14060 /* CD pin widget for input */
14061 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14063 /* FIXME: use matrix-type input source selection */
14064 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14066 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14071 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14076 /* always trun on EAPD */
14077 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14078 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14083 static struct hda_verb alc662_sue_init_verbs[] = {
14084 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14085 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14089 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
14090 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14091 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14095 /* Set Unsolicited Event*/
14096 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
14097 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14098 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14103 * generic initialization of ADC, input mixers and output mixers
14105 static struct hda_verb alc662_auto_init_verbs[] = {
14107 * Unmute ADC and set the default input to mic-in
14109 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14110 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14112 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
14114 * Note: PASD motherboards uses the Line In 2 as the input for front
14115 * panel mic (mic 2)
14117 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14125 * Set up output mixers (0x0c - 0x0f)
14127 /* set vol=0 to output mixers */
14128 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14129 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14130 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14132 /* set up input amps for analog loopback */
14133 /* Amp Indices: DAC = 0, mixer = 1 */
14134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14142 /* FIXME: use matrix-type input source selection */
14143 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14145 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14146 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14150 /* additional verbs for ALC663 */
14151 static struct hda_verb alc663_auto_init_verbs[] = {
14152 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14153 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14157 static struct hda_verb alc663_m51va_init_verbs[] = {
14158 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14159 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14160 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14162 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
14164 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14165 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14169 static struct hda_verb alc663_g71v_init_verbs[] = {
14170 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14171 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
14172 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
14174 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14175 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14176 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14178 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
14180 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14184 static struct hda_verb alc663_g50v_init_verbs[] = {
14185 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14186 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14187 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14189 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14190 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14194 /* capture mixer elements */
14195 static struct snd_kcontrol_new alc662_capture_mixer[] = {
14196 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14197 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14199 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14200 /* The multiple "Capture Source" controls confuse alsamixer
14201 * So call somewhat different..
14203 /* .name = "Capture Source", */
14204 .name = "Input Source",
14206 .info = alc662_mux_enum_info,
14207 .get = alc662_mux_enum_get,
14208 .put = alc662_mux_enum_put,
14213 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
14215 unsigned int present;
14216 unsigned char bits;
14218 present = snd_hda_codec_read(codec, 0x14, 0,
14219 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14220 bits = present ? HDA_AMP_MUTE : 0;
14221 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14222 HDA_AMP_MUTE, bits);
14225 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
14227 unsigned int present;
14228 unsigned char bits;
14230 present = snd_hda_codec_read(codec, 0x1b, 0,
14231 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14232 bits = present ? HDA_AMP_MUTE : 0;
14233 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14234 HDA_AMP_MUTE, bits);
14235 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14236 HDA_AMP_MUTE, bits);
14239 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
14242 if ((res >> 26) == ALC880_HP_EVENT)
14243 alc662_lenovo_101e_all_automute(codec);
14244 if ((res >> 26) == ALC880_FRONT_EVENT)
14245 alc662_lenovo_101e_ispeaker_automute(codec);
14248 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
14250 unsigned int present;
14252 present = snd_hda_codec_read(codec, 0x18, 0,
14253 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14254 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14255 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14256 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14257 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14258 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14259 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
14260 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14261 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
14264 /* unsolicited event for HP jack sensing */
14265 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
14268 if ((res >> 26) == ALC880_HP_EVENT)
14269 alc262_hippo1_automute( codec );
14271 if ((res >> 26) == ALC880_MIC_EVENT)
14272 alc662_eeepc_mic_automute(codec);
14275 static void alc662_eeepc_inithook(struct hda_codec *codec)
14277 alc262_hippo1_automute( codec );
14278 alc662_eeepc_mic_automute(codec);
14281 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
14284 unsigned int present;
14286 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
14287 present = snd_hda_codec_read(codec, 0x14, 0,
14288 AC_VERB_GET_PIN_SENSE, 0);
14289 present = (present & 0x80000000) != 0;
14291 /* mute internal speaker */
14292 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14293 HDA_AMP_MUTE, HDA_AMP_MUTE);
14295 /* unmute internal speaker if necessary */
14296 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
14297 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14298 HDA_AMP_MUTE, mute);
14302 /* unsolicited event for HP jack sensing */
14303 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
14306 if ((res >> 26) == ALC880_HP_EVENT)
14307 alc662_eeepc_ep20_automute(codec);
14310 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
14312 alc662_eeepc_ep20_automute(codec);
14315 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
14317 unsigned int present;
14318 unsigned char bits;
14320 present = snd_hda_codec_read(codec, 0x21, 0,
14321 AC_VERB_GET_PIN_SENSE, 0)
14322 & AC_PINSENSE_PRESENCE;
14323 bits = present ? HDA_AMP_MUTE : 0;
14324 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14325 HDA_AMP_MUTE, bits);
14328 static void alc663_m51va_mic_automute(struct hda_codec *codec)
14330 unsigned int present;
14332 present = snd_hda_codec_read(codec, 0x18, 0,
14333 AC_VERB_GET_PIN_SENSE, 0)
14334 & AC_PINSENSE_PRESENCE;
14335 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14336 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14337 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14338 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14339 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14340 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14341 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14342 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14345 static void alc663_m51va_unsol_event(struct hda_codec *codec,
14348 switch (res >> 26) {
14349 case ALC880_HP_EVENT:
14350 alc663_m51va_speaker_automute(codec);
14352 case ALC880_MIC_EVENT:
14353 alc663_m51va_mic_automute(codec);
14358 static void alc663_m51va_inithook(struct hda_codec *codec)
14360 alc663_m51va_speaker_automute(codec);
14361 alc663_m51va_mic_automute(codec);
14364 static void alc663_g71v_hp_automute(struct hda_codec *codec)
14366 unsigned int present;
14367 unsigned char bits;
14369 present = snd_hda_codec_read(codec, 0x21, 0,
14370 AC_VERB_GET_PIN_SENSE, 0)
14371 & AC_PINSENSE_PRESENCE;
14372 bits = present ? HDA_AMP_MUTE : 0;
14373 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14374 HDA_AMP_MUTE, bits);
14375 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14376 HDA_AMP_MUTE, bits);
14379 static void alc663_g71v_front_automute(struct hda_codec *codec)
14381 unsigned int present;
14382 unsigned char bits;
14384 present = snd_hda_codec_read(codec, 0x15, 0,
14385 AC_VERB_GET_PIN_SENSE, 0)
14386 & AC_PINSENSE_PRESENCE;
14387 bits = present ? HDA_AMP_MUTE : 0;
14388 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14389 HDA_AMP_MUTE, bits);
14392 static void alc663_g71v_unsol_event(struct hda_codec *codec,
14395 switch (res >> 26) {
14396 case ALC880_HP_EVENT:
14397 alc663_g71v_hp_automute(codec);
14399 case ALC880_FRONT_EVENT:
14400 alc663_g71v_front_automute(codec);
14402 case ALC880_MIC_EVENT:
14403 alc662_eeepc_mic_automute(codec);
14408 static void alc663_g71v_inithook(struct hda_codec *codec)
14410 alc663_g71v_front_automute(codec);
14411 alc663_g71v_hp_automute(codec);
14412 alc662_eeepc_mic_automute(codec);
14415 static void alc663_g50v_unsol_event(struct hda_codec *codec,
14418 switch (res >> 26) {
14419 case ALC880_HP_EVENT:
14420 alc663_m51va_speaker_automute(codec);
14422 case ALC880_MIC_EVENT:
14423 alc662_eeepc_mic_automute(codec);
14428 static void alc663_g50v_inithook(struct hda_codec *codec)
14430 alc663_m51va_speaker_automute(codec);
14431 alc662_eeepc_mic_automute(codec);
14434 #ifdef CONFIG_SND_HDA_POWER_SAVE
14435 #define alc662_loopbacks alc880_loopbacks
14439 /* pcm configuration: identiacal with ALC880 */
14440 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
14441 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
14442 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
14443 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
14446 * configuration and preset
14448 static const char *alc662_models[ALC662_MODEL_LAST] = {
14449 [ALC662_3ST_2ch_DIG] = "3stack-dig",
14450 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
14451 [ALC662_3ST_6ch] = "3stack-6ch",
14452 [ALC662_5ST_DIG] = "6stack-dig",
14453 [ALC662_LENOVO_101E] = "lenovo-101e",
14454 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
14455 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
14456 [ALC663_ASUS_M51VA] = "m51va",
14457 [ALC663_ASUS_G71V] = "g71v",
14458 [ALC663_ASUS_H13] = "h13",
14459 [ALC663_ASUS_G50V] = "g50v",
14460 [ALC662_AUTO] = "auto",
14463 static struct snd_pci_quirk alc662_cfg_tbl[] = {
14464 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
14465 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
14466 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
14467 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
14468 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
14469 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
14470 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
14471 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
14472 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
14473 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
14477 static struct alc_config_preset alc662_presets[] = {
14478 [ALC662_3ST_2ch_DIG] = {
14479 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
14480 .init_verbs = { alc662_init_verbs },
14481 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14482 .dac_nids = alc662_dac_nids,
14483 .dig_out_nid = ALC662_DIGOUT_NID,
14484 .dig_in_nid = ALC662_DIGIN_NID,
14485 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14486 .channel_mode = alc662_3ST_2ch_modes,
14487 .input_mux = &alc662_capture_source,
14489 [ALC662_3ST_6ch_DIG] = {
14490 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14491 alc662_capture_mixer },
14492 .init_verbs = { alc662_init_verbs },
14493 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14494 .dac_nids = alc662_dac_nids,
14495 .dig_out_nid = ALC662_DIGOUT_NID,
14496 .dig_in_nid = ALC662_DIGIN_NID,
14497 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14498 .channel_mode = alc662_3ST_6ch_modes,
14500 .input_mux = &alc662_capture_source,
14502 [ALC662_3ST_6ch] = {
14503 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14504 alc662_capture_mixer },
14505 .init_verbs = { alc662_init_verbs },
14506 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14507 .dac_nids = alc662_dac_nids,
14508 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14509 .channel_mode = alc662_3ST_6ch_modes,
14511 .input_mux = &alc662_capture_source,
14513 [ALC662_5ST_DIG] = {
14514 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
14515 alc662_capture_mixer },
14516 .init_verbs = { alc662_init_verbs },
14517 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14518 .dac_nids = alc662_dac_nids,
14519 .dig_out_nid = ALC662_DIGOUT_NID,
14520 .dig_in_nid = ALC662_DIGIN_NID,
14521 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
14522 .channel_mode = alc662_5stack_modes,
14523 .input_mux = &alc662_capture_source,
14525 [ALC662_LENOVO_101E] = {
14526 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
14527 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
14528 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14529 .dac_nids = alc662_dac_nids,
14530 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14531 .channel_mode = alc662_3ST_2ch_modes,
14532 .input_mux = &alc662_lenovo_101e_capture_source,
14533 .unsol_event = alc662_lenovo_101e_unsol_event,
14534 .init_hook = alc662_lenovo_101e_all_automute,
14536 [ALC662_ASUS_EEEPC_P701] = {
14537 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
14538 .init_verbs = { alc662_init_verbs,
14539 alc662_eeepc_sue_init_verbs },
14540 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14541 .dac_nids = alc662_dac_nids,
14542 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14543 .channel_mode = alc662_3ST_2ch_modes,
14544 .input_mux = &alc662_eeepc_capture_source,
14545 .unsol_event = alc662_eeepc_unsol_event,
14546 .init_hook = alc662_eeepc_inithook,
14548 [ALC662_ASUS_EEEPC_EP20] = {
14549 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
14550 alc662_chmode_mixer },
14551 .init_verbs = { alc662_init_verbs,
14552 alc662_eeepc_ep20_sue_init_verbs },
14553 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14554 .dac_nids = alc662_dac_nids,
14555 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14556 .channel_mode = alc662_3ST_6ch_modes,
14557 .input_mux = &alc662_lenovo_101e_capture_source,
14558 .unsol_event = alc662_eeepc_ep20_unsol_event,
14559 .init_hook = alc662_eeepc_ep20_inithook,
14561 [ALC663_ASUS_M51VA] = {
14562 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14563 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14564 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14565 .dac_nids = alc662_dac_nids,
14566 .dig_out_nid = ALC662_DIGOUT_NID,
14567 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14568 .channel_mode = alc662_3ST_2ch_modes,
14569 .input_mux = &alc663_m51va_capture_source,
14570 .unsol_event = alc663_m51va_unsol_event,
14571 .init_hook = alc663_m51va_inithook,
14573 [ALC663_ASUS_G71V] = {
14574 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
14575 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
14576 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14577 .dac_nids = alc662_dac_nids,
14578 .dig_out_nid = ALC662_DIGOUT_NID,
14579 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14580 .channel_mode = alc662_3ST_2ch_modes,
14581 .input_mux = &alc662_eeepc_capture_source,
14582 .unsol_event = alc663_g71v_unsol_event,
14583 .init_hook = alc663_g71v_inithook,
14585 [ALC663_ASUS_H13] = {
14586 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14587 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14588 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14589 .dac_nids = alc662_dac_nids,
14590 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14591 .channel_mode = alc662_3ST_2ch_modes,
14592 .input_mux = &alc663_m51va_capture_source,
14593 .unsol_event = alc663_m51va_unsol_event,
14594 .init_hook = alc663_m51va_inithook,
14596 [ALC663_ASUS_G50V] = {
14597 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
14598 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
14599 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14600 .dac_nids = alc662_dac_nids,
14601 .dig_out_nid = ALC662_DIGOUT_NID,
14602 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14603 .channel_mode = alc662_3ST_6ch_modes,
14604 .input_mux = &alc663_capture_source,
14605 .unsol_event = alc663_g50v_unsol_event,
14606 .init_hook = alc663_g50v_inithook,
14612 * BIOS auto configuration
14615 /* add playback controls from the parsed DAC table */
14616 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14617 const struct auto_pin_cfg *cfg)
14620 static const char *chname[4] = {
14621 "Front", "Surround", NULL /*CLFE*/, "Side"
14626 for (i = 0; i < cfg->line_outs; i++) {
14627 if (!spec->multiout.dac_nids[i])
14629 nid = alc880_idx_to_dac(i);
14632 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14633 "Center Playback Volume",
14634 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14638 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14639 "LFE Playback Volume",
14640 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14644 err = add_control(spec, ALC_CTL_BIND_MUTE,
14645 "Center Playback Switch",
14646 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
14650 err = add_control(spec, ALC_CTL_BIND_MUTE,
14651 "LFE Playback Switch",
14652 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
14657 sprintf(name, "%s Playback Volume", chname[i]);
14658 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14659 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14663 sprintf(name, "%s Playback Switch", chname[i]);
14664 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14665 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
14674 /* add playback controls for speaker and HP outputs */
14675 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
14686 /* ALC663 has a mono output pin on 0x17 */
14687 sprintf(name, "%s Playback Switch", pfx);
14688 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14689 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
14693 if (alc880_is_fixed_pin(pin)) {
14694 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14695 /* printk("DAC nid=%x\n",nid); */
14696 /* specify the DAC as the extra output */
14697 if (!spec->multiout.hp_nid)
14698 spec->multiout.hp_nid = nid;
14700 spec->multiout.extra_out_nid[0] = nid;
14701 /* control HP volume/switch on the output mixer amp */
14702 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14703 sprintf(name, "%s Playback Volume", pfx);
14704 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14705 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14708 sprintf(name, "%s Playback Switch", pfx);
14709 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14710 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
14713 } else if (alc880_is_multi_pin(pin)) {
14714 /* set manual connection */
14715 /* we have only a switch on HP-out PIN */
14716 sprintf(name, "%s Playback Switch", pfx);
14717 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14718 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14725 /* create playback/capture controls for input pins */
14726 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
14727 const struct auto_pin_cfg *cfg)
14729 struct hda_input_mux *imux = &spec->private_imux;
14732 for (i = 0; i < AUTO_PIN_LAST; i++) {
14733 if (alc880_is_input_pin(cfg->input_pins[i])) {
14734 idx = alc880_input_pin_idx(cfg->input_pins[i]);
14735 err = new_analog_input(spec, cfg->input_pins[i],
14736 auto_pin_cfg_labels[i],
14740 imux->items[imux->num_items].label =
14741 auto_pin_cfg_labels[i];
14742 imux->items[imux->num_items].index =
14743 alc880_input_pin_idx(cfg->input_pins[i]);
14750 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
14751 hda_nid_t nid, int pin_type,
14754 alc_set_pin_output(codec, nid, pin_type);
14755 /* need the manual connection? */
14756 if (alc880_is_multi_pin(nid)) {
14757 struct alc_spec *spec = codec->spec;
14758 int idx = alc880_multi_pin_idx(nid);
14759 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
14760 AC_VERB_SET_CONNECT_SEL,
14761 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
14765 static void alc662_auto_init_multi_out(struct hda_codec *codec)
14767 struct alc_spec *spec = codec->spec;
14770 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14771 for (i = 0; i <= HDA_SIDE; i++) {
14772 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14773 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14775 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
14780 static void alc662_auto_init_hp_out(struct hda_codec *codec)
14782 struct alc_spec *spec = codec->spec;
14785 pin = spec->autocfg.hp_pins[0];
14786 if (pin) /* connect to front */
14788 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14789 pin = spec->autocfg.speaker_pins[0];
14791 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14794 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14795 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14797 static void alc662_auto_init_analog_input(struct hda_codec *codec)
14799 struct alc_spec *spec = codec->spec;
14802 for (i = 0; i < AUTO_PIN_LAST; i++) {
14803 hda_nid_t nid = spec->autocfg.input_pins[i];
14804 if (alc662_is_input_pin(nid)) {
14805 snd_hda_codec_write(codec, nid, 0,
14806 AC_VERB_SET_PIN_WIDGET_CONTROL,
14807 (i <= AUTO_PIN_FRONT_MIC ?
14808 PIN_VREF80 : PIN_IN));
14809 if (nid != ALC662_PIN_CD_NID)
14810 snd_hda_codec_write(codec, nid, 0,
14811 AC_VERB_SET_AMP_GAIN_MUTE,
14817 #define alc662_auto_init_input_src alc882_auto_init_input_src
14819 static int alc662_parse_auto_config(struct hda_codec *codec)
14821 struct alc_spec *spec = codec->spec;
14823 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
14825 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14829 if (!spec->autocfg.line_outs)
14830 return 0; /* can't find valid BIOS pin config */
14832 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14835 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
14838 err = alc662_auto_create_extra_out(spec,
14839 spec->autocfg.speaker_pins[0],
14843 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
14847 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
14851 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14853 if (spec->autocfg.dig_out_pin)
14854 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
14856 if (spec->kctl_alloc)
14857 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14859 spec->num_mux_defs = 1;
14860 spec->input_mux = &spec->private_imux;
14862 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14863 if (codec->vendor_id == 0x10ec0663)
14864 spec->init_verbs[spec->num_init_verbs++] =
14865 alc663_auto_init_verbs;
14867 err = alc_auto_add_mic_boost(codec);
14871 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
14872 spec->num_mixers++;
14876 /* additional initialization for auto-configuration model */
14877 static void alc662_auto_init(struct hda_codec *codec)
14879 struct alc_spec *spec = codec->spec;
14880 alc662_auto_init_multi_out(codec);
14881 alc662_auto_init_hp_out(codec);
14882 alc662_auto_init_analog_input(codec);
14883 alc662_auto_init_input_src(codec);
14884 if (spec->unsol_event)
14885 alc_sku_automute(codec);
14888 static int patch_alc662(struct hda_codec *codec)
14890 struct alc_spec *spec;
14891 int err, board_config;
14893 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14897 codec->spec = spec;
14899 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14901 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
14904 if (board_config < 0) {
14905 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
14906 "trying auto-probe from BIOS...\n");
14907 board_config = ALC662_AUTO;
14910 if (board_config == ALC662_AUTO) {
14911 /* automatic parse from the BIOS config */
14912 err = alc662_parse_auto_config(codec);
14918 "hda_codec: Cannot set up configuration "
14919 "from BIOS. Using base mode...\n");
14920 board_config = ALC662_3ST_2ch_DIG;
14924 if (board_config != ALC662_AUTO)
14925 setup_preset(spec, &alc662_presets[board_config]);
14927 if (codec->vendor_id == 0x10ec0663) {
14928 spec->stream_name_analog = "ALC663 Analog";
14929 spec->stream_name_digital = "ALC663 Digital";
14931 spec->stream_name_analog = "ALC662 Analog";
14932 spec->stream_name_digital = "ALC662 Digital";
14935 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14936 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14938 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14939 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14941 spec->adc_nids = alc662_adc_nids;
14942 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14943 spec->capsrc_nids = alc662_capsrc_nids;
14945 spec->vmaster_nid = 0x02;
14947 codec->patch_ops = alc_patch_ops;
14948 if (board_config == ALC662_AUTO)
14949 spec->init_hook = alc662_auto_init;
14950 #ifdef CONFIG_SND_HDA_POWER_SAVE
14951 if (!spec->loopback.amplist)
14952 spec->loopback.amplist = alc662_loopbacks;
14961 struct hda_codec_preset snd_hda_preset_realtek[] = {
14962 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14963 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14964 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14965 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14966 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14967 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14968 .patch = patch_alc861 },
14969 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14970 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14971 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14972 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14973 .patch = patch_alc883 },
14974 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14975 .patch = patch_alc662 },
14976 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
14977 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14978 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14979 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14980 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14981 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14982 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14983 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14984 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14985 {} /* terminator */