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);
1010 spec->unsol_event = alc_sku_unsol_event;
1014 * Fix-up pin default configurations
1022 static void alc_fix_pincfg(struct hda_codec *codec,
1023 const struct snd_pci_quirk *quirk,
1024 const struct alc_pincfg **pinfix)
1026 const struct alc_pincfg *cfg;
1028 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1032 cfg = pinfix[quirk->value];
1033 for (; cfg->nid; cfg++) {
1036 for (i = 0; i < 4; i++) {
1037 snd_hda_codec_write(codec, cfg->nid, 0,
1038 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1046 * ALC880 3-stack model
1048 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1049 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1050 * F-Mic = 0x1b, HP = 0x19
1053 static hda_nid_t alc880_dac_nids[4] = {
1054 /* front, rear, clfe, rear_surr */
1055 0x02, 0x05, 0x04, 0x03
1058 static hda_nid_t alc880_adc_nids[3] = {
1063 /* The datasheet says the node 0x07 is connected from inputs,
1064 * but it shows zero connection in the real implementation on some devices.
1065 * Note: this is a 915GAV bug, fixed on 915GLV
1067 static hda_nid_t alc880_adc_nids_alt[2] = {
1072 #define ALC880_DIGOUT_NID 0x06
1073 #define ALC880_DIGIN_NID 0x0a
1075 static struct hda_input_mux alc880_capture_source = {
1079 { "Front Mic", 0x3 },
1085 /* channel source setting (2/6 channel selection for 3-stack) */
1087 static struct hda_verb alc880_threestack_ch2_init[] = {
1088 /* set line-in to input, mute it */
1089 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1090 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1091 /* set mic-in to input vref 80%, mute it */
1092 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1093 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1098 static struct hda_verb alc880_threestack_ch6_init[] = {
1099 /* set line-in to output, unmute it */
1100 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1101 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1102 /* set mic-in to output, unmute it */
1103 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1104 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1108 static struct hda_channel_mode alc880_threestack_modes[2] = {
1109 { 2, alc880_threestack_ch2_init },
1110 { 6, alc880_threestack_ch6_init },
1113 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1116 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1117 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1118 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1119 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1120 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1121 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1128 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1129 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1130 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1131 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1135 .name = "Channel Mode",
1136 .info = alc_ch_mode_info,
1137 .get = alc_ch_mode_get,
1138 .put = alc_ch_mode_put,
1143 /* capture mixer elements */
1144 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1145 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1146 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1147 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1148 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1149 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1150 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1153 /* The multiple "Capture Source" controls confuse alsamixer
1154 * So call somewhat different..
1156 /* .name = "Capture Source", */
1157 .name = "Input Source",
1159 .info = alc_mux_enum_info,
1160 .get = alc_mux_enum_get,
1161 .put = alc_mux_enum_put,
1166 /* capture mixer elements (in case NID 0x07 not available) */
1167 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1168 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1169 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1170 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1171 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1173 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1174 /* The multiple "Capture Source" controls confuse alsamixer
1175 * So call somewhat different..
1177 /* .name = "Capture Source", */
1178 .name = "Input Source",
1180 .info = alc_mux_enum_info,
1181 .get = alc_mux_enum_get,
1182 .put = alc_mux_enum_put,
1190 * ALC880 5-stack model
1192 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1194 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1195 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1198 /* additional mixers to alc880_three_stack_mixer */
1199 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1200 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1201 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1205 /* channel source setting (6/8 channel selection for 5-stack) */
1207 static struct hda_verb alc880_fivestack_ch6_init[] = {
1208 /* set line-in to input, mute it */
1209 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1210 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1215 static struct hda_verb alc880_fivestack_ch8_init[] = {
1216 /* set line-in to output, unmute it */
1217 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1218 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1222 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1223 { 6, alc880_fivestack_ch6_init },
1224 { 8, alc880_fivestack_ch8_init },
1229 * ALC880 6-stack model
1231 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1232 * Side = 0x05 (0x0f)
1233 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1234 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1237 static hda_nid_t alc880_6st_dac_nids[4] = {
1238 /* front, rear, clfe, rear_surr */
1239 0x02, 0x03, 0x04, 0x05
1242 static struct hda_input_mux alc880_6stack_capture_source = {
1246 { "Front Mic", 0x1 },
1252 /* fixed 8-channels */
1253 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1257 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1260 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1261 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1262 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1264 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1265 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1266 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1267 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1268 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1269 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1274 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1275 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1276 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1277 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1279 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1280 .name = "Channel Mode",
1281 .info = alc_ch_mode_info,
1282 .get = alc_ch_mode_get,
1283 .put = alc_ch_mode_put,
1292 * W810 has rear IO for:
1295 * Center/LFE (DAC 04)
1298 * The system also has a pair of internal speakers, and a headphone jack.
1299 * These are both connected to Line2 on the codec, hence to DAC 02.
1301 * There is a variable resistor to control the speaker or headphone
1302 * volume. This is a hardware-only device without a software API.
1304 * Plugging headphones in will disable the internal speakers. This is
1305 * implemented in hardware, not via the driver using jack sense. In
1306 * a similar fashion, plugging into the rear socket marked "front" will
1307 * disable both the speakers and headphones.
1309 * For input, there's a microphone jack, and an "audio in" jack.
1310 * These may not do anything useful with this driver yet, because I
1311 * haven't setup any initialization verbs for these yet...
1314 static hda_nid_t alc880_w810_dac_nids[3] = {
1315 /* front, rear/surround, clfe */
1319 /* fixed 6 channels */
1320 static struct hda_channel_mode alc880_w810_modes[1] = {
1324 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1325 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1327 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1328 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1329 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1330 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1331 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1332 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1333 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1342 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1343 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1347 static hda_nid_t alc880_z71v_dac_nids[1] = {
1350 #define ALC880_Z71V_HP_DAC 0x03
1352 /* fixed 2 channels */
1353 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1357 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1358 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1359 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1361 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1362 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1363 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1371 * ALC880 F1734 model
1373 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1374 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1377 static hda_nid_t alc880_f1734_dac_nids[1] = {
1380 #define ALC880_F1734_HP_DAC 0x02
1382 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1384 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1386 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1394 static struct hda_input_mux alc880_f1734_capture_source = {
1406 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1407 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1408 * Mic = 0x18, Line = 0x1a
1411 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1412 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1414 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1418 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1419 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1420 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1421 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1422 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1423 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1424 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1425 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1426 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1427 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1428 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1430 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1431 .name = "Channel Mode",
1432 .info = alc_ch_mode_info,
1433 .get = alc_ch_mode_get,
1434 .put = alc_ch_mode_put,
1440 * ALC880 ASUS W1V model
1442 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1443 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1444 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1447 /* additional mixers to alc880_asus_mixer */
1448 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1449 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1450 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1454 /* additional mixers to alc880_asus_mixer */
1455 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1456 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1457 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1462 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1463 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1464 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1467 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1470 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1471 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1473 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1474 /* The multiple "Capture Source" controls confuse alsamixer
1475 * So call somewhat different..
1477 /* .name = "Capture Source", */
1478 .name = "Input Source",
1480 .info = alc_mux_enum_info,
1481 .get = alc_mux_enum_get,
1482 .put = alc_mux_enum_put,
1488 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1489 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1490 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1491 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1492 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1493 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1494 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1495 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1496 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1497 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1498 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1500 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1505 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1506 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1509 .name = "Channel Mode",
1510 .info = alc_ch_mode_info,
1511 .get = alc_ch_mode_get,
1512 .put = alc_ch_mode_put,
1517 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1518 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1519 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1520 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1521 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1522 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1523 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1524 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1525 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1526 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1527 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1531 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1532 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1533 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1534 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1535 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1542 * virtual master controls
1546 * slave controls for virtual master
1548 static const char *alc_slave_vols[] = {
1549 "Front Playback Volume",
1550 "Surround Playback Volume",
1551 "Center Playback Volume",
1552 "LFE Playback Volume",
1553 "Side Playback Volume",
1554 "Headphone Playback Volume",
1555 "Speaker Playback Volume",
1556 "Mono Playback Volume",
1557 "Line-Out Playback Volume",
1561 static const char *alc_slave_sws[] = {
1562 "Front Playback Switch",
1563 "Surround Playback Switch",
1564 "Center Playback Switch",
1565 "LFE Playback Switch",
1566 "Side Playback Switch",
1567 "Headphone Playback Switch",
1568 "Speaker Playback Switch",
1569 "Mono Playback Switch",
1570 "IEC958 Playback Switch",
1575 * build control elements
1577 static int alc_build_controls(struct hda_codec *codec)
1579 struct alc_spec *spec = codec->spec;
1583 for (i = 0; i < spec->num_mixers; i++) {
1584 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1589 if (spec->multiout.dig_out_nid) {
1590 err = snd_hda_create_spdif_out_ctls(codec,
1591 spec->multiout.dig_out_nid);
1594 err = snd_hda_create_spdif_share_sw(codec,
1598 spec->multiout.share_spdif = 1;
1600 if (spec->dig_in_nid) {
1601 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1606 /* if we have no master control, let's create it */
1607 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1608 unsigned int vmaster_tlv[4];
1609 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1610 HDA_OUTPUT, vmaster_tlv);
1611 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1612 vmaster_tlv, alc_slave_vols);
1616 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1617 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1618 NULL, alc_slave_sws);
1628 * initialize the codec volumes, etc
1632 * generic initialization of ADC, input mixers and output mixers
1634 static struct hda_verb alc880_volume_init_verbs[] = {
1636 * Unmute ADC0-2 and set the default input to mic-in
1638 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1640 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1642 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1643 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1645 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1647 * Note: PASD motherboards uses the Line In 2 as the input for front
1650 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1655 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1656 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1657 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1660 * Set up output mixers (0x0c - 0x0f)
1662 /* set vol=0 to output mixers */
1663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1667 /* set up input amps for analog loopback */
1668 /* Amp Indices: DAC = 0, mixer = 1 */
1669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1671 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1673 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1675 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1682 * 3-stack pin configuration:
1683 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1685 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1687 * preset connection lists of input pins
1688 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1690 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1691 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1692 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1695 * Set pin mode and muting
1697 /* set front pin widgets 0x14 for output */
1698 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1699 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1700 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1702 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1703 /* Mic2 (as headphone out) for HP output */
1704 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1705 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1706 /* Line In pin widget for input */
1707 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1709 /* Line2 (as front mic) pin widget for input and vref at 80% */
1710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1711 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1712 /* CD pin widget for input */
1713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1719 * 5-stack pin configuration:
1720 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1721 * line-in/side = 0x1a, f-mic = 0x1b
1723 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1725 * preset connection lists of input pins
1726 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1728 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1729 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1732 * Set pin mode and muting
1734 /* set pin widgets 0x14-0x17 for output */
1735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1738 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1739 /* unmute pins for output (no gain on this amp) */
1740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1745 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1746 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1747 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1748 /* Mic2 (as headphone out) for HP output */
1749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1751 /* Line In pin widget for input */
1752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1754 /* Line2 (as front mic) pin widget for input and vref at 80% */
1755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1757 /* CD pin widget for input */
1758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1764 * W810 pin configuration:
1765 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1767 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1768 /* hphone/speaker input selector: front DAC */
1769 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1771 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1775 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1776 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1778 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1779 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1785 * Z71V pin configuration:
1786 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1788 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1795 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1797 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1803 * 6-stack pin configuration:
1804 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1805 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1807 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1808 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1810 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1811 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1815 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1816 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1817 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1819 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1821 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1824 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1825 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1833 * Uniwill pin configuration:
1834 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1837 static struct hda_verb alc880_uniwill_init_verbs[] = {
1838 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1846 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1847 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1850 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1855 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1857 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1858 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1859 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1860 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1861 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1862 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1863 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1873 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1875 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1876 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1882 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1886 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1887 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1888 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1889 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1891 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1892 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1893 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1894 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1895 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1896 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1899 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1904 static struct hda_verb alc880_beep_init_verbs[] = {
1905 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1909 /* toggle speaker-output according to the hp-jack state */
1910 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1912 unsigned int present;
1915 present = snd_hda_codec_read(codec, 0x14, 0,
1916 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1917 bits = present ? HDA_AMP_MUTE : 0;
1918 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1919 HDA_AMP_MUTE, bits);
1920 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1921 HDA_AMP_MUTE, bits);
1924 /* auto-toggle front mic */
1925 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1927 unsigned int present;
1930 present = snd_hda_codec_read(codec, 0x18, 0,
1931 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1932 bits = present ? HDA_AMP_MUTE : 0;
1933 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1936 static void alc880_uniwill_automute(struct hda_codec *codec)
1938 alc880_uniwill_hp_automute(codec);
1939 alc880_uniwill_mic_automute(codec);
1942 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1945 /* Looks like the unsol event is incompatible with the standard
1946 * definition. 4bit tag is placed at 28 bit!
1948 switch (res >> 28) {
1949 case ALC880_HP_EVENT:
1950 alc880_uniwill_hp_automute(codec);
1952 case ALC880_MIC_EVENT:
1953 alc880_uniwill_mic_automute(codec);
1958 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1960 unsigned int present;
1963 present = snd_hda_codec_read(codec, 0x14, 0,
1964 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1965 bits = present ? HDA_AMP_MUTE : 0;
1966 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
1969 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1971 unsigned int present;
1973 present = snd_hda_codec_read(codec, 0x21, 0,
1974 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1975 present &= HDA_AMP_VOLMASK;
1976 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1977 HDA_AMP_VOLMASK, present);
1978 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1979 HDA_AMP_VOLMASK, present);
1982 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1985 /* Looks like the unsol event is incompatible with the standard
1986 * definition. 4bit tag is placed at 28 bit!
1988 if ((res >> 28) == ALC880_HP_EVENT)
1989 alc880_uniwill_p53_hp_automute(codec);
1990 if ((res >> 28) == ALC880_DCVOL_EVENT)
1991 alc880_uniwill_p53_dcvol_automute(codec);
1995 * F1734 pin configuration:
1996 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1998 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1999 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2000 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2001 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2002 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2003 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2010 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2011 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2012 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2013 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2014 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2015 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2016 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2017 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2018 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2020 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2021 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2027 * ASUS pin configuration:
2028 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2030 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2031 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2032 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2033 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2034 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2037 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2039 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2040 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2041 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2042 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2043 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2045 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2046 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2047 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2049 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2052 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2053 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2058 /* Enable GPIO mask and set output */
2059 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2060 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2062 /* Clevo m520g init */
2063 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2064 /* headphone output */
2065 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2068 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2073 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2074 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2075 /* Mic1 (rear panel) */
2076 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2077 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2078 /* Mic2 (front panel) */
2079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2080 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2082 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2083 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2084 /* change to EAPD mode */
2085 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2086 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2091 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2092 /* change to EAPD mode */
2093 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2094 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2096 /* Headphone output */
2097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2099 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2100 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2102 /* Line In pin widget for input */
2103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2104 /* CD pin widget for input */
2105 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2106 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2107 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2109 /* change to EAPD mode */
2110 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2111 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2117 * LG m1 express dual
2120 * Rear Line-In/Out (blue): 0x14
2121 * Build-in Mic-In: 0x15
2123 * HP-Out (green): 0x1b
2124 * Mic-In/Out (red): 0x19
2128 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2129 static hda_nid_t alc880_lg_dac_nids[3] = {
2133 /* seems analog CD is not working */
2134 static struct hda_input_mux alc880_lg_capture_source = {
2139 { "Internal Mic", 0x6 },
2143 /* 2,4,6 channel modes */
2144 static struct hda_verb alc880_lg_ch2_init[] = {
2145 /* set line-in and mic-in to input */
2146 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2147 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2151 static struct hda_verb alc880_lg_ch4_init[] = {
2152 /* set line-in to out and mic-in to input */
2153 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2154 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2158 static struct hda_verb alc880_lg_ch6_init[] = {
2159 /* set line-in and mic-in to output */
2160 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2161 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2165 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2166 { 2, alc880_lg_ch2_init },
2167 { 4, alc880_lg_ch4_init },
2168 { 6, alc880_lg_ch6_init },
2171 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2173 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2174 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2175 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2176 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2177 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2178 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2179 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2184 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2185 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2187 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2188 .name = "Channel Mode",
2189 .info = alc_ch_mode_info,
2190 .get = alc_ch_mode_get,
2191 .put = alc_ch_mode_put,
2196 static struct hda_verb alc880_lg_init_verbs[] = {
2197 /* set capture source to mic-in */
2198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2199 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2200 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2201 /* mute all amp mixer inputs */
2202 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2205 /* line-in to input */
2206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2212 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2213 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2214 /* mic-in to input */
2215 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2216 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2217 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2219 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2220 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2221 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2227 /* toggle speaker-output according to the hp-jack state */
2228 static void alc880_lg_automute(struct hda_codec *codec)
2230 unsigned int present;
2233 present = snd_hda_codec_read(codec, 0x1b, 0,
2234 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2235 bits = present ? HDA_AMP_MUTE : 0;
2236 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2237 HDA_AMP_MUTE, bits);
2240 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2242 /* Looks like the unsol event is incompatible with the standard
2243 * definition. 4bit tag is placed at 28 bit!
2245 if ((res >> 28) == 0x01)
2246 alc880_lg_automute(codec);
2255 * Built-in Mic-In: 0x19
2261 static struct hda_input_mux alc880_lg_lw_capture_source = {
2265 { "Internal Mic", 0x1 },
2270 #define alc880_lg_lw_modes alc880_threestack_modes
2272 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2274 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2275 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2276 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2277 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2278 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2279 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2280 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2281 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2282 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2283 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2284 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2285 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2286 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2289 .name = "Channel Mode",
2290 .info = alc_ch_mode_info,
2291 .get = alc_ch_mode_get,
2292 .put = alc_ch_mode_put,
2297 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2298 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2299 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2300 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2302 /* set capture source to mic-in */
2303 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2311 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2312 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2313 /* mic-in to input */
2314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2317 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2320 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2324 /* toggle speaker-output according to the hp-jack state */
2325 static void alc880_lg_lw_automute(struct hda_codec *codec)
2327 unsigned int present;
2330 present = snd_hda_codec_read(codec, 0x1b, 0,
2331 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2332 bits = present ? HDA_AMP_MUTE : 0;
2333 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2334 HDA_AMP_MUTE, bits);
2337 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2339 /* Looks like the unsol event is incompatible with the standard
2340 * definition. 4bit tag is placed at 28 bit!
2342 if ((res >> 28) == 0x01)
2343 alc880_lg_lw_automute(codec);
2346 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2347 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2348 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2351 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2352 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2356 static struct hda_input_mux alc880_medion_rim_capture_source = {
2360 { "Internal Mic", 0x1 },
2364 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2365 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2367 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2368 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2370 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2373 /* Mic2 (as headphone out) for HP output */
2374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2376 /* Internal Speaker */
2377 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2378 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2380 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2381 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2383 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2387 /* toggle speaker-output according to the hp-jack state */
2388 static void alc880_medion_rim_automute(struct hda_codec *codec)
2390 unsigned int present;
2393 present = snd_hda_codec_read(codec, 0x14, 0,
2394 AC_VERB_GET_PIN_SENSE, 0)
2395 & AC_PINSENSE_PRESENCE;
2396 bits = present ? HDA_AMP_MUTE : 0;
2397 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2398 HDA_AMP_MUTE, bits);
2400 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2402 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2405 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2408 /* Looks like the unsol event is incompatible with the standard
2409 * definition. 4bit tag is placed at 28 bit!
2411 if ((res >> 28) == ALC880_HP_EVENT)
2412 alc880_medion_rim_automute(codec);
2415 #ifdef CONFIG_SND_HDA_POWER_SAVE
2416 static struct hda_amp_list alc880_loopbacks[] = {
2417 { 0x0b, HDA_INPUT, 0 },
2418 { 0x0b, HDA_INPUT, 1 },
2419 { 0x0b, HDA_INPUT, 2 },
2420 { 0x0b, HDA_INPUT, 3 },
2421 { 0x0b, HDA_INPUT, 4 },
2425 static struct hda_amp_list alc880_lg_loopbacks[] = {
2426 { 0x0b, HDA_INPUT, 1 },
2427 { 0x0b, HDA_INPUT, 6 },
2428 { 0x0b, HDA_INPUT, 7 },
2437 static int alc_init(struct hda_codec *codec)
2439 struct alc_spec *spec = codec->spec;
2443 if (codec->vendor_id == 0x10ec0888)
2444 alc888_coef_init(codec);
2446 for (i = 0; i < spec->num_init_verbs; i++)
2447 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2449 if (spec->init_hook)
2450 spec->init_hook(codec);
2455 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2457 struct alc_spec *spec = codec->spec;
2459 if (spec->unsol_event)
2460 spec->unsol_event(codec, res);
2463 #ifdef CONFIG_SND_HDA_POWER_SAVE
2464 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2466 struct alc_spec *spec = codec->spec;
2467 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2472 * Analog playback callbacks
2474 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2475 struct hda_codec *codec,
2476 struct snd_pcm_substream *substream)
2478 struct alc_spec *spec = codec->spec;
2479 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2483 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2484 struct hda_codec *codec,
2485 unsigned int stream_tag,
2486 unsigned int format,
2487 struct snd_pcm_substream *substream)
2489 struct alc_spec *spec = codec->spec;
2490 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2491 stream_tag, format, substream);
2494 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2495 struct hda_codec *codec,
2496 struct snd_pcm_substream *substream)
2498 struct alc_spec *spec = codec->spec;
2499 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2505 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2506 struct hda_codec *codec,
2507 struct snd_pcm_substream *substream)
2509 struct alc_spec *spec = codec->spec;
2510 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2513 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2514 struct hda_codec *codec,
2515 unsigned int stream_tag,
2516 unsigned int format,
2517 struct snd_pcm_substream *substream)
2519 struct alc_spec *spec = codec->spec;
2520 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2521 stream_tag, format, substream);
2524 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2525 struct hda_codec *codec,
2526 struct snd_pcm_substream *substream)
2528 struct alc_spec *spec = codec->spec;
2529 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2535 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2536 struct hda_codec *codec,
2537 unsigned int stream_tag,
2538 unsigned int format,
2539 struct snd_pcm_substream *substream)
2541 struct alc_spec *spec = codec->spec;
2543 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2544 stream_tag, 0, format);
2548 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2549 struct hda_codec *codec,
2550 struct snd_pcm_substream *substream)
2552 struct alc_spec *spec = codec->spec;
2554 snd_hda_codec_cleanup_stream(codec,
2555 spec->adc_nids[substream->number + 1]);
2562 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2566 /* NID is set in alc_build_pcms */
2568 .open = alc880_playback_pcm_open,
2569 .prepare = alc880_playback_pcm_prepare,
2570 .cleanup = alc880_playback_pcm_cleanup
2574 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2578 /* NID is set in alc_build_pcms */
2581 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2585 /* NID is set in alc_build_pcms */
2588 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2589 .substreams = 2, /* can be overridden */
2592 /* NID is set in alc_build_pcms */
2594 .prepare = alc880_alt_capture_pcm_prepare,
2595 .cleanup = alc880_alt_capture_pcm_cleanup
2599 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2603 /* NID is set in alc_build_pcms */
2605 .open = alc880_dig_playback_pcm_open,
2606 .close = alc880_dig_playback_pcm_close,
2607 .prepare = alc880_dig_playback_pcm_prepare
2611 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2615 /* NID is set in alc_build_pcms */
2618 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2619 static struct hda_pcm_stream alc_pcm_null_stream = {
2625 static int alc_build_pcms(struct hda_codec *codec)
2627 struct alc_spec *spec = codec->spec;
2628 struct hda_pcm *info = spec->pcm_rec;
2631 codec->num_pcms = 1;
2632 codec->pcm_info = info;
2634 info->name = spec->stream_name_analog;
2635 if (spec->stream_analog_playback) {
2636 if (snd_BUG_ON(!spec->multiout.dac_nids))
2638 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2639 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2641 if (spec->stream_analog_capture) {
2642 if (snd_BUG_ON(!spec->adc_nids))
2644 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2645 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2648 if (spec->channel_mode) {
2649 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2650 for (i = 0; i < spec->num_channel_mode; i++) {
2651 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2652 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2657 /* SPDIF for stream index #1 */
2658 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2659 codec->num_pcms = 2;
2660 info = spec->pcm_rec + 1;
2661 info->name = spec->stream_name_digital;
2662 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2663 if (spec->multiout.dig_out_nid &&
2664 spec->stream_digital_playback) {
2665 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2666 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2668 if (spec->dig_in_nid &&
2669 spec->stream_digital_capture) {
2670 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2671 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2675 /* If the use of more than one ADC is requested for the current
2676 * model, configure a second analog capture-only PCM.
2678 /* Additional Analaog capture for index #2 */
2679 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2680 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2681 codec->num_pcms = 3;
2682 info = spec->pcm_rec + 2;
2683 info->name = spec->stream_name_analog;
2684 if (spec->alt_dac_nid) {
2685 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2686 *spec->stream_analog_alt_playback;
2687 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2690 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2691 alc_pcm_null_stream;
2692 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2694 if (spec->num_adc_nids > 1) {
2695 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2696 *spec->stream_analog_alt_capture;
2697 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2699 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2700 spec->num_adc_nids - 1;
2702 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2703 alc_pcm_null_stream;
2704 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2711 static void alc_free(struct hda_codec *codec)
2713 struct alc_spec *spec = codec->spec;
2719 if (spec->kctl_alloc) {
2720 for (i = 0; i < spec->num_kctl_used; i++)
2721 kfree(spec->kctl_alloc[i].name);
2722 kfree(spec->kctl_alloc);
2725 codec->spec = NULL; /* to be sure */
2730 static struct hda_codec_ops alc_patch_ops = {
2731 .build_controls = alc_build_controls,
2732 .build_pcms = alc_build_pcms,
2735 .unsol_event = alc_unsol_event,
2736 #ifdef CONFIG_SND_HDA_POWER_SAVE
2737 .check_power_status = alc_check_power_status,
2743 * Test configuration for debugging
2745 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2748 #ifdef CONFIG_SND_DEBUG
2749 static hda_nid_t alc880_test_dac_nids[4] = {
2750 0x02, 0x03, 0x04, 0x05
2753 static struct hda_input_mux alc880_test_capture_source = {
2762 { "Surround", 0x6 },
2766 static struct hda_channel_mode alc880_test_modes[4] = {
2773 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2774 struct snd_ctl_elem_info *uinfo)
2776 static char *texts[] = {
2777 "N/A", "Line Out", "HP Out",
2778 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2780 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2782 uinfo->value.enumerated.items = 8;
2783 if (uinfo->value.enumerated.item >= 8)
2784 uinfo->value.enumerated.item = 7;
2785 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2789 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2790 struct snd_ctl_elem_value *ucontrol)
2792 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2793 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2794 unsigned int pin_ctl, item = 0;
2796 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2797 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2798 if (pin_ctl & AC_PINCTL_OUT_EN) {
2799 if (pin_ctl & AC_PINCTL_HP_EN)
2803 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2804 switch (pin_ctl & AC_PINCTL_VREFEN) {
2805 case AC_PINCTL_VREF_HIZ: item = 3; break;
2806 case AC_PINCTL_VREF_50: item = 4; break;
2807 case AC_PINCTL_VREF_GRD: item = 5; break;
2808 case AC_PINCTL_VREF_80: item = 6; break;
2809 case AC_PINCTL_VREF_100: item = 7; break;
2812 ucontrol->value.enumerated.item[0] = item;
2816 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2817 struct snd_ctl_elem_value *ucontrol)
2819 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2820 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2821 static unsigned int ctls[] = {
2822 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2823 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2824 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2825 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2826 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2827 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2829 unsigned int old_ctl, new_ctl;
2831 old_ctl = snd_hda_codec_read(codec, nid, 0,
2832 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2833 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2834 if (old_ctl != new_ctl) {
2836 snd_hda_codec_write_cache(codec, nid, 0,
2837 AC_VERB_SET_PIN_WIDGET_CONTROL,
2839 val = ucontrol->value.enumerated.item[0] >= 3 ?
2841 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2848 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2849 struct snd_ctl_elem_info *uinfo)
2851 static char *texts[] = {
2852 "Front", "Surround", "CLFE", "Side"
2854 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2856 uinfo->value.enumerated.items = 4;
2857 if (uinfo->value.enumerated.item >= 4)
2858 uinfo->value.enumerated.item = 3;
2859 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2863 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2864 struct snd_ctl_elem_value *ucontrol)
2866 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2867 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2870 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2871 ucontrol->value.enumerated.item[0] = sel & 3;
2875 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2876 struct snd_ctl_elem_value *ucontrol)
2878 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2879 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2882 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2883 if (ucontrol->value.enumerated.item[0] != sel) {
2884 sel = ucontrol->value.enumerated.item[0] & 3;
2885 snd_hda_codec_write_cache(codec, nid, 0,
2886 AC_VERB_SET_CONNECT_SEL, sel);
2892 #define PIN_CTL_TEST(xname,nid) { \
2893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2895 .info = alc_test_pin_ctl_info, \
2896 .get = alc_test_pin_ctl_get, \
2897 .put = alc_test_pin_ctl_put, \
2898 .private_value = nid \
2901 #define PIN_SRC_TEST(xname,nid) { \
2902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2904 .info = alc_test_pin_src_info, \
2905 .get = alc_test_pin_src_get, \
2906 .put = alc_test_pin_src_put, \
2907 .private_value = nid \
2910 static struct snd_kcontrol_new alc880_test_mixer[] = {
2911 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2912 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2913 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2914 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2915 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2916 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2917 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2918 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2919 PIN_CTL_TEST("Front Pin Mode", 0x14),
2920 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2921 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2922 PIN_CTL_TEST("Side Pin Mode", 0x17),
2923 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2924 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2925 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2926 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2927 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2928 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2929 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2930 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2931 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2932 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2933 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2934 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2935 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2936 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2937 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2938 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2943 .name = "Channel Mode",
2944 .info = alc_ch_mode_info,
2945 .get = alc_ch_mode_get,
2946 .put = alc_ch_mode_put,
2951 static struct hda_verb alc880_test_init_verbs[] = {
2952 /* Unmute inputs of 0x0c - 0x0f */
2953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2955 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2957 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2959 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2960 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2961 /* Vol output for 0x0c-0x0f */
2962 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2963 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2964 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2965 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2966 /* Set output pins 0x14-0x17 */
2967 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2969 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2970 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2971 /* Unmute output pins 0x14-0x17 */
2972 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2973 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2974 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2975 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2976 /* Set input pins 0x18-0x1c */
2977 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2978 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2979 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2981 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2982 /* Mute input pins 0x18-0x1b */
2983 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2984 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2985 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2986 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2989 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2991 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2992 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2993 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2994 /* Analog input/passthru */
2995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2996 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2998 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2999 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3007 static const char *alc880_models[ALC880_MODEL_LAST] = {
3008 [ALC880_3ST] = "3stack",
3009 [ALC880_TCL_S700] = "tcl",
3010 [ALC880_3ST_DIG] = "3stack-digout",
3011 [ALC880_CLEVO] = "clevo",
3012 [ALC880_5ST] = "5stack",
3013 [ALC880_5ST_DIG] = "5stack-digout",
3014 [ALC880_W810] = "w810",
3015 [ALC880_Z71V] = "z71v",
3016 [ALC880_6ST] = "6stack",
3017 [ALC880_6ST_DIG] = "6stack-digout",
3018 [ALC880_ASUS] = "asus",
3019 [ALC880_ASUS_W1V] = "asus-w1v",
3020 [ALC880_ASUS_DIG] = "asus-dig",
3021 [ALC880_ASUS_DIG2] = "asus-dig2",
3022 [ALC880_UNIWILL_DIG] = "uniwill",
3023 [ALC880_UNIWILL_P53] = "uniwill-p53",
3024 [ALC880_FUJITSU] = "fujitsu",
3025 [ALC880_F1734] = "F1734",
3027 [ALC880_LG_LW] = "lg-lw",
3028 [ALC880_MEDION_RIM] = "medion",
3029 #ifdef CONFIG_SND_DEBUG
3030 [ALC880_TEST] = "test",
3032 [ALC880_AUTO] = "auto",
3035 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3036 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3037 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3038 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3039 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3040 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3041 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3042 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3043 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3044 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3045 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3046 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3047 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3048 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3049 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3050 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3051 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3052 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3053 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3054 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3055 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3056 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3057 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3058 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3059 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3060 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3061 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3062 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3063 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3064 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3065 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3066 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3067 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3068 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3069 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3070 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3071 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3072 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3073 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3074 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3075 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3076 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3077 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3078 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3079 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3080 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3081 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3082 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3083 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3084 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3085 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3086 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3087 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3088 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3089 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3090 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3091 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3092 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3093 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3094 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3095 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3096 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3097 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3098 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3099 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3100 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3101 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3102 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3103 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3104 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3105 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3106 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3111 * ALC880 codec presets
3113 static struct alc_config_preset alc880_presets[] = {
3115 .mixers = { alc880_three_stack_mixer },
3116 .init_verbs = { alc880_volume_init_verbs,
3117 alc880_pin_3stack_init_verbs },
3118 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3119 .dac_nids = alc880_dac_nids,
3120 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3121 .channel_mode = alc880_threestack_modes,
3123 .input_mux = &alc880_capture_source,
3125 [ALC880_3ST_DIG] = {
3126 .mixers = { alc880_three_stack_mixer },
3127 .init_verbs = { alc880_volume_init_verbs,
3128 alc880_pin_3stack_init_verbs },
3129 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3130 .dac_nids = alc880_dac_nids,
3131 .dig_out_nid = ALC880_DIGOUT_NID,
3132 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3133 .channel_mode = alc880_threestack_modes,
3135 .input_mux = &alc880_capture_source,
3137 [ALC880_TCL_S700] = {
3138 .mixers = { alc880_tcl_s700_mixer },
3139 .init_verbs = { alc880_volume_init_verbs,
3140 alc880_pin_tcl_S700_init_verbs,
3141 alc880_gpio2_init_verbs },
3142 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3143 .dac_nids = alc880_dac_nids,
3145 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3146 .channel_mode = alc880_2_jack_modes,
3147 .input_mux = &alc880_capture_source,
3150 .mixers = { alc880_three_stack_mixer,
3151 alc880_five_stack_mixer},
3152 .init_verbs = { alc880_volume_init_verbs,
3153 alc880_pin_5stack_init_verbs },
3154 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3155 .dac_nids = alc880_dac_nids,
3156 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3157 .channel_mode = alc880_fivestack_modes,
3158 .input_mux = &alc880_capture_source,
3160 [ALC880_5ST_DIG] = {
3161 .mixers = { alc880_three_stack_mixer,
3162 alc880_five_stack_mixer },
3163 .init_verbs = { alc880_volume_init_verbs,
3164 alc880_pin_5stack_init_verbs },
3165 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3166 .dac_nids = alc880_dac_nids,
3167 .dig_out_nid = ALC880_DIGOUT_NID,
3168 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3169 .channel_mode = alc880_fivestack_modes,
3170 .input_mux = &alc880_capture_source,
3173 .mixers = { alc880_six_stack_mixer },
3174 .init_verbs = { alc880_volume_init_verbs,
3175 alc880_pin_6stack_init_verbs },
3176 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3177 .dac_nids = alc880_6st_dac_nids,
3178 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3179 .channel_mode = alc880_sixstack_modes,
3180 .input_mux = &alc880_6stack_capture_source,
3182 [ALC880_6ST_DIG] = {
3183 .mixers = { alc880_six_stack_mixer },
3184 .init_verbs = { alc880_volume_init_verbs,
3185 alc880_pin_6stack_init_verbs },
3186 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3187 .dac_nids = alc880_6st_dac_nids,
3188 .dig_out_nid = ALC880_DIGOUT_NID,
3189 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3190 .channel_mode = alc880_sixstack_modes,
3191 .input_mux = &alc880_6stack_capture_source,
3194 .mixers = { alc880_w810_base_mixer },
3195 .init_verbs = { alc880_volume_init_verbs,
3196 alc880_pin_w810_init_verbs,
3197 alc880_gpio2_init_verbs },
3198 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3199 .dac_nids = alc880_w810_dac_nids,
3200 .dig_out_nid = ALC880_DIGOUT_NID,
3201 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3202 .channel_mode = alc880_w810_modes,
3203 .input_mux = &alc880_capture_source,
3206 .mixers = { alc880_z71v_mixer },
3207 .init_verbs = { alc880_volume_init_verbs,
3208 alc880_pin_z71v_init_verbs },
3209 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3210 .dac_nids = alc880_z71v_dac_nids,
3211 .dig_out_nid = ALC880_DIGOUT_NID,
3213 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3214 .channel_mode = alc880_2_jack_modes,
3215 .input_mux = &alc880_capture_source,
3218 .mixers = { alc880_f1734_mixer },
3219 .init_verbs = { alc880_volume_init_verbs,
3220 alc880_pin_f1734_init_verbs },
3221 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3222 .dac_nids = alc880_f1734_dac_nids,
3224 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3225 .channel_mode = alc880_2_jack_modes,
3226 .input_mux = &alc880_f1734_capture_source,
3227 .unsol_event = alc880_uniwill_p53_unsol_event,
3228 .init_hook = alc880_uniwill_p53_hp_automute,
3231 .mixers = { alc880_asus_mixer },
3232 .init_verbs = { alc880_volume_init_verbs,
3233 alc880_pin_asus_init_verbs,
3234 alc880_gpio1_init_verbs },
3235 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3236 .dac_nids = alc880_asus_dac_nids,
3237 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3238 .channel_mode = alc880_asus_modes,
3240 .input_mux = &alc880_capture_source,
3242 [ALC880_ASUS_DIG] = {
3243 .mixers = { alc880_asus_mixer },
3244 .init_verbs = { alc880_volume_init_verbs,
3245 alc880_pin_asus_init_verbs,
3246 alc880_gpio1_init_verbs },
3247 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3248 .dac_nids = alc880_asus_dac_nids,
3249 .dig_out_nid = ALC880_DIGOUT_NID,
3250 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3251 .channel_mode = alc880_asus_modes,
3253 .input_mux = &alc880_capture_source,
3255 [ALC880_ASUS_DIG2] = {
3256 .mixers = { alc880_asus_mixer },
3257 .init_verbs = { alc880_volume_init_verbs,
3258 alc880_pin_asus_init_verbs,
3259 alc880_gpio2_init_verbs }, /* use GPIO2 */
3260 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3261 .dac_nids = alc880_asus_dac_nids,
3262 .dig_out_nid = ALC880_DIGOUT_NID,
3263 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3264 .channel_mode = alc880_asus_modes,
3266 .input_mux = &alc880_capture_source,
3268 [ALC880_ASUS_W1V] = {
3269 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3270 .init_verbs = { alc880_volume_init_verbs,
3271 alc880_pin_asus_init_verbs,
3272 alc880_gpio1_init_verbs },
3273 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3274 .dac_nids = alc880_asus_dac_nids,
3275 .dig_out_nid = ALC880_DIGOUT_NID,
3276 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3277 .channel_mode = alc880_asus_modes,
3279 .input_mux = &alc880_capture_source,
3281 [ALC880_UNIWILL_DIG] = {
3282 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3283 .init_verbs = { alc880_volume_init_verbs,
3284 alc880_pin_asus_init_verbs },
3285 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3286 .dac_nids = alc880_asus_dac_nids,
3287 .dig_out_nid = ALC880_DIGOUT_NID,
3288 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3289 .channel_mode = alc880_asus_modes,
3291 .input_mux = &alc880_capture_source,
3293 [ALC880_UNIWILL] = {
3294 .mixers = { alc880_uniwill_mixer },
3295 .init_verbs = { alc880_volume_init_verbs,
3296 alc880_uniwill_init_verbs },
3297 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3298 .dac_nids = alc880_asus_dac_nids,
3299 .dig_out_nid = ALC880_DIGOUT_NID,
3300 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3301 .channel_mode = alc880_threestack_modes,
3303 .input_mux = &alc880_capture_source,
3304 .unsol_event = alc880_uniwill_unsol_event,
3305 .init_hook = alc880_uniwill_automute,
3307 [ALC880_UNIWILL_P53] = {
3308 .mixers = { alc880_uniwill_p53_mixer },
3309 .init_verbs = { alc880_volume_init_verbs,
3310 alc880_uniwill_p53_init_verbs },
3311 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3312 .dac_nids = alc880_asus_dac_nids,
3313 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3314 .channel_mode = alc880_threestack_modes,
3315 .input_mux = &alc880_capture_source,
3316 .unsol_event = alc880_uniwill_p53_unsol_event,
3317 .init_hook = alc880_uniwill_p53_hp_automute,
3319 [ALC880_FUJITSU] = {
3320 .mixers = { alc880_fujitsu_mixer,
3321 alc880_pcbeep_mixer, },
3322 .init_verbs = { alc880_volume_init_verbs,
3323 alc880_uniwill_p53_init_verbs,
3324 alc880_beep_init_verbs },
3325 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3326 .dac_nids = alc880_dac_nids,
3327 .dig_out_nid = ALC880_DIGOUT_NID,
3328 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3329 .channel_mode = alc880_2_jack_modes,
3330 .input_mux = &alc880_capture_source,
3331 .unsol_event = alc880_uniwill_p53_unsol_event,
3332 .init_hook = alc880_uniwill_p53_hp_automute,
3335 .mixers = { alc880_three_stack_mixer },
3336 .init_verbs = { alc880_volume_init_verbs,
3337 alc880_pin_clevo_init_verbs },
3338 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3339 .dac_nids = alc880_dac_nids,
3341 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3342 .channel_mode = alc880_threestack_modes,
3344 .input_mux = &alc880_capture_source,
3347 .mixers = { alc880_lg_mixer },
3348 .init_verbs = { alc880_volume_init_verbs,
3349 alc880_lg_init_verbs },
3350 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3351 .dac_nids = alc880_lg_dac_nids,
3352 .dig_out_nid = ALC880_DIGOUT_NID,
3353 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3354 .channel_mode = alc880_lg_ch_modes,
3356 .input_mux = &alc880_lg_capture_source,
3357 .unsol_event = alc880_lg_unsol_event,
3358 .init_hook = alc880_lg_automute,
3359 #ifdef CONFIG_SND_HDA_POWER_SAVE
3360 .loopbacks = alc880_lg_loopbacks,
3364 .mixers = { alc880_lg_lw_mixer },
3365 .init_verbs = { alc880_volume_init_verbs,
3366 alc880_lg_lw_init_verbs },
3367 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3368 .dac_nids = alc880_dac_nids,
3369 .dig_out_nid = ALC880_DIGOUT_NID,
3370 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3371 .channel_mode = alc880_lg_lw_modes,
3372 .input_mux = &alc880_lg_lw_capture_source,
3373 .unsol_event = alc880_lg_lw_unsol_event,
3374 .init_hook = alc880_lg_lw_automute,
3376 [ALC880_MEDION_RIM] = {
3377 .mixers = { alc880_medion_rim_mixer },
3378 .init_verbs = { alc880_volume_init_verbs,
3379 alc880_medion_rim_init_verbs,
3380 alc_gpio2_init_verbs },
3381 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3382 .dac_nids = alc880_dac_nids,
3383 .dig_out_nid = ALC880_DIGOUT_NID,
3384 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3385 .channel_mode = alc880_2_jack_modes,
3386 .input_mux = &alc880_medion_rim_capture_source,
3387 .unsol_event = alc880_medion_rim_unsol_event,
3388 .init_hook = alc880_medion_rim_automute,
3390 #ifdef CONFIG_SND_DEBUG
3392 .mixers = { alc880_test_mixer },
3393 .init_verbs = { alc880_test_init_verbs },
3394 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3395 .dac_nids = alc880_test_dac_nids,
3396 .dig_out_nid = ALC880_DIGOUT_NID,
3397 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3398 .channel_mode = alc880_test_modes,
3399 .input_mux = &alc880_test_capture_source,
3405 * Automatic parse of I/O pins from the BIOS configuration
3408 #define NUM_CONTROL_ALLOC 32
3409 #define NUM_VERB_ALLOC 32
3413 ALC_CTL_WIDGET_MUTE,
3416 static struct snd_kcontrol_new alc880_control_templates[] = {
3417 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3418 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3419 HDA_BIND_MUTE(NULL, 0, 0, 0),
3422 /* add dynamic controls */
3423 static int add_control(struct alc_spec *spec, int type, const char *name,
3426 struct snd_kcontrol_new *knew;
3428 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3429 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3431 /* array + terminator */
3432 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3435 if (spec->kctl_alloc) {
3436 memcpy(knew, spec->kctl_alloc,
3437 sizeof(*knew) * spec->num_kctl_alloc);
3438 kfree(spec->kctl_alloc);
3440 spec->kctl_alloc = knew;
3441 spec->num_kctl_alloc = num;
3444 knew = &spec->kctl_alloc[spec->num_kctl_used];
3445 *knew = alc880_control_templates[type];
3446 knew->name = kstrdup(name, GFP_KERNEL);
3449 knew->private_value = val;
3450 spec->num_kctl_used++;
3454 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3455 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3456 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3457 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3458 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3459 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3460 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3461 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3462 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3463 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3464 #define ALC880_PIN_CD_NID 0x1c
3466 /* fill in the dac_nids table from the parsed pin configuration */
3467 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3468 const struct auto_pin_cfg *cfg)
3474 memset(assigned, 0, sizeof(assigned));
3475 spec->multiout.dac_nids = spec->private_dac_nids;
3477 /* check the pins hardwired to audio widget */
3478 for (i = 0; i < cfg->line_outs; i++) {
3479 nid = cfg->line_out_pins[i];
3480 if (alc880_is_fixed_pin(nid)) {
3481 int idx = alc880_fixed_pin_idx(nid);
3482 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3486 /* left pins can be connect to any audio widget */
3487 for (i = 0; i < cfg->line_outs; i++) {
3488 nid = cfg->line_out_pins[i];
3489 if (alc880_is_fixed_pin(nid))
3491 /* search for an empty channel */
3492 for (j = 0; j < cfg->line_outs; j++) {
3494 spec->multiout.dac_nids[i] =
3495 alc880_idx_to_dac(j);
3501 spec->multiout.num_dacs = cfg->line_outs;
3505 /* add playback controls from the parsed DAC table */
3506 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3507 const struct auto_pin_cfg *cfg)
3510 static const char *chname[4] = {
3511 "Front", "Surround", NULL /*CLFE*/, "Side"
3516 for (i = 0; i < cfg->line_outs; i++) {
3517 if (!spec->multiout.dac_nids[i])
3519 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3522 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3523 "Center Playback Volume",
3524 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3528 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3529 "LFE Playback Volume",
3530 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3534 err = add_control(spec, ALC_CTL_BIND_MUTE,
3535 "Center Playback Switch",
3536 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3540 err = add_control(spec, ALC_CTL_BIND_MUTE,
3541 "LFE Playback Switch",
3542 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3547 sprintf(name, "%s Playback Volume", chname[i]);
3548 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3549 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3553 sprintf(name, "%s Playback Switch", chname[i]);
3554 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3555 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3564 /* add playback controls for speaker and HP outputs */
3565 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3575 if (alc880_is_fixed_pin(pin)) {
3576 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3577 /* specify the DAC as the extra output */
3578 if (!spec->multiout.hp_nid)
3579 spec->multiout.hp_nid = nid;
3581 spec->multiout.extra_out_nid[0] = nid;
3582 /* control HP volume/switch on the output mixer amp */
3583 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3584 sprintf(name, "%s Playback Volume", pfx);
3585 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3586 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3589 sprintf(name, "%s Playback Switch", pfx);
3590 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3591 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3594 } else if (alc880_is_multi_pin(pin)) {
3595 /* set manual connection */
3596 /* we have only a switch on HP-out PIN */
3597 sprintf(name, "%s Playback Switch", pfx);
3598 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3599 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3606 /* create input playback/capture controls for the given pin */
3607 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3608 const char *ctlname,
3609 int idx, hda_nid_t mix_nid)
3614 sprintf(name, "%s Playback Volume", ctlname);
3615 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3616 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3619 sprintf(name, "%s Playback Switch", ctlname);
3620 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3621 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3627 /* create playback/capture controls for input pins */
3628 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3629 const struct auto_pin_cfg *cfg)
3631 struct hda_input_mux *imux = &spec->private_imux;
3634 for (i = 0; i < AUTO_PIN_LAST; i++) {
3635 if (alc880_is_input_pin(cfg->input_pins[i])) {
3636 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3637 err = new_analog_input(spec, cfg->input_pins[i],
3638 auto_pin_cfg_labels[i],
3642 imux->items[imux->num_items].label =
3643 auto_pin_cfg_labels[i];
3644 imux->items[imux->num_items].index =
3645 alc880_input_pin_idx(cfg->input_pins[i]);
3652 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3653 unsigned int pin_type)
3655 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3658 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3662 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3663 hda_nid_t nid, int pin_type,
3666 alc_set_pin_output(codec, nid, pin_type);
3667 /* need the manual connection? */
3668 if (alc880_is_multi_pin(nid)) {
3669 struct alc_spec *spec = codec->spec;
3670 int idx = alc880_multi_pin_idx(nid);
3671 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3672 AC_VERB_SET_CONNECT_SEL,
3673 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3677 static int get_pin_type(int line_out_type)
3679 if (line_out_type == AUTO_PIN_HP_OUT)
3685 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3687 struct alc_spec *spec = codec->spec;
3690 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3691 for (i = 0; i < spec->autocfg.line_outs; i++) {
3692 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3693 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3694 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3698 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3700 struct alc_spec *spec = codec->spec;
3703 pin = spec->autocfg.speaker_pins[0];
3704 if (pin) /* connect to front */
3705 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3706 pin = spec->autocfg.hp_pins[0];
3707 if (pin) /* connect to front */
3708 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3711 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3713 struct alc_spec *spec = codec->spec;
3716 for (i = 0; i < AUTO_PIN_LAST; i++) {
3717 hda_nid_t nid = spec->autocfg.input_pins[i];
3718 if (alc880_is_input_pin(nid)) {
3719 snd_hda_codec_write(codec, nid, 0,
3720 AC_VERB_SET_PIN_WIDGET_CONTROL,
3721 i <= AUTO_PIN_FRONT_MIC ?
3722 PIN_VREF80 : PIN_IN);
3723 if (nid != ALC880_PIN_CD_NID)
3724 snd_hda_codec_write(codec, nid, 0,
3725 AC_VERB_SET_AMP_GAIN_MUTE,
3731 /* parse the BIOS configuration and set up the alc_spec */
3732 /* return 1 if successful, 0 if the proper config is not found,
3733 * or a negative error code
3735 static int alc880_parse_auto_config(struct hda_codec *codec)
3737 struct alc_spec *spec = codec->spec;
3739 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3741 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3745 if (!spec->autocfg.line_outs)
3746 return 0; /* can't find valid BIOS pin config */
3748 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3751 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3754 err = alc880_auto_create_extra_out(spec,
3755 spec->autocfg.speaker_pins[0],
3759 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3763 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3767 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3769 if (spec->autocfg.dig_out_pin)
3770 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3771 if (spec->autocfg.dig_in_pin)
3772 spec->dig_in_nid = ALC880_DIGIN_NID;
3774 if (spec->kctl_alloc)
3775 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3777 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3779 spec->num_mux_defs = 1;
3780 spec->input_mux = &spec->private_imux;
3785 /* additional initialization for auto-configuration model */
3786 static void alc880_auto_init(struct hda_codec *codec)
3788 struct alc_spec *spec = codec->spec;
3789 alc880_auto_init_multi_out(codec);
3790 alc880_auto_init_extra_out(codec);
3791 alc880_auto_init_analog_input(codec);
3792 if (spec->unsol_event)
3793 alc_sku_automute(codec);
3797 * OK, here we have finally the patch for ALC880
3800 static int patch_alc880(struct hda_codec *codec)
3802 struct alc_spec *spec;
3806 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3812 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3815 if (board_config < 0) {
3816 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3817 "trying auto-probe from BIOS...\n");
3818 board_config = ALC880_AUTO;
3821 if (board_config == ALC880_AUTO) {
3822 /* automatic parse from the BIOS config */
3823 err = alc880_parse_auto_config(codec);
3829 "hda_codec: Cannot set up configuration "
3830 "from BIOS. Using 3-stack mode...\n");
3831 board_config = ALC880_3ST;
3835 if (board_config != ALC880_AUTO)
3836 setup_preset(spec, &alc880_presets[board_config]);
3838 spec->stream_name_analog = "ALC880 Analog";
3839 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3840 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3841 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3843 spec->stream_name_digital = "ALC880 Digital";
3844 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3845 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3847 if (!spec->adc_nids && spec->input_mux) {
3848 /* check whether NID 0x07 is valid */
3849 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3851 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3852 if (wcap != AC_WID_AUD_IN) {
3853 spec->adc_nids = alc880_adc_nids_alt;
3854 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3855 spec->mixers[spec->num_mixers] =
3856 alc880_capture_alt_mixer;
3859 spec->adc_nids = alc880_adc_nids;
3860 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3861 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3866 spec->vmaster_nid = 0x0c;
3868 codec->patch_ops = alc_patch_ops;
3869 if (board_config == ALC880_AUTO)
3870 spec->init_hook = alc880_auto_init;
3871 #ifdef CONFIG_SND_HDA_POWER_SAVE
3872 if (!spec->loopback.amplist)
3873 spec->loopback.amplist = alc880_loopbacks;
3884 static hda_nid_t alc260_dac_nids[1] = {
3889 static hda_nid_t alc260_adc_nids[1] = {
3894 static hda_nid_t alc260_adc_nids_alt[1] = {
3899 static hda_nid_t alc260_hp_adc_nids[2] = {
3904 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3905 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3907 static hda_nid_t alc260_dual_adc_nids[2] = {
3912 #define ALC260_DIGOUT_NID 0x03
3913 #define ALC260_DIGIN_NID 0x06
3915 static struct hda_input_mux alc260_capture_source = {
3919 { "Front Mic", 0x1 },
3925 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3926 * headphone jack and the internal CD lines since these are the only pins at
3927 * which audio can appear. For flexibility, also allow the option of
3928 * recording the mixer output on the second ADC (ADC0 doesn't have a
3929 * connection to the mixer output).
3931 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3935 { "Mic/Line", 0x0 },
3937 { "Headphone", 0x2 },
3943 { "Mic/Line", 0x0 },
3945 { "Headphone", 0x2 },
3952 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3953 * the Fujitsu S702x, but jacks are marked differently.
3955 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3962 { "Headphone", 0x5 },
3971 { "Headphone", 0x6 },
3977 * This is just place-holder, so there's something for alc_build_pcms to look
3978 * at when it calculates the maximum number of channels. ALC260 has no mixer
3979 * element which allows changing the channel mode, so the verb list is
3982 static struct hda_channel_mode alc260_modes[1] = {
3987 /* Mixer combinations
3989 * basic: base_output + input + pc_beep + capture
3990 * HP: base_output + input + capture_alt
3991 * HP_3013: hp_3013 + input + capture
3992 * fujitsu: fujitsu + capture
3993 * acer: acer + capture
3996 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3997 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3998 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3999 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4000 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4001 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4002 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4006 static struct snd_kcontrol_new alc260_input_mixer[] = {
4007 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4008 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4009 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4010 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4012 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4013 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4014 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4018 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4019 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4020 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4024 /* update HP, line and mono out pins according to the master switch */
4025 static void alc260_hp_master_update(struct hda_codec *codec,
4026 hda_nid_t hp, hda_nid_t line,
4029 struct alc_spec *spec = codec->spec;
4030 unsigned int val = spec->master_sw ? PIN_HP : 0;
4031 /* change HP and line-out pins */
4032 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4034 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4036 /* mono (speaker) depending on the HP jack sense */
4037 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4038 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4042 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4043 struct snd_ctl_elem_value *ucontrol)
4045 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4046 struct alc_spec *spec = codec->spec;
4047 *ucontrol->value.integer.value = spec->master_sw;
4051 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4052 struct snd_ctl_elem_value *ucontrol)
4054 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4055 struct alc_spec *spec = codec->spec;
4056 int val = !!*ucontrol->value.integer.value;
4057 hda_nid_t hp, line, mono;
4059 if (val == spec->master_sw)
4061 spec->master_sw = val;
4062 hp = (kcontrol->private_value >> 16) & 0xff;
4063 line = (kcontrol->private_value >> 8) & 0xff;
4064 mono = kcontrol->private_value & 0xff;
4065 alc260_hp_master_update(codec, hp, line, mono);
4069 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4071 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4072 .name = "Master Playback Switch",
4073 .info = snd_ctl_boolean_mono_info,
4074 .get = alc260_hp_master_sw_get,
4075 .put = alc260_hp_master_sw_put,
4076 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4078 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4079 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4080 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4081 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4082 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4084 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4088 static struct hda_verb alc260_hp_unsol_verbs[] = {
4089 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4093 static void alc260_hp_automute(struct hda_codec *codec)
4095 struct alc_spec *spec = codec->spec;
4096 unsigned int present;
4098 present = snd_hda_codec_read(codec, 0x10, 0,
4099 AC_VERB_GET_PIN_SENSE, 0);
4100 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4101 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4104 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4106 if ((res >> 26) == ALC880_HP_EVENT)
4107 alc260_hp_automute(codec);
4110 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4112 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4113 .name = "Master Playback Switch",
4114 .info = snd_ctl_boolean_mono_info,
4115 .get = alc260_hp_master_sw_get,
4116 .put = alc260_hp_master_sw_put,
4117 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4119 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4120 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4121 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4122 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4123 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4124 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4125 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4126 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4130 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4131 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4135 static void alc260_hp_3013_automute(struct hda_codec *codec)
4137 struct alc_spec *spec = codec->spec;
4138 unsigned int present;
4140 present = snd_hda_codec_read(codec, 0x15, 0,
4141 AC_VERB_GET_PIN_SENSE, 0);
4142 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4143 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4146 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4149 if ((res >> 26) == ALC880_HP_EVENT)
4150 alc260_hp_3013_automute(codec);
4153 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4154 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4156 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4157 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4158 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4159 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4160 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4161 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4162 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4163 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4164 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4165 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4166 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4167 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4168 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4172 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4173 * versions of the ALC260 don't act on requests to enable mic bias from NID
4174 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4175 * datasheet doesn't mention this restriction. At this stage it's not clear
4176 * whether this behaviour is intentional or is a hardware bug in chip
4177 * revisions available in early 2006. Therefore for now allow the
4178 * "Headphone Jack Mode" control to span all choices, but if it turns out
4179 * that the lack of mic bias for this NID is intentional we could change the
4180 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4182 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4183 * don't appear to make the mic bias available from the "line" jack, even
4184 * though the NID used for this jack (0x14) can supply it. The theory is
4185 * that perhaps Acer have included blocking capacitors between the ALC260
4186 * and the output jack. If this turns out to be the case for all such
4187 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4188 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4190 * The C20x Tablet series have a mono internal speaker which is controlled
4191 * via the chip's Mono sum widget and pin complex, so include the necessary
4192 * controls for such models. On models without a "mono speaker" the control
4193 * won't do anything.
4195 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4196 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4197 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4198 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4199 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4201 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4203 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4204 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4206 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4207 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4208 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4209 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4210 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4211 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4212 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4216 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4217 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4219 static struct snd_kcontrol_new alc260_will_mixer[] = {
4220 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4221 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4223 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4224 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4225 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4226 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4227 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4228 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4229 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4230 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4231 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4235 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4236 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4238 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4239 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4240 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4242 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4243 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4244 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4245 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4246 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4247 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4248 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4252 /* capture mixer elements */
4253 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4254 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4255 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4256 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4257 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4259 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4260 /* The multiple "Capture Source" controls confuse alsamixer
4261 * So call somewhat different..
4263 /* .name = "Capture Source", */
4264 .name = "Input Source",
4266 .info = alc_mux_enum_info,
4267 .get = alc_mux_enum_get,
4268 .put = alc_mux_enum_put,
4273 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4274 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4275 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4277 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4278 /* The multiple "Capture Source" controls confuse alsamixer
4279 * So call somewhat different..
4281 /* .name = "Capture Source", */
4282 .name = "Input Source",
4284 .info = alc_mux_enum_info,
4285 .get = alc_mux_enum_get,
4286 .put = alc_mux_enum_put,
4292 * initialization verbs
4294 static struct hda_verb alc260_init_verbs[] = {
4295 /* Line In pin widget for input */
4296 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4297 /* CD pin widget for input */
4298 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4299 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4300 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4301 /* Mic2 (front panel) pin widget for input and vref at 80% */
4302 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4303 /* LINE-2 is used for line-out in rear */
4304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4305 /* select line-out */
4306 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4308 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4310 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4312 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4313 /* mute capture amp left and right */
4314 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4315 /* set connection select to line in (default select for this ADC) */
4316 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4317 /* mute capture amp left and right */
4318 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4319 /* set connection select to line in (default select for this ADC) */
4320 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4321 /* set vol=0 Line-Out mixer amp left and right */
4322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4323 /* unmute pin widget amp left and right (no gain on this amp) */
4324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4325 /* set vol=0 HP mixer amp left and right */
4326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4327 /* unmute pin widget amp left and right (no gain on this amp) */
4328 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4329 /* set vol=0 Mono mixer amp left and right */
4330 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4331 /* unmute pin widget amp left and right (no gain on this amp) */
4332 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4333 /* unmute LINE-2 out pin */
4334 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4335 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4338 /* mute analog inputs */
4339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4343 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4344 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4345 /* mute Front out path */
4346 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4347 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4348 /* mute Headphone out path */
4349 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4350 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4351 /* mute Mono out path */
4352 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4353 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4357 #if 0 /* should be identical with alc260_init_verbs? */
4358 static struct hda_verb alc260_hp_init_verbs[] = {
4359 /* Headphone and output */
4360 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4362 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4363 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4364 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4365 /* Mic2 (front panel) pin widget for input and vref at 80% */
4366 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4367 /* Line In pin widget for input */
4368 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4369 /* Line-2 pin widget for output */
4370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4371 /* CD pin widget for input */
4372 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4373 /* unmute amp left and right */
4374 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4375 /* set connection select to line in (default select for this ADC) */
4376 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4377 /* unmute Line-Out mixer amp left and right (volume = 0) */
4378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4379 /* mute pin widget amp left and right (no gain on this amp) */
4380 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4381 /* unmute HP mixer amp left and right (volume = 0) */
4382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4383 /* mute pin widget amp left and right (no gain on this amp) */
4384 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4385 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4388 /* mute analog inputs */
4389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4390 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4392 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4394 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4395 /* Unmute Front out path */
4396 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4398 /* Unmute Headphone out path */
4399 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4400 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4401 /* Unmute Mono out path */
4402 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4403 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4408 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4409 /* Line out and output */
4410 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4412 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4413 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4414 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4415 /* Mic2 (front panel) pin widget for input and vref at 80% */
4416 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4417 /* Line In pin widget for input */
4418 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4419 /* Headphone pin widget for output */
4420 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4421 /* CD pin widget for input */
4422 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4423 /* unmute amp left and right */
4424 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4425 /* set connection select to line in (default select for this ADC) */
4426 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4427 /* unmute Line-Out mixer amp left and right (volume = 0) */
4428 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4429 /* mute pin widget amp left and right (no gain on this amp) */
4430 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4431 /* unmute HP mixer amp left and right (volume = 0) */
4432 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4433 /* mute pin widget amp left and right (no gain on this amp) */
4434 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4435 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4438 /* mute analog inputs */
4439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4441 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4444 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4445 /* Unmute Front out path */
4446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4447 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4448 /* Unmute Headphone out path */
4449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4451 /* Unmute Mono out path */
4452 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4453 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4457 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4458 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4459 * audio = 0x16, internal speaker = 0x10.
4461 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4462 /* Disable all GPIOs */
4463 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4464 /* Internal speaker is connected to headphone pin */
4465 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4466 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4468 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4469 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4470 /* Ensure all other unused pins are disabled and muted. */
4471 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4472 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4473 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4474 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4475 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4476 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4477 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4480 /* Disable digital (SPDIF) pins */
4481 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4482 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4484 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4485 * when acting as an output.
4487 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4489 /* Start with output sum widgets muted and their output gains at min */
4490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4494 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4496 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4497 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4498 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4500 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4501 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4502 /* Unmute Line1 pin widget output buffer since it starts as an output.
4503 * If the pin mode is changed by the user the pin mode control will
4504 * take care of enabling the pin's input/output buffers as needed.
4505 * Therefore there's no need to enable the input buffer at this
4508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4509 /* Unmute input buffer of pin widget used for Line-in (no equiv
4512 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4514 /* Mute capture amp left and right */
4515 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4516 /* Set ADC connection select to match default mixer setting - line
4519 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4521 /* Do the same for the second ADC: mute capture input amp and
4522 * set ADC connection to line in (on mic1 pin)
4524 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4525 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4527 /* Mute all inputs to mixer widget (even unconnected ones) */
4528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4540 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4541 * similar laptops (adapted from Fujitsu init verbs).
4543 static struct hda_verb alc260_acer_init_verbs[] = {
4544 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4545 * the headphone jack. Turn this on and rely on the standard mute
4546 * methods whenever the user wants to turn these outputs off.
4548 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4549 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4550 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4551 /* Internal speaker/Headphone jack is connected to Line-out pin */
4552 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4553 /* Internal microphone/Mic jack is connected to Mic1 pin */
4554 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4555 /* Line In jack is connected to Line1 pin */
4556 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4557 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4558 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4559 /* Ensure all other unused pins are disabled and muted. */
4560 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4561 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4562 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4563 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4564 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4566 /* Disable digital (SPDIF) pins */
4567 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4568 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4570 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4571 * bus when acting as outputs.
4573 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4574 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4576 /* Start with output sum widgets muted and their output gains at min */
4577 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4578 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4579 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4581 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4582 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4583 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4584 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4585 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4587 /* Unmute Line-out pin widget amp left and right
4588 * (no equiv mixer ctrl)
4590 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4591 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4592 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4593 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4594 * inputs. If the pin mode is changed by the user the pin mode control
4595 * will take care of enabling the pin's input/output buffers as needed.
4596 * Therefore there's no need to enable the input buffer at this
4599 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4602 /* Mute capture amp left and right */
4603 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4604 /* Set ADC connection select to match default mixer setting - mic
4607 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4609 /* Do similar with the second ADC: mute capture input amp and
4610 * set ADC connection to mic to match ALSA's default state.
4612 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4613 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4615 /* Mute all inputs to mixer widget (even unconnected ones) */
4616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4623 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4628 static struct hda_verb alc260_will_verbs[] = {
4629 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4630 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4631 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4632 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4633 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4634 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4638 static struct hda_verb alc260_replacer_672v_verbs[] = {
4639 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4640 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4641 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4643 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4644 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4645 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4647 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4651 /* toggle speaker-output according to the hp-jack state */
4652 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4654 unsigned int present;
4656 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4657 present = snd_hda_codec_read(codec, 0x0f, 0,
4658 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4660 snd_hda_codec_write_cache(codec, 0x01, 0,
4661 AC_VERB_SET_GPIO_DATA, 1);
4662 snd_hda_codec_write_cache(codec, 0x0f, 0,
4663 AC_VERB_SET_PIN_WIDGET_CONTROL,
4666 snd_hda_codec_write_cache(codec, 0x01, 0,
4667 AC_VERB_SET_GPIO_DATA, 0);
4668 snd_hda_codec_write_cache(codec, 0x0f, 0,
4669 AC_VERB_SET_PIN_WIDGET_CONTROL,
4674 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4677 if ((res >> 26) == ALC880_HP_EVENT)
4678 alc260_replacer_672v_automute(codec);
4681 /* Test configuration for debugging, modelled after the ALC880 test
4684 #ifdef CONFIG_SND_DEBUG
4685 static hda_nid_t alc260_test_dac_nids[1] = {
4688 static hda_nid_t alc260_test_adc_nids[2] = {
4691 /* For testing the ALC260, each input MUX needs its own definition since
4692 * the signal assignments are different. This assumes that the first ADC
4695 static struct hda_input_mux alc260_test_capture_sources[2] = {
4699 { "MIC1 pin", 0x0 },
4700 { "MIC2 pin", 0x1 },
4701 { "LINE1 pin", 0x2 },
4702 { "LINE2 pin", 0x3 },
4704 { "LINE-OUT pin", 0x5 },
4705 { "HP-OUT pin", 0x6 },
4711 { "MIC1 pin", 0x0 },
4712 { "MIC2 pin", 0x1 },
4713 { "LINE1 pin", 0x2 },
4714 { "LINE2 pin", 0x3 },
4717 { "LINE-OUT pin", 0x6 },
4718 { "HP-OUT pin", 0x7 },
4722 static struct snd_kcontrol_new alc260_test_mixer[] = {
4723 /* Output driver widgets */
4724 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4725 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4726 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4727 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4728 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4729 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4731 /* Modes for retasking pin widgets
4732 * Note: the ALC260 doesn't seem to act on requests to enable mic
4733 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4734 * mention this restriction. At this stage it's not clear whether
4735 * this behaviour is intentional or is a hardware bug in chip
4736 * revisions available at least up until early 2006. Therefore for
4737 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4738 * choices, but if it turns out that the lack of mic bias for these
4739 * NIDs is intentional we could change their modes from
4740 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4742 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4743 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4744 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4745 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4746 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4747 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4749 /* Loopback mixer controls */
4750 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4751 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4752 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4753 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4754 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4755 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4756 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4757 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4758 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4759 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4760 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4761 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4762 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4763 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4764 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4765 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4767 /* Controls for GPIO pins, assuming they are configured as outputs */
4768 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4769 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4770 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4771 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4773 /* Switches to allow the digital IO pins to be enabled. The datasheet
4774 * is ambigious as to which NID is which; testing on laptops which
4775 * make this output available should provide clarification.
4777 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4778 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4780 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4781 * this output to turn on an external amplifier.
4783 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4784 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4788 static struct hda_verb alc260_test_init_verbs[] = {
4789 /* Enable all GPIOs as outputs with an initial value of 0 */
4790 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4791 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4792 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4794 /* Enable retasking pins as output, initially without power amp */
4795 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4796 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4797 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4798 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4799 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4800 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4802 /* Disable digital (SPDIF) pins initially, but users can enable
4803 * them via a mixer switch. In the case of SPDIF-out, this initverb
4804 * payload also sets the generation to 0, output to be in "consumer"
4805 * PCM format, copyright asserted, no pre-emphasis and no validity
4808 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4809 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4811 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4812 * OUT1 sum bus when acting as an output.
4814 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4815 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4816 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4817 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4819 /* Start with output sum widgets muted and their output gains at min */
4820 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4821 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4822 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4823 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4824 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4826 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4827 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4828 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4830 /* Unmute retasking pin widget output buffers since the default
4831 * state appears to be output. As the pin mode is changed by the
4832 * user the pin mode control will take care of enabling the pin's
4833 * input/output buffers as needed.
4835 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4836 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4838 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4839 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4840 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4841 /* Also unmute the mono-out pin widget */
4842 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4844 /* Mute capture amp left and right */
4845 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4846 /* Set ADC connection select to match default mixer setting (mic1
4849 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4851 /* Do the same for the second ADC: mute capture input amp and
4852 * set ADC connection to mic1 pin
4854 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4855 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4857 /* Mute all inputs to mixer widget (even unconnected ones) */
4858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4865 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4871 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4872 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4874 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4875 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4878 * for BIOS auto-configuration
4881 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4885 unsigned long vol_val, sw_val;
4889 if (nid >= 0x0f && nid < 0x11) {
4890 nid_vol = nid - 0x7;
4891 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4892 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4893 } else if (nid == 0x11) {
4894 nid_vol = nid - 0x7;
4895 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4896 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4897 } else if (nid >= 0x12 && nid <= 0x15) {
4899 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4900 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4904 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4905 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4908 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4909 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4915 /* add playback controls from the parsed DAC table */
4916 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4917 const struct auto_pin_cfg *cfg)
4922 spec->multiout.num_dacs = 1;
4923 spec->multiout.dac_nids = spec->private_dac_nids;
4924 spec->multiout.dac_nids[0] = 0x02;
4926 nid = cfg->line_out_pins[0];
4928 err = alc260_add_playback_controls(spec, nid, "Front");
4933 nid = cfg->speaker_pins[0];
4935 err = alc260_add_playback_controls(spec, nid, "Speaker");
4940 nid = cfg->hp_pins[0];
4942 err = alc260_add_playback_controls(spec, nid, "Headphone");
4949 /* create playback/capture controls for input pins */
4950 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4951 const struct auto_pin_cfg *cfg)
4953 struct hda_input_mux *imux = &spec->private_imux;
4956 for (i = 0; i < AUTO_PIN_LAST; i++) {
4957 if (cfg->input_pins[i] >= 0x12) {
4958 idx = cfg->input_pins[i] - 0x12;
4959 err = new_analog_input(spec, cfg->input_pins[i],
4960 auto_pin_cfg_labels[i], idx,
4964 imux->items[imux->num_items].label =
4965 auto_pin_cfg_labels[i];
4966 imux->items[imux->num_items].index = idx;
4969 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4970 idx = cfg->input_pins[i] - 0x09;
4971 err = new_analog_input(spec, cfg->input_pins[i],
4972 auto_pin_cfg_labels[i], idx,
4976 imux->items[imux->num_items].label =
4977 auto_pin_cfg_labels[i];
4978 imux->items[imux->num_items].index = idx;
4985 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4986 hda_nid_t nid, int pin_type,
4989 alc_set_pin_output(codec, nid, pin_type);
4990 /* need the manual connection? */
4992 int idx = nid - 0x12;
4993 snd_hda_codec_write(codec, idx + 0x0b, 0,
4994 AC_VERB_SET_CONNECT_SEL, sel_idx);
4998 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5000 struct alc_spec *spec = codec->spec;
5003 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5004 nid = spec->autocfg.line_out_pins[0];
5006 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5007 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5010 nid = spec->autocfg.speaker_pins[0];
5012 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5014 nid = spec->autocfg.hp_pins[0];
5016 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5019 #define ALC260_PIN_CD_NID 0x16
5020 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5022 struct alc_spec *spec = codec->spec;
5025 for (i = 0; i < AUTO_PIN_LAST; i++) {
5026 hda_nid_t nid = spec->autocfg.input_pins[i];
5028 snd_hda_codec_write(codec, nid, 0,
5029 AC_VERB_SET_PIN_WIDGET_CONTROL,
5030 i <= AUTO_PIN_FRONT_MIC ?
5031 PIN_VREF80 : PIN_IN);
5032 if (nid != ALC260_PIN_CD_NID)
5033 snd_hda_codec_write(codec, nid, 0,
5034 AC_VERB_SET_AMP_GAIN_MUTE,
5041 * generic initialization of ADC, input mixers and output mixers
5043 static struct hda_verb alc260_volume_init_verbs[] = {
5045 * Unmute ADC0-1 and set the default input to mic-in
5047 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5048 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5049 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5050 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5052 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5054 * Note: PASD motherboards uses the Line In 2 as the input for
5055 * front panel mic (mic 2)
5057 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5058 /* mute analog inputs */
5059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5066 * Set up output mixers (0x08 - 0x0a)
5068 /* set vol=0 to output mixers */
5069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5071 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5072 /* set up input amps for analog loopback */
5073 /* Amp Indices: DAC = 0, mixer = 1 */
5074 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5075 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5076 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5077 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5078 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5079 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5084 static int alc260_parse_auto_config(struct hda_codec *codec)
5086 struct alc_spec *spec = codec->spec;
5089 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5091 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5095 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5098 if (!spec->kctl_alloc)
5099 return 0; /* can't find valid BIOS pin config */
5100 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5104 spec->multiout.max_channels = 2;
5106 if (spec->autocfg.dig_out_pin)
5107 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5108 if (spec->kctl_alloc)
5109 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5111 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5113 spec->num_mux_defs = 1;
5114 spec->input_mux = &spec->private_imux;
5116 /* check whether NID 0x04 is valid */
5117 wcap = get_wcaps(codec, 0x04);
5118 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5119 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5120 spec->adc_nids = alc260_adc_nids_alt;
5121 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5122 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5124 spec->adc_nids = alc260_adc_nids;
5125 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5126 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5133 /* additional initialization for auto-configuration model */
5134 static void alc260_auto_init(struct hda_codec *codec)
5136 struct alc_spec *spec = codec->spec;
5137 alc260_auto_init_multi_out(codec);
5138 alc260_auto_init_analog_input(codec);
5139 if (spec->unsol_event)
5140 alc_sku_automute(codec);
5143 #ifdef CONFIG_SND_HDA_POWER_SAVE
5144 static struct hda_amp_list alc260_loopbacks[] = {
5145 { 0x07, HDA_INPUT, 0 },
5146 { 0x07, HDA_INPUT, 1 },
5147 { 0x07, HDA_INPUT, 2 },
5148 { 0x07, HDA_INPUT, 3 },
5149 { 0x07, HDA_INPUT, 4 },
5155 * ALC260 configurations
5157 static const char *alc260_models[ALC260_MODEL_LAST] = {
5158 [ALC260_BASIC] = "basic",
5160 [ALC260_HP_3013] = "hp-3013",
5161 [ALC260_FUJITSU_S702X] = "fujitsu",
5162 [ALC260_ACER] = "acer",
5163 [ALC260_WILL] = "will",
5164 [ALC260_REPLACER_672V] = "replacer",
5165 #ifdef CONFIG_SND_DEBUG
5166 [ALC260_TEST] = "test",
5168 [ALC260_AUTO] = "auto",
5171 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5172 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5173 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5174 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5175 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5176 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5177 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5178 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5179 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5180 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5181 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5182 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5183 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5184 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5185 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5186 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5187 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5188 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5189 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5193 static struct alc_config_preset alc260_presets[] = {
5195 .mixers = { alc260_base_output_mixer,
5197 alc260_pc_beep_mixer,
5198 alc260_capture_mixer },
5199 .init_verbs = { alc260_init_verbs },
5200 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5201 .dac_nids = alc260_dac_nids,
5202 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5203 .adc_nids = alc260_adc_nids,
5204 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5205 .channel_mode = alc260_modes,
5206 .input_mux = &alc260_capture_source,
5209 .mixers = { alc260_hp_output_mixer,
5211 alc260_capture_alt_mixer },
5212 .init_verbs = { alc260_init_verbs,
5213 alc260_hp_unsol_verbs },
5214 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5215 .dac_nids = alc260_dac_nids,
5216 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5217 .adc_nids = alc260_hp_adc_nids,
5218 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5219 .channel_mode = alc260_modes,
5220 .input_mux = &alc260_capture_source,
5221 .unsol_event = alc260_hp_unsol_event,
5222 .init_hook = alc260_hp_automute,
5224 [ALC260_HP_3013] = {
5225 .mixers = { alc260_hp_3013_mixer,
5227 alc260_capture_alt_mixer },
5228 .init_verbs = { alc260_hp_3013_init_verbs,
5229 alc260_hp_3013_unsol_verbs },
5230 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5231 .dac_nids = alc260_dac_nids,
5232 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5233 .adc_nids = alc260_hp_adc_nids,
5234 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5235 .channel_mode = alc260_modes,
5236 .input_mux = &alc260_capture_source,
5237 .unsol_event = alc260_hp_3013_unsol_event,
5238 .init_hook = alc260_hp_3013_automute,
5240 [ALC260_FUJITSU_S702X] = {
5241 .mixers = { alc260_fujitsu_mixer,
5242 alc260_capture_mixer },
5243 .init_verbs = { alc260_fujitsu_init_verbs },
5244 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5245 .dac_nids = alc260_dac_nids,
5246 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5247 .adc_nids = alc260_dual_adc_nids,
5248 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5249 .channel_mode = alc260_modes,
5250 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5251 .input_mux = alc260_fujitsu_capture_sources,
5254 .mixers = { alc260_acer_mixer,
5255 alc260_capture_mixer },
5256 .init_verbs = { alc260_acer_init_verbs },
5257 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5258 .dac_nids = alc260_dac_nids,
5259 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5260 .adc_nids = alc260_dual_adc_nids,
5261 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5262 .channel_mode = alc260_modes,
5263 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5264 .input_mux = alc260_acer_capture_sources,
5267 .mixers = { alc260_will_mixer,
5268 alc260_capture_mixer },
5269 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5270 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5271 .dac_nids = alc260_dac_nids,
5272 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5273 .adc_nids = alc260_adc_nids,
5274 .dig_out_nid = ALC260_DIGOUT_NID,
5275 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5276 .channel_mode = alc260_modes,
5277 .input_mux = &alc260_capture_source,
5279 [ALC260_REPLACER_672V] = {
5280 .mixers = { alc260_replacer_672v_mixer,
5281 alc260_capture_mixer },
5282 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5283 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5284 .dac_nids = alc260_dac_nids,
5285 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5286 .adc_nids = alc260_adc_nids,
5287 .dig_out_nid = ALC260_DIGOUT_NID,
5288 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5289 .channel_mode = alc260_modes,
5290 .input_mux = &alc260_capture_source,
5291 .unsol_event = alc260_replacer_672v_unsol_event,
5292 .init_hook = alc260_replacer_672v_automute,
5294 #ifdef CONFIG_SND_DEBUG
5296 .mixers = { alc260_test_mixer,
5297 alc260_capture_mixer },
5298 .init_verbs = { alc260_test_init_verbs },
5299 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5300 .dac_nids = alc260_test_dac_nids,
5301 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5302 .adc_nids = alc260_test_adc_nids,
5303 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5304 .channel_mode = alc260_modes,
5305 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5306 .input_mux = alc260_test_capture_sources,
5311 static int patch_alc260(struct hda_codec *codec)
5313 struct alc_spec *spec;
5314 int err, board_config;
5316 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5322 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5325 if (board_config < 0) {
5326 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5327 "trying auto-probe from BIOS...\n");
5328 board_config = ALC260_AUTO;
5331 if (board_config == ALC260_AUTO) {
5332 /* automatic parse from the BIOS config */
5333 err = alc260_parse_auto_config(codec);
5339 "hda_codec: Cannot set up configuration "
5340 "from BIOS. Using base mode...\n");
5341 board_config = ALC260_BASIC;
5345 if (board_config != ALC260_AUTO)
5346 setup_preset(spec, &alc260_presets[board_config]);
5348 spec->stream_name_analog = "ALC260 Analog";
5349 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5350 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5352 spec->stream_name_digital = "ALC260 Digital";
5353 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5354 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5356 spec->vmaster_nid = 0x08;
5358 codec->patch_ops = alc_patch_ops;
5359 if (board_config == ALC260_AUTO)
5360 spec->init_hook = alc260_auto_init;
5361 #ifdef CONFIG_SND_HDA_POWER_SAVE
5362 if (!spec->loopback.amplist)
5363 spec->loopback.amplist = alc260_loopbacks;
5373 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5374 * configuration. Each pin widget can choose any input DACs and a mixer.
5375 * Each ADC is connected from a mixer of all inputs. This makes possible
5376 * 6-channel independent captures.
5378 * In addition, an independent DAC for the multi-playback (not used in this
5381 #define ALC882_DIGOUT_NID 0x06
5382 #define ALC882_DIGIN_NID 0x0a
5384 static struct hda_channel_mode alc882_ch_modes[1] = {
5388 static hda_nid_t alc882_dac_nids[4] = {
5389 /* front, rear, clfe, rear_surr */
5390 0x02, 0x03, 0x04, 0x05
5393 /* identical with ALC880 */
5394 #define alc882_adc_nids alc880_adc_nids
5395 #define alc882_adc_nids_alt alc880_adc_nids_alt
5397 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5398 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5401 /* FIXME: should be a matrix-type input source selection */
5403 static struct hda_input_mux alc882_capture_source = {
5407 { "Front Mic", 0x1 },
5412 #define alc882_mux_enum_info alc_mux_enum_info
5413 #define alc882_mux_enum_get alc_mux_enum_get
5415 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5416 struct snd_ctl_elem_value *ucontrol)
5418 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5419 struct alc_spec *spec = codec->spec;
5420 const struct hda_input_mux *imux = spec->input_mux;
5421 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5422 hda_nid_t nid = spec->capsrc_nids ?
5423 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5424 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5425 unsigned int i, idx;
5427 idx = ucontrol->value.enumerated.item[0];
5428 if (idx >= imux->num_items)
5429 idx = imux->num_items - 1;
5430 if (*cur_val == idx)
5432 for (i = 0; i < imux->num_items; i++) {
5433 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5434 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5435 imux->items[i].index,
5445 static struct hda_verb alc882_3ST_ch2_init[] = {
5446 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5447 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5448 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5449 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5456 static struct hda_verb alc882_3ST_ch6_init[] = {
5457 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5458 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5459 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5460 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5461 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5462 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5466 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5467 { 2, alc882_3ST_ch2_init },
5468 { 6, alc882_3ST_ch6_init },
5474 static struct hda_verb alc882_sixstack_ch6_init[] = {
5475 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5476 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5477 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5478 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5485 static struct hda_verb alc882_sixstack_ch8_init[] = {
5486 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5487 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5488 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5489 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5493 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5494 { 6, alc882_sixstack_ch6_init },
5495 { 8, alc882_sixstack_ch8_init },
5499 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5505 static struct hda_verb alc885_mbp_ch2_init[] = {
5506 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5507 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5515 static struct hda_verb alc885_mbp_ch6_init[] = {
5516 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5517 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5518 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5519 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5520 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5524 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5525 { 2, alc885_mbp_ch2_init },
5526 { 6, alc885_mbp_ch6_init },
5530 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5531 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5533 static struct snd_kcontrol_new alc882_base_mixer[] = {
5534 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5535 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5536 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5537 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5538 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5539 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5540 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5541 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5542 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5543 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5545 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5546 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5547 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5548 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5549 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5550 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5552 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5553 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5554 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5555 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5556 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5560 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5561 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5562 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5563 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5564 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5565 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5566 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5567 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5568 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5569 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5570 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5573 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5574 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5575 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5576 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5577 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5578 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5579 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5580 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5581 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5582 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5583 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5584 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5588 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5589 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5590 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5591 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5592 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5593 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5594 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5595 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5596 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5597 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5598 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5599 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5601 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5605 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5606 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5608 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5609 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5610 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5611 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5612 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5613 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5614 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5615 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5616 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5617 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5618 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5620 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5621 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5625 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5626 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5627 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5628 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5629 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5630 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5631 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5632 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5633 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5634 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5635 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5636 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5637 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5641 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5643 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5644 .name = "Channel Mode",
5645 .info = alc_ch_mode_info,
5646 .get = alc_ch_mode_get,
5647 .put = alc_ch_mode_put,
5652 static struct hda_verb alc882_init_verbs[] = {
5653 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5659 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5660 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5667 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5668 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5670 /* Front Pin: output 0 (0x0c) */
5671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5672 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5673 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5674 /* Rear Pin: output 1 (0x0d) */
5675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5677 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5678 /* CLFE Pin: output 2 (0x0e) */
5679 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5680 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5681 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5682 /* Side Pin: output 3 (0x0f) */
5683 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5685 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5686 /* Mic (rear) pin: input vref at 80% */
5687 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5688 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5689 /* Front Mic pin: input vref at 80% */
5690 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5691 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5692 /* Line In pin: input */
5693 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5694 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5695 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5696 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5697 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5698 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5699 /* CD pin widget for input */
5700 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5702 /* FIXME: use matrix-type input source selection */
5703 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5704 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5705 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5711 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5719 /* ADC1: mute amp left and right */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5721 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5722 /* ADC2: mute amp left and right */
5723 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5724 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5725 /* ADC3: mute amp left and right */
5726 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5727 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5732 static struct hda_verb alc882_eapd_verbs[] = {
5733 /* change to EAPD mode */
5734 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5735 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5740 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5741 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5742 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5743 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5744 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5745 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5746 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5747 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5751 static struct hda_verb alc882_macpro_init_verbs[] = {
5752 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5756 /* Front Pin: output 0 (0x0c) */
5757 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5759 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5760 /* Front Mic pin: input vref at 80% */
5761 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5763 /* Speaker: output */
5764 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5765 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5766 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5767 /* Headphone output (output 0 - 0x0c) */
5768 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5769 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5770 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5772 /* FIXME: use matrix-type input source selection */
5773 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5774 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5789 /* ADC1: mute amp left and right */
5790 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5791 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5792 /* ADC2: mute amp left and right */
5793 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5794 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5795 /* ADC3: mute amp left and right */
5796 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5797 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5802 /* Macbook Pro rev3 */
5803 static struct hda_verb alc885_mbp3_init_verbs[] = {
5804 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5812 /* Front Pin: output 0 (0x0c) */
5813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5814 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5815 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5816 /* HP Pin: output 0 (0x0d) */
5817 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5818 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5819 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5820 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5821 /* Mic (rear) pin: input vref at 80% */
5822 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5824 /* Front Mic pin: input vref at 80% */
5825 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5827 /* Line In pin: use output 1 when in LineOut mode */
5828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5830 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5832 /* FIXME: use matrix-type input source selection */
5833 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5834 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5836 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5840 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5841 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5843 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5845 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5849 /* ADC1: mute amp left and right */
5850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5851 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5852 /* ADC2: mute amp left and right */
5853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5854 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5855 /* ADC3: mute amp left and right */
5856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5857 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5862 /* iMac 24 mixer. */
5863 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5864 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5865 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5869 /* iMac 24 init verbs. */
5870 static struct hda_verb alc885_imac24_init_verbs[] = {
5871 /* Internal speakers: output 0 (0x0c) */
5872 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5873 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5874 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5875 /* Internal speakers: output 0 (0x0c) */
5876 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5878 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5879 /* Headphone: output 0 (0x0c) */
5880 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5881 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5882 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5883 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5884 /* Front Mic: input vref at 80% */
5885 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5886 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5890 /* Toggle speaker-output according to the hp-jack state */
5891 static void alc885_imac24_automute(struct hda_codec *codec)
5893 unsigned int present;
5895 present = snd_hda_codec_read(codec, 0x14, 0,
5896 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5897 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5898 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5899 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5900 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5903 /* Processes unsolicited events. */
5904 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5907 /* Headphone insertion or removal. */
5908 if ((res >> 26) == ALC880_HP_EVENT)
5909 alc885_imac24_automute(codec);
5912 static void alc885_mbp3_automute(struct hda_codec *codec)
5914 unsigned int present;
5916 present = snd_hda_codec_read(codec, 0x15, 0,
5917 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5918 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5919 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5920 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5921 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5924 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5927 /* Headphone insertion or removal. */
5928 if ((res >> 26) == ALC880_HP_EVENT)
5929 alc885_mbp3_automute(codec);
5933 static struct hda_verb alc882_targa_verbs[] = {
5934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5938 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5940 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5941 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5942 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5944 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5945 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5946 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5947 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5951 /* toggle speaker-output according to the hp-jack state */
5952 static void alc882_targa_automute(struct hda_codec *codec)
5954 unsigned int present;
5956 present = snd_hda_codec_read(codec, 0x14, 0,
5957 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5958 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5959 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5960 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5964 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5966 /* Looks like the unsol event is incompatible with the standard
5967 * definition. 4bit tag is placed at 26 bit!
5969 if (((res >> 26) == ALC880_HP_EVENT)) {
5970 alc882_targa_automute(codec);
5974 static struct hda_verb alc882_asus_a7j_verbs[] = {
5975 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5976 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5979 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5980 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5982 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5983 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5984 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5986 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5987 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5988 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5992 static struct hda_verb alc882_asus_a7m_verbs[] = {
5993 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5994 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5997 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6000 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6001 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6002 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6004 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6005 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6006 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6010 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6012 unsigned int gpiostate, gpiomask, gpiodir;
6014 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6015 AC_VERB_GET_GPIO_DATA, 0);
6018 gpiostate |= (1 << pin);
6020 gpiostate &= ~(1 << pin);
6022 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6023 AC_VERB_GET_GPIO_MASK, 0);
6024 gpiomask |= (1 << pin);
6026 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6027 AC_VERB_GET_GPIO_DIRECTION, 0);
6028 gpiodir |= (1 << pin);
6031 snd_hda_codec_write(codec, codec->afg, 0,
6032 AC_VERB_SET_GPIO_MASK, gpiomask);
6033 snd_hda_codec_write(codec, codec->afg, 0,
6034 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6038 snd_hda_codec_write(codec, codec->afg, 0,
6039 AC_VERB_SET_GPIO_DATA, gpiostate);
6042 /* set up GPIO at initialization */
6043 static void alc885_macpro_init_hook(struct hda_codec *codec)
6045 alc882_gpio_mute(codec, 0, 0);
6046 alc882_gpio_mute(codec, 1, 0);
6049 /* set up GPIO and update auto-muting at initialization */
6050 static void alc885_imac24_init_hook(struct hda_codec *codec)
6052 alc885_macpro_init_hook(codec);
6053 alc885_imac24_automute(codec);
6057 * generic initialization of ADC, input mixers and output mixers
6059 static struct hda_verb alc882_auto_init_verbs[] = {
6061 * Unmute ADC0-2 and set the default input to mic-in
6063 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6065 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6066 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6067 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6068 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6070 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6072 * Note: PASD motherboards uses the Line In 2 as the input for
6073 * front panel mic (mic 2)
6075 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6076 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6077 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6078 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6083 * Set up output mixers (0x0c - 0x0f)
6085 /* set vol=0 to output mixers */
6086 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6088 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6089 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6090 /* set up input amps for analog loopback */
6091 /* Amp Indices: DAC = 0, mixer = 1 */
6092 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6094 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6095 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6096 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6097 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6098 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6099 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6100 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6101 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6103 /* FIXME: use matrix-type input source selection */
6104 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6105 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6107 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6114 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6124 /* capture mixer elements */
6125 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6126 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6127 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6128 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6129 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6131 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6132 /* The multiple "Capture Source" controls confuse alsamixer
6133 * So call somewhat different..
6135 /* .name = "Capture Source", */
6136 .name = "Input Source",
6138 .info = alc882_mux_enum_info,
6139 .get = alc882_mux_enum_get,
6140 .put = alc882_mux_enum_put,
6145 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6146 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6147 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6148 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6149 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6150 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6151 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6154 /* The multiple "Capture Source" controls confuse alsamixer
6155 * So call somewhat different..
6157 /* .name = "Capture Source", */
6158 .name = "Input Source",
6160 .info = alc882_mux_enum_info,
6161 .get = alc882_mux_enum_get,
6162 .put = alc882_mux_enum_put,
6167 #ifdef CONFIG_SND_HDA_POWER_SAVE
6168 #define alc882_loopbacks alc880_loopbacks
6171 /* pcm configuration: identiacal with ALC880 */
6172 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6173 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6174 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6175 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6178 * configuration and preset
6180 static const char *alc882_models[ALC882_MODEL_LAST] = {
6181 [ALC882_3ST_DIG] = "3stack-dig",
6182 [ALC882_6ST_DIG] = "6stack-dig",
6183 [ALC882_ARIMA] = "arima",
6184 [ALC882_W2JC] = "w2jc",
6185 [ALC882_TARGA] = "targa",
6186 [ALC882_ASUS_A7J] = "asus-a7j",
6187 [ALC882_ASUS_A7M] = "asus-a7m",
6188 [ALC885_MACPRO] = "macpro",
6189 [ALC885_MBP3] = "mbp3",
6190 [ALC885_IMAC24] = "imac24",
6191 [ALC882_AUTO] = "auto",
6194 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6195 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6196 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6197 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6198 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6199 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6200 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6201 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6202 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6203 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6204 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6205 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6206 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6210 static struct alc_config_preset alc882_presets[] = {
6211 [ALC882_3ST_DIG] = {
6212 .mixers = { alc882_base_mixer },
6213 .init_verbs = { alc882_init_verbs },
6214 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6215 .dac_nids = alc882_dac_nids,
6216 .dig_out_nid = ALC882_DIGOUT_NID,
6217 .dig_in_nid = ALC882_DIGIN_NID,
6218 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6219 .channel_mode = alc882_ch_modes,
6221 .input_mux = &alc882_capture_source,
6223 [ALC882_6ST_DIG] = {
6224 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6225 .init_verbs = { alc882_init_verbs },
6226 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6227 .dac_nids = alc882_dac_nids,
6228 .dig_out_nid = ALC882_DIGOUT_NID,
6229 .dig_in_nid = ALC882_DIGIN_NID,
6230 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6231 .channel_mode = alc882_sixstack_modes,
6232 .input_mux = &alc882_capture_source,
6235 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6236 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6237 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6238 .dac_nids = alc882_dac_nids,
6239 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6240 .channel_mode = alc882_sixstack_modes,
6241 .input_mux = &alc882_capture_source,
6244 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6245 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6246 alc880_gpio1_init_verbs },
6247 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6248 .dac_nids = alc882_dac_nids,
6249 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6250 .channel_mode = alc880_threestack_modes,
6252 .input_mux = &alc882_capture_source,
6253 .dig_out_nid = ALC882_DIGOUT_NID,
6256 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6257 .init_verbs = { alc885_mbp3_init_verbs,
6258 alc880_gpio1_init_verbs },
6259 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6260 .dac_nids = alc882_dac_nids,
6261 .channel_mode = alc885_mbp_6ch_modes,
6262 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6263 .input_mux = &alc882_capture_source,
6264 .dig_out_nid = ALC882_DIGOUT_NID,
6265 .dig_in_nid = ALC882_DIGIN_NID,
6266 .unsol_event = alc885_mbp3_unsol_event,
6267 .init_hook = alc885_mbp3_automute,
6270 .mixers = { alc882_macpro_mixer },
6271 .init_verbs = { alc882_macpro_init_verbs },
6272 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6273 .dac_nids = alc882_dac_nids,
6274 .dig_out_nid = ALC882_DIGOUT_NID,
6275 .dig_in_nid = ALC882_DIGIN_NID,
6276 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6277 .channel_mode = alc882_ch_modes,
6278 .input_mux = &alc882_capture_source,
6279 .init_hook = alc885_macpro_init_hook,
6282 .mixers = { alc885_imac24_mixer },
6283 .init_verbs = { alc885_imac24_init_verbs },
6284 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6285 .dac_nids = alc882_dac_nids,
6286 .dig_out_nid = ALC882_DIGOUT_NID,
6287 .dig_in_nid = ALC882_DIGIN_NID,
6288 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6289 .channel_mode = alc882_ch_modes,
6290 .input_mux = &alc882_capture_source,
6291 .unsol_event = alc885_imac24_unsol_event,
6292 .init_hook = alc885_imac24_init_hook,
6295 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6296 alc882_capture_mixer },
6297 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6298 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6299 .dac_nids = alc882_dac_nids,
6300 .dig_out_nid = ALC882_DIGOUT_NID,
6301 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6302 .adc_nids = alc882_adc_nids,
6303 .capsrc_nids = alc882_capsrc_nids,
6304 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6305 .channel_mode = alc882_3ST_6ch_modes,
6307 .input_mux = &alc882_capture_source,
6308 .unsol_event = alc882_targa_unsol_event,
6309 .init_hook = alc882_targa_automute,
6311 [ALC882_ASUS_A7J] = {
6312 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6313 alc882_capture_mixer },
6314 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6315 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6316 .dac_nids = alc882_dac_nids,
6317 .dig_out_nid = ALC882_DIGOUT_NID,
6318 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6319 .adc_nids = alc882_adc_nids,
6320 .capsrc_nids = alc882_capsrc_nids,
6321 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6322 .channel_mode = alc882_3ST_6ch_modes,
6324 .input_mux = &alc882_capture_source,
6326 [ALC882_ASUS_A7M] = {
6327 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6328 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6329 alc880_gpio1_init_verbs,
6330 alc882_asus_a7m_verbs },
6331 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6332 .dac_nids = alc882_dac_nids,
6333 .dig_out_nid = ALC882_DIGOUT_NID,
6334 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6335 .channel_mode = alc880_threestack_modes,
6337 .input_mux = &alc882_capture_source,
6346 PINFIX_ABIT_AW9D_MAX
6349 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6350 { 0x15, 0x01080104 }, /* side */
6351 { 0x16, 0x01011012 }, /* rear */
6352 { 0x17, 0x01016011 }, /* clfe */
6356 static const struct alc_pincfg *alc882_pin_fixes[] = {
6357 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6360 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6361 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6366 * BIOS auto configuration
6368 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6369 hda_nid_t nid, int pin_type,
6373 struct alc_spec *spec = codec->spec;
6376 alc_set_pin_output(codec, nid, pin_type);
6377 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6380 idx = spec->multiout.dac_nids[dac_idx] - 2;
6381 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6385 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6387 struct alc_spec *spec = codec->spec;
6390 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6391 for (i = 0; i <= HDA_SIDE; i++) {
6392 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6393 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6395 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6400 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6402 struct alc_spec *spec = codec->spec;
6405 pin = spec->autocfg.hp_pins[0];
6406 if (pin) /* connect to front */
6408 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6409 pin = spec->autocfg.speaker_pins[0];
6411 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6414 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6415 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6417 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6419 struct alc_spec *spec = codec->spec;
6422 for (i = 0; i < AUTO_PIN_LAST; i++) {
6423 hda_nid_t nid = spec->autocfg.input_pins[i];
6428 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6429 unsigned int pincap;
6430 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6431 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6435 snd_hda_codec_write(codec, nid, 0,
6436 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6437 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6438 snd_hda_codec_write(codec, nid, 0,
6439 AC_VERB_SET_AMP_GAIN_MUTE,
6444 static void alc882_auto_init_input_src(struct hda_codec *codec)
6446 struct alc_spec *spec = codec->spec;
6447 const struct hda_input_mux *imux = spec->input_mux;
6450 for (c = 0; c < spec->num_adc_nids; c++) {
6451 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6452 hda_nid_t nid = spec->capsrc_nids[c];
6453 int conns, mute, idx, item;
6455 conns = snd_hda_get_connections(codec, nid, conn_list,
6456 ARRAY_SIZE(conn_list));
6459 for (idx = 0; idx < conns; idx++) {
6460 /* if the current connection is the selected one,
6461 * unmute it as default - otherwise mute it
6463 mute = AMP_IN_MUTE(idx);
6464 for (item = 0; item < imux->num_items; item++) {
6465 if (imux->items[item].index == idx) {
6466 if (spec->cur_mux[c] == item)
6467 mute = AMP_IN_UNMUTE(idx);
6471 snd_hda_codec_write(codec, nid, 0,
6472 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6477 /* add mic boosts if needed */
6478 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6480 struct alc_spec *spec = codec->spec;
6484 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6485 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6486 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6488 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6492 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6493 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6494 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6496 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6503 /* almost identical with ALC880 parser... */
6504 static int alc882_parse_auto_config(struct hda_codec *codec)
6506 struct alc_spec *spec = codec->spec;
6507 int err = alc880_parse_auto_config(codec);
6512 return 0; /* no config found */
6514 err = alc_auto_add_mic_boost(codec);
6518 /* hack - override the init verbs */
6519 spec->init_verbs[0] = alc882_auto_init_verbs;
6521 return 1; /* config found */
6524 /* additional initialization for auto-configuration model */
6525 static void alc882_auto_init(struct hda_codec *codec)
6527 struct alc_spec *spec = codec->spec;
6528 alc882_auto_init_multi_out(codec);
6529 alc882_auto_init_hp_out(codec);
6530 alc882_auto_init_analog_input(codec);
6531 alc882_auto_init_input_src(codec);
6532 if (spec->unsol_event)
6533 alc_sku_automute(codec);
6536 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6538 static int patch_alc882(struct hda_codec *codec)
6540 struct alc_spec *spec;
6541 int err, board_config;
6543 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6549 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6553 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6554 /* Pick up systems that don't supply PCI SSID */
6555 switch (codec->subsystem_id) {
6556 case 0x106b0c00: /* Mac Pro */
6557 board_config = ALC885_MACPRO;
6559 case 0x106b1000: /* iMac 24 */
6560 board_config = ALC885_IMAC24;
6562 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6563 case 0x106b2c00: /* Macbook Pro rev3 */
6564 case 0x106b3600: /* Macbook 3.1 */
6565 board_config = ALC885_MBP3;
6568 /* ALC889A is handled better as ALC888-compatible */
6569 if (codec->revision_id == 0x100103) {
6571 return patch_alc883(codec);
6573 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6574 "trying auto-probe from BIOS...\n");
6575 board_config = ALC882_AUTO;
6579 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6581 if (board_config == ALC882_AUTO) {
6582 /* automatic parse from the BIOS config */
6583 err = alc882_parse_auto_config(codec);
6589 "hda_codec: Cannot set up configuration "
6590 "from BIOS. Using base mode...\n");
6591 board_config = ALC882_3ST_DIG;
6595 if (board_config != ALC882_AUTO)
6596 setup_preset(spec, &alc882_presets[board_config]);
6598 if (codec->vendor_id == 0x10ec0885) {
6599 spec->stream_name_analog = "ALC885 Analog";
6600 spec->stream_name_digital = "ALC885 Digital";
6602 spec->stream_name_analog = "ALC882 Analog";
6603 spec->stream_name_digital = "ALC882 Digital";
6606 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6607 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6608 /* FIXME: setup DAC5 */
6609 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6610 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6612 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6613 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6615 if (!spec->adc_nids && spec->input_mux) {
6616 /* check whether NID 0x07 is valid */
6617 unsigned int wcap = get_wcaps(codec, 0x07);
6619 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6620 if (wcap != AC_WID_AUD_IN) {
6621 spec->adc_nids = alc882_adc_nids_alt;
6622 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6623 spec->capsrc_nids = alc882_capsrc_nids_alt;
6624 spec->mixers[spec->num_mixers] =
6625 alc882_capture_alt_mixer;
6628 spec->adc_nids = alc882_adc_nids;
6629 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6630 spec->capsrc_nids = alc882_capsrc_nids;
6631 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6636 spec->vmaster_nid = 0x0c;
6638 codec->patch_ops = alc_patch_ops;
6639 if (board_config == ALC882_AUTO)
6640 spec->init_hook = alc882_auto_init;
6641 #ifdef CONFIG_SND_HDA_POWER_SAVE
6642 if (!spec->loopback.amplist)
6643 spec->loopback.amplist = alc882_loopbacks;
6652 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6653 * configuration. Each pin widget can choose any input DACs and a mixer.
6654 * Each ADC is connected from a mixer of all inputs. This makes possible
6655 * 6-channel independent captures.
6657 * In addition, an independent DAC for the multi-playback (not used in this
6660 #define ALC883_DIGOUT_NID 0x06
6661 #define ALC883_DIGIN_NID 0x0a
6663 static hda_nid_t alc883_dac_nids[4] = {
6664 /* front, rear, clfe, rear_surr */
6665 0x02, 0x03, 0x04, 0x05
6668 static hda_nid_t alc883_adc_nids[2] = {
6673 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6676 /* FIXME: should be a matrix-type input source selection */
6678 static struct hda_input_mux alc883_capture_source = {
6682 { "Front Mic", 0x1 },
6688 static struct hda_input_mux alc883_3stack_6ch_intel = {
6692 { "Front Mic", 0x0 },
6698 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6706 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6716 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6724 #define alc883_mux_enum_info alc_mux_enum_info
6725 #define alc883_mux_enum_get alc_mux_enum_get
6726 /* ALC883 has the ALC882-type input selection */
6727 #define alc883_mux_enum_put alc882_mux_enum_put
6732 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6739 static struct hda_verb alc883_3ST_ch2_init[] = {
6740 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6741 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6742 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6743 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6750 static struct hda_verb alc883_3ST_ch4_init[] = {
6751 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6752 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6753 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6754 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6755 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6762 static struct hda_verb alc883_3ST_ch6_init[] = {
6763 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6764 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6765 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6766 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6767 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6768 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6772 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6773 { 2, alc883_3ST_ch2_init },
6774 { 4, alc883_3ST_ch4_init },
6775 { 6, alc883_3ST_ch6_init },
6781 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6782 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6783 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6784 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6785 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6792 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6793 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6794 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6795 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6796 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6797 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6804 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6805 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6806 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6807 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6808 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6809 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6810 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6814 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6815 { 2, alc883_3ST_ch2_intel_init },
6816 { 4, alc883_3ST_ch4_intel_init },
6817 { 6, alc883_3ST_ch6_intel_init },
6823 static struct hda_verb alc883_sixstack_ch6_init[] = {
6824 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6825 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6826 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6827 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6834 static struct hda_verb alc883_sixstack_ch8_init[] = {
6835 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6836 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6837 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6838 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6842 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6843 { 6, alc883_sixstack_ch6_init },
6844 { 8, alc883_sixstack_ch8_init },
6847 static struct hda_verb alc883_medion_eapd_verbs[] = {
6848 /* eanable EAPD on medion laptop */
6849 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6850 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6854 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6855 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6858 static struct snd_kcontrol_new alc883_base_mixer[] = {
6859 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6860 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6861 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6862 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6863 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6864 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6865 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6866 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6867 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6868 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6870 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6871 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6872 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6873 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6875 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6876 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6877 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6878 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6879 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6880 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6881 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6882 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6883 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6884 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6885 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6887 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6888 /* .name = "Capture Source", */
6889 .name = "Input Source",
6891 .info = alc883_mux_enum_info,
6892 .get = alc883_mux_enum_get,
6893 .put = alc883_mux_enum_put,
6898 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6899 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6900 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6901 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6902 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6903 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6904 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6905 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6907 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6909 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6910 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6911 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6912 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6913 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6914 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6915 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6918 /* .name = "Capture Source", */
6919 .name = "Input Source",
6921 .info = alc883_mux_enum_info,
6922 .get = alc883_mux_enum_get,
6923 .put = alc883_mux_enum_put,
6928 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6929 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6930 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6931 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6932 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6934 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6935 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6936 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6937 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6938 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6939 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6940 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6941 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6942 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6944 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6945 /* .name = "Capture Source", */
6946 .name = "Input Source",
6948 .info = alc883_mux_enum_info,
6949 .get = alc883_mux_enum_get,
6950 .put = alc883_mux_enum_put,
6955 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6956 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6957 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6958 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6959 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6961 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6962 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6963 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6964 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6965 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6966 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6967 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6968 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6969 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6971 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6972 /* .name = "Capture Source", */
6973 .name = "Input Source",
6975 .info = alc883_mux_enum_info,
6976 .get = alc883_mux_enum_get,
6977 .put = alc883_mux_enum_put,
6982 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6986 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6987 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6989 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6991 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6992 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6993 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6994 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6996 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6997 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6998 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6999 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7000 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7001 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7003 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7004 /* .name = "Capture Source", */
7005 .name = "Input Source",
7007 .info = alc883_mux_enum_info,
7008 .get = alc883_mux_enum_get,
7009 .put = alc883_mux_enum_put,
7014 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7015 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7016 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7017 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7018 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7019 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7020 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7021 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7022 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7024 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7025 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7026 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7027 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7029 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7030 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7033 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7034 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7035 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7036 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7037 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7038 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7039 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7042 /* .name = "Capture Source", */
7043 .name = "Input Source",
7045 .info = alc883_mux_enum_info,
7046 .get = alc883_mux_enum_get,
7047 .put = alc883_mux_enum_put,
7052 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7053 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7054 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7055 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7056 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7057 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7059 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7060 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7061 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7062 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7063 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7064 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7065 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7066 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7068 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7069 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7071 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7072 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7073 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7074 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7075 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7076 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7077 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7078 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7080 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7081 /* .name = "Capture Source", */
7082 .name = "Input Source",
7084 .info = alc883_mux_enum_info,
7085 .get = alc883_mux_enum_get,
7086 .put = alc883_mux_enum_put,
7091 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7092 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7093 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7094 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7095 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7096 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7097 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7098 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7099 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7100 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7101 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7102 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7104 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7106 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7107 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7108 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7109 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7110 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7111 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7112 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7113 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7114 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7118 /* .name = "Capture Source", */
7119 .name = "Input Source",
7121 .info = alc883_mux_enum_info,
7122 .get = alc883_mux_enum_get,
7123 .put = alc883_mux_enum_put,
7128 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7129 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7130 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7131 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7133 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7136 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7137 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7146 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7147 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7148 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7150 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7151 /* .name = "Capture Source", */
7152 .name = "Input Source",
7154 .info = alc883_mux_enum_info,
7155 .get = alc883_mux_enum_get,
7156 .put = alc883_mux_enum_put,
7161 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7162 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7163 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7164 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7165 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7166 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7170 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7171 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7172 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7173 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7174 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7175 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7176 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7178 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7179 /* .name = "Capture Source", */
7180 .name = "Input Source",
7182 .info = alc883_mux_enum_info,
7183 .get = alc883_mux_enum_get,
7184 .put = alc883_mux_enum_put,
7189 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7191 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7192 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7193 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7194 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7196 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7198 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7199 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7201 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7202 /* .name = "Capture Source", */
7203 .name = "Input Source",
7205 .info = alc883_mux_enum_info,
7206 .get = alc883_mux_enum_get,
7207 .put = alc883_mux_enum_put,
7212 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7213 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7214 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7215 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7220 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7221 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7222 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7223 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7224 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7225 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7228 /* .name = "Capture Source", */
7229 .name = "Input Source",
7231 .info = alc883_mux_enum_info,
7232 .get = alc883_mux_enum_get,
7233 .put = alc883_mux_enum_put,
7238 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7239 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7240 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7241 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7242 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7243 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7246 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7247 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7248 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7249 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7250 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7251 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7254 /* .name = "Capture Source", */
7255 .name = "Input Source",
7257 .info = alc883_mux_enum_info,
7258 .get = alc883_mux_enum_get,
7259 .put = alc883_mux_enum_put,
7264 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7265 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7266 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7268 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7269 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7271 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7273 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7274 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7275 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7276 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7278 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7279 /* .name = "Capture Source", */
7280 .name = "Input Source",
7282 .info = alc883_mux_enum_info,
7283 .get = alc883_mux_enum_get,
7284 .put = alc883_mux_enum_put,
7289 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7291 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7292 .name = "Channel Mode",
7293 .info = alc_ch_mode_info,
7294 .get = alc_ch_mode_get,
7295 .put = alc_ch_mode_put,
7300 static struct hda_verb alc883_init_verbs[] = {
7301 /* ADC1: mute amp left and right */
7302 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7303 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7304 /* ADC2: mute amp left and right */
7305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7306 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7307 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7313 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7314 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7317 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7321 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7324 /* mute analog input loopbacks */
7325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7331 /* Front Pin: output 0 (0x0c) */
7332 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7333 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7334 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7335 /* Rear Pin: output 1 (0x0d) */
7336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7337 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7338 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7339 /* CLFE Pin: output 2 (0x0e) */
7340 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7341 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7342 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7343 /* Side Pin: output 3 (0x0f) */
7344 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7345 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7346 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7347 /* Mic (rear) pin: input vref at 80% */
7348 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7349 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7350 /* Front Mic pin: input vref at 80% */
7351 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7352 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7353 /* Line In pin: input */
7354 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7355 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7356 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7357 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7358 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7359 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7360 /* CD pin widget for input */
7361 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7363 /* FIXME: use matrix-type input source selection */
7364 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7378 /* toggle speaker-output according to the hp-jack state */
7379 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7381 unsigned int present;
7383 present = snd_hda_codec_read(codec, 0x15, 0,
7384 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7385 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7386 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7387 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7388 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7391 /* auto-toggle front mic */
7393 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7395 unsigned int present;
7398 present = snd_hda_codec_read(codec, 0x18, 0,
7399 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7400 bits = present ? HDA_AMP_MUTE : 0;
7401 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7405 static void alc883_mitac_automute(struct hda_codec *codec)
7407 alc883_mitac_hp_automute(codec);
7408 /* alc883_mitac_mic_automute(codec); */
7411 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7414 switch (res >> 26) {
7415 case ALC880_HP_EVENT:
7416 alc883_mitac_hp_automute(codec);
7418 case ALC880_MIC_EVENT:
7419 /* alc883_mitac_mic_automute(codec); */
7424 static struct hda_verb alc883_mitac_verbs[] = {
7426 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7429 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7430 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7432 /* enable unsolicited event */
7433 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7434 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7439 static struct hda_verb alc883_clevo_m720_verbs[] = {
7441 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7444 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7445 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7447 /* enable unsolicited event */
7448 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7449 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7454 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7456 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7457 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7459 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7462 /* enable unsolicited event */
7463 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7468 static struct hda_verb alc883_tagra_verbs[] = {
7469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7473 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7475 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7476 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7477 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7479 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7480 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7481 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7482 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7487 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7489 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7490 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7494 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7495 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7497 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7502 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7505 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7506 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7507 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7511 static struct hda_verb alc883_haier_w66_verbs[] = {
7512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7515 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7517 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7518 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7519 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7520 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7524 static struct hda_verb alc888_3st_hp_verbs[] = {
7525 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7526 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7527 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7531 static struct hda_verb alc888_6st_dell_verbs[] = {
7532 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7536 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7537 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7538 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7539 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7540 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7544 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7545 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7546 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7547 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7548 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7552 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7553 { 2, alc888_3st_hp_2ch_init },
7554 { 6, alc888_3st_hp_6ch_init },
7557 /* toggle front-jack and RCA according to the hp-jack state */
7558 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7560 unsigned int present;
7562 present = snd_hda_codec_read(codec, 0x1b, 0,
7563 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7564 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7565 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7566 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7567 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7570 /* toggle RCA according to the front-jack state */
7571 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7573 unsigned int present;
7575 present = snd_hda_codec_read(codec, 0x14, 0,
7576 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7577 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7578 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7581 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7584 if ((res >> 26) == ALC880_HP_EVENT)
7585 alc888_lenovo_ms7195_front_automute(codec);
7586 if ((res >> 26) == ALC880_FRONT_EVENT)
7587 alc888_lenovo_ms7195_rca_automute(codec);
7590 static struct hda_verb alc883_medion_md2_verbs[] = {
7591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7594 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7596 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7600 /* toggle speaker-output according to the hp-jack state */
7601 static void alc883_medion_md2_automute(struct hda_codec *codec)
7603 unsigned int present;
7605 present = snd_hda_codec_read(codec, 0x14, 0,
7606 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7607 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7608 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7611 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7614 if ((res >> 26) == ALC880_HP_EVENT)
7615 alc883_medion_md2_automute(codec);
7618 /* toggle speaker-output according to the hp-jack state */
7619 static void alc883_tagra_automute(struct hda_codec *codec)
7621 unsigned int present;
7624 present = snd_hda_codec_read(codec, 0x14, 0,
7625 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7626 bits = present ? HDA_AMP_MUTE : 0;
7627 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7628 HDA_AMP_MUTE, bits);
7629 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7633 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7635 if ((res >> 26) == ALC880_HP_EVENT)
7636 alc883_tagra_automute(codec);
7639 /* toggle speaker-output according to the hp-jack state */
7640 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7642 unsigned int present;
7645 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7646 & AC_PINSENSE_PRESENCE;
7647 bits = present ? HDA_AMP_MUTE : 0;
7648 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7649 HDA_AMP_MUTE, bits);
7652 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7654 unsigned int present;
7656 present = snd_hda_codec_read(codec, 0x18, 0,
7657 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7658 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7659 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7662 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7664 alc883_clevo_m720_hp_automute(codec);
7665 alc883_clevo_m720_mic_automute(codec);
7668 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7671 switch (res >> 26) {
7672 case ALC880_HP_EVENT:
7673 alc883_clevo_m720_hp_automute(codec);
7675 case ALC880_MIC_EVENT:
7676 alc883_clevo_m720_mic_automute(codec);
7681 /* toggle speaker-output according to the hp-jack state */
7682 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7684 unsigned int present;
7687 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7688 & AC_PINSENSE_PRESENCE;
7689 bits = present ? HDA_AMP_MUTE : 0;
7690 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7691 HDA_AMP_MUTE, bits);
7694 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7697 if ((res >> 26) == ALC880_HP_EVENT)
7698 alc883_2ch_fujitsu_pi2515_automute(codec);
7701 static void alc883_haier_w66_automute(struct hda_codec *codec)
7703 unsigned int present;
7706 present = snd_hda_codec_read(codec, 0x1b, 0,
7707 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7708 bits = present ? 0x80 : 0;
7709 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7713 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7716 if ((res >> 26) == ALC880_HP_EVENT)
7717 alc883_haier_w66_automute(codec);
7720 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7722 unsigned int present;
7725 present = snd_hda_codec_read(codec, 0x14, 0,
7726 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7727 bits = present ? HDA_AMP_MUTE : 0;
7728 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7729 HDA_AMP_MUTE, bits);
7732 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7734 unsigned int present;
7737 present = snd_hda_codec_read(codec, 0x1b, 0,
7738 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7739 bits = present ? HDA_AMP_MUTE : 0;
7740 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7741 HDA_AMP_MUTE, bits);
7742 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7743 HDA_AMP_MUTE, bits);
7746 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7749 if ((res >> 26) == ALC880_HP_EVENT)
7750 alc883_lenovo_101e_all_automute(codec);
7751 if ((res >> 26) == ALC880_FRONT_EVENT)
7752 alc883_lenovo_101e_ispeaker_automute(codec);
7755 /* toggle speaker-output according to the hp-jack state */
7756 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7758 unsigned int present;
7760 present = snd_hda_codec_read(codec, 0x14, 0,
7761 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7762 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7763 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7764 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7765 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7768 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7771 if ((res >> 26) == ALC880_HP_EVENT)
7772 alc883_acer_aspire_automute(codec);
7775 static struct hda_verb alc883_acer_eapd_verbs[] = {
7776 /* HP Pin: output 0 (0x0c) */
7777 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7778 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7779 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7780 /* Front Pin: output 0 (0x0c) */
7781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7782 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7783 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7784 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7785 /* eanable EAPD on medion laptop */
7786 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7787 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7788 /* enable unsolicited event */
7789 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7793 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7795 unsigned int present;
7797 present = snd_hda_codec_read(codec, 0x1b, 0,
7798 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7799 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7800 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7801 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7802 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7803 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7804 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7805 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7806 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7809 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7812 switch (res >> 26) {
7813 case ALC880_HP_EVENT:
7814 printk("hp_event\n");
7815 alc888_6st_dell_front_automute(codec);
7821 * generic initialization of ADC, input mixers and output mixers
7823 static struct hda_verb alc883_auto_init_verbs[] = {
7825 * Unmute ADC0-2 and set the default input to mic-in
7827 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7828 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7829 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7830 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7832 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7834 * Note: PASD motherboards uses the Line In 2 as the input for
7835 * front panel mic (mic 2)
7837 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7840 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7845 * Set up output mixers (0x0c - 0x0f)
7847 /* set vol=0 to output mixers */
7848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7849 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7851 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7852 /* set up input amps for analog loopback */
7853 /* Amp Indices: DAC = 0, mixer = 1 */
7854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7856 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7857 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7858 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7859 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7860 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7861 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7862 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7863 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7865 /* FIXME: use matrix-type input source selection */
7866 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7868 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7869 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7870 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7871 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7877 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7883 /* capture mixer elements */
7884 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7885 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7886 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7887 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7888 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7890 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7891 /* The multiple "Capture Source" controls confuse alsamixer
7892 * So call somewhat different..
7894 /* .name = "Capture Source", */
7895 .name = "Input Source",
7897 .info = alc882_mux_enum_info,
7898 .get = alc882_mux_enum_get,
7899 .put = alc882_mux_enum_put,
7904 #ifdef CONFIG_SND_HDA_POWER_SAVE
7905 #define alc883_loopbacks alc880_loopbacks
7908 /* pcm configuration: identiacal with ALC880 */
7909 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7910 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7911 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7912 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7913 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7916 * configuration and preset
7918 static const char *alc883_models[ALC883_MODEL_LAST] = {
7919 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7920 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7921 [ALC883_3ST_6ch] = "3stack-6ch",
7922 [ALC883_6ST_DIG] = "6stack-dig",
7923 [ALC883_TARGA_DIG] = "targa-dig",
7924 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7925 [ALC883_ACER] = "acer",
7926 [ALC883_ACER_ASPIRE] = "acer-aspire",
7927 [ALC883_MEDION] = "medion",
7928 [ALC883_MEDION_MD2] = "medion-md2",
7929 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7930 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7931 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7932 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7933 [ALC883_HAIER_W66] = "haier-w66",
7934 [ALC888_3ST_HP] = "3stack-hp",
7935 [ALC888_6ST_DELL] = "6stack-dell",
7936 [ALC883_MITAC] = "mitac",
7937 [ALC883_CLEVO_M720] = "clevo-m720",
7938 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7939 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
7940 [ALC883_AUTO] = "auto",
7943 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7944 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7945 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7946 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7947 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7948 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
7949 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7950 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7951 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7952 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7953 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7954 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7955 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7956 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7957 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7958 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7959 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7960 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7961 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7962 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7963 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7964 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7965 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7966 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7967 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7968 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7969 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7970 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7971 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7972 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7973 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7974 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7975 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7976 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7977 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7978 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7979 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7980 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7981 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7982 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7983 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7984 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7985 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7986 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7987 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7988 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7989 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7990 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7991 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7992 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7993 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7994 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7995 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7996 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7997 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7998 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
7999 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8000 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8004 static struct alc_config_preset alc883_presets[] = {
8005 [ALC883_3ST_2ch_DIG] = {
8006 .mixers = { alc883_3ST_2ch_mixer },
8007 .init_verbs = { alc883_init_verbs },
8008 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8009 .dac_nids = alc883_dac_nids,
8010 .dig_out_nid = ALC883_DIGOUT_NID,
8011 .dig_in_nid = ALC883_DIGIN_NID,
8012 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8013 .channel_mode = alc883_3ST_2ch_modes,
8014 .input_mux = &alc883_capture_source,
8016 [ALC883_3ST_6ch_DIG] = {
8017 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8018 .init_verbs = { alc883_init_verbs },
8019 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8020 .dac_nids = alc883_dac_nids,
8021 .dig_out_nid = ALC883_DIGOUT_NID,
8022 .dig_in_nid = ALC883_DIGIN_NID,
8023 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8024 .channel_mode = alc883_3ST_6ch_modes,
8026 .input_mux = &alc883_capture_source,
8028 [ALC883_3ST_6ch] = {
8029 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8030 .init_verbs = { alc883_init_verbs },
8031 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8032 .dac_nids = alc883_dac_nids,
8033 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8034 .channel_mode = alc883_3ST_6ch_modes,
8036 .input_mux = &alc883_capture_source,
8038 [ALC883_3ST_6ch_INTEL] = {
8039 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8040 .init_verbs = { alc883_init_verbs },
8041 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8042 .dac_nids = alc883_dac_nids,
8043 .dig_out_nid = ALC883_DIGOUT_NID,
8044 .dig_in_nid = ALC883_DIGIN_NID,
8045 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8046 .channel_mode = alc883_3ST_6ch_intel_modes,
8048 .input_mux = &alc883_3stack_6ch_intel,
8050 [ALC883_6ST_DIG] = {
8051 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8052 .init_verbs = { alc883_init_verbs },
8053 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8054 .dac_nids = alc883_dac_nids,
8055 .dig_out_nid = ALC883_DIGOUT_NID,
8056 .dig_in_nid = ALC883_DIGIN_NID,
8057 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8058 .channel_mode = alc883_sixstack_modes,
8059 .input_mux = &alc883_capture_source,
8061 [ALC883_TARGA_DIG] = {
8062 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8063 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8064 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8065 .dac_nids = alc883_dac_nids,
8066 .dig_out_nid = ALC883_DIGOUT_NID,
8067 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8068 .channel_mode = alc883_3ST_6ch_modes,
8070 .input_mux = &alc883_capture_source,
8071 .unsol_event = alc883_tagra_unsol_event,
8072 .init_hook = alc883_tagra_automute,
8074 [ALC883_TARGA_2ch_DIG] = {
8075 .mixers = { alc883_tagra_2ch_mixer},
8076 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8077 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8078 .dac_nids = alc883_dac_nids,
8079 .dig_out_nid = ALC883_DIGOUT_NID,
8080 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8081 .channel_mode = alc883_3ST_2ch_modes,
8082 .input_mux = &alc883_capture_source,
8083 .unsol_event = alc883_tagra_unsol_event,
8084 .init_hook = alc883_tagra_automute,
8087 .mixers = { alc883_base_mixer },
8088 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8089 * and the headphone jack. Turn this on and rely on the
8090 * standard mute methods whenever the user wants to turn
8091 * these outputs off.
8093 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8094 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8095 .dac_nids = alc883_dac_nids,
8096 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8097 .channel_mode = alc883_3ST_2ch_modes,
8098 .input_mux = &alc883_capture_source,
8100 [ALC883_ACER_ASPIRE] = {
8101 .mixers = { alc883_acer_aspire_mixer },
8102 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8103 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8104 .dac_nids = alc883_dac_nids,
8105 .dig_out_nid = ALC883_DIGOUT_NID,
8106 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8107 .channel_mode = alc883_3ST_2ch_modes,
8108 .input_mux = &alc883_capture_source,
8109 .unsol_event = alc883_acer_aspire_unsol_event,
8110 .init_hook = alc883_acer_aspire_automute,
8113 .mixers = { alc883_fivestack_mixer,
8114 alc883_chmode_mixer },
8115 .init_verbs = { alc883_init_verbs,
8116 alc883_medion_eapd_verbs },
8117 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8118 .dac_nids = alc883_dac_nids,
8119 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8120 .channel_mode = alc883_sixstack_modes,
8121 .input_mux = &alc883_capture_source,
8123 [ALC883_MEDION_MD2] = {
8124 .mixers = { alc883_medion_md2_mixer},
8125 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8126 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8127 .dac_nids = alc883_dac_nids,
8128 .dig_out_nid = ALC883_DIGOUT_NID,
8129 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8130 .channel_mode = alc883_3ST_2ch_modes,
8131 .input_mux = &alc883_capture_source,
8132 .unsol_event = alc883_medion_md2_unsol_event,
8133 .init_hook = alc883_medion_md2_automute,
8135 [ALC883_LAPTOP_EAPD] = {
8136 .mixers = { alc883_base_mixer },
8137 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8138 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8139 .dac_nids = alc883_dac_nids,
8140 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8141 .channel_mode = alc883_3ST_2ch_modes,
8142 .input_mux = &alc883_capture_source,
8144 [ALC883_CLEVO_M720] = {
8145 .mixers = { alc883_clevo_m720_mixer },
8146 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8147 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8148 .dac_nids = alc883_dac_nids,
8149 .dig_out_nid = ALC883_DIGOUT_NID,
8150 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8151 .channel_mode = alc883_3ST_2ch_modes,
8152 .input_mux = &alc883_capture_source,
8153 .unsol_event = alc883_clevo_m720_unsol_event,
8154 .init_hook = alc883_clevo_m720_automute,
8156 [ALC883_LENOVO_101E_2ch] = {
8157 .mixers = { alc883_lenovo_101e_2ch_mixer},
8158 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8159 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8160 .dac_nids = alc883_dac_nids,
8161 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8162 .channel_mode = alc883_3ST_2ch_modes,
8163 .input_mux = &alc883_lenovo_101e_capture_source,
8164 .unsol_event = alc883_lenovo_101e_unsol_event,
8165 .init_hook = alc883_lenovo_101e_all_automute,
8167 [ALC883_LENOVO_NB0763] = {
8168 .mixers = { alc883_lenovo_nb0763_mixer },
8169 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8170 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8171 .dac_nids = alc883_dac_nids,
8172 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8173 .channel_mode = alc883_3ST_2ch_modes,
8175 .input_mux = &alc883_lenovo_nb0763_capture_source,
8176 .unsol_event = alc883_medion_md2_unsol_event,
8177 .init_hook = alc883_medion_md2_automute,
8179 [ALC888_LENOVO_MS7195_DIG] = {
8180 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8181 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8182 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8183 .dac_nids = alc883_dac_nids,
8184 .dig_out_nid = ALC883_DIGOUT_NID,
8185 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8186 .channel_mode = alc883_3ST_6ch_modes,
8188 .input_mux = &alc883_capture_source,
8189 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8190 .init_hook = alc888_lenovo_ms7195_front_automute,
8192 [ALC883_HAIER_W66] = {
8193 .mixers = { alc883_tagra_2ch_mixer},
8194 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8195 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8196 .dac_nids = alc883_dac_nids,
8197 .dig_out_nid = ALC883_DIGOUT_NID,
8198 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8199 .channel_mode = alc883_3ST_2ch_modes,
8200 .input_mux = &alc883_capture_source,
8201 .unsol_event = alc883_haier_w66_unsol_event,
8202 .init_hook = alc883_haier_w66_automute,
8205 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8206 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8207 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8208 .dac_nids = alc883_dac_nids,
8209 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8210 .channel_mode = alc888_3st_hp_modes,
8212 .input_mux = &alc883_capture_source,
8214 [ALC888_6ST_DELL] = {
8215 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8216 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8217 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8218 .dac_nids = alc883_dac_nids,
8219 .dig_out_nid = ALC883_DIGOUT_NID,
8220 .dig_in_nid = ALC883_DIGIN_NID,
8221 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8222 .channel_mode = alc883_sixstack_modes,
8223 .input_mux = &alc883_capture_source,
8224 .unsol_event = alc888_6st_dell_unsol_event,
8225 .init_hook = alc888_6st_dell_front_automute,
8228 .mixers = { alc883_mitac_mixer },
8229 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8230 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8231 .dac_nids = alc883_dac_nids,
8232 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8233 .channel_mode = alc883_3ST_2ch_modes,
8234 .input_mux = &alc883_capture_source,
8235 .unsol_event = alc883_mitac_unsol_event,
8236 .init_hook = alc883_mitac_automute,
8238 [ALC883_FUJITSU_PI2515] = {
8239 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8240 .init_verbs = { alc883_init_verbs,
8241 alc883_2ch_fujitsu_pi2515_verbs},
8242 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8243 .dac_nids = alc883_dac_nids,
8244 .dig_out_nid = ALC883_DIGOUT_NID,
8245 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8246 .channel_mode = alc883_3ST_2ch_modes,
8247 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8248 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8249 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8255 * BIOS auto configuration
8257 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8258 hda_nid_t nid, int pin_type,
8262 struct alc_spec *spec = codec->spec;
8265 alc_set_pin_output(codec, nid, pin_type);
8266 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8269 idx = spec->multiout.dac_nids[dac_idx] - 2;
8270 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8274 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8276 struct alc_spec *spec = codec->spec;
8279 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8280 for (i = 0; i <= HDA_SIDE; i++) {
8281 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8282 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8284 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8289 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8291 struct alc_spec *spec = codec->spec;
8294 pin = spec->autocfg.hp_pins[0];
8295 if (pin) /* connect to front */
8297 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8298 pin = spec->autocfg.speaker_pins[0];
8300 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8303 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8304 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8306 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8308 struct alc_spec *spec = codec->spec;
8311 for (i = 0; i < AUTO_PIN_LAST; i++) {
8312 hda_nid_t nid = spec->autocfg.input_pins[i];
8313 if (alc883_is_input_pin(nid)) {
8314 snd_hda_codec_write(codec, nid, 0,
8315 AC_VERB_SET_PIN_WIDGET_CONTROL,
8316 (i <= AUTO_PIN_FRONT_MIC ?
8317 PIN_VREF80 : PIN_IN));
8318 if (nid != ALC883_PIN_CD_NID)
8319 snd_hda_codec_write(codec, nid, 0,
8320 AC_VERB_SET_AMP_GAIN_MUTE,
8326 #define alc883_auto_init_input_src alc882_auto_init_input_src
8328 /* almost identical with ALC880 parser... */
8329 static int alc883_parse_auto_config(struct hda_codec *codec)
8331 struct alc_spec *spec = codec->spec;
8332 int err = alc880_parse_auto_config(codec);
8337 return 0; /* no config found */
8339 err = alc_auto_add_mic_boost(codec);
8343 /* hack - override the init verbs */
8344 spec->init_verbs[0] = alc883_auto_init_verbs;
8345 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8348 return 1; /* config found */
8351 /* additional initialization for auto-configuration model */
8352 static void alc883_auto_init(struct hda_codec *codec)
8354 struct alc_spec *spec = codec->spec;
8355 alc883_auto_init_multi_out(codec);
8356 alc883_auto_init_hp_out(codec);
8357 alc883_auto_init_analog_input(codec);
8358 alc883_auto_init_input_src(codec);
8359 if (spec->unsol_event)
8360 alc_sku_automute(codec);
8363 static int patch_alc883(struct hda_codec *codec)
8365 struct alc_spec *spec;
8366 int err, board_config;
8368 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8374 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8376 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8379 if (board_config < 0) {
8380 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8381 "trying auto-probe from BIOS...\n");
8382 board_config = ALC883_AUTO;
8385 if (board_config == ALC883_AUTO) {
8386 /* automatic parse from the BIOS config */
8387 err = alc883_parse_auto_config(codec);
8393 "hda_codec: Cannot set up configuration "
8394 "from BIOS. Using base mode...\n");
8395 board_config = ALC883_3ST_2ch_DIG;
8399 if (board_config != ALC883_AUTO)
8400 setup_preset(spec, &alc883_presets[board_config]);
8402 switch (codec->vendor_id) {
8404 spec->stream_name_analog = "ALC888 Analog";
8405 spec->stream_name_digital = "ALC888 Digital";
8408 spec->stream_name_analog = "ALC889 Analog";
8409 spec->stream_name_digital = "ALC889 Digital";
8412 spec->stream_name_analog = "ALC883 Analog";
8413 spec->stream_name_digital = "ALC883 Digital";
8417 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8418 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8419 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8421 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8422 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8424 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8425 spec->adc_nids = alc883_adc_nids;
8426 spec->capsrc_nids = alc883_capsrc_nids;
8428 spec->vmaster_nid = 0x0c;
8430 codec->patch_ops = alc_patch_ops;
8431 if (board_config == ALC883_AUTO)
8432 spec->init_hook = alc883_auto_init;
8434 #ifdef CONFIG_SND_HDA_POWER_SAVE
8435 if (!spec->loopback.amplist)
8436 spec->loopback.amplist = alc883_loopbacks;
8446 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8447 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8449 #define alc262_dac_nids alc260_dac_nids
8450 #define alc262_adc_nids alc882_adc_nids
8451 #define alc262_adc_nids_alt alc882_adc_nids_alt
8452 #define alc262_capsrc_nids alc882_capsrc_nids
8453 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8455 #define alc262_modes alc260_modes
8456 #define alc262_capture_source alc882_capture_source
8458 static struct snd_kcontrol_new alc262_base_mixer[] = {
8459 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8460 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8461 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8462 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8463 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8464 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8467 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8468 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8469 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8470 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8471 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8472 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8473 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8474 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8475 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8476 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8480 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8481 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8482 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8483 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8484 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8485 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8486 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8487 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8488 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8489 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8490 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8491 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8492 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8493 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8494 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8495 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8496 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8500 /* update HP, line and mono-out pins according to the master switch */
8501 static void alc262_hp_master_update(struct hda_codec *codec)
8503 struct alc_spec *spec = codec->spec;
8504 int val = spec->master_sw;
8507 snd_hda_codec_write_cache(codec, 0x1b, 0,
8508 AC_VERB_SET_PIN_WIDGET_CONTROL,
8510 snd_hda_codec_write_cache(codec, 0x15, 0,
8511 AC_VERB_SET_PIN_WIDGET_CONTROL,
8513 /* mono (speaker) depending on the HP jack sense */
8514 val = val && !spec->jack_present;
8515 snd_hda_codec_write_cache(codec, 0x16, 0,
8516 AC_VERB_SET_PIN_WIDGET_CONTROL,
8520 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8522 struct alc_spec *spec = codec->spec;
8523 unsigned int presence;
8524 presence = snd_hda_codec_read(codec, 0x1b, 0,
8525 AC_VERB_GET_PIN_SENSE, 0);
8526 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8527 alc262_hp_master_update(codec);
8530 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8532 if ((res >> 26) != ALC880_HP_EVENT)
8534 alc262_hp_bpc_automute(codec);
8537 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8539 struct alc_spec *spec = codec->spec;
8540 unsigned int presence;
8541 presence = snd_hda_codec_read(codec, 0x15, 0,
8542 AC_VERB_GET_PIN_SENSE, 0);
8543 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8544 alc262_hp_master_update(codec);
8547 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8550 if ((res >> 26) != ALC880_HP_EVENT)
8552 alc262_hp_wildwest_automute(codec);
8555 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8556 struct snd_ctl_elem_value *ucontrol)
8558 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8559 struct alc_spec *spec = codec->spec;
8560 *ucontrol->value.integer.value = spec->master_sw;
8564 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8565 struct snd_ctl_elem_value *ucontrol)
8567 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8568 struct alc_spec *spec = codec->spec;
8569 int val = !!*ucontrol->value.integer.value;
8571 if (val == spec->master_sw)
8573 spec->master_sw = val;
8574 alc262_hp_master_update(codec);
8578 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8580 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8581 .name = "Master Playback Switch",
8582 .info = snd_ctl_boolean_mono_info,
8583 .get = alc262_hp_master_sw_get,
8584 .put = alc262_hp_master_sw_put,
8586 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8587 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8589 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8591 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8595 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8596 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8597 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8598 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8599 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8600 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8601 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8602 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8603 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8604 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8605 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8606 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8610 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8613 .name = "Master Playback Switch",
8614 .info = snd_ctl_boolean_mono_info,
8615 .get = alc262_hp_master_sw_get,
8616 .put = alc262_hp_master_sw_put,
8618 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8619 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8620 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8622 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8624 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8626 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8627 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8628 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8631 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8632 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8633 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8634 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8638 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8639 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8640 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8641 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8645 /* mute/unmute internal speaker according to the hp jack and mute state */
8646 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8648 struct alc_spec *spec = codec->spec;
8650 if (force || !spec->sense_updated) {
8651 unsigned int present;
8652 present = snd_hda_codec_read(codec, 0x15, 0,
8653 AC_VERB_GET_PIN_SENSE, 0);
8654 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8655 spec->sense_updated = 1;
8657 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8658 spec->jack_present ? HDA_AMP_MUTE : 0);
8661 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8664 if ((res >> 26) != ALC880_HP_EVENT)
8666 alc262_hp_t5735_automute(codec, 1);
8669 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8671 alc262_hp_t5735_automute(codec, 1);
8674 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8675 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8676 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8677 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8681 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8685 static struct hda_verb alc262_hp_t5735_verbs[] = {
8686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8689 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8693 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8694 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8695 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8696 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8697 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8698 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8699 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8703 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8704 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8705 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8706 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8707 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8708 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8709 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8713 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8717 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8724 /* bind hp and internal speaker mute (with plug check) */
8725 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8726 struct snd_ctl_elem_value *ucontrol)
8728 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8729 long *valp = ucontrol->value.integer.value;
8732 /* change hp mute */
8733 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8735 valp[0] ? 0 : HDA_AMP_MUTE);
8736 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8738 valp[1] ? 0 : HDA_AMP_MUTE);
8740 /* change speaker according to HP jack state */
8741 struct alc_spec *spec = codec->spec;
8743 if (spec->jack_present)
8744 mute = HDA_AMP_MUTE;
8746 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8748 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8749 HDA_AMP_MUTE, mute);
8754 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8755 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8757 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8758 .name = "Master Playback Switch",
8759 .info = snd_hda_mixer_amp_switch_info,
8760 .get = snd_hda_mixer_amp_switch_get,
8761 .put = alc262_sony_master_sw_put,
8762 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8766 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8767 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8771 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8772 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8773 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8777 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8778 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8782 #define alc262_capture_mixer alc882_capture_mixer
8783 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8786 * generic initialization of ADC, input mixers and output mixers
8788 static struct hda_verb alc262_init_verbs[] = {
8790 * Unmute ADC0-2 and set the default input to mic-in
8792 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8793 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8794 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8795 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8796 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8797 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8799 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8801 * Note: PASD motherboards uses the Line In 2 as the input for
8802 * front panel mic (mic 2)
8804 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8805 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8806 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8807 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8808 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8809 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8812 * Set up output mixers (0x0c - 0x0e)
8814 /* set vol=0 to output mixers */
8815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8817 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8818 /* set up input amps for analog loopback */
8819 /* Amp Indices: DAC = 0, mixer = 1 */
8820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8822 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8823 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8824 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8825 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8827 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8829 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8830 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8831 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8832 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8834 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8836 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8838 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8840 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8841 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8843 /* FIXME: use matrix-type input source selection */
8844 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8845 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8851 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8853 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8857 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8864 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8865 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8866 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8870 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8871 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8872 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8873 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8875 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8876 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8880 static struct hda_verb alc262_sony_unsol_verbs[] = {
8881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8882 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8883 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8885 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8886 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8890 /* mute/unmute internal speaker according to the hp jack and mute state */
8891 static void alc262_hippo_automute(struct hda_codec *codec)
8893 struct alc_spec *spec = codec->spec;
8895 unsigned int present;
8897 /* need to execute and sync at first */
8898 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8899 present = snd_hda_codec_read(codec, 0x15, 0,
8900 AC_VERB_GET_PIN_SENSE, 0);
8901 spec->jack_present = (present & 0x80000000) != 0;
8902 if (spec->jack_present) {
8903 /* mute internal speaker */
8904 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8905 HDA_AMP_MUTE, HDA_AMP_MUTE);
8907 /* unmute internal speaker if necessary */
8908 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8909 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8910 HDA_AMP_MUTE, mute);
8914 /* unsolicited event for HP jack sensing */
8915 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8918 if ((res >> 26) != ALC880_HP_EVENT)
8920 alc262_hippo_automute(codec);
8923 static void alc262_hippo1_automute(struct hda_codec *codec)
8926 unsigned int present;
8928 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8929 present = snd_hda_codec_read(codec, 0x1b, 0,
8930 AC_VERB_GET_PIN_SENSE, 0);
8931 present = (present & 0x80000000) != 0;
8933 /* mute internal speaker */
8934 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8935 HDA_AMP_MUTE, HDA_AMP_MUTE);
8937 /* unmute internal speaker if necessary */
8938 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8939 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8940 HDA_AMP_MUTE, mute);
8944 /* unsolicited event for HP jack sensing */
8945 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8948 if ((res >> 26) != ALC880_HP_EVENT)
8950 alc262_hippo1_automute(codec);
8956 * 0x16 = internal speaker
8957 * 0x18 = external mic
8960 static struct snd_kcontrol_new alc262_nec_mixer[] = {
8961 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8962 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
8964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8965 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8966 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8968 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8969 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8973 static struct hda_verb alc262_nec_verbs[] = {
8974 /* Unmute Speaker */
8975 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8978 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8981 /* External mic to headphone */
8982 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8983 /* External mic to speaker */
8984 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8990 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8991 * 0x1b = port replicator headphone out
8994 #define ALC_HP_EVENT 0x37
8996 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8997 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8998 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8999 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9000 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9004 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9005 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9006 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9010 static struct hda_input_mux alc262_fujitsu_capture_source = {
9019 static struct hda_input_mux alc262_HP_capture_source = {
9023 { "Front Mic", 0x1 },
9030 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9034 { "Front Mic", 0x2 },
9040 /* mute/unmute internal speaker according to the hp jacks and mute state */
9041 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9043 struct alc_spec *spec = codec->spec;
9046 if (force || !spec->sense_updated) {
9047 unsigned int present;
9048 /* need to execute and sync at first */
9049 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9050 /* check laptop HP jack */
9051 present = snd_hda_codec_read(codec, 0x14, 0,
9052 AC_VERB_GET_PIN_SENSE, 0);
9053 /* need to execute and sync at first */
9054 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9055 /* check docking HP jack */
9056 present |= snd_hda_codec_read(codec, 0x1b, 0,
9057 AC_VERB_GET_PIN_SENSE, 0);
9058 if (present & AC_PINSENSE_PRESENCE)
9059 spec->jack_present = 1;
9061 spec->jack_present = 0;
9062 spec->sense_updated = 1;
9064 /* unmute internal speaker only if both HPs are unplugged and
9065 * master switch is on
9067 if (spec->jack_present)
9068 mute = HDA_AMP_MUTE;
9070 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9071 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9072 HDA_AMP_MUTE, mute);
9075 /* unsolicited event for HP jack sensing */
9076 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9079 if ((res >> 26) != ALC_HP_EVENT)
9081 alc262_fujitsu_automute(codec, 1);
9084 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9086 alc262_fujitsu_automute(codec, 1);
9089 /* bind volumes of both NID 0x0c and 0x0d */
9090 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9091 .ops = &snd_hda_bind_vol,
9093 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9094 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9099 /* mute/unmute internal speaker according to the hp jack and mute state */
9100 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9102 struct alc_spec *spec = codec->spec;
9105 if (force || !spec->sense_updated) {
9106 unsigned int present_int_hp;
9107 /* need to execute and sync at first */
9108 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9109 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9110 AC_VERB_GET_PIN_SENSE, 0);
9111 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9112 spec->sense_updated = 1;
9114 if (spec->jack_present) {
9115 /* mute internal speaker */
9116 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9117 HDA_AMP_MUTE, HDA_AMP_MUTE);
9118 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9119 HDA_AMP_MUTE, HDA_AMP_MUTE);
9121 /* unmute internal speaker if necessary */
9122 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9123 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9124 HDA_AMP_MUTE, mute);
9125 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9126 HDA_AMP_MUTE, mute);
9130 /* unsolicited event for HP jack sensing */
9131 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9134 if ((res >> 26) != ALC_HP_EVENT)
9136 alc262_lenovo_3000_automute(codec, 1);
9139 /* bind hp and internal speaker mute (with plug check) */
9140 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9141 struct snd_ctl_elem_value *ucontrol)
9143 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9144 long *valp = ucontrol->value.integer.value;
9147 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9149 valp ? 0 : HDA_AMP_MUTE);
9150 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9152 valp ? 0 : HDA_AMP_MUTE);
9155 alc262_fujitsu_automute(codec, 0);
9159 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9160 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9163 .name = "Master Playback Switch",
9164 .info = snd_hda_mixer_amp_switch_info,
9165 .get = snd_hda_mixer_amp_switch_get,
9166 .put = alc262_fujitsu_master_sw_put,
9167 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9169 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9170 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9171 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9172 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9173 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9174 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9176 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9177 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9178 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9182 /* bind hp and internal speaker mute (with plug check) */
9183 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9184 struct snd_ctl_elem_value *ucontrol)
9186 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9187 long *valp = ucontrol->value.integer.value;
9190 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9192 valp ? 0 : HDA_AMP_MUTE);
9195 alc262_lenovo_3000_automute(codec, 0);
9199 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9200 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9202 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9203 .name = "Master Playback Switch",
9204 .info = snd_hda_mixer_amp_switch_info,
9205 .get = snd_hda_mixer_amp_switch_get,
9206 .put = alc262_lenovo_3000_master_sw_put,
9207 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9209 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9210 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9211 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9214 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9215 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9216 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9220 /* additional init verbs for Benq laptops */
9221 static struct hda_verb alc262_EAPD_verbs[] = {
9222 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9223 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9227 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9228 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9229 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9231 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9232 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9236 /* Samsung Q1 Ultra Vista model setup */
9237 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9238 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9239 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9241 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9242 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9243 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9247 static struct hda_verb alc262_ultra_verbs[] = {
9249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9254 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9255 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9256 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9261 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9262 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9264 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9266 /* ADC, choose mic */
9267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9270 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9271 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9272 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9273 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9280 /* mute/unmute internal speaker according to the hp jack and mute state */
9281 static void alc262_ultra_automute(struct hda_codec *codec)
9283 struct alc_spec *spec = codec->spec;
9287 /* auto-mute only when HP is used as HP */
9288 if (!spec->cur_mux[0]) {
9289 unsigned int present;
9290 /* need to execute and sync at first */
9291 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9292 present = snd_hda_codec_read(codec, 0x15, 0,
9293 AC_VERB_GET_PIN_SENSE, 0);
9294 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9295 if (spec->jack_present)
9296 mute = HDA_AMP_MUTE;
9298 /* mute/unmute internal speaker */
9299 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9300 HDA_AMP_MUTE, mute);
9301 /* mute/unmute HP */
9302 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9303 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9306 /* unsolicited event for HP jack sensing */
9307 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9310 if ((res >> 26) != ALC880_HP_EVENT)
9312 alc262_ultra_automute(codec);
9315 static struct hda_input_mux alc262_ultra_capture_source = {
9319 { "Headphone", 0x7 },
9323 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9324 struct snd_ctl_elem_value *ucontrol)
9326 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9327 struct alc_spec *spec = codec->spec;
9330 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9333 /* reprogram the HP pin as mic or HP according to the input source */
9334 snd_hda_codec_write_cache(codec, 0x15, 0,
9335 AC_VERB_SET_PIN_WIDGET_CONTROL,
9336 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9337 alc262_ultra_automute(codec); /* mute/unmute HP */
9341 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9342 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9343 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9345 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9346 .name = "Capture Source",
9347 .info = alc882_mux_enum_info,
9348 .get = alc882_mux_enum_get,
9349 .put = alc262_ultra_mux_enum_put,
9354 /* add playback controls from the parsed DAC table */
9355 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9356 const struct auto_pin_cfg *cfg)
9361 spec->multiout.num_dacs = 1; /* only use one dac */
9362 spec->multiout.dac_nids = spec->private_dac_nids;
9363 spec->multiout.dac_nids[0] = 2;
9365 nid = cfg->line_out_pins[0];
9367 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9368 "Front Playback Volume",
9369 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9372 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9373 "Front Playback Switch",
9374 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9379 nid = cfg->speaker_pins[0];
9382 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9383 "Speaker Playback Volume",
9384 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9388 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9389 "Speaker Playback Switch",
9390 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9395 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9396 "Speaker Playback Switch",
9397 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9403 nid = cfg->hp_pins[0];
9405 /* spec->multiout.hp_nid = 2; */
9407 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9408 "Headphone Playback Volume",
9409 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9413 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9414 "Headphone Playback Switch",
9415 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9420 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9421 "Headphone Playback Switch",
9422 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9431 /* identical with ALC880 */
9432 #define alc262_auto_create_analog_input_ctls \
9433 alc880_auto_create_analog_input_ctls
9436 * generic initialization of ADC, input mixers and output mixers
9438 static struct hda_verb alc262_volume_init_verbs[] = {
9440 * Unmute ADC0-2 and set the default input to mic-in
9442 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9444 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9446 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9449 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9451 * Note: PASD motherboards uses the Line In 2 as the input for
9452 * front panel mic (mic 2)
9454 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9462 * Set up output mixers (0x0c - 0x0f)
9464 /* set vol=0 to output mixers */
9465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9469 /* set up input amps for analog loopback */
9470 /* Amp Indices: DAC = 0, mixer = 1 */
9471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9473 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9474 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9476 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9478 /* FIXME: use matrix-type input source selection */
9479 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9480 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9482 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9483 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9484 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9499 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9501 * Unmute ADC0-2 and set the default input to mic-in
9503 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9504 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9505 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9506 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9507 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9510 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9512 * Note: PASD motherboards uses the Line In 2 as the input for
9513 * front panel mic (mic 2)
9515 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9525 * Set up output mixers (0x0c - 0x0e)
9527 /* set vol=0 to output mixers */
9528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9529 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9532 /* set up input amps for analog loopback */
9533 /* Amp Indices: DAC = 0, mixer = 1 */
9534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9541 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9543 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9545 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9548 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9549 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9555 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9558 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9559 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9560 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9561 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9562 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9565 /* FIXME: use matrix-type input source selection */
9566 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9567 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9568 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9573 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9574 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9583 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9588 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9590 * Unmute ADC0-2 and set the default input to mic-in
9592 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9594 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9596 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9599 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9601 * Note: PASD motherboards uses the Line In 2 as the input for front
9604 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9606 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9614 * Set up output mixers (0x0c - 0x0e)
9616 /* set vol=0 to output mixers */
9617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9621 /* set up input amps for analog loopback */
9622 /* Amp Indices: DAC = 0, mixer = 1 */
9623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9626 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9627 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9628 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9631 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9632 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9633 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9634 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9635 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9636 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9637 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9639 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9642 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9643 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9645 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9646 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9647 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9648 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9649 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9650 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9652 /* FIXME: use matrix-type input source selection */
9653 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9654 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9660 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9668 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9676 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9679 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9684 #ifdef CONFIG_SND_HDA_POWER_SAVE
9685 #define alc262_loopbacks alc880_loopbacks
9688 /* pcm configuration: identiacal with ALC880 */
9689 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9690 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9691 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9692 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9695 * BIOS auto configuration
9697 static int alc262_parse_auto_config(struct hda_codec *codec)
9699 struct alc_spec *spec = codec->spec;
9701 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9703 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9707 if (!spec->autocfg.line_outs)
9708 return 0; /* can't find valid BIOS pin config */
9709 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9712 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9716 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9718 if (spec->autocfg.dig_out_pin)
9719 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9720 if (spec->autocfg.dig_in_pin)
9721 spec->dig_in_nid = ALC262_DIGIN_NID;
9723 if (spec->kctl_alloc)
9724 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9726 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9727 spec->num_mux_defs = 1;
9728 spec->input_mux = &spec->private_imux;
9730 err = alc_auto_add_mic_boost(codec);
9737 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9738 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9739 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9740 #define alc262_auto_init_input_src alc882_auto_init_input_src
9743 /* init callback for auto-configuration model -- overriding the default init */
9744 static void alc262_auto_init(struct hda_codec *codec)
9746 struct alc_spec *spec = codec->spec;
9747 alc262_auto_init_multi_out(codec);
9748 alc262_auto_init_hp_out(codec);
9749 alc262_auto_init_analog_input(codec);
9750 alc262_auto_init_input_src(codec);
9751 if (spec->unsol_event)
9752 alc_sku_automute(codec);
9756 * configuration and preset
9758 static const char *alc262_models[ALC262_MODEL_LAST] = {
9759 [ALC262_BASIC] = "basic",
9760 [ALC262_HIPPO] = "hippo",
9761 [ALC262_HIPPO_1] = "hippo_1",
9762 [ALC262_FUJITSU] = "fujitsu",
9763 [ALC262_HP_BPC] = "hp-bpc",
9764 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9765 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9766 [ALC262_HP_RP5700] = "hp-rp5700",
9767 [ALC262_BENQ_ED8] = "benq",
9768 [ALC262_BENQ_T31] = "benq-t31",
9769 [ALC262_SONY_ASSAMD] = "sony-assamd",
9770 [ALC262_ULTRA] = "ultra",
9771 [ALC262_LENOVO_3000] = "lenovo-3000",
9772 [ALC262_NEC] = "nec",
9773 [ALC262_AUTO] = "auto",
9776 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9777 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9778 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
9779 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9780 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9781 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9782 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9783 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9784 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9785 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9786 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9787 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9788 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9789 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9790 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9791 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9792 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9793 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9794 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9795 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9796 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9797 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9798 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9799 ALC262_HP_TC_T5735),
9800 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9801 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9802 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9803 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9804 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9805 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9806 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9807 ALC262_SONY_ASSAMD),
9808 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9809 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9810 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9811 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9812 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9813 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9814 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9815 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9819 static struct alc_config_preset alc262_presets[] = {
9821 .mixers = { alc262_base_mixer },
9822 .init_verbs = { alc262_init_verbs },
9823 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9824 .dac_nids = alc262_dac_nids,
9826 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9827 .channel_mode = alc262_modes,
9828 .input_mux = &alc262_capture_source,
9831 .mixers = { alc262_base_mixer },
9832 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9833 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9834 .dac_nids = alc262_dac_nids,
9836 .dig_out_nid = ALC262_DIGOUT_NID,
9837 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9838 .channel_mode = alc262_modes,
9839 .input_mux = &alc262_capture_source,
9840 .unsol_event = alc262_hippo_unsol_event,
9841 .init_hook = alc262_hippo_automute,
9843 [ALC262_HIPPO_1] = {
9844 .mixers = { alc262_hippo1_mixer },
9845 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9846 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9847 .dac_nids = alc262_dac_nids,
9849 .dig_out_nid = ALC262_DIGOUT_NID,
9850 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9851 .channel_mode = alc262_modes,
9852 .input_mux = &alc262_capture_source,
9853 .unsol_event = alc262_hippo1_unsol_event,
9854 .init_hook = alc262_hippo1_automute,
9856 [ALC262_FUJITSU] = {
9857 .mixers = { alc262_fujitsu_mixer },
9858 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9859 alc262_fujitsu_unsol_verbs },
9860 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9861 .dac_nids = alc262_dac_nids,
9863 .dig_out_nid = ALC262_DIGOUT_NID,
9864 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9865 .channel_mode = alc262_modes,
9866 .input_mux = &alc262_fujitsu_capture_source,
9867 .unsol_event = alc262_fujitsu_unsol_event,
9868 .init_hook = alc262_fujitsu_init_hook,
9871 .mixers = { alc262_HP_BPC_mixer },
9872 .init_verbs = { alc262_HP_BPC_init_verbs },
9873 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9874 .dac_nids = alc262_dac_nids,
9876 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9877 .channel_mode = alc262_modes,
9878 .input_mux = &alc262_HP_capture_source,
9879 .unsol_event = alc262_hp_bpc_unsol_event,
9880 .init_hook = alc262_hp_bpc_automute,
9882 [ALC262_HP_BPC_D7000_WF] = {
9883 .mixers = { alc262_HP_BPC_WildWest_mixer },
9884 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9885 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9886 .dac_nids = alc262_dac_nids,
9888 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9889 .channel_mode = alc262_modes,
9890 .input_mux = &alc262_HP_D7000_capture_source,
9891 .unsol_event = alc262_hp_wildwest_unsol_event,
9892 .init_hook = alc262_hp_wildwest_automute,
9894 [ALC262_HP_BPC_D7000_WL] = {
9895 .mixers = { alc262_HP_BPC_WildWest_mixer,
9896 alc262_HP_BPC_WildWest_option_mixer },
9897 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9898 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9899 .dac_nids = alc262_dac_nids,
9901 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9902 .channel_mode = alc262_modes,
9903 .input_mux = &alc262_HP_D7000_capture_source,
9904 .unsol_event = alc262_hp_wildwest_unsol_event,
9905 .init_hook = alc262_hp_wildwest_automute,
9907 [ALC262_HP_TC_T5735] = {
9908 .mixers = { alc262_hp_t5735_mixer },
9909 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9910 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9911 .dac_nids = alc262_dac_nids,
9913 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9914 .channel_mode = alc262_modes,
9915 .input_mux = &alc262_capture_source,
9916 .unsol_event = alc262_hp_t5735_unsol_event,
9917 .init_hook = alc262_hp_t5735_init_hook,
9919 [ALC262_HP_RP5700] = {
9920 .mixers = { alc262_hp_rp5700_mixer },
9921 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9922 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9923 .dac_nids = alc262_dac_nids,
9924 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9925 .channel_mode = alc262_modes,
9926 .input_mux = &alc262_hp_rp5700_capture_source,
9928 [ALC262_BENQ_ED8] = {
9929 .mixers = { alc262_base_mixer },
9930 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9931 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9932 .dac_nids = alc262_dac_nids,
9934 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9935 .channel_mode = alc262_modes,
9936 .input_mux = &alc262_capture_source,
9938 [ALC262_SONY_ASSAMD] = {
9939 .mixers = { alc262_sony_mixer },
9940 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9941 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9942 .dac_nids = alc262_dac_nids,
9944 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9945 .channel_mode = alc262_modes,
9946 .input_mux = &alc262_capture_source,
9947 .unsol_event = alc262_hippo_unsol_event,
9948 .init_hook = alc262_hippo_automute,
9950 [ALC262_BENQ_T31] = {
9951 .mixers = { alc262_benq_t31_mixer },
9952 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9953 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9954 .dac_nids = alc262_dac_nids,
9956 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9957 .channel_mode = alc262_modes,
9958 .input_mux = &alc262_capture_source,
9959 .unsol_event = alc262_hippo_unsol_event,
9960 .init_hook = alc262_hippo_automute,
9963 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9964 .init_verbs = { alc262_ultra_verbs },
9965 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9966 .dac_nids = alc262_dac_nids,
9967 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9968 .channel_mode = alc262_modes,
9969 .input_mux = &alc262_ultra_capture_source,
9970 .adc_nids = alc262_adc_nids, /* ADC0 */
9971 .capsrc_nids = alc262_capsrc_nids,
9972 .num_adc_nids = 1, /* single ADC */
9973 .unsol_event = alc262_ultra_unsol_event,
9974 .init_hook = alc262_ultra_automute,
9976 [ALC262_LENOVO_3000] = {
9977 .mixers = { alc262_lenovo_3000_mixer },
9978 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9979 alc262_lenovo_3000_unsol_verbs },
9980 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9981 .dac_nids = alc262_dac_nids,
9983 .dig_out_nid = ALC262_DIGOUT_NID,
9984 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9985 .channel_mode = alc262_modes,
9986 .input_mux = &alc262_fujitsu_capture_source,
9987 .unsol_event = alc262_lenovo_3000_unsol_event,
9990 .mixers = { alc262_nec_mixer },
9991 .init_verbs = { alc262_nec_verbs },
9992 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9993 .dac_nids = alc262_dac_nids,
9995 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9996 .channel_mode = alc262_modes,
9997 .input_mux = &alc262_capture_source,
10001 static int patch_alc262(struct hda_codec *codec)
10003 struct alc_spec *spec;
10007 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10011 codec->spec = spec;
10013 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10018 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10019 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10020 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10021 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10025 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10027 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10031 if (board_config < 0) {
10032 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10033 "trying auto-probe from BIOS...\n");
10034 board_config = ALC262_AUTO;
10037 if (board_config == ALC262_AUTO) {
10038 /* automatic parse from the BIOS config */
10039 err = alc262_parse_auto_config(codec);
10045 "hda_codec: Cannot set up configuration "
10046 "from BIOS. Using base mode...\n");
10047 board_config = ALC262_BASIC;
10051 if (board_config != ALC262_AUTO)
10052 setup_preset(spec, &alc262_presets[board_config]);
10054 spec->stream_name_analog = "ALC262 Analog";
10055 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10056 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10058 spec->stream_name_digital = "ALC262 Digital";
10059 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10060 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10062 if (!spec->adc_nids && spec->input_mux) {
10063 /* check whether NID 0x07 is valid */
10064 unsigned int wcap = get_wcaps(codec, 0x07);
10067 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10068 if (wcap != AC_WID_AUD_IN) {
10069 spec->adc_nids = alc262_adc_nids_alt;
10070 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10071 spec->capsrc_nids = alc262_capsrc_nids_alt;
10072 spec->mixers[spec->num_mixers] =
10073 alc262_capture_alt_mixer;
10074 spec->num_mixers++;
10076 spec->adc_nids = alc262_adc_nids;
10077 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10078 spec->capsrc_nids = alc262_capsrc_nids;
10079 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
10080 spec->num_mixers++;
10084 spec->vmaster_nid = 0x0c;
10086 codec->patch_ops = alc_patch_ops;
10087 if (board_config == ALC262_AUTO)
10088 spec->init_hook = alc262_auto_init;
10089 #ifdef CONFIG_SND_HDA_POWER_SAVE
10090 if (!spec->loopback.amplist)
10091 spec->loopback.amplist = alc262_loopbacks;
10098 * ALC268 channel source setting (2 channel)
10100 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10101 #define alc268_modes alc260_modes
10103 static hda_nid_t alc268_dac_nids[2] = {
10108 static hda_nid_t alc268_adc_nids[2] = {
10113 static hda_nid_t alc268_adc_nids_alt[1] = {
10118 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10120 static struct snd_kcontrol_new alc268_base_mixer[] = {
10121 /* output mixer control */
10122 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10123 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10124 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10125 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10126 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10127 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10128 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10132 /* bind Beep switches of both NID 0x0f and 0x10 */
10133 static struct hda_bind_ctls alc268_bind_beep_sw = {
10134 .ops = &snd_hda_bind_sw,
10136 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10137 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10142 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10143 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10144 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10148 static struct hda_verb alc268_eapd_verbs[] = {
10149 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10150 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10154 /* Toshiba specific */
10155 #define alc268_toshiba_automute alc262_hippo_automute
10157 static struct hda_verb alc268_toshiba_verbs[] = {
10158 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10162 /* Acer specific */
10163 /* bind volumes of both NID 0x02 and 0x03 */
10164 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10165 .ops = &snd_hda_bind_vol,
10167 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10168 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10173 /* mute/unmute internal speaker according to the hp jack and mute state */
10174 static void alc268_acer_automute(struct hda_codec *codec, int force)
10176 struct alc_spec *spec = codec->spec;
10179 if (force || !spec->sense_updated) {
10180 unsigned int present;
10181 present = snd_hda_codec_read(codec, 0x14, 0,
10182 AC_VERB_GET_PIN_SENSE, 0);
10183 spec->jack_present = (present & 0x80000000) != 0;
10184 spec->sense_updated = 1;
10186 if (spec->jack_present)
10187 mute = HDA_AMP_MUTE; /* mute internal speaker */
10188 else /* unmute internal speaker if necessary */
10189 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10190 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10191 HDA_AMP_MUTE, mute);
10195 /* bind hp and internal speaker mute (with plug check) */
10196 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10197 struct snd_ctl_elem_value *ucontrol)
10199 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10200 long *valp = ucontrol->value.integer.value;
10203 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10205 valp[0] ? 0 : HDA_AMP_MUTE);
10206 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10208 valp[1] ? 0 : HDA_AMP_MUTE);
10210 alc268_acer_automute(codec, 0);
10214 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10215 /* output mixer control */
10216 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10219 .name = "Master Playback Switch",
10220 .info = snd_hda_mixer_amp_switch_info,
10221 .get = snd_hda_mixer_amp_switch_get,
10222 .put = alc268_acer_master_sw_put,
10223 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10225 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10226 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10227 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10231 static struct hda_verb alc268_acer_verbs[] = {
10232 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10233 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10236 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10237 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10239 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10243 /* unsolicited event for HP jack sensing */
10244 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10247 if ((res >> 26) != ALC880_HP_EVENT)
10249 alc268_toshiba_automute(codec);
10252 static void alc268_acer_unsol_event(struct hda_codec *codec,
10255 if ((res >> 26) != ALC880_HP_EVENT)
10257 alc268_acer_automute(codec, 1);
10260 static void alc268_acer_init_hook(struct hda_codec *codec)
10262 alc268_acer_automute(codec, 1);
10265 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10266 /* output mixer control */
10267 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10268 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10269 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10270 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10271 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10272 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10276 static struct hda_verb alc268_dell_verbs[] = {
10277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10278 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10279 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10283 /* mute/unmute internal speaker according to the hp jack and mute state */
10284 static void alc268_dell_automute(struct hda_codec *codec)
10286 unsigned int present;
10289 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10290 if (present & 0x80000000)
10291 mute = HDA_AMP_MUTE;
10293 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10294 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10295 HDA_AMP_MUTE, mute);
10298 static void alc268_dell_unsol_event(struct hda_codec *codec,
10301 if ((res >> 26) != ALC880_HP_EVENT)
10303 alc268_dell_automute(codec);
10306 #define alc268_dell_init_hook alc268_dell_automute
10308 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10309 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10310 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10311 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10313 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10314 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10315 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10316 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10320 static struct hda_verb alc267_quanta_il1_verbs[] = {
10321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10322 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10326 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10328 unsigned int present;
10330 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10331 & AC_PINSENSE_PRESENCE;
10332 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10333 present ? 0 : PIN_OUT);
10336 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10338 unsigned int present;
10340 present = snd_hda_codec_read(codec, 0x18, 0,
10341 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10342 snd_hda_codec_write(codec, 0x23, 0,
10343 AC_VERB_SET_CONNECT_SEL,
10344 present ? 0x00 : 0x01);
10347 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10349 alc267_quanta_il1_hp_automute(codec);
10350 alc267_quanta_il1_mic_automute(codec);
10353 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10356 switch (res >> 26) {
10357 case ALC880_HP_EVENT:
10358 alc267_quanta_il1_hp_automute(codec);
10360 case ALC880_MIC_EVENT:
10361 alc267_quanta_il1_mic_automute(codec);
10367 * generic initialization of ADC, input mixers and output mixers
10369 static struct hda_verb alc268_base_init_verbs[] = {
10370 /* Unmute DAC0-1 and set vol = 0 */
10371 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10372 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10373 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10374 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10375 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10376 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10379 * Set up output mixers (0x0c - 0x0e)
10381 /* set vol=0 to output mixers */
10382 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10383 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10384 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10385 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10387 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10388 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10392 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10393 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10394 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10395 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10396 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10397 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10399 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10400 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10401 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10402 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10404 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10405 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10407 /* set PCBEEP vol = 0, mute connections */
10408 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10410 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10412 /* Unmute Selector 23h,24h and set the default input to mic-in */
10414 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10415 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10416 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10423 * generic initialization of ADC, input mixers and output mixers
10425 static struct hda_verb alc268_volume_init_verbs[] = {
10426 /* set output DAC */
10427 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10428 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10429 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10430 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10432 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10434 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10435 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10436 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10439 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10441 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10442 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10444 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10445 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10446 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10447 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10449 /* set PCBEEP vol = 0, mute connections */
10450 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10451 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10452 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10457 #define alc268_mux_enum_info alc_mux_enum_info
10458 #define alc268_mux_enum_get alc_mux_enum_get
10459 #define alc268_mux_enum_put alc_mux_enum_put
10461 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10462 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10463 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10465 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10466 /* The multiple "Capture Source" controls confuse alsamixer
10467 * So call somewhat different..
10469 /* .name = "Capture Source", */
10470 .name = "Input Source",
10472 .info = alc268_mux_enum_info,
10473 .get = alc268_mux_enum_get,
10474 .put = alc268_mux_enum_put,
10479 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10480 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10481 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10482 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10483 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10485 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10486 /* The multiple "Capture Source" controls confuse alsamixer
10487 * So call somewhat different..
10489 /* .name = "Capture Source", */
10490 .name = "Input Source",
10492 .info = alc268_mux_enum_info,
10493 .get = alc268_mux_enum_get,
10494 .put = alc268_mux_enum_put,
10499 static struct hda_input_mux alc268_capture_source = {
10503 { "Front Mic", 0x1 },
10509 static struct hda_input_mux alc268_acer_capture_source = {
10513 { "Internal Mic", 0x6 },
10518 #ifdef CONFIG_SND_DEBUG
10519 static struct snd_kcontrol_new alc268_test_mixer[] = {
10520 /* Volume widgets */
10521 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10522 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10523 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10524 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10525 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10526 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10527 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10528 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10529 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10530 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10531 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10532 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10533 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10534 /* The below appears problematic on some hardwares */
10535 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10536 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10537 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10538 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10539 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10541 /* Modes for retasking pin widgets */
10542 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10543 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10544 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10545 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10547 /* Controls for GPIO pins, assuming they are configured as outputs */
10548 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10549 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10550 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10551 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10553 /* Switches to allow the digital SPDIF output pin to be enabled.
10554 * The ALC268 does not have an SPDIF input.
10556 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10558 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10559 * this output to turn on an external amplifier.
10561 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10562 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10568 /* create input playback/capture controls for the given pin */
10569 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10570 const char *ctlname, int idx)
10575 sprintf(name, "%s Playback Volume", ctlname);
10577 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10578 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10582 } else if (nid == 0x15) {
10583 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10584 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10590 sprintf(name, "%s Playback Switch", ctlname);
10591 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10592 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10598 /* add playback controls from the parsed DAC table */
10599 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10600 const struct auto_pin_cfg *cfg)
10605 spec->multiout.num_dacs = 2; /* only use one dac */
10606 spec->multiout.dac_nids = spec->private_dac_nids;
10607 spec->multiout.dac_nids[0] = 2;
10608 spec->multiout.dac_nids[1] = 3;
10610 nid = cfg->line_out_pins[0];
10612 alc268_new_analog_output(spec, nid, "Front", 0);
10614 nid = cfg->speaker_pins[0];
10616 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10617 "Speaker Playback Volume",
10618 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10622 nid = cfg->hp_pins[0];
10624 alc268_new_analog_output(spec, nid, "Headphone", 0);
10626 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10628 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10629 "Mono Playback Switch",
10630 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10637 /* create playback/capture controls for input pins */
10638 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10639 const struct auto_pin_cfg *cfg)
10641 struct hda_input_mux *imux = &spec->private_imux;
10644 for (i = 0; i < AUTO_PIN_LAST; i++) {
10645 switch(cfg->input_pins[i]) {
10647 idx1 = 0; /* Mic 1 */
10650 idx1 = 1; /* Mic 2 */
10653 idx1 = 2; /* Line In */
10660 idx1 = 6; /* digital mics */
10665 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10666 imux->items[imux->num_items].index = idx1;
10672 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10674 struct alc_spec *spec = codec->spec;
10675 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10676 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10677 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10678 unsigned int dac_vol1, dac_vol2;
10681 snd_hda_codec_write(codec, speaker_nid, 0,
10682 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10683 snd_hda_codec_write(codec, 0x0f, 0,
10684 AC_VERB_SET_AMP_GAIN_MUTE,
10686 snd_hda_codec_write(codec, 0x10, 0,
10687 AC_VERB_SET_AMP_GAIN_MUTE,
10690 snd_hda_codec_write(codec, 0x0f, 0,
10691 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10692 snd_hda_codec_write(codec, 0x10, 0,
10693 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10696 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10697 if (line_nid == 0x14)
10698 dac_vol2 = AMP_OUT_ZERO;
10699 else if (line_nid == 0x15)
10700 dac_vol1 = AMP_OUT_ZERO;
10701 if (hp_nid == 0x14)
10702 dac_vol2 = AMP_OUT_ZERO;
10703 else if (hp_nid == 0x15)
10704 dac_vol1 = AMP_OUT_ZERO;
10705 if (line_nid != 0x16 || hp_nid != 0x16 ||
10706 spec->autocfg.line_out_pins[1] != 0x16 ||
10707 spec->autocfg.line_out_pins[2] != 0x16)
10708 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10710 snd_hda_codec_write(codec, 0x02, 0,
10711 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10712 snd_hda_codec_write(codec, 0x03, 0,
10713 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10716 /* pcm configuration: identiacal with ALC880 */
10717 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10718 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10719 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10720 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10723 * BIOS auto configuration
10725 static int alc268_parse_auto_config(struct hda_codec *codec)
10727 struct alc_spec *spec = codec->spec;
10729 static hda_nid_t alc268_ignore[] = { 0 };
10731 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10735 if (!spec->autocfg.line_outs)
10736 return 0; /* can't find valid BIOS pin config */
10738 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10741 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10745 spec->multiout.max_channels = 2;
10747 /* digital only support output */
10748 if (spec->autocfg.dig_out_pin)
10749 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10751 if (spec->kctl_alloc)
10752 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10754 if (spec->autocfg.speaker_pins[0] != 0x1d)
10755 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10757 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10758 spec->num_mux_defs = 1;
10759 spec->input_mux = &spec->private_imux;
10761 err = alc_auto_add_mic_boost(codec);
10768 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10769 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10770 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10772 /* init callback for auto-configuration model -- overriding the default init */
10773 static void alc268_auto_init(struct hda_codec *codec)
10775 struct alc_spec *spec = codec->spec;
10776 alc268_auto_init_multi_out(codec);
10777 alc268_auto_init_hp_out(codec);
10778 alc268_auto_init_mono_speaker_out(codec);
10779 alc268_auto_init_analog_input(codec);
10780 if (spec->unsol_event)
10781 alc_sku_automute(codec);
10785 * configuration and preset
10787 static const char *alc268_models[ALC268_MODEL_LAST] = {
10788 [ALC267_QUANTA_IL1] = "quanta-il1",
10789 [ALC268_3ST] = "3stack",
10790 [ALC268_TOSHIBA] = "toshiba",
10791 [ALC268_ACER] = "acer",
10792 [ALC268_DELL] = "dell",
10793 [ALC268_ZEPTO] = "zepto",
10794 #ifdef CONFIG_SND_DEBUG
10795 [ALC268_TEST] = "test",
10797 [ALC268_AUTO] = "auto",
10800 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10801 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10802 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10803 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10804 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10805 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10806 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10807 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10808 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10809 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10810 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10811 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10812 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10813 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10814 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10818 static struct alc_config_preset alc268_presets[] = {
10819 [ALC267_QUANTA_IL1] = {
10820 .mixers = { alc267_quanta_il1_mixer },
10821 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10822 alc267_quanta_il1_verbs },
10823 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10824 .dac_nids = alc268_dac_nids,
10825 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10826 .adc_nids = alc268_adc_nids_alt,
10828 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10829 .channel_mode = alc268_modes,
10830 .input_mux = &alc268_capture_source,
10831 .unsol_event = alc267_quanta_il1_unsol_event,
10832 .init_hook = alc267_quanta_il1_automute,
10835 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10836 alc268_beep_mixer },
10837 .init_verbs = { alc268_base_init_verbs },
10838 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10839 .dac_nids = alc268_dac_nids,
10840 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10841 .adc_nids = alc268_adc_nids_alt,
10842 .capsrc_nids = alc268_capsrc_nids,
10844 .dig_out_nid = ALC268_DIGOUT_NID,
10845 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10846 .channel_mode = alc268_modes,
10847 .input_mux = &alc268_capture_source,
10849 [ALC268_TOSHIBA] = {
10850 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10851 alc268_beep_mixer },
10852 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10853 alc268_toshiba_verbs },
10854 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10855 .dac_nids = alc268_dac_nids,
10856 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10857 .adc_nids = alc268_adc_nids_alt,
10858 .capsrc_nids = alc268_capsrc_nids,
10860 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10861 .channel_mode = alc268_modes,
10862 .input_mux = &alc268_capture_source,
10863 .unsol_event = alc268_toshiba_unsol_event,
10864 .init_hook = alc268_toshiba_automute,
10867 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10868 alc268_beep_mixer },
10869 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10870 alc268_acer_verbs },
10871 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10872 .dac_nids = alc268_dac_nids,
10873 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10874 .adc_nids = alc268_adc_nids_alt,
10875 .capsrc_nids = alc268_capsrc_nids,
10877 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10878 .channel_mode = alc268_modes,
10879 .input_mux = &alc268_acer_capture_source,
10880 .unsol_event = alc268_acer_unsol_event,
10881 .init_hook = alc268_acer_init_hook,
10884 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10885 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10886 alc268_dell_verbs },
10887 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10888 .dac_nids = alc268_dac_nids,
10890 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10891 .channel_mode = alc268_modes,
10892 .unsol_event = alc268_dell_unsol_event,
10893 .init_hook = alc268_dell_init_hook,
10894 .input_mux = &alc268_capture_source,
10897 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10898 alc268_beep_mixer },
10899 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10900 alc268_toshiba_verbs },
10901 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10902 .dac_nids = alc268_dac_nids,
10903 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10904 .adc_nids = alc268_adc_nids_alt,
10905 .capsrc_nids = alc268_capsrc_nids,
10907 .dig_out_nid = ALC268_DIGOUT_NID,
10908 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10909 .channel_mode = alc268_modes,
10910 .input_mux = &alc268_capture_source,
10911 .unsol_event = alc268_toshiba_unsol_event,
10912 .init_hook = alc268_toshiba_automute
10914 #ifdef CONFIG_SND_DEBUG
10916 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10917 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10918 alc268_volume_init_verbs },
10919 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10920 .dac_nids = alc268_dac_nids,
10921 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10922 .adc_nids = alc268_adc_nids_alt,
10923 .capsrc_nids = alc268_capsrc_nids,
10925 .dig_out_nid = ALC268_DIGOUT_NID,
10926 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10927 .channel_mode = alc268_modes,
10928 .input_mux = &alc268_capture_source,
10933 static int patch_alc268(struct hda_codec *codec)
10935 struct alc_spec *spec;
10939 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10943 codec->spec = spec;
10945 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10949 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10950 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10951 "trying auto-probe from BIOS...\n");
10952 board_config = ALC268_AUTO;
10955 if (board_config == ALC268_AUTO) {
10956 /* automatic parse from the BIOS config */
10957 err = alc268_parse_auto_config(codec);
10963 "hda_codec: Cannot set up configuration "
10964 "from BIOS. Using base mode...\n");
10965 board_config = ALC268_3ST;
10969 if (board_config != ALC268_AUTO)
10970 setup_preset(spec, &alc268_presets[board_config]);
10972 if (codec->vendor_id == 0x10ec0267) {
10973 spec->stream_name_analog = "ALC267 Analog";
10974 spec->stream_name_digital = "ALC267 Digital";
10976 spec->stream_name_analog = "ALC268 Analog";
10977 spec->stream_name_digital = "ALC268 Digital";
10980 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10981 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10982 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10984 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10986 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10987 /* override the amp caps for beep generator */
10988 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10989 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10990 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10991 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10992 (0 << AC_AMPCAP_MUTE_SHIFT));
10994 if (!spec->adc_nids && spec->input_mux) {
10995 /* check whether NID 0x07 is valid */
10996 unsigned int wcap = get_wcaps(codec, 0x07);
11000 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11001 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11002 spec->adc_nids = alc268_adc_nids_alt;
11003 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11004 spec->mixers[spec->num_mixers] =
11005 alc268_capture_alt_mixer;
11006 spec->num_mixers++;
11008 spec->adc_nids = alc268_adc_nids;
11009 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11010 spec->mixers[spec->num_mixers] =
11011 alc268_capture_mixer;
11012 spec->num_mixers++;
11014 spec->capsrc_nids = alc268_capsrc_nids;
11015 /* set default input source */
11016 for (i = 0; i < spec->num_adc_nids; i++)
11017 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11018 0, AC_VERB_SET_CONNECT_SEL,
11019 spec->input_mux->items[0].index);
11022 spec->vmaster_nid = 0x02;
11024 codec->patch_ops = alc_patch_ops;
11025 if (board_config == ALC268_AUTO)
11026 spec->init_hook = alc268_auto_init;
11032 * ALC269 channel source setting (2 channel)
11034 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11036 #define alc269_dac_nids alc260_dac_nids
11038 static hda_nid_t alc269_adc_nids[1] = {
11043 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11051 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11059 #define alc269_modes alc260_modes
11060 #define alc269_capture_source alc880_lg_lw_capture_source
11062 static struct snd_kcontrol_new alc269_base_mixer[] = {
11063 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11064 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11065 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11066 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11069 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11070 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11071 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11072 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11073 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11074 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11078 /* bind volumes of both NID 0x0c and 0x0d */
11079 static struct hda_bind_ctls alc269_epc_bind_vol = {
11080 .ops = &snd_hda_bind_vol,
11082 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11083 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11088 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11089 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11090 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11091 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11095 /* capture mixer elements */
11096 static struct snd_kcontrol_new alc269_capture_mixer[] = {
11097 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11098 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11100 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11101 /* The multiple "Capture Source" controls confuse alsamixer
11102 * So call somewhat different..
11104 /* .name = "Capture Source", */
11105 .name = "Input Source",
11107 .info = alc_mux_enum_info,
11108 .get = alc_mux_enum_get,
11109 .put = alc_mux_enum_put,
11114 /* capture mixer elements */
11115 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11116 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11117 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11122 * generic initialization of ADC, input mixers and output mixers
11124 static struct hda_verb alc269_init_verbs[] = {
11126 * Unmute ADC0 and set the default input to mic-in
11128 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11130 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11131 * analog-loopback mixer widget
11132 * Note: PASD motherboards uses the Line In 2 as the input for
11133 * front panel mic (mic 2)
11135 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11139 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11140 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11143 * Set up output mixers (0x0c - 0x0e)
11145 /* set vol=0 to output mixers */
11146 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11147 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11149 /* set up input amps for analog loopback */
11150 /* Amp Indices: DAC = 0, mixer = 1 */
11151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11152 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11153 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11154 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11156 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11158 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11159 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11160 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11161 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11162 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11163 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11164 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11166 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11168 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11169 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11170 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11171 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11172 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11174 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11175 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11177 /* FIXME: use matrix-type input source selection */
11178 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11179 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11180 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11186 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11187 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11191 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11192 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11193 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
11194 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11195 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
11196 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11197 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11198 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11202 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11203 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11204 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
11205 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11206 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
11207 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11208 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11212 /* toggle speaker-output according to the hp-jack state */
11213 static void alc269_speaker_automute(struct hda_codec *codec)
11215 unsigned int present;
11218 present = snd_hda_codec_read(codec, 0x15, 0,
11219 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11220 bits = present ? AMP_IN_MUTE(0) : 0;
11221 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11222 AMP_IN_MUTE(0), bits);
11223 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11224 AMP_IN_MUTE(0), bits);
11227 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11229 unsigned int present;
11231 present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0)
11232 & AC_PINSENSE_PRESENCE;
11233 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11237 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11239 unsigned int present;
11241 present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0)
11242 & AC_PINSENSE_PRESENCE;
11243 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11244 present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0));
11245 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11246 present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1));
11249 /* unsolicited event for HP jack sensing */
11250 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11253 if ((res >> 26) == ALC880_HP_EVENT)
11254 alc269_speaker_automute(codec);
11256 if ((res >> 26) == ALC880_MIC_EVENT)
11257 alc269_eeepc_dmic_automute(codec);
11260 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11262 alc269_speaker_automute(codec);
11263 alc269_eeepc_dmic_automute(codec);
11266 /* unsolicited event for HP jack sensing */
11267 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
11270 if ((res >> 26) == ALC880_HP_EVENT)
11271 alc269_speaker_automute(codec);
11273 if ((res >> 26) == ALC880_MIC_EVENT)
11274 alc269_eeepc_amic_automute(codec);
11277 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
11279 alc269_speaker_automute(codec);
11280 alc269_eeepc_amic_automute(codec);
11283 /* add playback controls from the parsed DAC table */
11284 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11285 const struct auto_pin_cfg *cfg)
11290 spec->multiout.num_dacs = 1; /* only use one dac */
11291 spec->multiout.dac_nids = spec->private_dac_nids;
11292 spec->multiout.dac_nids[0] = 2;
11294 nid = cfg->line_out_pins[0];
11296 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11297 "Front Playback Volume",
11298 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
11301 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11302 "Front Playback Switch",
11303 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11308 nid = cfg->speaker_pins[0];
11310 if (!cfg->line_out_pins[0]) {
11311 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11312 "Speaker Playback Volume",
11313 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11319 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11320 "Speaker Playback Switch",
11321 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11326 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11327 "Speaker Playback Switch",
11328 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11334 nid = cfg->hp_pins[0];
11336 /* spec->multiout.hp_nid = 2; */
11337 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
11338 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11339 "Headphone Playback Volume",
11340 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11346 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11347 "Headphone Playback Switch",
11348 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11353 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11354 "Headphone Playback Switch",
11355 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11364 #define alc269_auto_create_analog_input_ctls \
11365 alc880_auto_create_analog_input_ctls
11367 #ifdef CONFIG_SND_HDA_POWER_SAVE
11368 #define alc269_loopbacks alc880_loopbacks
11371 /* pcm configuration: identiacal with ALC880 */
11372 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11373 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11374 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11375 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
11378 * BIOS auto configuration
11380 static int alc269_parse_auto_config(struct hda_codec *codec)
11382 struct alc_spec *spec = codec->spec;
11384 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
11386 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11391 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
11394 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
11398 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11400 if (spec->autocfg.dig_out_pin)
11401 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
11403 if (spec->kctl_alloc)
11404 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11406 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
11407 spec->num_mux_defs = 1;
11408 spec->input_mux = &spec->private_imux;
11410 err = alc_auto_add_mic_boost(codec);
11414 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
11415 spec->num_mixers++;
11420 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11421 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11422 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11425 /* init callback for auto-configuration model -- overriding the default init */
11426 static void alc269_auto_init(struct hda_codec *codec)
11428 struct alc_spec *spec = codec->spec;
11429 alc269_auto_init_multi_out(codec);
11430 alc269_auto_init_hp_out(codec);
11431 alc269_auto_init_analog_input(codec);
11432 if (spec->unsol_event)
11433 alc_sku_automute(codec);
11437 * configuration and preset
11439 static const char *alc269_models[ALC269_MODEL_LAST] = {
11440 [ALC269_BASIC] = "basic",
11443 static struct snd_pci_quirk alc269_cfg_tbl[] = {
11444 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11445 ALC269_ASUS_EEEPC_P703),
11446 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
11447 ALC269_ASUS_EEEPC_P901),
11451 static struct alc_config_preset alc269_presets[] = {
11453 .mixers = { alc269_base_mixer, alc269_capture_mixer },
11454 .init_verbs = { alc269_init_verbs },
11455 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11456 .dac_nids = alc269_dac_nids,
11458 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11459 .channel_mode = alc269_modes,
11460 .input_mux = &alc269_capture_source,
11462 [ALC269_ASUS_EEEPC_P703] = {
11463 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer },
11464 .init_verbs = { alc269_init_verbs,
11465 alc269_eeepc_amic_init_verbs },
11466 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11467 .dac_nids = alc269_dac_nids,
11469 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11470 .channel_mode = alc269_modes,
11471 .input_mux = &alc269_eeepc_amic_capture_source,
11472 .unsol_event = alc269_eeepc_amic_unsol_event,
11473 .init_hook = alc269_eeepc_amic_inithook,
11475 [ALC269_ASUS_EEEPC_P901] = {
11476 .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer},
11477 .init_verbs = { alc269_init_verbs,
11478 alc269_eeepc_dmic_init_verbs },
11479 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11480 .dac_nids = alc269_dac_nids,
11482 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11483 .channel_mode = alc269_modes,
11484 .input_mux = &alc269_eeepc_dmic_capture_source,
11485 .unsol_event = alc269_eeepc_dmic_unsol_event,
11486 .init_hook = alc269_eeepc_dmic_inithook,
11490 static int patch_alc269(struct hda_codec *codec)
11492 struct alc_spec *spec;
11496 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11500 codec->spec = spec;
11502 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11504 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
11508 if (board_config < 0) {
11509 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
11510 "trying auto-probe from BIOS...\n");
11511 board_config = ALC269_AUTO;
11514 if (board_config == ALC269_AUTO) {
11515 /* automatic parse from the BIOS config */
11516 err = alc269_parse_auto_config(codec);
11522 "hda_codec: Cannot set up configuration "
11523 "from BIOS. Using base mode...\n");
11524 board_config = ALC269_BASIC;
11528 if (board_config != ALC269_AUTO)
11529 setup_preset(spec, &alc269_presets[board_config]);
11531 spec->stream_name_analog = "ALC269 Analog";
11532 spec->stream_analog_playback = &alc269_pcm_analog_playback;
11533 spec->stream_analog_capture = &alc269_pcm_analog_capture;
11535 spec->stream_name_digital = "ALC269 Digital";
11536 spec->stream_digital_playback = &alc269_pcm_digital_playback;
11537 spec->stream_digital_capture = &alc269_pcm_digital_capture;
11539 spec->adc_nids = alc269_adc_nids;
11540 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
11542 codec->patch_ops = alc_patch_ops;
11543 if (board_config == ALC269_AUTO)
11544 spec->init_hook = alc269_auto_init;
11545 #ifdef CONFIG_SND_HDA_POWER_SAVE
11546 if (!spec->loopback.amplist)
11547 spec->loopback.amplist = alc269_loopbacks;
11554 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11558 * set the path ways for 2 channel output
11559 * need to set the codec line out and mic 1 pin widgets to inputs
11561 static struct hda_verb alc861_threestack_ch2_init[] = {
11562 /* set pin widget 1Ah (line in) for input */
11563 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11564 /* set pin widget 18h (mic1/2) for input, for mic also enable
11567 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11569 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11571 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11572 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11578 * need to set the codec line out and mic 1 pin widgets to outputs
11580 static struct hda_verb alc861_threestack_ch6_init[] = {
11581 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11582 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11583 /* set pin widget 18h (mic1) for output (CLFE)*/
11584 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11586 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11587 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11589 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11591 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11592 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11597 static struct hda_channel_mode alc861_threestack_modes[2] = {
11598 { 2, alc861_threestack_ch2_init },
11599 { 6, alc861_threestack_ch6_init },
11601 /* Set mic1 as input and unmute the mixer */
11602 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11603 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11604 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11607 /* Set mic1 as output and mute mixer */
11608 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11609 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11610 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11614 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11615 { 2, alc861_uniwill_m31_ch2_init },
11616 { 4, alc861_uniwill_m31_ch4_init },
11619 /* Set mic1 and line-in as input and unmute the mixer */
11620 static struct hda_verb alc861_asus_ch2_init[] = {
11621 /* set pin widget 1Ah (line in) for input */
11622 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11623 /* set pin widget 18h (mic1/2) for input, for mic also enable
11626 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11628 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11630 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11631 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11635 /* Set mic1 nad line-in as output and mute mixer */
11636 static struct hda_verb alc861_asus_ch6_init[] = {
11637 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11638 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11639 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11640 /* set pin widget 18h (mic1) for output (CLFE)*/
11641 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11642 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11643 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11644 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11646 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11648 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11649 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11654 static struct hda_channel_mode alc861_asus_modes[2] = {
11655 { 2, alc861_asus_ch2_init },
11656 { 6, alc861_asus_ch6_init },
11661 static struct snd_kcontrol_new alc861_base_mixer[] = {
11662 /* output mixer control */
11663 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11664 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11665 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11666 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11667 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11669 /*Input mixer control */
11670 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11671 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11672 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11673 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11674 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11675 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11676 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11677 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11678 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11681 /* Capture mixer control */
11682 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11683 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11685 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11686 .name = "Capture Source",
11688 .info = alc_mux_enum_info,
11689 .get = alc_mux_enum_get,
11690 .put = alc_mux_enum_put,
11695 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11696 /* output mixer control */
11697 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11698 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11699 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11700 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11701 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11703 /* Input mixer control */
11704 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11705 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11706 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11707 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11708 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11709 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11710 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11711 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11712 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11715 /* Capture mixer control */
11716 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11717 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11719 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11720 .name = "Capture Source",
11722 .info = alc_mux_enum_info,
11723 .get = alc_mux_enum_get,
11724 .put = alc_mux_enum_put,
11727 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11728 .name = "Channel Mode",
11729 .info = alc_ch_mode_info,
11730 .get = alc_ch_mode_get,
11731 .put = alc_ch_mode_put,
11732 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11737 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11738 /* output mixer control */
11739 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11740 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11741 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11743 /*Capture mixer control */
11744 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11745 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11747 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11748 .name = "Capture Source",
11750 .info = alc_mux_enum_info,
11751 .get = alc_mux_enum_get,
11752 .put = alc_mux_enum_put,
11758 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11759 /* output mixer control */
11760 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11761 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11762 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11763 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11764 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11766 /* Input mixer control */
11767 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11768 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11769 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11770 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11771 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11772 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11774 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11775 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11776 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11778 /* Capture mixer control */
11779 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11780 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11783 .name = "Capture Source",
11785 .info = alc_mux_enum_info,
11786 .get = alc_mux_enum_get,
11787 .put = alc_mux_enum_put,
11790 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11791 .name = "Channel Mode",
11792 .info = alc_ch_mode_info,
11793 .get = alc_ch_mode_get,
11794 .put = alc_ch_mode_put,
11795 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11800 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11801 /* output mixer control */
11802 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11803 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11804 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11805 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11806 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11808 /* Input mixer control */
11809 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11810 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11811 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11812 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11813 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11814 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11816 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11817 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11818 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11820 /* Capture mixer control */
11821 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11822 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11824 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11825 .name = "Capture Source",
11827 .info = alc_mux_enum_info,
11828 .get = alc_mux_enum_get,
11829 .put = alc_mux_enum_put,
11832 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11833 .name = "Channel Mode",
11834 .info = alc_ch_mode_info,
11835 .get = alc_ch_mode_get,
11836 .put = alc_ch_mode_put,
11837 .private_value = ARRAY_SIZE(alc861_asus_modes),
11842 /* additional mixer */
11843 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11844 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11845 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11846 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11847 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11852 * generic initialization of ADC, input mixers and output mixers
11854 static struct hda_verb alc861_base_init_verbs[] = {
11856 * Unmute ADC0 and set the default input to mic-in
11858 /* port-A for surround (rear panel) */
11859 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11860 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11861 /* port-B for mic-in (rear panel) with vref */
11862 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11863 /* port-C for line-in (rear panel) */
11864 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11865 /* port-D for Front */
11866 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11867 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11868 /* port-E for HP out (front panel) */
11869 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11870 /* route front PCM to HP */
11871 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11872 /* port-F for mic-in (front panel) with vref */
11873 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11874 /* port-G for CLFE (rear panel) */
11875 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11876 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11877 /* port-H for side (rear panel) */
11878 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11879 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11881 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11882 /* route front mic to ADC1*/
11883 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11884 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11886 /* Unmute DAC0~3 & spdif out*/
11887 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11888 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11889 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11890 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11891 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11893 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11894 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11895 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11896 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11897 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11899 /* Unmute Stereo Mixer 15 */
11900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11901 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11902 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11903 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11905 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11906 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11907 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11908 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11909 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11910 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11911 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11912 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11913 /* hp used DAC 3 (Front) */
11914 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11915 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11920 static struct hda_verb alc861_threestack_init_verbs[] = {
11922 * Unmute ADC0 and set the default input to mic-in
11924 /* port-A for surround (rear panel) */
11925 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11926 /* port-B for mic-in (rear panel) with vref */
11927 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11928 /* port-C for line-in (rear panel) */
11929 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11930 /* port-D for Front */
11931 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11932 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11933 /* port-E for HP out (front panel) */
11934 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11935 /* route front PCM to HP */
11936 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11937 /* port-F for mic-in (front panel) with vref */
11938 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11939 /* port-G for CLFE (rear panel) */
11940 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11941 /* port-H for side (rear panel) */
11942 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11944 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11945 /* route front mic to ADC1*/
11946 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11947 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11948 /* Unmute DAC0~3 & spdif out*/
11949 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11950 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11951 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11952 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11955 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11956 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11957 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11958 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11959 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11961 /* Unmute Stereo Mixer 15 */
11962 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11963 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11965 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11967 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11968 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11969 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11970 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11971 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11973 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11975 /* hp used DAC 3 (Front) */
11976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11977 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11981 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11983 * Unmute ADC0 and set the default input to mic-in
11985 /* port-A for surround (rear panel) */
11986 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11987 /* port-B for mic-in (rear panel) with vref */
11988 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11989 /* port-C for line-in (rear panel) */
11990 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11991 /* port-D for Front */
11992 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11993 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11994 /* port-E for HP out (front panel) */
11995 /* this has to be set to VREF80 */
11996 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11997 /* route front PCM to HP */
11998 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11999 /* port-F for mic-in (front panel) with vref */
12000 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12001 /* port-G for CLFE (rear panel) */
12002 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12003 /* port-H for side (rear panel) */
12004 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12006 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12007 /* route front mic to ADC1*/
12008 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12009 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12010 /* Unmute DAC0~3 & spdif out*/
12011 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12012 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12013 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12014 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12017 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12018 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12019 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12020 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12021 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12023 /* Unmute Stereo Mixer 15 */
12024 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12025 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12029 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12030 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12031 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12032 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12033 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12034 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12035 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12036 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12037 /* hp used DAC 3 (Front) */
12038 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12039 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12043 static struct hda_verb alc861_asus_init_verbs[] = {
12045 * Unmute ADC0 and set the default input to mic-in
12047 /* port-A for surround (rear panel)
12048 * according to codec#0 this is the HP jack
12050 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12051 /* route front PCM to HP */
12052 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12053 /* port-B for mic-in (rear panel) with vref */
12054 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12055 /* port-C for line-in (rear panel) */
12056 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12057 /* port-D for Front */
12058 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12059 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12060 /* port-E for HP out (front panel) */
12061 /* this has to be set to VREF80 */
12062 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12063 /* route front PCM to HP */
12064 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12065 /* port-F for mic-in (front panel) with vref */
12066 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12067 /* port-G for CLFE (rear panel) */
12068 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12069 /* port-H for side (rear panel) */
12070 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12072 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12073 /* route front mic to ADC1*/
12074 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12075 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12076 /* Unmute DAC0~3 & spdif out*/
12077 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12078 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12079 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12080 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12082 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12083 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12084 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12085 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12086 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12088 /* Unmute Stereo Mixer 15 */
12089 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12094 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12095 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12096 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12097 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12098 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12099 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12100 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12101 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12102 /* hp used DAC 3 (Front) */
12103 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12104 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12108 /* additional init verbs for ASUS laptops */
12109 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
12110 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
12111 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
12116 * generic initialization of ADC, input mixers and output mixers
12118 static struct hda_verb alc861_auto_init_verbs[] = {
12120 * Unmute ADC0 and set the default input to mic-in
12122 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12123 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12125 /* Unmute DAC0~3 & spdif out*/
12126 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12127 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12128 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12129 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12132 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12133 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12134 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12135 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12136 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12138 /* Unmute Stereo Mixer 15 */
12139 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
12144 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12145 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12146 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12147 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12149 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12150 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12151 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12153 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12155 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12156 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12157 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12158 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12159 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12160 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12162 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
12167 static struct hda_verb alc861_toshiba_init_verbs[] = {
12168 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12173 /* toggle speaker-output according to the hp-jack state */
12174 static void alc861_toshiba_automute(struct hda_codec *codec)
12176 unsigned int present;
12178 present = snd_hda_codec_read(codec, 0x0f, 0,
12179 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12180 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
12181 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12182 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
12183 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
12186 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
12189 if ((res >> 26) == ALC880_HP_EVENT)
12190 alc861_toshiba_automute(codec);
12193 /* pcm configuration: identiacal with ALC880 */
12194 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
12195 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
12196 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
12197 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
12200 #define ALC861_DIGOUT_NID 0x07
12202 static struct hda_channel_mode alc861_8ch_modes[1] = {
12206 static hda_nid_t alc861_dac_nids[4] = {
12207 /* front, surround, clfe, side */
12208 0x03, 0x06, 0x05, 0x04
12211 static hda_nid_t alc660_dac_nids[3] = {
12212 /* front, clfe, surround */
12216 static hda_nid_t alc861_adc_nids[1] = {
12221 static struct hda_input_mux alc861_capture_source = {
12225 { "Front Mic", 0x3 },
12232 /* fill in the dac_nids table from the parsed pin configuration */
12233 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
12234 const struct auto_pin_cfg *cfg)
12239 spec->multiout.dac_nids = spec->private_dac_nids;
12240 for (i = 0; i < cfg->line_outs; i++) {
12241 nid = cfg->line_out_pins[i];
12243 if (i >= ARRAY_SIZE(alc861_dac_nids))
12245 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
12248 spec->multiout.num_dacs = cfg->line_outs;
12252 /* add playback controls from the parsed DAC table */
12253 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
12254 const struct auto_pin_cfg *cfg)
12257 static const char *chname[4] = {
12258 "Front", "Surround", NULL /*CLFE*/, "Side"
12263 for (i = 0; i < cfg->line_outs; i++) {
12264 nid = spec->multiout.dac_nids[i];
12269 err = add_control(spec, ALC_CTL_BIND_MUTE,
12270 "Center Playback Switch",
12271 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12275 err = add_control(spec, ALC_CTL_BIND_MUTE,
12276 "LFE Playback Switch",
12277 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12282 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
12284 if (nid == alc861_dac_nids[idx])
12286 sprintf(name, "%s Playback Switch", chname[idx]);
12287 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12288 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12297 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
12305 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
12307 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12308 "Headphone Playback Switch",
12309 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12312 spec->multiout.hp_nid = nid;
12317 /* create playback/capture controls for input pins */
12318 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
12319 const struct auto_pin_cfg *cfg)
12321 struct hda_input_mux *imux = &spec->private_imux;
12322 int i, err, idx, idx1;
12324 for (i = 0; i < AUTO_PIN_LAST; i++) {
12325 switch (cfg->input_pins[i]) {
12328 idx = 2; /* Line In */
12332 idx = 2; /* Line In */
12336 idx = 1; /* Mic In */
12340 idx = 1; /* Mic In */
12350 err = new_analog_input(spec, cfg->input_pins[i],
12351 auto_pin_cfg_labels[i], idx, 0x15);
12355 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12356 imux->items[imux->num_items].index = idx1;
12362 static struct snd_kcontrol_new alc861_capture_mixer[] = {
12363 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12364 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12367 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12368 /* The multiple "Capture Source" controls confuse alsamixer
12369 * So call somewhat different..
12371 /* .name = "Capture Source", */
12372 .name = "Input Source",
12374 .info = alc_mux_enum_info,
12375 .get = alc_mux_enum_get,
12376 .put = alc_mux_enum_put,
12381 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
12383 int pin_type, int dac_idx)
12385 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12387 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12391 static void alc861_auto_init_multi_out(struct hda_codec *codec)
12393 struct alc_spec *spec = codec->spec;
12396 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
12397 for (i = 0; i < spec->autocfg.line_outs; i++) {
12398 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12399 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12401 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
12402 spec->multiout.dac_nids[i]);
12406 static void alc861_auto_init_hp_out(struct hda_codec *codec)
12408 struct alc_spec *spec = codec->spec;
12411 pin = spec->autocfg.hp_pins[0];
12412 if (pin) /* connect to front */
12413 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
12414 spec->multiout.dac_nids[0]);
12415 pin = spec->autocfg.speaker_pins[0];
12417 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12420 static void alc861_auto_init_analog_input(struct hda_codec *codec)
12422 struct alc_spec *spec = codec->spec;
12425 for (i = 0; i < AUTO_PIN_LAST; i++) {
12426 hda_nid_t nid = spec->autocfg.input_pins[i];
12427 if (nid >= 0x0c && nid <= 0x11) {
12428 snd_hda_codec_write(codec, nid, 0,
12429 AC_VERB_SET_PIN_WIDGET_CONTROL,
12430 i <= AUTO_PIN_FRONT_MIC ?
12431 PIN_VREF80 : PIN_IN);
12436 /* parse the BIOS configuration and set up the alc_spec */
12437 /* return 1 if successful, 0 if the proper config is not found,
12438 * or a negative error code
12440 static int alc861_parse_auto_config(struct hda_codec *codec)
12442 struct alc_spec *spec = codec->spec;
12444 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12446 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12450 if (!spec->autocfg.line_outs)
12451 return 0; /* can't find valid BIOS pin config */
12453 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
12456 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
12459 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
12462 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
12466 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12468 if (spec->autocfg.dig_out_pin)
12469 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
12471 if (spec->kctl_alloc)
12472 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12474 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
12476 spec->num_mux_defs = 1;
12477 spec->input_mux = &spec->private_imux;
12479 spec->adc_nids = alc861_adc_nids;
12480 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
12481 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
12482 spec->num_mixers++;
12487 /* additional initialization for auto-configuration model */
12488 static void alc861_auto_init(struct hda_codec *codec)
12490 struct alc_spec *spec = codec->spec;
12491 alc861_auto_init_multi_out(codec);
12492 alc861_auto_init_hp_out(codec);
12493 alc861_auto_init_analog_input(codec);
12494 if (spec->unsol_event)
12495 alc_sku_automute(codec);
12498 #ifdef CONFIG_SND_HDA_POWER_SAVE
12499 static struct hda_amp_list alc861_loopbacks[] = {
12500 { 0x15, HDA_INPUT, 0 },
12501 { 0x15, HDA_INPUT, 1 },
12502 { 0x15, HDA_INPUT, 2 },
12503 { 0x15, HDA_INPUT, 3 },
12510 * configuration and preset
12512 static const char *alc861_models[ALC861_MODEL_LAST] = {
12513 [ALC861_3ST] = "3stack",
12514 [ALC660_3ST] = "3stack-660",
12515 [ALC861_3ST_DIG] = "3stack-dig",
12516 [ALC861_6ST_DIG] = "6stack-dig",
12517 [ALC861_UNIWILL_M31] = "uniwill-m31",
12518 [ALC861_TOSHIBA] = "toshiba",
12519 [ALC861_ASUS] = "asus",
12520 [ALC861_ASUS_LAPTOP] = "asus-laptop",
12521 [ALC861_AUTO] = "auto",
12524 static struct snd_pci_quirk alc861_cfg_tbl[] = {
12525 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
12526 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12527 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12528 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
12529 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
12530 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
12531 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
12532 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12533 * Any other models that need this preset?
12535 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12536 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
12537 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
12538 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
12539 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
12540 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
12541 /* FIXME: the below seems conflict */
12542 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12543 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
12544 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
12548 static struct alc_config_preset alc861_presets[] = {
12550 .mixers = { alc861_3ST_mixer },
12551 .init_verbs = { alc861_threestack_init_verbs },
12552 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12553 .dac_nids = alc861_dac_nids,
12554 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12555 .channel_mode = alc861_threestack_modes,
12557 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12558 .adc_nids = alc861_adc_nids,
12559 .input_mux = &alc861_capture_source,
12561 [ALC861_3ST_DIG] = {
12562 .mixers = { alc861_base_mixer },
12563 .init_verbs = { alc861_threestack_init_verbs },
12564 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12565 .dac_nids = alc861_dac_nids,
12566 .dig_out_nid = ALC861_DIGOUT_NID,
12567 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12568 .channel_mode = alc861_threestack_modes,
12570 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12571 .adc_nids = alc861_adc_nids,
12572 .input_mux = &alc861_capture_source,
12574 [ALC861_6ST_DIG] = {
12575 .mixers = { alc861_base_mixer },
12576 .init_verbs = { alc861_base_init_verbs },
12577 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12578 .dac_nids = alc861_dac_nids,
12579 .dig_out_nid = ALC861_DIGOUT_NID,
12580 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12581 .channel_mode = alc861_8ch_modes,
12582 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12583 .adc_nids = alc861_adc_nids,
12584 .input_mux = &alc861_capture_source,
12587 .mixers = { alc861_3ST_mixer },
12588 .init_verbs = { alc861_threestack_init_verbs },
12589 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12590 .dac_nids = alc660_dac_nids,
12591 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12592 .channel_mode = alc861_threestack_modes,
12594 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12595 .adc_nids = alc861_adc_nids,
12596 .input_mux = &alc861_capture_source,
12598 [ALC861_UNIWILL_M31] = {
12599 .mixers = { alc861_uniwill_m31_mixer },
12600 .init_verbs = { alc861_uniwill_m31_init_verbs },
12601 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12602 .dac_nids = alc861_dac_nids,
12603 .dig_out_nid = ALC861_DIGOUT_NID,
12604 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12605 .channel_mode = alc861_uniwill_m31_modes,
12607 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12608 .adc_nids = alc861_adc_nids,
12609 .input_mux = &alc861_capture_source,
12611 [ALC861_TOSHIBA] = {
12612 .mixers = { alc861_toshiba_mixer },
12613 .init_verbs = { alc861_base_init_verbs,
12614 alc861_toshiba_init_verbs },
12615 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12616 .dac_nids = alc861_dac_nids,
12617 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12618 .channel_mode = alc883_3ST_2ch_modes,
12619 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12620 .adc_nids = alc861_adc_nids,
12621 .input_mux = &alc861_capture_source,
12622 .unsol_event = alc861_toshiba_unsol_event,
12623 .init_hook = alc861_toshiba_automute,
12626 .mixers = { alc861_asus_mixer },
12627 .init_verbs = { alc861_asus_init_verbs },
12628 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12629 .dac_nids = alc861_dac_nids,
12630 .dig_out_nid = ALC861_DIGOUT_NID,
12631 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12632 .channel_mode = alc861_asus_modes,
12635 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12636 .adc_nids = alc861_adc_nids,
12637 .input_mux = &alc861_capture_source,
12639 [ALC861_ASUS_LAPTOP] = {
12640 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12641 .init_verbs = { alc861_asus_init_verbs,
12642 alc861_asus_laptop_init_verbs },
12643 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12644 .dac_nids = alc861_dac_nids,
12645 .dig_out_nid = ALC861_DIGOUT_NID,
12646 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12647 .channel_mode = alc883_3ST_2ch_modes,
12649 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12650 .adc_nids = alc861_adc_nids,
12651 .input_mux = &alc861_capture_source,
12656 static int patch_alc861(struct hda_codec *codec)
12658 struct alc_spec *spec;
12662 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12666 codec->spec = spec;
12668 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12672 if (board_config < 0) {
12673 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12674 "trying auto-probe from BIOS...\n");
12675 board_config = ALC861_AUTO;
12678 if (board_config == ALC861_AUTO) {
12679 /* automatic parse from the BIOS config */
12680 err = alc861_parse_auto_config(codec);
12686 "hda_codec: Cannot set up configuration "
12687 "from BIOS. Using base mode...\n");
12688 board_config = ALC861_3ST_DIG;
12692 if (board_config != ALC861_AUTO)
12693 setup_preset(spec, &alc861_presets[board_config]);
12695 spec->stream_name_analog = "ALC861 Analog";
12696 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12697 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12699 spec->stream_name_digital = "ALC861 Digital";
12700 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12701 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12703 spec->vmaster_nid = 0x03;
12705 codec->patch_ops = alc_patch_ops;
12706 if (board_config == ALC861_AUTO)
12707 spec->init_hook = alc861_auto_init;
12708 #ifdef CONFIG_SND_HDA_POWER_SAVE
12709 if (!spec->loopback.amplist)
12710 spec->loopback.amplist = alc861_loopbacks;
12717 * ALC861-VD support
12721 * In addition, an independent DAC
12723 #define ALC861VD_DIGOUT_NID 0x06
12725 static hda_nid_t alc861vd_dac_nids[4] = {
12726 /* front, surr, clfe, side surr */
12727 0x02, 0x03, 0x04, 0x05
12730 /* dac_nids for ALC660vd are in a different order - according to
12731 * Realtek's driver.
12732 * This should probably tesult in a different mixer for 6stack models
12733 * of ALC660vd codecs, but for now there is only 3stack mixer
12734 * - and it is the same as in 861vd.
12735 * adc_nids in ALC660vd are (is) the same as in 861vd
12737 static hda_nid_t alc660vd_dac_nids[3] = {
12738 /* front, rear, clfe, rear_surr */
12742 static hda_nid_t alc861vd_adc_nids[1] = {
12747 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12750 /* FIXME: should be a matrix-type input source selection */
12751 static struct hda_input_mux alc861vd_capture_source = {
12755 { "Front Mic", 0x1 },
12761 static struct hda_input_mux alc861vd_dallas_capture_source = {
12764 { "Ext Mic", 0x0 },
12765 { "Int Mic", 0x1 },
12769 static struct hda_input_mux alc861vd_hp_capture_source = {
12772 { "Front Mic", 0x0 },
12773 { "ATAPI Mic", 0x1 },
12777 #define alc861vd_mux_enum_info alc_mux_enum_info
12778 #define alc861vd_mux_enum_get alc_mux_enum_get
12779 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12780 #define alc861vd_mux_enum_put alc882_mux_enum_put
12785 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12792 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12793 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12794 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12795 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12796 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12803 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12804 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12805 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12806 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12807 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12811 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12812 { 6, alc861vd_6stack_ch6_init },
12813 { 8, alc861vd_6stack_ch8_init },
12816 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12818 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12819 .name = "Channel Mode",
12820 .info = alc_ch_mode_info,
12821 .get = alc_ch_mode_get,
12822 .put = alc_ch_mode_put,
12827 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12828 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12829 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12832 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12833 /* The multiple "Capture Source" controls confuse alsamixer
12834 * So call somewhat different..
12836 /* .name = "Capture Source", */
12837 .name = "Input Source",
12839 .info = alc861vd_mux_enum_info,
12840 .get = alc861vd_mux_enum_get,
12841 .put = alc861vd_mux_enum_put,
12846 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12847 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12849 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12850 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12851 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12853 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12854 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12856 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12858 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12860 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12861 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12863 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12864 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12868 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12869 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12870 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12872 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12873 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12874 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12879 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12880 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12882 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12883 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12888 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12889 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12890 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12894 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12898 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12899 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12900 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12902 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12903 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12905 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12906 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12908 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12909 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12914 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12915 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12916 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12917 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12919 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12922 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12925 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12926 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12927 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12929 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12930 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12935 /* Pin assignment: Speaker=0x14, HP = 0x15,
12936 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12938 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12939 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12940 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12941 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12942 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12943 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12944 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12945 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12946 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12947 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12948 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12949 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12950 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12954 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12955 * Front Mic=0x18, ATAPI Mic = 0x19,
12957 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12958 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12959 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12960 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12961 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12962 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12963 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12964 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12965 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12971 * generic initialization of ADC, input mixers and output mixers
12973 static struct hda_verb alc861vd_volume_init_verbs[] = {
12975 * Unmute ADC0 and set the default input to mic-in
12977 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12978 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12980 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12981 * the analog-loopback mixer widget
12983 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12984 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12990 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12991 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12992 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12993 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12997 * Set up output mixers (0x02 - 0x05)
12999 /* set vol=0 to output mixers */
13000 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13001 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13002 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13003 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13005 /* set up input amps for analog loopback */
13006 /* Amp Indices: DAC = 0, mixer = 1 */
13007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13008 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13009 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13010 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13011 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13012 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13013 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13014 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13020 * 3-stack pin configuration:
13021 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13023 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13025 * Set pin mode and muting
13027 /* set front pin widgets 0x14 for output */
13028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13030 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13032 /* Mic (rear) pin: input vref at 80% */
13033 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13034 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13035 /* Front Mic pin: input vref at 80% */
13036 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13037 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13038 /* Line In pin: input */
13039 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13040 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13041 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13042 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13043 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13044 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13045 /* CD pin widget for input */
13046 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13052 * 6-stack pin configuration:
13054 static struct hda_verb alc861vd_6stack_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 /* Rear Pin: output 1 (0x0d) */
13064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13067 /* CLFE Pin: output 2 (0x0e) */
13068 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13069 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13070 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13071 /* Side Pin: output 3 (0x0f) */
13072 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13073 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13074 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13076 /* Mic (rear) pin: input vref at 80% */
13077 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13079 /* Front Mic pin: input vref at 80% */
13080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13081 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13082 /* Line In pin: input */
13083 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13084 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13085 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13086 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13087 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13088 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13089 /* CD pin widget for input */
13090 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13095 static struct hda_verb alc861vd_eapd_verbs[] = {
13096 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13100 static struct hda_verb alc660vd_eapd_verbs[] = {
13101 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13102 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13106 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13110 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13111 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13115 /* toggle speaker-output according to the hp-jack state */
13116 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
13118 unsigned int present;
13119 unsigned char bits;
13121 present = snd_hda_codec_read(codec, 0x1b, 0,
13122 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13123 bits = present ? HDA_AMP_MUTE : 0;
13124 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13125 HDA_AMP_MUTE, bits);
13128 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
13130 unsigned int present;
13131 unsigned char bits;
13133 present = snd_hda_codec_read(codec, 0x18, 0,
13134 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13135 bits = present ? HDA_AMP_MUTE : 0;
13136 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
13137 HDA_AMP_MUTE, bits);
13140 static void alc861vd_lenovo_automute(struct hda_codec *codec)
13142 alc861vd_lenovo_hp_automute(codec);
13143 alc861vd_lenovo_mic_automute(codec);
13146 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
13149 switch (res >> 26) {
13150 case ALC880_HP_EVENT:
13151 alc861vd_lenovo_hp_automute(codec);
13153 case ALC880_MIC_EVENT:
13154 alc861vd_lenovo_mic_automute(codec);
13159 static struct hda_verb alc861vd_dallas_verbs[] = {
13160 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13161 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13162 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13163 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13165 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13166 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13168 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13169 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13171 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13172 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13174 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13175 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13176 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13178 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13179 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13180 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13181 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13183 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13185 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13187 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13188 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13189 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13190 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13197 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13198 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13199 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13204 /* toggle speaker-output according to the hp-jack state */
13205 static void alc861vd_dallas_automute(struct hda_codec *codec)
13207 unsigned int present;
13209 present = snd_hda_codec_read(codec, 0x15, 0,
13210 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13211 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13212 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13215 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
13217 if ((res >> 26) == ALC880_HP_EVENT)
13218 alc861vd_dallas_automute(codec);
13221 #ifdef CONFIG_SND_HDA_POWER_SAVE
13222 #define alc861vd_loopbacks alc880_loopbacks
13225 /* pcm configuration: identiacal with ALC880 */
13226 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
13227 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
13228 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
13229 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
13232 * configuration and preset
13234 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
13235 [ALC660VD_3ST] = "3stack-660",
13236 [ALC660VD_3ST_DIG] = "3stack-660-digout",
13237 [ALC861VD_3ST] = "3stack",
13238 [ALC861VD_3ST_DIG] = "3stack-digout",
13239 [ALC861VD_6ST_DIG] = "6stack-digout",
13240 [ALC861VD_LENOVO] = "lenovo",
13241 [ALC861VD_DALLAS] = "dallas",
13242 [ALC861VD_HP] = "hp",
13243 [ALC861VD_AUTO] = "auto",
13246 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
13247 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
13248 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
13249 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
13250 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
13251 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO),
13252 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
13253 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
13254 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
13255 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
13256 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
13257 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
13258 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
13259 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
13260 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
13261 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
13262 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
13263 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
13267 static struct alc_config_preset alc861vd_presets[] = {
13269 .mixers = { alc861vd_3st_mixer },
13270 .init_verbs = { alc861vd_volume_init_verbs,
13271 alc861vd_3stack_init_verbs },
13272 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13273 .dac_nids = alc660vd_dac_nids,
13274 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13275 .channel_mode = alc861vd_3stack_2ch_modes,
13276 .input_mux = &alc861vd_capture_source,
13278 [ALC660VD_3ST_DIG] = {
13279 .mixers = { alc861vd_3st_mixer },
13280 .init_verbs = { alc861vd_volume_init_verbs,
13281 alc861vd_3stack_init_verbs },
13282 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13283 .dac_nids = alc660vd_dac_nids,
13284 .dig_out_nid = ALC861VD_DIGOUT_NID,
13285 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13286 .channel_mode = alc861vd_3stack_2ch_modes,
13287 .input_mux = &alc861vd_capture_source,
13290 .mixers = { alc861vd_3st_mixer },
13291 .init_verbs = { alc861vd_volume_init_verbs,
13292 alc861vd_3stack_init_verbs },
13293 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13294 .dac_nids = alc861vd_dac_nids,
13295 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13296 .channel_mode = alc861vd_3stack_2ch_modes,
13297 .input_mux = &alc861vd_capture_source,
13299 [ALC861VD_3ST_DIG] = {
13300 .mixers = { alc861vd_3st_mixer },
13301 .init_verbs = { alc861vd_volume_init_verbs,
13302 alc861vd_3stack_init_verbs },
13303 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13304 .dac_nids = alc861vd_dac_nids,
13305 .dig_out_nid = ALC861VD_DIGOUT_NID,
13306 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13307 .channel_mode = alc861vd_3stack_2ch_modes,
13308 .input_mux = &alc861vd_capture_source,
13310 [ALC861VD_6ST_DIG] = {
13311 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
13312 .init_verbs = { alc861vd_volume_init_verbs,
13313 alc861vd_6stack_init_verbs },
13314 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13315 .dac_nids = alc861vd_dac_nids,
13316 .dig_out_nid = ALC861VD_DIGOUT_NID,
13317 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
13318 .channel_mode = alc861vd_6stack_modes,
13319 .input_mux = &alc861vd_capture_source,
13321 [ALC861VD_LENOVO] = {
13322 .mixers = { alc861vd_lenovo_mixer },
13323 .init_verbs = { alc861vd_volume_init_verbs,
13324 alc861vd_3stack_init_verbs,
13325 alc861vd_eapd_verbs,
13326 alc861vd_lenovo_unsol_verbs },
13327 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13328 .dac_nids = alc660vd_dac_nids,
13329 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13330 .channel_mode = alc861vd_3stack_2ch_modes,
13331 .input_mux = &alc861vd_capture_source,
13332 .unsol_event = alc861vd_lenovo_unsol_event,
13333 .init_hook = alc861vd_lenovo_automute,
13335 [ALC861VD_DALLAS] = {
13336 .mixers = { alc861vd_dallas_mixer },
13337 .init_verbs = { alc861vd_dallas_verbs },
13338 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13339 .dac_nids = alc861vd_dac_nids,
13340 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13341 .channel_mode = alc861vd_3stack_2ch_modes,
13342 .input_mux = &alc861vd_dallas_capture_source,
13343 .unsol_event = alc861vd_dallas_unsol_event,
13344 .init_hook = alc861vd_dallas_automute,
13347 .mixers = { alc861vd_hp_mixer },
13348 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
13349 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13350 .dac_nids = alc861vd_dac_nids,
13351 .dig_out_nid = ALC861VD_DIGOUT_NID,
13352 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13353 .channel_mode = alc861vd_3stack_2ch_modes,
13354 .input_mux = &alc861vd_hp_capture_source,
13355 .unsol_event = alc861vd_dallas_unsol_event,
13356 .init_hook = alc861vd_dallas_automute,
13361 * BIOS auto configuration
13363 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
13364 hda_nid_t nid, int pin_type, int dac_idx)
13366 alc_set_pin_output(codec, nid, pin_type);
13369 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
13371 struct alc_spec *spec = codec->spec;
13374 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13375 for (i = 0; i <= HDA_SIDE; i++) {
13376 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13377 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13379 alc861vd_auto_set_output_and_unmute(codec, nid,
13385 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
13387 struct alc_spec *spec = codec->spec;
13390 pin = spec->autocfg.hp_pins[0];
13391 if (pin) /* connect to front and use dac 0 */
13392 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13393 pin = spec->autocfg.speaker_pins[0];
13395 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13398 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13399 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13401 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
13403 struct alc_spec *spec = codec->spec;
13406 for (i = 0; i < AUTO_PIN_LAST; i++) {
13407 hda_nid_t nid = spec->autocfg.input_pins[i];
13408 if (alc861vd_is_input_pin(nid)) {
13409 snd_hda_codec_write(codec, nid, 0,
13410 AC_VERB_SET_PIN_WIDGET_CONTROL,
13411 i <= AUTO_PIN_FRONT_MIC ?
13412 PIN_VREF80 : PIN_IN);
13413 if (nid != ALC861VD_PIN_CD_NID)
13414 snd_hda_codec_write(codec, nid, 0,
13415 AC_VERB_SET_AMP_GAIN_MUTE,
13421 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
13423 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13424 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13426 /* add playback controls from the parsed DAC table */
13427 /* Based on ALC880 version. But ALC861VD has separate,
13428 * different NIDs for mute/unmute switch and volume control */
13429 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
13430 const struct auto_pin_cfg *cfg)
13433 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
13434 hda_nid_t nid_v, nid_s;
13437 for (i = 0; i < cfg->line_outs; i++) {
13438 if (!spec->multiout.dac_nids[i])
13440 nid_v = alc861vd_idx_to_mixer_vol(
13442 spec->multiout.dac_nids[i]));
13443 nid_s = alc861vd_idx_to_mixer_switch(
13445 spec->multiout.dac_nids[i]));
13449 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13450 "Center Playback Volume",
13451 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
13455 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13456 "LFE Playback Volume",
13457 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
13461 err = add_control(spec, ALC_CTL_BIND_MUTE,
13462 "Center Playback Switch",
13463 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
13467 err = add_control(spec, ALC_CTL_BIND_MUTE,
13468 "LFE Playback Switch",
13469 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
13474 sprintf(name, "%s Playback Volume", chname[i]);
13475 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13476 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
13480 sprintf(name, "%s Playback Switch", chname[i]);
13481 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13482 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
13491 /* add playback controls for speaker and HP outputs */
13492 /* Based on ALC880 version. But ALC861VD has separate,
13493 * different NIDs for mute/unmute switch and volume control */
13494 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
13495 hda_nid_t pin, const char *pfx)
13497 hda_nid_t nid_v, nid_s;
13504 if (alc880_is_fixed_pin(pin)) {
13505 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13506 /* specify the DAC as the extra output */
13507 if (!spec->multiout.hp_nid)
13508 spec->multiout.hp_nid = nid_v;
13510 spec->multiout.extra_out_nid[0] = nid_v;
13511 /* control HP volume/switch on the output mixer amp */
13512 nid_v = alc861vd_idx_to_mixer_vol(
13513 alc880_fixed_pin_idx(pin));
13514 nid_s = alc861vd_idx_to_mixer_switch(
13515 alc880_fixed_pin_idx(pin));
13517 sprintf(name, "%s Playback Volume", pfx);
13518 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13519 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
13522 sprintf(name, "%s Playback Switch", pfx);
13523 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13524 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
13527 } else if (alc880_is_multi_pin(pin)) {
13528 /* set manual connection */
13529 /* we have only a switch on HP-out PIN */
13530 sprintf(name, "%s Playback Switch", pfx);
13531 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13532 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13539 /* parse the BIOS configuration and set up the alc_spec
13540 * return 1 if successful, 0 if the proper config is not found,
13541 * or a negative error code
13542 * Based on ALC880 version - had to change it to override
13543 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13544 static int alc861vd_parse_auto_config(struct hda_codec *codec)
13546 struct alc_spec *spec = codec->spec;
13548 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
13550 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13554 if (!spec->autocfg.line_outs)
13555 return 0; /* can't find valid BIOS pin config */
13557 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13560 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
13563 err = alc861vd_auto_create_extra_out(spec,
13564 spec->autocfg.speaker_pins[0],
13568 err = alc861vd_auto_create_extra_out(spec,
13569 spec->autocfg.hp_pins[0],
13573 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
13577 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13579 if (spec->autocfg.dig_out_pin)
13580 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13582 if (spec->kctl_alloc)
13583 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13585 spec->init_verbs[spec->num_init_verbs++]
13586 = alc861vd_volume_init_verbs;
13588 spec->num_mux_defs = 1;
13589 spec->input_mux = &spec->private_imux;
13591 err = alc_auto_add_mic_boost(codec);
13598 /* additional initialization for auto-configuration model */
13599 static void alc861vd_auto_init(struct hda_codec *codec)
13601 struct alc_spec *spec = codec->spec;
13602 alc861vd_auto_init_multi_out(codec);
13603 alc861vd_auto_init_hp_out(codec);
13604 alc861vd_auto_init_analog_input(codec);
13605 alc861vd_auto_init_input_src(codec);
13606 if (spec->unsol_event)
13607 alc_sku_automute(codec);
13610 static int patch_alc861vd(struct hda_codec *codec)
13612 struct alc_spec *spec;
13613 int err, board_config;
13615 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13619 codec->spec = spec;
13621 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13625 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13626 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13627 "ALC861VD, trying auto-probe from BIOS...\n");
13628 board_config = ALC861VD_AUTO;
13631 if (board_config == ALC861VD_AUTO) {
13632 /* automatic parse from the BIOS config */
13633 err = alc861vd_parse_auto_config(codec);
13639 "hda_codec: Cannot set up configuration "
13640 "from BIOS. Using base mode...\n");
13641 board_config = ALC861VD_3ST;
13645 if (board_config != ALC861VD_AUTO)
13646 setup_preset(spec, &alc861vd_presets[board_config]);
13648 if (codec->vendor_id == 0x10ec0660) {
13649 spec->stream_name_analog = "ALC660-VD Analog";
13650 spec->stream_name_digital = "ALC660-VD Digital";
13651 /* always turn on EAPD */
13652 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
13654 spec->stream_name_analog = "ALC861VD Analog";
13655 spec->stream_name_digital = "ALC861VD Digital";
13658 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13659 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13661 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13662 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13664 spec->adc_nids = alc861vd_adc_nids;
13665 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13666 spec->capsrc_nids = alc861vd_capsrc_nids;
13668 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13669 spec->num_mixers++;
13671 spec->vmaster_nid = 0x02;
13673 codec->patch_ops = alc_patch_ops;
13675 if (board_config == ALC861VD_AUTO)
13676 spec->init_hook = alc861vd_auto_init;
13677 #ifdef CONFIG_SND_HDA_POWER_SAVE
13678 if (!spec->loopback.amplist)
13679 spec->loopback.amplist = alc861vd_loopbacks;
13688 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13689 * configuration. Each pin widget can choose any input DACs and a mixer.
13690 * Each ADC is connected from a mixer of all inputs. This makes possible
13691 * 6-channel independent captures.
13693 * In addition, an independent DAC for the multi-playback (not used in this
13696 #define ALC662_DIGOUT_NID 0x06
13697 #define ALC662_DIGIN_NID 0x0a
13699 static hda_nid_t alc662_dac_nids[4] = {
13700 /* front, rear, clfe, rear_surr */
13704 static hda_nid_t alc662_adc_nids[1] = {
13709 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13712 /* FIXME: should be a matrix-type input source selection */
13713 static struct hda_input_mux alc662_capture_source = {
13717 { "Front Mic", 0x1 },
13723 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13731 static struct hda_input_mux alc662_eeepc_capture_source = {
13739 static struct hda_input_mux alc663_capture_source = {
13743 { "Front Mic", 0x1 },
13748 static struct hda_input_mux alc663_m51va_capture_source = {
13751 { "Ext-Mic", 0x0 },
13756 #define alc662_mux_enum_info alc_mux_enum_info
13757 #define alc662_mux_enum_get alc_mux_enum_get
13758 #define alc662_mux_enum_put alc882_mux_enum_put
13763 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13770 static struct hda_verb alc662_3ST_ch2_init[] = {
13771 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13772 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13773 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13774 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13781 static struct hda_verb alc662_3ST_ch6_init[] = {
13782 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13783 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13784 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13785 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13786 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13787 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13791 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13792 { 2, alc662_3ST_ch2_init },
13793 { 6, alc662_3ST_ch6_init },
13799 static struct hda_verb alc662_sixstack_ch6_init[] = {
13800 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13801 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13802 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13809 static struct hda_verb alc662_sixstack_ch8_init[] = {
13810 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13811 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13812 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13816 static struct hda_channel_mode alc662_5stack_modes[2] = {
13817 { 2, alc662_sixstack_ch6_init },
13818 { 6, alc662_sixstack_ch8_init },
13821 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13822 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13825 static struct snd_kcontrol_new alc662_base_mixer[] = {
13826 /* output mixer control */
13827 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13828 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13829 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13830 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13831 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13832 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13833 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13834 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13835 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13837 /*Input mixer control */
13838 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13839 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13840 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13841 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13842 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13843 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13844 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13845 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13849 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13850 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13851 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13852 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13853 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13854 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13855 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13856 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13859 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13860 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13861 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13862 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13866 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13867 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13868 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13869 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13870 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13871 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13872 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13873 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13874 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13875 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13876 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13877 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13878 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13879 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13882 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13883 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13884 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13885 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13889 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13890 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13891 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13892 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13893 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13894 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13895 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13896 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13902 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13903 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13905 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13906 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13908 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13909 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13910 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13912 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13913 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13914 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13918 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13919 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13920 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13921 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13922 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13923 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13924 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13925 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13926 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13927 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13928 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13929 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13930 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13931 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13932 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13936 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
13937 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13938 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13939 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13941 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13942 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT),
13946 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
13947 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13948 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13949 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13950 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13955 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13956 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13960 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
13961 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13962 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13965 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13966 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13967 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13968 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13969 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13970 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13974 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13976 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13977 .name = "Channel Mode",
13978 .info = alc_ch_mode_info,
13979 .get = alc_ch_mode_get,
13980 .put = alc_ch_mode_put,
13985 static struct hda_verb alc662_init_verbs[] = {
13986 /* ADC: mute amp left and right */
13987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13988 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13989 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13992 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13993 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13994 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13999 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14000 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14001 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14002 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14004 /* Front Pin: output 0 (0x0c) */
14005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14008 /* Rear Pin: output 1 (0x0d) */
14009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14010 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14012 /* CLFE Pin: output 2 (0x0e) */
14013 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14014 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14016 /* Mic (rear) pin: input vref at 80% */
14017 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14018 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14019 /* Front Mic pin: input vref at 80% */
14020 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14021 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14022 /* Line In pin: input */
14023 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14024 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14025 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14026 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14027 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14028 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14029 /* CD pin widget for input */
14030 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14032 /* FIXME: use matrix-type input source selection */
14033 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14040 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14041 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14042 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14043 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14045 /* always trun on EAPD */
14046 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14047 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14052 static struct hda_verb alc662_sue_init_verbs[] = {
14053 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14054 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14058 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
14059 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14064 /* Set Unsolicited Event*/
14065 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
14066 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14067 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14072 * generic initialization of ADC, input mixers and output mixers
14074 static struct hda_verb alc662_auto_init_verbs[] = {
14076 * Unmute ADC and set the default input to mic-in
14078 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14081 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
14083 * Note: PASD motherboards uses the Line In 2 as the input for front
14084 * panel mic (mic 2)
14086 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14094 * Set up output mixers (0x0c - 0x0f)
14096 /* set vol=0 to output mixers */
14097 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14098 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14099 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14101 /* set up input amps for analog loopback */
14102 /* Amp Indices: DAC = 0, mixer = 1 */
14103 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14104 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14105 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14106 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14107 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14108 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14111 /* FIXME: use matrix-type input source selection */
14112 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14115 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14119 /* additional verbs for ALC663 */
14120 static struct hda_verb alc663_auto_init_verbs[] = {
14121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14122 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14126 static struct hda_verb alc663_m51va_init_verbs[] = {
14127 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14128 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14129 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14131 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
14133 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14134 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14138 static struct hda_verb alc663_g71v_init_verbs[] = {
14139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14140 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
14141 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
14143 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14144 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14145 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14147 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14148 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
14149 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14153 static struct hda_verb alc663_g50v_init_verbs[] = {
14154 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14155 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14156 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14158 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14159 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14163 /* capture mixer elements */
14164 static struct snd_kcontrol_new alc662_capture_mixer[] = {
14165 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14166 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14169 /* The multiple "Capture Source" controls confuse alsamixer
14170 * So call somewhat different..
14172 /* .name = "Capture Source", */
14173 .name = "Input Source",
14175 .info = alc662_mux_enum_info,
14176 .get = alc662_mux_enum_get,
14177 .put = alc662_mux_enum_put,
14182 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
14184 unsigned int present;
14185 unsigned char bits;
14187 present = snd_hda_codec_read(codec, 0x14, 0,
14188 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14189 bits = present ? HDA_AMP_MUTE : 0;
14190 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14191 HDA_AMP_MUTE, bits);
14194 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
14196 unsigned int present;
14197 unsigned char bits;
14199 present = snd_hda_codec_read(codec, 0x1b, 0,
14200 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14201 bits = present ? HDA_AMP_MUTE : 0;
14202 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14203 HDA_AMP_MUTE, bits);
14204 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14205 HDA_AMP_MUTE, bits);
14208 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
14211 if ((res >> 26) == ALC880_HP_EVENT)
14212 alc662_lenovo_101e_all_automute(codec);
14213 if ((res >> 26) == ALC880_FRONT_EVENT)
14214 alc662_lenovo_101e_ispeaker_automute(codec);
14217 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
14219 unsigned int present;
14221 present = snd_hda_codec_read(codec, 0x18, 0,
14222 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14223 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14224 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14225 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14226 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14227 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14228 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
14229 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14230 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
14233 /* unsolicited event for HP jack sensing */
14234 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
14237 if ((res >> 26) == ALC880_HP_EVENT)
14238 alc262_hippo1_automute( codec );
14240 if ((res >> 26) == ALC880_MIC_EVENT)
14241 alc662_eeepc_mic_automute(codec);
14244 static void alc662_eeepc_inithook(struct hda_codec *codec)
14246 alc262_hippo1_automute( codec );
14247 alc662_eeepc_mic_automute(codec);
14250 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
14253 unsigned int present;
14255 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
14256 present = snd_hda_codec_read(codec, 0x14, 0,
14257 AC_VERB_GET_PIN_SENSE, 0);
14258 present = (present & 0x80000000) != 0;
14260 /* mute internal speaker */
14261 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14262 HDA_AMP_MUTE, HDA_AMP_MUTE);
14264 /* unmute internal speaker if necessary */
14265 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
14266 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14267 HDA_AMP_MUTE, mute);
14271 /* unsolicited event for HP jack sensing */
14272 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
14275 if ((res >> 26) == ALC880_HP_EVENT)
14276 alc662_eeepc_ep20_automute(codec);
14279 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
14281 alc662_eeepc_ep20_automute(codec);
14284 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
14286 unsigned int present;
14287 unsigned char bits;
14289 present = snd_hda_codec_read(codec, 0x21, 0,
14290 AC_VERB_GET_PIN_SENSE, 0)
14291 & AC_PINSENSE_PRESENCE;
14292 bits = present ? HDA_AMP_MUTE : 0;
14293 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14294 HDA_AMP_MUTE, bits);
14297 static void alc663_m51va_mic_automute(struct hda_codec *codec)
14299 unsigned int present;
14301 present = snd_hda_codec_read(codec, 0x18, 0,
14302 AC_VERB_GET_PIN_SENSE, 0)
14303 & AC_PINSENSE_PRESENCE;
14304 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14305 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14306 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14307 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14308 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14309 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14310 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14311 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14314 static void alc663_m51va_unsol_event(struct hda_codec *codec,
14317 switch (res >> 26) {
14318 case ALC880_HP_EVENT:
14319 alc663_m51va_speaker_automute(codec);
14321 case ALC880_MIC_EVENT:
14322 alc663_m51va_mic_automute(codec);
14327 static void alc663_m51va_inithook(struct hda_codec *codec)
14329 alc663_m51va_speaker_automute(codec);
14330 alc663_m51va_mic_automute(codec);
14333 static void alc663_g71v_hp_automute(struct hda_codec *codec)
14335 unsigned int present;
14336 unsigned char bits;
14338 present = snd_hda_codec_read(codec, 0x21, 0,
14339 AC_VERB_GET_PIN_SENSE, 0)
14340 & AC_PINSENSE_PRESENCE;
14341 bits = present ? HDA_AMP_MUTE : 0;
14342 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14343 HDA_AMP_MUTE, bits);
14344 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14345 HDA_AMP_MUTE, bits);
14348 static void alc663_g71v_front_automute(struct hda_codec *codec)
14350 unsigned int present;
14351 unsigned char bits;
14353 present = snd_hda_codec_read(codec, 0x15, 0,
14354 AC_VERB_GET_PIN_SENSE, 0)
14355 & AC_PINSENSE_PRESENCE;
14356 bits = present ? HDA_AMP_MUTE : 0;
14357 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14358 HDA_AMP_MUTE, bits);
14361 static void alc663_g71v_unsol_event(struct hda_codec *codec,
14364 switch (res >> 26) {
14365 case ALC880_HP_EVENT:
14366 alc663_g71v_hp_automute(codec);
14368 case ALC880_FRONT_EVENT:
14369 alc663_g71v_front_automute(codec);
14371 case ALC880_MIC_EVENT:
14372 alc662_eeepc_mic_automute(codec);
14377 static void alc663_g71v_inithook(struct hda_codec *codec)
14379 alc663_g71v_front_automute(codec);
14380 alc663_g71v_hp_automute(codec);
14381 alc662_eeepc_mic_automute(codec);
14384 static void alc663_g50v_unsol_event(struct hda_codec *codec,
14387 switch (res >> 26) {
14388 case ALC880_HP_EVENT:
14389 alc663_m51va_speaker_automute(codec);
14391 case ALC880_MIC_EVENT:
14392 alc662_eeepc_mic_automute(codec);
14397 static void alc663_g50v_inithook(struct hda_codec *codec)
14399 alc663_m51va_speaker_automute(codec);
14400 alc662_eeepc_mic_automute(codec);
14403 #ifdef CONFIG_SND_HDA_POWER_SAVE
14404 #define alc662_loopbacks alc880_loopbacks
14408 /* pcm configuration: identiacal with ALC880 */
14409 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
14410 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
14411 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
14412 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
14415 * configuration and preset
14417 static const char *alc662_models[ALC662_MODEL_LAST] = {
14418 [ALC662_3ST_2ch_DIG] = "3stack-dig",
14419 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
14420 [ALC662_3ST_6ch] = "3stack-6ch",
14421 [ALC662_5ST_DIG] = "6stack-dig",
14422 [ALC662_LENOVO_101E] = "lenovo-101e",
14423 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
14424 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
14425 [ALC663_ASUS_M51VA] = "m51va",
14426 [ALC663_ASUS_G71V] = "g71v",
14427 [ALC663_ASUS_H13] = "h13",
14428 [ALC663_ASUS_G50V] = "g50v",
14429 [ALC662_AUTO] = "auto",
14432 static struct snd_pci_quirk alc662_cfg_tbl[] = {
14433 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
14434 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
14435 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
14436 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
14437 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
14438 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
14439 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
14440 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
14441 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
14442 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
14446 static struct alc_config_preset alc662_presets[] = {
14447 [ALC662_3ST_2ch_DIG] = {
14448 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
14449 .init_verbs = { alc662_init_verbs },
14450 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14451 .dac_nids = alc662_dac_nids,
14452 .dig_out_nid = ALC662_DIGOUT_NID,
14453 .dig_in_nid = ALC662_DIGIN_NID,
14454 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14455 .channel_mode = alc662_3ST_2ch_modes,
14456 .input_mux = &alc662_capture_source,
14458 [ALC662_3ST_6ch_DIG] = {
14459 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14460 alc662_capture_mixer },
14461 .init_verbs = { alc662_init_verbs },
14462 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14463 .dac_nids = alc662_dac_nids,
14464 .dig_out_nid = ALC662_DIGOUT_NID,
14465 .dig_in_nid = ALC662_DIGIN_NID,
14466 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14467 .channel_mode = alc662_3ST_6ch_modes,
14469 .input_mux = &alc662_capture_source,
14471 [ALC662_3ST_6ch] = {
14472 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14473 alc662_capture_mixer },
14474 .init_verbs = { alc662_init_verbs },
14475 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14476 .dac_nids = alc662_dac_nids,
14477 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14478 .channel_mode = alc662_3ST_6ch_modes,
14480 .input_mux = &alc662_capture_source,
14482 [ALC662_5ST_DIG] = {
14483 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
14484 alc662_capture_mixer },
14485 .init_verbs = { alc662_init_verbs },
14486 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14487 .dac_nids = alc662_dac_nids,
14488 .dig_out_nid = ALC662_DIGOUT_NID,
14489 .dig_in_nid = ALC662_DIGIN_NID,
14490 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
14491 .channel_mode = alc662_5stack_modes,
14492 .input_mux = &alc662_capture_source,
14494 [ALC662_LENOVO_101E] = {
14495 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
14496 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
14497 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14498 .dac_nids = alc662_dac_nids,
14499 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14500 .channel_mode = alc662_3ST_2ch_modes,
14501 .input_mux = &alc662_lenovo_101e_capture_source,
14502 .unsol_event = alc662_lenovo_101e_unsol_event,
14503 .init_hook = alc662_lenovo_101e_all_automute,
14505 [ALC662_ASUS_EEEPC_P701] = {
14506 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
14507 .init_verbs = { alc662_init_verbs,
14508 alc662_eeepc_sue_init_verbs },
14509 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14510 .dac_nids = alc662_dac_nids,
14511 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14512 .channel_mode = alc662_3ST_2ch_modes,
14513 .input_mux = &alc662_eeepc_capture_source,
14514 .unsol_event = alc662_eeepc_unsol_event,
14515 .init_hook = alc662_eeepc_inithook,
14517 [ALC662_ASUS_EEEPC_EP20] = {
14518 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
14519 alc662_chmode_mixer },
14520 .init_verbs = { alc662_init_verbs,
14521 alc662_eeepc_ep20_sue_init_verbs },
14522 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14523 .dac_nids = alc662_dac_nids,
14524 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14525 .channel_mode = alc662_3ST_6ch_modes,
14526 .input_mux = &alc662_lenovo_101e_capture_source,
14527 .unsol_event = alc662_eeepc_ep20_unsol_event,
14528 .init_hook = alc662_eeepc_ep20_inithook,
14530 [ALC663_ASUS_M51VA] = {
14531 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14532 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14533 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14534 .dac_nids = alc662_dac_nids,
14535 .dig_out_nid = ALC662_DIGOUT_NID,
14536 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14537 .channel_mode = alc662_3ST_2ch_modes,
14538 .input_mux = &alc663_m51va_capture_source,
14539 .unsol_event = alc663_m51va_unsol_event,
14540 .init_hook = alc663_m51va_inithook,
14542 [ALC663_ASUS_G71V] = {
14543 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
14544 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
14545 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14546 .dac_nids = alc662_dac_nids,
14547 .dig_out_nid = ALC662_DIGOUT_NID,
14548 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14549 .channel_mode = alc662_3ST_2ch_modes,
14550 .input_mux = &alc662_eeepc_capture_source,
14551 .unsol_event = alc663_g71v_unsol_event,
14552 .init_hook = alc663_g71v_inithook,
14554 [ALC663_ASUS_H13] = {
14555 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14556 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14557 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14558 .dac_nids = alc662_dac_nids,
14559 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14560 .channel_mode = alc662_3ST_2ch_modes,
14561 .input_mux = &alc663_m51va_capture_source,
14562 .unsol_event = alc663_m51va_unsol_event,
14563 .init_hook = alc663_m51va_inithook,
14565 [ALC663_ASUS_G50V] = {
14566 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
14567 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
14568 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14569 .dac_nids = alc662_dac_nids,
14570 .dig_out_nid = ALC662_DIGOUT_NID,
14571 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14572 .channel_mode = alc662_3ST_6ch_modes,
14573 .input_mux = &alc663_capture_source,
14574 .unsol_event = alc663_g50v_unsol_event,
14575 .init_hook = alc663_g50v_inithook,
14581 * BIOS auto configuration
14584 /* add playback controls from the parsed DAC table */
14585 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14586 const struct auto_pin_cfg *cfg)
14589 static const char *chname[4] = {
14590 "Front", "Surround", NULL /*CLFE*/, "Side"
14595 for (i = 0; i < cfg->line_outs; i++) {
14596 if (!spec->multiout.dac_nids[i])
14598 nid = alc880_idx_to_dac(i);
14601 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14602 "Center Playback Volume",
14603 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14607 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14608 "LFE Playback Volume",
14609 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14613 err = add_control(spec, ALC_CTL_BIND_MUTE,
14614 "Center Playback Switch",
14615 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
14619 err = add_control(spec, ALC_CTL_BIND_MUTE,
14620 "LFE Playback Switch",
14621 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
14626 sprintf(name, "%s Playback Volume", chname[i]);
14627 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14628 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14632 sprintf(name, "%s Playback Switch", chname[i]);
14633 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14634 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
14643 /* add playback controls for speaker and HP outputs */
14644 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
14655 /* ALC663 has a mono output pin on 0x17 */
14656 sprintf(name, "%s Playback Switch", pfx);
14657 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14658 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
14662 if (alc880_is_fixed_pin(pin)) {
14663 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14664 /* printk("DAC nid=%x\n",nid); */
14665 /* specify the DAC as the extra output */
14666 if (!spec->multiout.hp_nid)
14667 spec->multiout.hp_nid = nid;
14669 spec->multiout.extra_out_nid[0] = nid;
14670 /* control HP volume/switch on the output mixer amp */
14671 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14672 sprintf(name, "%s Playback Volume", pfx);
14673 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14674 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14677 sprintf(name, "%s Playback Switch", pfx);
14678 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14679 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
14682 } else if (alc880_is_multi_pin(pin)) {
14683 /* set manual connection */
14684 /* we have only a switch on HP-out PIN */
14685 sprintf(name, "%s Playback Switch", pfx);
14686 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14687 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14694 /* create playback/capture controls for input pins */
14695 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
14696 const struct auto_pin_cfg *cfg)
14698 struct hda_input_mux *imux = &spec->private_imux;
14701 for (i = 0; i < AUTO_PIN_LAST; i++) {
14702 if (alc880_is_input_pin(cfg->input_pins[i])) {
14703 idx = alc880_input_pin_idx(cfg->input_pins[i]);
14704 err = new_analog_input(spec, cfg->input_pins[i],
14705 auto_pin_cfg_labels[i],
14709 imux->items[imux->num_items].label =
14710 auto_pin_cfg_labels[i];
14711 imux->items[imux->num_items].index =
14712 alc880_input_pin_idx(cfg->input_pins[i]);
14719 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
14720 hda_nid_t nid, int pin_type,
14723 alc_set_pin_output(codec, nid, pin_type);
14724 /* need the manual connection? */
14725 if (alc880_is_multi_pin(nid)) {
14726 struct alc_spec *spec = codec->spec;
14727 int idx = alc880_multi_pin_idx(nid);
14728 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
14729 AC_VERB_SET_CONNECT_SEL,
14730 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
14734 static void alc662_auto_init_multi_out(struct hda_codec *codec)
14736 struct alc_spec *spec = codec->spec;
14739 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14740 for (i = 0; i <= HDA_SIDE; i++) {
14741 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14742 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14744 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
14749 static void alc662_auto_init_hp_out(struct hda_codec *codec)
14751 struct alc_spec *spec = codec->spec;
14754 pin = spec->autocfg.hp_pins[0];
14755 if (pin) /* connect to front */
14757 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14758 pin = spec->autocfg.speaker_pins[0];
14760 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14763 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14764 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14766 static void alc662_auto_init_analog_input(struct hda_codec *codec)
14768 struct alc_spec *spec = codec->spec;
14771 for (i = 0; i < AUTO_PIN_LAST; i++) {
14772 hda_nid_t nid = spec->autocfg.input_pins[i];
14773 if (alc662_is_input_pin(nid)) {
14774 snd_hda_codec_write(codec, nid, 0,
14775 AC_VERB_SET_PIN_WIDGET_CONTROL,
14776 (i <= AUTO_PIN_FRONT_MIC ?
14777 PIN_VREF80 : PIN_IN));
14778 if (nid != ALC662_PIN_CD_NID)
14779 snd_hda_codec_write(codec, nid, 0,
14780 AC_VERB_SET_AMP_GAIN_MUTE,
14786 #define alc662_auto_init_input_src alc882_auto_init_input_src
14788 static int alc662_parse_auto_config(struct hda_codec *codec)
14790 struct alc_spec *spec = codec->spec;
14792 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
14794 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14798 if (!spec->autocfg.line_outs)
14799 return 0; /* can't find valid BIOS pin config */
14801 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14804 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
14807 err = alc662_auto_create_extra_out(spec,
14808 spec->autocfg.speaker_pins[0],
14812 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
14816 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
14820 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14822 if (spec->autocfg.dig_out_pin)
14823 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
14825 if (spec->kctl_alloc)
14826 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14828 spec->num_mux_defs = 1;
14829 spec->input_mux = &spec->private_imux;
14831 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14832 if (codec->vendor_id == 0x10ec0663)
14833 spec->init_verbs[spec->num_init_verbs++] =
14834 alc663_auto_init_verbs;
14836 err = alc_auto_add_mic_boost(codec);
14840 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
14841 spec->num_mixers++;
14845 /* additional initialization for auto-configuration model */
14846 static void alc662_auto_init(struct hda_codec *codec)
14848 struct alc_spec *spec = codec->spec;
14849 alc662_auto_init_multi_out(codec);
14850 alc662_auto_init_hp_out(codec);
14851 alc662_auto_init_analog_input(codec);
14852 alc662_auto_init_input_src(codec);
14853 if (spec->unsol_event)
14854 alc_sku_automute(codec);
14857 static int patch_alc662(struct hda_codec *codec)
14859 struct alc_spec *spec;
14860 int err, board_config;
14862 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14866 codec->spec = spec;
14868 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14870 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
14873 if (board_config < 0) {
14874 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
14875 "trying auto-probe from BIOS...\n");
14876 board_config = ALC662_AUTO;
14879 if (board_config == ALC662_AUTO) {
14880 /* automatic parse from the BIOS config */
14881 err = alc662_parse_auto_config(codec);
14887 "hda_codec: Cannot set up configuration "
14888 "from BIOS. Using base mode...\n");
14889 board_config = ALC662_3ST_2ch_DIG;
14893 if (board_config != ALC662_AUTO)
14894 setup_preset(spec, &alc662_presets[board_config]);
14896 if (codec->vendor_id == 0x10ec0663) {
14897 spec->stream_name_analog = "ALC663 Analog";
14898 spec->stream_name_digital = "ALC663 Digital";
14900 spec->stream_name_analog = "ALC662 Analog";
14901 spec->stream_name_digital = "ALC662 Digital";
14904 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14905 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14907 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14908 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14910 spec->adc_nids = alc662_adc_nids;
14911 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14912 spec->capsrc_nids = alc662_capsrc_nids;
14914 spec->vmaster_nid = 0x02;
14916 codec->patch_ops = alc_patch_ops;
14917 if (board_config == ALC662_AUTO)
14918 spec->init_hook = alc662_auto_init;
14919 #ifdef CONFIG_SND_HDA_POWER_SAVE
14920 if (!spec->loopback.amplist)
14921 spec->loopback.amplist = alc662_loopbacks;
14930 struct hda_codec_preset snd_hda_preset_realtek[] = {
14931 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14932 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14933 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14934 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14935 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14936 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14937 .patch = patch_alc861 },
14938 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14939 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14940 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14941 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14942 .patch = patch_alc883 },
14943 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14944 .patch = patch_alc662 },
14945 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
14946 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14947 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14948 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14949 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14950 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14951 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14952 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14953 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14954 {} /* terminator */