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,
104 ALC262_MODEL_LAST /* last tag */
115 #ifdef CONFIG_SND_DEBUG
119 ALC268_MODEL_LAST /* last tag */
126 ALC269_MODEL_LAST /* last tag */
143 /* ALC861-VD models */
164 ALC662_ASUS_EEEPC_P701,
165 ALC662_ASUS_EEEPC_EP20,
197 ALC883_TARGA_2ch_DIG,
203 ALC883_LENOVO_101E_2ch,
204 ALC883_LENOVO_NB0763,
205 ALC888_LENOVO_MS7195_DIG,
211 ALC883_FUJITSU_PI2515,
212 ALC883_3ST_6ch_INTEL,
218 #define GPIO_MASK 0x03
221 /* codec parameterization */
222 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
223 unsigned int num_mixers;
225 const struct hda_verb *init_verbs[5]; /* initialization verbs
229 unsigned int num_init_verbs;
231 char *stream_name_analog; /* analog PCM stream */
232 struct hda_pcm_stream *stream_analog_playback;
233 struct hda_pcm_stream *stream_analog_capture;
234 struct hda_pcm_stream *stream_analog_alt_playback;
235 struct hda_pcm_stream *stream_analog_alt_capture;
237 char *stream_name_digital; /* digital PCM stream */
238 struct hda_pcm_stream *stream_digital_playback;
239 struct hda_pcm_stream *stream_digital_capture;
242 struct hda_multi_out multiout; /* playback set-up
243 * max_channels, dacs must be set
244 * dig_out_nid and hp_nid are optional
246 hda_nid_t alt_dac_nid;
249 unsigned int num_adc_nids;
251 hda_nid_t *capsrc_nids;
252 hda_nid_t dig_in_nid; /* digital-in NID; optional */
255 unsigned int num_mux_defs;
256 const struct hda_input_mux *input_mux;
257 unsigned int cur_mux[3];
260 const struct hda_channel_mode *channel_mode;
261 int num_channel_mode;
264 /* PCM information */
265 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
267 /* dynamic controls, init_verbs and input_mux */
268 struct auto_pin_cfg autocfg;
269 unsigned int num_kctl_alloc, num_kctl_used;
270 struct snd_kcontrol_new *kctl_alloc;
271 struct hda_input_mux private_imux;
272 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
275 void (*init_hook)(struct hda_codec *codec);
276 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
278 /* for pin sensing */
279 unsigned int sense_updated: 1;
280 unsigned int jack_present: 1;
281 unsigned int master_sw: 1;
283 /* for virtual master */
284 hda_nid_t vmaster_nid;
285 #ifdef CONFIG_SND_HDA_POWER_SAVE
286 struct hda_loopback_check loopback;
291 unsigned int pll_coef_idx, pll_coef_bit;
295 * configuration template - to be copied to the spec instance
297 struct alc_config_preset {
298 struct snd_kcontrol_new *mixers[5]; /* should be identical size
301 const struct hda_verb *init_verbs[5];
302 unsigned int num_dacs;
304 hda_nid_t dig_out_nid; /* optional */
305 hda_nid_t hp_nid; /* optional */
306 unsigned int num_adc_nids;
308 hda_nid_t *capsrc_nids;
309 hda_nid_t dig_in_nid;
310 unsigned int num_channel_mode;
311 const struct hda_channel_mode *channel_mode;
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 void (*unsol_event)(struct hda_codec *, unsigned int);
316 void (*init_hook)(struct hda_codec *);
317 #ifdef CONFIG_SND_HDA_POWER_SAVE
318 struct hda_amp_list *loopbacks;
326 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
327 struct snd_ctl_elem_info *uinfo)
329 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
330 struct alc_spec *spec = codec->spec;
331 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
332 if (mux_idx >= spec->num_mux_defs)
334 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
337 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
338 struct snd_ctl_elem_value *ucontrol)
340 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
341 struct alc_spec *spec = codec->spec;
342 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
344 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
348 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
349 struct snd_ctl_elem_value *ucontrol)
351 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
352 struct alc_spec *spec = codec->spec;
353 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
354 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
355 hda_nid_t nid = spec->capsrc_nids ?
356 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
357 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
358 nid, &spec->cur_mux[adc_idx]);
363 * channel mode setting
365 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
366 struct snd_ctl_elem_info *uinfo)
368 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
369 struct alc_spec *spec = codec->spec;
370 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
371 spec->num_channel_mode);
374 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
375 struct snd_ctl_elem_value *ucontrol)
377 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
378 struct alc_spec *spec = codec->spec;
379 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
380 spec->num_channel_mode,
381 spec->multiout.max_channels);
384 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
385 struct snd_ctl_elem_value *ucontrol)
387 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
388 struct alc_spec *spec = codec->spec;
389 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
390 spec->num_channel_mode,
391 &spec->multiout.max_channels);
392 if (err >= 0 && spec->need_dac_fix)
393 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
398 * Control the mode of pin widget settings via the mixer. "pc" is used
399 * instead of "%" to avoid consequences of accidently treating the % as
400 * being part of a format specifier. Maximum allowed length of a value is
401 * 63 characters plus NULL terminator.
403 * Note: some retasking pin complexes seem to ignore requests for input
404 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
405 * are requested. Therefore order this list so that this behaviour will not
406 * cause problems when mixer clients move through the enum sequentially.
407 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
410 static char *alc_pin_mode_names[] = {
411 "Mic 50pc bias", "Mic 80pc bias",
412 "Line in", "Line out", "Headphone out",
414 static unsigned char alc_pin_mode_values[] = {
415 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
417 /* The control can present all 5 options, or it can limit the options based
418 * in the pin being assumed to be exclusively an input or an output pin. In
419 * addition, "input" pins may or may not process the mic bias option
420 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
421 * accept requests for bias as of chip versions up to March 2006) and/or
422 * wiring in the computer.
424 #define ALC_PIN_DIR_IN 0x00
425 #define ALC_PIN_DIR_OUT 0x01
426 #define ALC_PIN_DIR_INOUT 0x02
427 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
428 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
430 /* Info about the pin modes supported by the different pin direction modes.
431 * For each direction the minimum and maximum values are given.
433 static signed char alc_pin_mode_dir_info[5][2] = {
434 { 0, 2 }, /* ALC_PIN_DIR_IN */
435 { 3, 4 }, /* ALC_PIN_DIR_OUT */
436 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
437 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
438 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
440 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
441 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
442 #define alc_pin_mode_n_items(_dir) \
443 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
445 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
446 struct snd_ctl_elem_info *uinfo)
448 unsigned int item_num = uinfo->value.enumerated.item;
449 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
451 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
453 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
455 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
456 item_num = alc_pin_mode_min(dir);
457 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
461 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
462 struct snd_ctl_elem_value *ucontrol)
465 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
466 hda_nid_t nid = kcontrol->private_value & 0xffff;
467 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
468 long *valp = ucontrol->value.integer.value;
469 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
470 AC_VERB_GET_PIN_WIDGET_CONTROL,
473 /* Find enumerated value for current pinctl setting */
474 i = alc_pin_mode_min(dir);
475 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
477 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
481 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
482 struct snd_ctl_elem_value *ucontrol)
485 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
486 hda_nid_t nid = kcontrol->private_value & 0xffff;
487 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
488 long val = *ucontrol->value.integer.value;
489 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
490 AC_VERB_GET_PIN_WIDGET_CONTROL,
493 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
494 val = alc_pin_mode_min(dir);
496 change = pinctl != alc_pin_mode_values[val];
498 /* Set pin mode to that requested */
499 snd_hda_codec_write_cache(codec, nid, 0,
500 AC_VERB_SET_PIN_WIDGET_CONTROL,
501 alc_pin_mode_values[val]);
503 /* Also enable the retasking pin's input/output as required
504 * for the requested pin mode. Enum values of 2 or less are
507 * Dynamically switching the input/output buffers probably
508 * reduces noise slightly (particularly on input) so we'll
509 * do it. However, having both input and output buffers
510 * enabled simultaneously doesn't seem to be problematic if
511 * this turns out to be necessary in the future.
514 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
515 HDA_AMP_MUTE, HDA_AMP_MUTE);
516 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
519 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
520 HDA_AMP_MUTE, HDA_AMP_MUTE);
521 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
528 #define ALC_PIN_MODE(xname, nid, dir) \
529 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
530 .info = alc_pin_mode_info, \
531 .get = alc_pin_mode_get, \
532 .put = alc_pin_mode_put, \
533 .private_value = nid | (dir<<16) }
535 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
536 * together using a mask with more than one bit set. This control is
537 * currently used only by the ALC260 test model. At this stage they are not
538 * needed for any "production" models.
540 #ifdef CONFIG_SND_DEBUG
541 #define alc_gpio_data_info snd_ctl_boolean_mono_info
543 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_value *ucontrol)
546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
547 hda_nid_t nid = kcontrol->private_value & 0xffff;
548 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
549 long *valp = ucontrol->value.integer.value;
550 unsigned int val = snd_hda_codec_read(codec, nid, 0,
551 AC_VERB_GET_GPIO_DATA, 0x00);
553 *valp = (val & mask) != 0;
556 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
557 struct snd_ctl_elem_value *ucontrol)
560 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
561 hda_nid_t nid = kcontrol->private_value & 0xffff;
562 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
563 long val = *ucontrol->value.integer.value;
564 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
565 AC_VERB_GET_GPIO_DATA,
568 /* Set/unset the masked GPIO bit(s) as needed */
569 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
574 snd_hda_codec_write_cache(codec, nid, 0,
575 AC_VERB_SET_GPIO_DATA, gpio_data);
579 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
580 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
581 .info = alc_gpio_data_info, \
582 .get = alc_gpio_data_get, \
583 .put = alc_gpio_data_put, \
584 .private_value = nid | (mask<<16) }
585 #endif /* CONFIG_SND_DEBUG */
587 /* A switch control to allow the enabling of the digital IO pins on the
588 * ALC260. This is incredibly simplistic; the intention of this control is
589 * to provide something in the test model allowing digital outputs to be
590 * identified if present. If models are found which can utilise these
591 * outputs a more complete mixer control can be devised for those models if
594 #ifdef CONFIG_SND_DEBUG
595 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
597 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
598 struct snd_ctl_elem_value *ucontrol)
600 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
601 hda_nid_t nid = kcontrol->private_value & 0xffff;
602 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
603 long *valp = ucontrol->value.integer.value;
604 unsigned int val = snd_hda_codec_read(codec, nid, 0,
605 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
607 *valp = (val & mask) != 0;
610 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
611 struct snd_ctl_elem_value *ucontrol)
614 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
615 hda_nid_t nid = kcontrol->private_value & 0xffff;
616 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
617 long val = *ucontrol->value.integer.value;
618 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
619 AC_VERB_GET_DIGI_CONVERT_1,
622 /* Set/unset the masked control bit(s) as needed */
623 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
628 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
633 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
634 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
635 .info = alc_spdif_ctrl_info, \
636 .get = alc_spdif_ctrl_get, \
637 .put = alc_spdif_ctrl_put, \
638 .private_value = nid | (mask<<16) }
639 #endif /* CONFIG_SND_DEBUG */
641 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
642 * Again, this is only used in the ALC26x test models to help identify when
643 * the EAPD line must be asserted for features to work.
645 #ifdef CONFIG_SND_DEBUG
646 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
648 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
649 struct snd_ctl_elem_value *ucontrol)
651 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
652 hda_nid_t nid = kcontrol->private_value & 0xffff;
653 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
654 long *valp = ucontrol->value.integer.value;
655 unsigned int val = snd_hda_codec_read(codec, nid, 0,
656 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
658 *valp = (val & mask) != 0;
662 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
663 struct snd_ctl_elem_value *ucontrol)
666 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
667 hda_nid_t nid = kcontrol->private_value & 0xffff;
668 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
669 long val = *ucontrol->value.integer.value;
670 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
671 AC_VERB_GET_EAPD_BTLENABLE,
674 /* Set/unset the masked control bit(s) as needed */
675 change = (!val ? 0 : mask) != (ctrl_data & mask);
680 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
686 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
687 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
688 .info = alc_eapd_ctrl_info, \
689 .get = alc_eapd_ctrl_get, \
690 .put = alc_eapd_ctrl_put, \
691 .private_value = nid | (mask<<16) }
692 #endif /* CONFIG_SND_DEBUG */
695 * set up from the preset table
697 static void setup_preset(struct alc_spec *spec,
698 const struct alc_config_preset *preset)
702 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
703 spec->mixers[spec->num_mixers++] = preset->mixers[i];
704 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
706 spec->init_verbs[spec->num_init_verbs++] =
707 preset->init_verbs[i];
709 spec->channel_mode = preset->channel_mode;
710 spec->num_channel_mode = preset->num_channel_mode;
711 spec->need_dac_fix = preset->need_dac_fix;
713 spec->multiout.max_channels = spec->channel_mode[0].channels;
715 spec->multiout.num_dacs = preset->num_dacs;
716 spec->multiout.dac_nids = preset->dac_nids;
717 spec->multiout.dig_out_nid = preset->dig_out_nid;
718 spec->multiout.hp_nid = preset->hp_nid;
720 spec->num_mux_defs = preset->num_mux_defs;
721 if (!spec->num_mux_defs)
722 spec->num_mux_defs = 1;
723 spec->input_mux = preset->input_mux;
725 spec->num_adc_nids = preset->num_adc_nids;
726 spec->adc_nids = preset->adc_nids;
727 spec->capsrc_nids = preset->capsrc_nids;
728 spec->dig_in_nid = preset->dig_in_nid;
730 spec->unsol_event = preset->unsol_event;
731 spec->init_hook = preset->init_hook;
732 #ifdef CONFIG_SND_HDA_POWER_SAVE
733 spec->loopback.amplist = preset->loopbacks;
737 /* Enable GPIO mask and set output */
738 static struct hda_verb alc_gpio1_init_verbs[] = {
739 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
740 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
741 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
745 static struct hda_verb alc_gpio2_init_verbs[] = {
746 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
747 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
748 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
752 static struct hda_verb alc_gpio3_init_verbs[] = {
753 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
754 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
755 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
760 * Fix hardware PLL issue
761 * On some codecs, the analog PLL gating control must be off while
762 * the default value is 1.
764 static void alc_fix_pll(struct hda_codec *codec)
766 struct alc_spec *spec = codec->spec;
771 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
773 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
774 AC_VERB_GET_PROC_COEF, 0);
775 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
777 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
778 val & ~(1 << spec->pll_coef_bit));
781 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
782 unsigned int coef_idx, unsigned int coef_bit)
784 struct alc_spec *spec = codec->spec;
786 spec->pll_coef_idx = coef_idx;
787 spec->pll_coef_bit = coef_bit;
791 static void alc_sku_automute(struct hda_codec *codec)
793 struct alc_spec *spec = codec->spec;
794 unsigned int present;
795 unsigned int hp_nid = spec->autocfg.hp_pins[0];
796 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
798 /* need to execute and sync at first */
799 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
800 present = snd_hda_codec_read(codec, hp_nid, 0,
801 AC_VERB_GET_PIN_SENSE, 0);
802 spec->jack_present = (present & 0x80000000) != 0;
803 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
804 spec->jack_present ? 0 : PIN_OUT);
807 /* unsolicited event for HP jack sensing */
808 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
810 if (codec->vendor_id == 0x10ec0880)
814 if (res != ALC880_HP_EVENT)
817 alc_sku_automute(codec);
820 /* additional initialization for ALC888 variants */
821 static void alc888_coef_init(struct hda_codec *codec)
825 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
826 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
827 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
828 if ((tmp & 0xf0) == 2)
830 snd_hda_codec_read(codec, 0x20, 0,
831 AC_VERB_SET_PROC_COEF, 0x830);
834 snd_hda_codec_read(codec, 0x20, 0,
835 AC_VERB_SET_PROC_COEF, 0x3030);
838 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
839 * 31 ~ 16 : Manufacture ID
841 * 7 ~ 0 : Assembly ID
842 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
844 static void alc_subsystem_id(struct hda_codec *codec,
845 unsigned int porta, unsigned int porte,
848 unsigned int ass, tmp, i;
850 struct alc_spec *spec = codec->spec;
852 ass = codec->subsystem_id & 0xffff;
853 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
857 * 31~30 : port conetcivity
860 * 19~16 : Check sum (15:1)
865 if (codec->vendor_id == 0x10ec0260)
867 ass = snd_hda_codec_read(codec, nid, 0,
868 AC_VERB_GET_CONFIG_DEFAULT, 0);
869 if (!(ass & 1) && !(ass & 0x100000))
871 if ((ass >> 30) != 1) /* no physical connection */
876 for (i = 1; i < 16; i++) {
880 if (((ass >> 16) & 0xf) != tmp)
886 * 2 : 0 --> Desktop, 1 --> Laptop
887 * 3~5 : External Amplifier control
890 tmp = (ass & 0x38) >> 3; /* external Amp control */
893 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
896 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
899 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
901 case 5: /* set EAPD output high */
902 switch (codec->vendor_id) {
904 snd_hda_codec_write(codec, 0x0f, 0,
905 AC_VERB_SET_EAPD_BTLENABLE, 2);
906 snd_hda_codec_write(codec, 0x10, 0,
907 AC_VERB_SET_EAPD_BTLENABLE, 2);
918 snd_hda_codec_write(codec, 0x14, 0,
919 AC_VERB_SET_EAPD_BTLENABLE, 2);
920 snd_hda_codec_write(codec, 0x15, 0,
921 AC_VERB_SET_EAPD_BTLENABLE, 2);
924 switch (codec->vendor_id) {
926 snd_hda_codec_write(codec, 0x1a, 0,
927 AC_VERB_SET_COEF_INDEX, 7);
928 tmp = snd_hda_codec_read(codec, 0x1a, 0,
929 AC_VERB_GET_PROC_COEF, 0);
930 snd_hda_codec_write(codec, 0x1a, 0,
931 AC_VERB_SET_COEF_INDEX, 7);
932 snd_hda_codec_write(codec, 0x1a, 0,
933 AC_VERB_SET_PROC_COEF,
942 snd_hda_codec_write(codec, 0x20, 0,
943 AC_VERB_SET_COEF_INDEX, 7);
944 tmp = snd_hda_codec_read(codec, 0x20, 0,
945 AC_VERB_GET_PROC_COEF, 0);
946 snd_hda_codec_write(codec, 0x20, 0,
947 AC_VERB_SET_COEF_INDEX, 7);
948 snd_hda_codec_write(codec, 0x20, 0,
949 AC_VERB_SET_PROC_COEF,
953 alc888_coef_init(codec);
957 snd_hda_codec_write(codec, 0x20, 0,
958 AC_VERB_SET_COEF_INDEX, 7);
959 tmp = snd_hda_codec_read(codec, 0x20, 0,
960 AC_VERB_GET_PROC_COEF, 0);
961 snd_hda_codec_write(codec, 0x20, 0,
962 AC_VERB_SET_COEF_INDEX, 7);
963 snd_hda_codec_write(codec, 0x20, 0,
964 AC_VERB_SET_PROC_COEF,
972 /* is laptop or Desktop and enable the function "Mute internal speaker
973 * when the external headphone out jack is plugged"
978 * 10~8 : Jack location
979 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
981 * 15 : 1 --> enable the function "Mute internal speaker
982 * when the external headphone out jack is plugged"
984 if (!spec->autocfg.speaker_pins[0]) {
985 if (spec->autocfg.line_out_pins[0])
986 spec->autocfg.speaker_pins[0] =
987 spec->autocfg.line_out_pins[0];
992 if (!spec->autocfg.hp_pins[0]) {
993 tmp = (ass >> 11) & 0x3; /* HP to chassis */
995 spec->autocfg.hp_pins[0] = porta;
997 spec->autocfg.hp_pins[0] = porte;
999 spec->autocfg.hp_pins[0] = portd;
1004 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1005 AC_VERB_SET_UNSOLICITED_ENABLE,
1006 AC_USRSP_EN | ALC880_HP_EVENT);
1007 spec->unsol_event = alc_sku_unsol_event;
1011 * Fix-up pin default configurations
1019 static void alc_fix_pincfg(struct hda_codec *codec,
1020 const struct snd_pci_quirk *quirk,
1021 const struct alc_pincfg **pinfix)
1023 const struct alc_pincfg *cfg;
1025 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1029 cfg = pinfix[quirk->value];
1030 for (; cfg->nid; cfg++) {
1033 for (i = 0; i < 4; i++) {
1034 snd_hda_codec_write(codec, cfg->nid, 0,
1035 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1043 * ALC880 3-stack model
1045 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1046 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1047 * F-Mic = 0x1b, HP = 0x19
1050 static hda_nid_t alc880_dac_nids[4] = {
1051 /* front, rear, clfe, rear_surr */
1052 0x02, 0x05, 0x04, 0x03
1055 static hda_nid_t alc880_adc_nids[3] = {
1060 /* The datasheet says the node 0x07 is connected from inputs,
1061 * but it shows zero connection in the real implementation on some devices.
1062 * Note: this is a 915GAV bug, fixed on 915GLV
1064 static hda_nid_t alc880_adc_nids_alt[2] = {
1069 #define ALC880_DIGOUT_NID 0x06
1070 #define ALC880_DIGIN_NID 0x0a
1072 static struct hda_input_mux alc880_capture_source = {
1076 { "Front Mic", 0x3 },
1082 /* channel source setting (2/6 channel selection for 3-stack) */
1084 static struct hda_verb alc880_threestack_ch2_init[] = {
1085 /* set line-in to input, mute it */
1086 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1087 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1088 /* set mic-in to input vref 80%, mute it */
1089 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1090 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1095 static struct hda_verb alc880_threestack_ch6_init[] = {
1096 /* set line-in to output, unmute it */
1097 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1098 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1099 /* set mic-in to output, unmute it */
1100 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1101 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1105 static struct hda_channel_mode alc880_threestack_modes[2] = {
1106 { 2, alc880_threestack_ch2_init },
1107 { 6, alc880_threestack_ch6_init },
1110 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1111 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1112 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1113 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1114 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1115 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1116 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1117 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1118 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1119 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1120 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1121 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1122 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1127 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1128 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1131 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1132 .name = "Channel Mode",
1133 .info = alc_ch_mode_info,
1134 .get = alc_ch_mode_get,
1135 .put = alc_ch_mode_put,
1140 /* capture mixer elements */
1141 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1142 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1143 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1144 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1145 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1146 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1147 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1150 /* The multiple "Capture Source" controls confuse alsamixer
1151 * So call somewhat different..
1153 /* .name = "Capture Source", */
1154 .name = "Input Source",
1156 .info = alc_mux_enum_info,
1157 .get = alc_mux_enum_get,
1158 .put = alc_mux_enum_put,
1163 /* capture mixer elements (in case NID 0x07 not available) */
1164 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1165 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1166 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1167 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1168 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1170 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1171 /* The multiple "Capture Source" controls confuse alsamixer
1172 * So call somewhat different..
1174 /* .name = "Capture Source", */
1175 .name = "Input Source",
1177 .info = alc_mux_enum_info,
1178 .get = alc_mux_enum_get,
1179 .put = alc_mux_enum_put,
1187 * ALC880 5-stack model
1189 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1191 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1192 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1195 /* additional mixers to alc880_three_stack_mixer */
1196 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1197 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1198 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1202 /* channel source setting (6/8 channel selection for 5-stack) */
1204 static struct hda_verb alc880_fivestack_ch6_init[] = {
1205 /* set line-in to input, mute it */
1206 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1207 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1212 static struct hda_verb alc880_fivestack_ch8_init[] = {
1213 /* set line-in to output, unmute it */
1214 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1215 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1219 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1220 { 6, alc880_fivestack_ch6_init },
1221 { 8, alc880_fivestack_ch8_init },
1226 * ALC880 6-stack model
1228 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1229 * Side = 0x05 (0x0f)
1230 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1231 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1234 static hda_nid_t alc880_6st_dac_nids[4] = {
1235 /* front, rear, clfe, rear_surr */
1236 0x02, 0x03, 0x04, 0x05
1239 static struct hda_input_mux alc880_6stack_capture_source = {
1243 { "Front Mic", 0x1 },
1249 /* fixed 8-channels */
1250 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1254 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1255 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1256 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1257 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1258 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1259 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1260 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1261 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1262 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1263 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1264 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1265 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1266 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1267 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1268 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1271 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1272 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1273 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1274 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1277 .name = "Channel Mode",
1278 .info = alc_ch_mode_info,
1279 .get = alc_ch_mode_get,
1280 .put = alc_ch_mode_put,
1289 * W810 has rear IO for:
1292 * Center/LFE (DAC 04)
1295 * The system also has a pair of internal speakers, and a headphone jack.
1296 * These are both connected to Line2 on the codec, hence to DAC 02.
1298 * There is a variable resistor to control the speaker or headphone
1299 * volume. This is a hardware-only device without a software API.
1301 * Plugging headphones in will disable the internal speakers. This is
1302 * implemented in hardware, not via the driver using jack sense. In
1303 * a similar fashion, plugging into the rear socket marked "front" will
1304 * disable both the speakers and headphones.
1306 * For input, there's a microphone jack, and an "audio in" jack.
1307 * These may not do anything useful with this driver yet, because I
1308 * haven't setup any initialization verbs for these yet...
1311 static hda_nid_t alc880_w810_dac_nids[3] = {
1312 /* front, rear/surround, clfe */
1316 /* fixed 6 channels */
1317 static struct hda_channel_mode alc880_w810_modes[1] = {
1321 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1322 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1323 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1324 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1325 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1326 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1327 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1328 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1329 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1330 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1339 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1340 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1344 static hda_nid_t alc880_z71v_dac_nids[1] = {
1347 #define ALC880_Z71V_HP_DAC 0x03
1349 /* fixed 2 channels */
1350 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1354 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1355 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1356 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1357 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1358 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1359 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1360 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1368 * ALC880 F1734 model
1370 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1371 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1374 static hda_nid_t alc880_f1734_dac_nids[1] = {
1377 #define ALC880_F1734_HP_DAC 0x02
1379 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1381 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1382 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1383 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1384 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1385 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1391 static struct hda_input_mux alc880_f1734_capture_source = {
1403 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1404 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1405 * Mic = 0x18, Line = 0x1a
1408 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1409 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1411 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1413 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1414 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1415 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1416 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1417 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1418 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1419 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1420 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1421 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1422 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1423 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1427 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1428 .name = "Channel Mode",
1429 .info = alc_ch_mode_info,
1430 .get = alc_ch_mode_get,
1431 .put = alc_ch_mode_put,
1437 * ALC880 ASUS W1V model
1439 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1440 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1441 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1444 /* additional mixers to alc880_asus_mixer */
1445 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1446 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1447 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1451 /* additional mixers to alc880_asus_mixer */
1452 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1453 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1454 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1459 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1460 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1461 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1462 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1463 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1464 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1467 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1468 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1470 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1471 /* The multiple "Capture Source" controls confuse alsamixer
1472 * So call somewhat different..
1474 /* .name = "Capture Source", */
1475 .name = "Input Source",
1477 .info = alc_mux_enum_info,
1478 .get = alc_mux_enum_get,
1479 .put = alc_mux_enum_put,
1485 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1486 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1487 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1488 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1489 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1490 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1491 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1492 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1493 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1496 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1497 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1499 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1500 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1501 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1502 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1503 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1505 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1506 .name = "Channel Mode",
1507 .info = alc_ch_mode_info,
1508 .get = alc_ch_mode_get,
1509 .put = alc_ch_mode_put,
1514 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1515 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1516 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1517 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1518 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1519 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1520 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1521 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1522 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1523 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1524 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1528 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1529 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1530 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1531 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1532 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1539 * virtual master controls
1543 * slave controls for virtual master
1545 static const char *alc_slave_vols[] = {
1546 "Front Playback Volume",
1547 "Surround Playback Volume",
1548 "Center Playback Volume",
1549 "LFE Playback Volume",
1550 "Side Playback Volume",
1551 "Headphone Playback Volume",
1552 "Speaker Playback Volume",
1553 "Mono Playback Volume",
1554 "Line-Out Playback Volume",
1558 static const char *alc_slave_sws[] = {
1559 "Front Playback Switch",
1560 "Surround Playback Switch",
1561 "Center Playback Switch",
1562 "LFE Playback Switch",
1563 "Side Playback Switch",
1564 "Headphone Playback Switch",
1565 "Speaker Playback Switch",
1566 "Mono Playback Switch",
1567 "IEC958 Playback Switch",
1572 * build control elements
1574 static int alc_build_controls(struct hda_codec *codec)
1576 struct alc_spec *spec = codec->spec;
1580 for (i = 0; i < spec->num_mixers; i++) {
1581 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1586 if (spec->multiout.dig_out_nid) {
1587 err = snd_hda_create_spdif_out_ctls(codec,
1588 spec->multiout.dig_out_nid);
1591 err = snd_hda_create_spdif_share_sw(codec,
1595 spec->multiout.share_spdif = 1;
1597 if (spec->dig_in_nid) {
1598 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1603 /* if we have no master control, let's create it */
1604 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1605 unsigned int vmaster_tlv[4];
1606 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1607 HDA_OUTPUT, vmaster_tlv);
1608 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1609 vmaster_tlv, alc_slave_vols);
1613 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1614 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1615 NULL, alc_slave_sws);
1625 * initialize the codec volumes, etc
1629 * generic initialization of ADC, input mixers and output mixers
1631 static struct hda_verb alc880_volume_init_verbs[] = {
1633 * Unmute ADC0-2 and set the default input to mic-in
1635 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1637 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1638 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1639 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1640 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1642 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1644 * Note: PASD motherboards uses the Line In 2 as the input for front
1647 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1649 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1650 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1657 * Set up output mixers (0x0c - 0x0f)
1659 /* set vol=0 to output mixers */
1660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1663 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1664 /* set up input amps for analog loopback */
1665 /* Amp Indices: DAC = 0, mixer = 1 */
1666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1668 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1669 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1670 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1671 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1672 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1679 * 3-stack pin configuration:
1680 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1682 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1684 * preset connection lists of input pins
1685 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1687 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1688 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1689 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1692 * Set pin mode and muting
1694 /* set front pin widgets 0x14 for output */
1695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1696 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1697 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1698 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1699 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1700 /* Mic2 (as headphone out) for HP output */
1701 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1702 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1703 /* Line In pin widget for input */
1704 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1705 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1706 /* Line2 (as front mic) pin widget for input and vref at 80% */
1707 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1708 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1709 /* CD pin widget for input */
1710 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1716 * 5-stack pin configuration:
1717 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1718 * line-in/side = 0x1a, f-mic = 0x1b
1720 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1722 * preset connection lists of input pins
1723 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1725 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1726 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1729 * Set pin mode and muting
1731 /* set pin widgets 0x14-0x17 for output */
1732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1733 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1734 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1735 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1736 /* unmute pins for output (no gain on this amp) */
1737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1739 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1740 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1742 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1743 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1744 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1745 /* Mic2 (as headphone out) for HP output */
1746 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1748 /* Line In pin widget for input */
1749 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1750 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1751 /* Line2 (as front mic) pin widget for input and vref at 80% */
1752 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1753 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1754 /* CD pin widget for input */
1755 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1761 * W810 pin configuration:
1762 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1764 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1765 /* hphone/speaker input selector: front DAC */
1766 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1768 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1770 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1772 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1776 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1782 * Z71V pin configuration:
1783 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1785 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1786 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1787 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1791 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1793 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1794 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1800 * 6-stack pin configuration:
1801 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1802 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1804 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1805 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1811 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1812 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1813 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1814 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1816 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1817 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1820 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1821 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1822 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1823 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1824 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1830 * Uniwill pin configuration:
1831 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1834 static struct hda_verb alc880_uniwill_init_verbs[] = {
1835 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1837 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1838 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1839 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1841 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1842 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1843 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1844 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1853 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1854 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1855 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1856 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1857 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1858 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1859 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1860 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1862 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1863 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1870 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1872 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1873 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1876 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1879 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1880 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1886 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1888 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1890 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1891 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1892 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1895 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1896 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1901 static struct hda_verb alc880_beep_init_verbs[] = {
1902 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1906 /* toggle speaker-output according to the hp-jack state */
1907 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1909 unsigned int present;
1912 present = snd_hda_codec_read(codec, 0x14, 0,
1913 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1914 bits = present ? HDA_AMP_MUTE : 0;
1915 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1916 HDA_AMP_MUTE, bits);
1917 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1918 HDA_AMP_MUTE, bits);
1921 /* auto-toggle front mic */
1922 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1924 unsigned int present;
1927 present = snd_hda_codec_read(codec, 0x18, 0,
1928 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1929 bits = present ? HDA_AMP_MUTE : 0;
1930 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1933 static void alc880_uniwill_automute(struct hda_codec *codec)
1935 alc880_uniwill_hp_automute(codec);
1936 alc880_uniwill_mic_automute(codec);
1939 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1942 /* Looks like the unsol event is incompatible with the standard
1943 * definition. 4bit tag is placed at 28 bit!
1945 switch (res >> 28) {
1946 case ALC880_HP_EVENT:
1947 alc880_uniwill_hp_automute(codec);
1949 case ALC880_MIC_EVENT:
1950 alc880_uniwill_mic_automute(codec);
1955 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1957 unsigned int present;
1960 present = snd_hda_codec_read(codec, 0x14, 0,
1961 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1962 bits = present ? HDA_AMP_MUTE : 0;
1963 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
1966 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1968 unsigned int present;
1970 present = snd_hda_codec_read(codec, 0x21, 0,
1971 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1972 present &= HDA_AMP_VOLMASK;
1973 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1974 HDA_AMP_VOLMASK, present);
1975 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1976 HDA_AMP_VOLMASK, present);
1979 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1982 /* Looks like the unsol event is incompatible with the standard
1983 * definition. 4bit tag is placed at 28 bit!
1985 if ((res >> 28) == ALC880_HP_EVENT)
1986 alc880_uniwill_p53_hp_automute(codec);
1987 if ((res >> 28) == ALC880_DCVOL_EVENT)
1988 alc880_uniwill_p53_dcvol_automute(codec);
1992 * F1734 pin configuration:
1993 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1995 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1996 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
1997 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1998 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1999 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2000 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2003 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2009 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2010 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2011 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2013 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2014 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2015 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2017 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2018 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2024 * ASUS pin configuration:
2025 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2027 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2028 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2029 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2030 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2031 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2033 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2034 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2035 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2036 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2037 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2038 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2039 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2040 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2042 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2043 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2044 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2045 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2046 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2050 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2055 /* Enable GPIO mask and set output */
2056 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2057 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2059 /* Clevo m520g init */
2060 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2061 /* headphone output */
2062 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2064 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2065 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2067 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2070 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2071 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2072 /* Mic1 (rear panel) */
2073 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2075 /* Mic2 (front panel) */
2076 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2077 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2081 /* change to EAPD mode */
2082 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2083 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2088 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2089 /* change to EAPD mode */
2090 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2091 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2093 /* Headphone output */
2094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2096 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2097 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2099 /* Line In pin widget for input */
2100 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2101 /* CD pin widget for input */
2102 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2103 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2106 /* change to EAPD mode */
2107 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2108 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2114 * LG m1 express dual
2117 * Rear Line-In/Out (blue): 0x14
2118 * Build-in Mic-In: 0x15
2120 * HP-Out (green): 0x1b
2121 * Mic-In/Out (red): 0x19
2125 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2126 static hda_nid_t alc880_lg_dac_nids[3] = {
2130 /* seems analog CD is not working */
2131 static struct hda_input_mux alc880_lg_capture_source = {
2136 { "Internal Mic", 0x6 },
2140 /* 2,4,6 channel modes */
2141 static struct hda_verb alc880_lg_ch2_init[] = {
2142 /* set line-in and mic-in to input */
2143 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2144 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2148 static struct hda_verb alc880_lg_ch4_init[] = {
2149 /* set line-in to out and mic-in to input */
2150 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2151 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2155 static struct hda_verb alc880_lg_ch6_init[] = {
2156 /* set line-in and mic-in to output */
2157 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2158 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2162 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2163 { 2, alc880_lg_ch2_init },
2164 { 4, alc880_lg_ch4_init },
2165 { 6, alc880_lg_ch6_init },
2168 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2169 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2170 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2171 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2172 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2173 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2174 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2175 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2176 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2179 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2180 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2181 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2182 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2184 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2185 .name = "Channel Mode",
2186 .info = alc_ch_mode_info,
2187 .get = alc_ch_mode_get,
2188 .put = alc_ch_mode_put,
2193 static struct hda_verb alc880_lg_init_verbs[] = {
2194 /* set capture source to mic-in */
2195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2197 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2198 /* mute all amp mixer inputs */
2199 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2200 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2202 /* line-in to input */
2203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2204 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2207 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2209 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2210 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2211 /* mic-in to input */
2212 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2213 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2214 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2216 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2218 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2220 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2224 /* toggle speaker-output according to the hp-jack state */
2225 static void alc880_lg_automute(struct hda_codec *codec)
2227 unsigned int present;
2230 present = snd_hda_codec_read(codec, 0x1b, 0,
2231 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2232 bits = present ? HDA_AMP_MUTE : 0;
2233 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2234 HDA_AMP_MUTE, bits);
2237 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2239 /* Looks like the unsol event is incompatible with the standard
2240 * definition. 4bit tag is placed at 28 bit!
2242 if ((res >> 28) == 0x01)
2243 alc880_lg_automute(codec);
2252 * Built-in Mic-In: 0x19
2258 static struct hda_input_mux alc880_lg_lw_capture_source = {
2262 { "Internal Mic", 0x1 },
2267 #define alc880_lg_lw_modes alc880_threestack_modes
2269 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2270 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2271 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2272 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2275 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2276 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2277 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2278 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2279 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2283 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2285 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2286 .name = "Channel Mode",
2287 .info = alc_ch_mode_info,
2288 .get = alc_ch_mode_get,
2289 .put = alc_ch_mode_put,
2294 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2295 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2296 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2297 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2299 /* set capture source to mic-in */
2300 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2301 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2308 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2309 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2310 /* mic-in to input */
2311 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2312 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2314 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2315 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2317 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2321 /* toggle speaker-output according to the hp-jack state */
2322 static void alc880_lg_lw_automute(struct hda_codec *codec)
2324 unsigned int present;
2327 present = snd_hda_codec_read(codec, 0x1b, 0,
2328 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2329 bits = present ? HDA_AMP_MUTE : 0;
2330 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2331 HDA_AMP_MUTE, bits);
2334 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2336 /* Looks like the unsol event is incompatible with the standard
2337 * definition. 4bit tag is placed at 28 bit!
2339 if ((res >> 28) == 0x01)
2340 alc880_lg_lw_automute(codec);
2343 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2344 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2345 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2348 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2349 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2353 static struct hda_input_mux alc880_medion_rim_capture_source = {
2357 { "Internal Mic", 0x1 },
2361 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2362 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2365 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2367 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2368 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2369 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2370 /* Mic2 (as headphone out) for HP output */
2371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2373 /* Internal Speaker */
2374 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2375 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2377 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2378 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2380 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2384 /* toggle speaker-output according to the hp-jack state */
2385 static void alc880_medion_rim_automute(struct hda_codec *codec)
2387 unsigned int present;
2390 present = snd_hda_codec_read(codec, 0x14, 0,
2391 AC_VERB_GET_PIN_SENSE, 0)
2392 & AC_PINSENSE_PRESENCE;
2393 bits = present ? HDA_AMP_MUTE : 0;
2394 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2395 HDA_AMP_MUTE, bits);
2397 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2399 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2402 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2405 /* Looks like the unsol event is incompatible with the standard
2406 * definition. 4bit tag is placed at 28 bit!
2408 if ((res >> 28) == ALC880_HP_EVENT)
2409 alc880_medion_rim_automute(codec);
2412 #ifdef CONFIG_SND_HDA_POWER_SAVE
2413 static struct hda_amp_list alc880_loopbacks[] = {
2414 { 0x0b, HDA_INPUT, 0 },
2415 { 0x0b, HDA_INPUT, 1 },
2416 { 0x0b, HDA_INPUT, 2 },
2417 { 0x0b, HDA_INPUT, 3 },
2418 { 0x0b, HDA_INPUT, 4 },
2422 static struct hda_amp_list alc880_lg_loopbacks[] = {
2423 { 0x0b, HDA_INPUT, 1 },
2424 { 0x0b, HDA_INPUT, 6 },
2425 { 0x0b, HDA_INPUT, 7 },
2434 static int alc_init(struct hda_codec *codec)
2436 struct alc_spec *spec = codec->spec;
2441 for (i = 0; i < spec->num_init_verbs; i++)
2442 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2444 if (spec->init_hook)
2445 spec->init_hook(codec);
2450 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2452 struct alc_spec *spec = codec->spec;
2454 if (spec->unsol_event)
2455 spec->unsol_event(codec, res);
2458 #ifdef CONFIG_SND_HDA_POWER_SAVE
2459 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2461 struct alc_spec *spec = codec->spec;
2462 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2467 * Analog playback callbacks
2469 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2470 struct hda_codec *codec,
2471 struct snd_pcm_substream *substream)
2473 struct alc_spec *spec = codec->spec;
2474 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2478 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2479 struct hda_codec *codec,
2480 unsigned int stream_tag,
2481 unsigned int format,
2482 struct snd_pcm_substream *substream)
2484 struct alc_spec *spec = codec->spec;
2485 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2486 stream_tag, format, substream);
2489 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2490 struct hda_codec *codec,
2491 struct snd_pcm_substream *substream)
2493 struct alc_spec *spec = codec->spec;
2494 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2500 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2501 struct hda_codec *codec,
2502 struct snd_pcm_substream *substream)
2504 struct alc_spec *spec = codec->spec;
2505 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2508 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2509 struct hda_codec *codec,
2510 unsigned int stream_tag,
2511 unsigned int format,
2512 struct snd_pcm_substream *substream)
2514 struct alc_spec *spec = codec->spec;
2515 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2516 stream_tag, format, substream);
2519 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2520 struct hda_codec *codec,
2521 struct snd_pcm_substream *substream)
2523 struct alc_spec *spec = codec->spec;
2524 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2530 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2531 struct hda_codec *codec,
2532 unsigned int stream_tag,
2533 unsigned int format,
2534 struct snd_pcm_substream *substream)
2536 struct alc_spec *spec = codec->spec;
2538 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2539 stream_tag, 0, format);
2543 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2544 struct hda_codec *codec,
2545 struct snd_pcm_substream *substream)
2547 struct alc_spec *spec = codec->spec;
2549 snd_hda_codec_cleanup_stream(codec,
2550 spec->adc_nids[substream->number + 1]);
2557 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2561 /* NID is set in alc_build_pcms */
2563 .open = alc880_playback_pcm_open,
2564 .prepare = alc880_playback_pcm_prepare,
2565 .cleanup = alc880_playback_pcm_cleanup
2569 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2573 /* NID is set in alc_build_pcms */
2576 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2580 /* NID is set in alc_build_pcms */
2583 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2584 .substreams = 2, /* can be overridden */
2587 /* NID is set in alc_build_pcms */
2589 .prepare = alc880_alt_capture_pcm_prepare,
2590 .cleanup = alc880_alt_capture_pcm_cleanup
2594 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2598 /* NID is set in alc_build_pcms */
2600 .open = alc880_dig_playback_pcm_open,
2601 .close = alc880_dig_playback_pcm_close,
2602 .prepare = alc880_dig_playback_pcm_prepare
2606 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2610 /* NID is set in alc_build_pcms */
2613 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2614 static struct hda_pcm_stream alc_pcm_null_stream = {
2620 static int alc_build_pcms(struct hda_codec *codec)
2622 struct alc_spec *spec = codec->spec;
2623 struct hda_pcm *info = spec->pcm_rec;
2626 codec->num_pcms = 1;
2627 codec->pcm_info = info;
2629 info->name = spec->stream_name_analog;
2630 if (spec->stream_analog_playback) {
2631 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2632 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2633 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2635 if (spec->stream_analog_capture) {
2636 snd_assert(spec->adc_nids, return -EINVAL);
2637 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2638 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2641 if (spec->channel_mode) {
2642 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2643 for (i = 0; i < spec->num_channel_mode; i++) {
2644 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2645 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2650 /* SPDIF for stream index #1 */
2651 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2652 codec->num_pcms = 2;
2653 info = spec->pcm_rec + 1;
2654 info->name = spec->stream_name_digital;
2655 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2656 if (spec->multiout.dig_out_nid &&
2657 spec->stream_digital_playback) {
2658 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2659 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2661 if (spec->dig_in_nid &&
2662 spec->stream_digital_capture) {
2663 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2664 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2668 /* If the use of more than one ADC is requested for the current
2669 * model, configure a second analog capture-only PCM.
2671 /* Additional Analaog capture for index #2 */
2672 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2673 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2674 codec->num_pcms = 3;
2675 info = spec->pcm_rec + 2;
2676 info->name = spec->stream_name_analog;
2677 if (spec->alt_dac_nid) {
2678 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2679 *spec->stream_analog_alt_playback;
2680 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2683 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2684 alc_pcm_null_stream;
2685 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2687 if (spec->num_adc_nids > 1) {
2688 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2689 *spec->stream_analog_alt_capture;
2690 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2692 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2693 spec->num_adc_nids - 1;
2695 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2696 alc_pcm_null_stream;
2697 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2704 static void alc_free(struct hda_codec *codec)
2706 struct alc_spec *spec = codec->spec;
2712 if (spec->kctl_alloc) {
2713 for (i = 0; i < spec->num_kctl_used; i++)
2714 kfree(spec->kctl_alloc[i].name);
2715 kfree(spec->kctl_alloc);
2718 codec->spec = NULL; /* to be sure */
2723 static struct hda_codec_ops alc_patch_ops = {
2724 .build_controls = alc_build_controls,
2725 .build_pcms = alc_build_pcms,
2728 .unsol_event = alc_unsol_event,
2729 #ifdef CONFIG_SND_HDA_POWER_SAVE
2730 .check_power_status = alc_check_power_status,
2736 * Test configuration for debugging
2738 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2741 #ifdef CONFIG_SND_DEBUG
2742 static hda_nid_t alc880_test_dac_nids[4] = {
2743 0x02, 0x03, 0x04, 0x05
2746 static struct hda_input_mux alc880_test_capture_source = {
2755 { "Surround", 0x6 },
2759 static struct hda_channel_mode alc880_test_modes[4] = {
2766 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2767 struct snd_ctl_elem_info *uinfo)
2769 static char *texts[] = {
2770 "N/A", "Line Out", "HP Out",
2771 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2773 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2775 uinfo->value.enumerated.items = 8;
2776 if (uinfo->value.enumerated.item >= 8)
2777 uinfo->value.enumerated.item = 7;
2778 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2782 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2783 struct snd_ctl_elem_value *ucontrol)
2785 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2786 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2787 unsigned int pin_ctl, item = 0;
2789 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2790 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2791 if (pin_ctl & AC_PINCTL_OUT_EN) {
2792 if (pin_ctl & AC_PINCTL_HP_EN)
2796 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2797 switch (pin_ctl & AC_PINCTL_VREFEN) {
2798 case AC_PINCTL_VREF_HIZ: item = 3; break;
2799 case AC_PINCTL_VREF_50: item = 4; break;
2800 case AC_PINCTL_VREF_GRD: item = 5; break;
2801 case AC_PINCTL_VREF_80: item = 6; break;
2802 case AC_PINCTL_VREF_100: item = 7; break;
2805 ucontrol->value.enumerated.item[0] = item;
2809 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2810 struct snd_ctl_elem_value *ucontrol)
2812 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2813 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2814 static unsigned int ctls[] = {
2815 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2816 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2817 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2818 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2819 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2820 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2822 unsigned int old_ctl, new_ctl;
2824 old_ctl = snd_hda_codec_read(codec, nid, 0,
2825 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2826 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2827 if (old_ctl != new_ctl) {
2829 snd_hda_codec_write_cache(codec, nid, 0,
2830 AC_VERB_SET_PIN_WIDGET_CONTROL,
2832 val = ucontrol->value.enumerated.item[0] >= 3 ?
2834 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2841 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2842 struct snd_ctl_elem_info *uinfo)
2844 static char *texts[] = {
2845 "Front", "Surround", "CLFE", "Side"
2847 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2849 uinfo->value.enumerated.items = 4;
2850 if (uinfo->value.enumerated.item >= 4)
2851 uinfo->value.enumerated.item = 3;
2852 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2856 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2857 struct snd_ctl_elem_value *ucontrol)
2859 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2860 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2863 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2864 ucontrol->value.enumerated.item[0] = sel & 3;
2868 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2869 struct snd_ctl_elem_value *ucontrol)
2871 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2872 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2875 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2876 if (ucontrol->value.enumerated.item[0] != sel) {
2877 sel = ucontrol->value.enumerated.item[0] & 3;
2878 snd_hda_codec_write_cache(codec, nid, 0,
2879 AC_VERB_SET_CONNECT_SEL, sel);
2885 #define PIN_CTL_TEST(xname,nid) { \
2886 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2888 .info = alc_test_pin_ctl_info, \
2889 .get = alc_test_pin_ctl_get, \
2890 .put = alc_test_pin_ctl_put, \
2891 .private_value = nid \
2894 #define PIN_SRC_TEST(xname,nid) { \
2895 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2897 .info = alc_test_pin_src_info, \
2898 .get = alc_test_pin_src_get, \
2899 .put = alc_test_pin_src_put, \
2900 .private_value = nid \
2903 static struct snd_kcontrol_new alc880_test_mixer[] = {
2904 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2905 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2906 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2907 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2908 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2909 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2910 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2911 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2912 PIN_CTL_TEST("Front Pin Mode", 0x14),
2913 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2914 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2915 PIN_CTL_TEST("Side Pin Mode", 0x17),
2916 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2917 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2918 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2919 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2920 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2921 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2922 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2923 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2924 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2925 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2926 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2927 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2928 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2929 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2930 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2931 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2936 .name = "Channel Mode",
2937 .info = alc_ch_mode_info,
2938 .get = alc_ch_mode_get,
2939 .put = alc_ch_mode_put,
2944 static struct hda_verb alc880_test_init_verbs[] = {
2945 /* Unmute inputs of 0x0c - 0x0f */
2946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2948 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2949 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2951 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2952 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2954 /* Vol output for 0x0c-0x0f */
2955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2957 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2958 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2959 /* Set output pins 0x14-0x17 */
2960 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2961 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2962 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2963 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2964 /* Unmute output pins 0x14-0x17 */
2965 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2967 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2968 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2969 /* Set input pins 0x18-0x1c */
2970 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2971 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2972 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2973 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2974 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2975 /* Mute input pins 0x18-0x1b */
2976 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2977 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2979 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2982 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2984 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2985 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2986 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2987 /* Analog input/passthru */
2988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2990 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2992 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3000 static const char *alc880_models[ALC880_MODEL_LAST] = {
3001 [ALC880_3ST] = "3stack",
3002 [ALC880_TCL_S700] = "tcl",
3003 [ALC880_3ST_DIG] = "3stack-digout",
3004 [ALC880_CLEVO] = "clevo",
3005 [ALC880_5ST] = "5stack",
3006 [ALC880_5ST_DIG] = "5stack-digout",
3007 [ALC880_W810] = "w810",
3008 [ALC880_Z71V] = "z71v",
3009 [ALC880_6ST] = "6stack",
3010 [ALC880_6ST_DIG] = "6stack-digout",
3011 [ALC880_ASUS] = "asus",
3012 [ALC880_ASUS_W1V] = "asus-w1v",
3013 [ALC880_ASUS_DIG] = "asus-dig",
3014 [ALC880_ASUS_DIG2] = "asus-dig2",
3015 [ALC880_UNIWILL_DIG] = "uniwill",
3016 [ALC880_UNIWILL_P53] = "uniwill-p53",
3017 [ALC880_FUJITSU] = "fujitsu",
3018 [ALC880_F1734] = "F1734",
3020 [ALC880_LG_LW] = "lg-lw",
3021 [ALC880_MEDION_RIM] = "medion",
3022 #ifdef CONFIG_SND_DEBUG
3023 [ALC880_TEST] = "test",
3025 [ALC880_AUTO] = "auto",
3028 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3029 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3030 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3031 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3032 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3033 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3034 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3035 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3036 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3037 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3038 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3039 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3040 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3041 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3042 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3043 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3044 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3045 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3046 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3047 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3048 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3049 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3050 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3051 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3052 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3053 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3054 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3055 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3056 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3057 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3058 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3059 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3060 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3061 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3062 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3063 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3064 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3065 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3066 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3067 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3068 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3069 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3070 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3071 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3072 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3073 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3074 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3075 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3076 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3077 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3078 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3079 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3080 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3081 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3082 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3083 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3084 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3085 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3086 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3087 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3088 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3089 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3090 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3091 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3092 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3093 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3094 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3095 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3096 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3097 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3098 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3099 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3104 * ALC880 codec presets
3106 static struct alc_config_preset alc880_presets[] = {
3108 .mixers = { alc880_three_stack_mixer },
3109 .init_verbs = { alc880_volume_init_verbs,
3110 alc880_pin_3stack_init_verbs },
3111 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3112 .dac_nids = alc880_dac_nids,
3113 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3114 .channel_mode = alc880_threestack_modes,
3116 .input_mux = &alc880_capture_source,
3118 [ALC880_3ST_DIG] = {
3119 .mixers = { alc880_three_stack_mixer },
3120 .init_verbs = { alc880_volume_init_verbs,
3121 alc880_pin_3stack_init_verbs },
3122 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3123 .dac_nids = alc880_dac_nids,
3124 .dig_out_nid = ALC880_DIGOUT_NID,
3125 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3126 .channel_mode = alc880_threestack_modes,
3128 .input_mux = &alc880_capture_source,
3130 [ALC880_TCL_S700] = {
3131 .mixers = { alc880_tcl_s700_mixer },
3132 .init_verbs = { alc880_volume_init_verbs,
3133 alc880_pin_tcl_S700_init_verbs,
3134 alc880_gpio2_init_verbs },
3135 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3136 .dac_nids = alc880_dac_nids,
3138 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3139 .channel_mode = alc880_2_jack_modes,
3140 .input_mux = &alc880_capture_source,
3143 .mixers = { alc880_three_stack_mixer,
3144 alc880_five_stack_mixer},
3145 .init_verbs = { alc880_volume_init_verbs,
3146 alc880_pin_5stack_init_verbs },
3147 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3148 .dac_nids = alc880_dac_nids,
3149 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3150 .channel_mode = alc880_fivestack_modes,
3151 .input_mux = &alc880_capture_source,
3153 [ALC880_5ST_DIG] = {
3154 .mixers = { alc880_three_stack_mixer,
3155 alc880_five_stack_mixer },
3156 .init_verbs = { alc880_volume_init_verbs,
3157 alc880_pin_5stack_init_verbs },
3158 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3159 .dac_nids = alc880_dac_nids,
3160 .dig_out_nid = ALC880_DIGOUT_NID,
3161 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3162 .channel_mode = alc880_fivestack_modes,
3163 .input_mux = &alc880_capture_source,
3166 .mixers = { alc880_six_stack_mixer },
3167 .init_verbs = { alc880_volume_init_verbs,
3168 alc880_pin_6stack_init_verbs },
3169 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3170 .dac_nids = alc880_6st_dac_nids,
3171 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3172 .channel_mode = alc880_sixstack_modes,
3173 .input_mux = &alc880_6stack_capture_source,
3175 [ALC880_6ST_DIG] = {
3176 .mixers = { alc880_six_stack_mixer },
3177 .init_verbs = { alc880_volume_init_verbs,
3178 alc880_pin_6stack_init_verbs },
3179 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3180 .dac_nids = alc880_6st_dac_nids,
3181 .dig_out_nid = ALC880_DIGOUT_NID,
3182 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3183 .channel_mode = alc880_sixstack_modes,
3184 .input_mux = &alc880_6stack_capture_source,
3187 .mixers = { alc880_w810_base_mixer },
3188 .init_verbs = { alc880_volume_init_verbs,
3189 alc880_pin_w810_init_verbs,
3190 alc880_gpio2_init_verbs },
3191 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3192 .dac_nids = alc880_w810_dac_nids,
3193 .dig_out_nid = ALC880_DIGOUT_NID,
3194 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3195 .channel_mode = alc880_w810_modes,
3196 .input_mux = &alc880_capture_source,
3199 .mixers = { alc880_z71v_mixer },
3200 .init_verbs = { alc880_volume_init_verbs,
3201 alc880_pin_z71v_init_verbs },
3202 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3203 .dac_nids = alc880_z71v_dac_nids,
3204 .dig_out_nid = ALC880_DIGOUT_NID,
3206 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3207 .channel_mode = alc880_2_jack_modes,
3208 .input_mux = &alc880_capture_source,
3211 .mixers = { alc880_f1734_mixer },
3212 .init_verbs = { alc880_volume_init_verbs,
3213 alc880_pin_f1734_init_verbs },
3214 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3215 .dac_nids = alc880_f1734_dac_nids,
3217 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3218 .channel_mode = alc880_2_jack_modes,
3219 .input_mux = &alc880_f1734_capture_source,
3220 .unsol_event = alc880_uniwill_p53_unsol_event,
3221 .init_hook = alc880_uniwill_p53_hp_automute,
3224 .mixers = { alc880_asus_mixer },
3225 .init_verbs = { alc880_volume_init_verbs,
3226 alc880_pin_asus_init_verbs,
3227 alc880_gpio1_init_verbs },
3228 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3229 .dac_nids = alc880_asus_dac_nids,
3230 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3231 .channel_mode = alc880_asus_modes,
3233 .input_mux = &alc880_capture_source,
3235 [ALC880_ASUS_DIG] = {
3236 .mixers = { alc880_asus_mixer },
3237 .init_verbs = { alc880_volume_init_verbs,
3238 alc880_pin_asus_init_verbs,
3239 alc880_gpio1_init_verbs },
3240 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3241 .dac_nids = alc880_asus_dac_nids,
3242 .dig_out_nid = ALC880_DIGOUT_NID,
3243 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3244 .channel_mode = alc880_asus_modes,
3246 .input_mux = &alc880_capture_source,
3248 [ALC880_ASUS_DIG2] = {
3249 .mixers = { alc880_asus_mixer },
3250 .init_verbs = { alc880_volume_init_verbs,
3251 alc880_pin_asus_init_verbs,
3252 alc880_gpio2_init_verbs }, /* use GPIO2 */
3253 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3254 .dac_nids = alc880_asus_dac_nids,
3255 .dig_out_nid = ALC880_DIGOUT_NID,
3256 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3257 .channel_mode = alc880_asus_modes,
3259 .input_mux = &alc880_capture_source,
3261 [ALC880_ASUS_W1V] = {
3262 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3263 .init_verbs = { alc880_volume_init_verbs,
3264 alc880_pin_asus_init_verbs,
3265 alc880_gpio1_init_verbs },
3266 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3267 .dac_nids = alc880_asus_dac_nids,
3268 .dig_out_nid = ALC880_DIGOUT_NID,
3269 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3270 .channel_mode = alc880_asus_modes,
3272 .input_mux = &alc880_capture_source,
3274 [ALC880_UNIWILL_DIG] = {
3275 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3276 .init_verbs = { alc880_volume_init_verbs,
3277 alc880_pin_asus_init_verbs },
3278 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3279 .dac_nids = alc880_asus_dac_nids,
3280 .dig_out_nid = ALC880_DIGOUT_NID,
3281 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3282 .channel_mode = alc880_asus_modes,
3284 .input_mux = &alc880_capture_source,
3286 [ALC880_UNIWILL] = {
3287 .mixers = { alc880_uniwill_mixer },
3288 .init_verbs = { alc880_volume_init_verbs,
3289 alc880_uniwill_init_verbs },
3290 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3291 .dac_nids = alc880_asus_dac_nids,
3292 .dig_out_nid = ALC880_DIGOUT_NID,
3293 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3294 .channel_mode = alc880_threestack_modes,
3296 .input_mux = &alc880_capture_source,
3297 .unsol_event = alc880_uniwill_unsol_event,
3298 .init_hook = alc880_uniwill_automute,
3300 [ALC880_UNIWILL_P53] = {
3301 .mixers = { alc880_uniwill_p53_mixer },
3302 .init_verbs = { alc880_volume_init_verbs,
3303 alc880_uniwill_p53_init_verbs },
3304 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3305 .dac_nids = alc880_asus_dac_nids,
3306 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3307 .channel_mode = alc880_threestack_modes,
3308 .input_mux = &alc880_capture_source,
3309 .unsol_event = alc880_uniwill_p53_unsol_event,
3310 .init_hook = alc880_uniwill_p53_hp_automute,
3312 [ALC880_FUJITSU] = {
3313 .mixers = { alc880_fujitsu_mixer,
3314 alc880_pcbeep_mixer, },
3315 .init_verbs = { alc880_volume_init_verbs,
3316 alc880_uniwill_p53_init_verbs,
3317 alc880_beep_init_verbs },
3318 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3319 .dac_nids = alc880_dac_nids,
3320 .dig_out_nid = ALC880_DIGOUT_NID,
3321 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3322 .channel_mode = alc880_2_jack_modes,
3323 .input_mux = &alc880_capture_source,
3324 .unsol_event = alc880_uniwill_p53_unsol_event,
3325 .init_hook = alc880_uniwill_p53_hp_automute,
3328 .mixers = { alc880_three_stack_mixer },
3329 .init_verbs = { alc880_volume_init_verbs,
3330 alc880_pin_clevo_init_verbs },
3331 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3332 .dac_nids = alc880_dac_nids,
3334 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3335 .channel_mode = alc880_threestack_modes,
3337 .input_mux = &alc880_capture_source,
3340 .mixers = { alc880_lg_mixer },
3341 .init_verbs = { alc880_volume_init_verbs,
3342 alc880_lg_init_verbs },
3343 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3344 .dac_nids = alc880_lg_dac_nids,
3345 .dig_out_nid = ALC880_DIGOUT_NID,
3346 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3347 .channel_mode = alc880_lg_ch_modes,
3349 .input_mux = &alc880_lg_capture_source,
3350 .unsol_event = alc880_lg_unsol_event,
3351 .init_hook = alc880_lg_automute,
3352 #ifdef CONFIG_SND_HDA_POWER_SAVE
3353 .loopbacks = alc880_lg_loopbacks,
3357 .mixers = { alc880_lg_lw_mixer },
3358 .init_verbs = { alc880_volume_init_verbs,
3359 alc880_lg_lw_init_verbs },
3360 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3361 .dac_nids = alc880_dac_nids,
3362 .dig_out_nid = ALC880_DIGOUT_NID,
3363 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3364 .channel_mode = alc880_lg_lw_modes,
3365 .input_mux = &alc880_lg_lw_capture_source,
3366 .unsol_event = alc880_lg_lw_unsol_event,
3367 .init_hook = alc880_lg_lw_automute,
3369 [ALC880_MEDION_RIM] = {
3370 .mixers = { alc880_medion_rim_mixer },
3371 .init_verbs = { alc880_volume_init_verbs,
3372 alc880_medion_rim_init_verbs,
3373 alc_gpio2_init_verbs },
3374 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3375 .dac_nids = alc880_dac_nids,
3376 .dig_out_nid = ALC880_DIGOUT_NID,
3377 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3378 .channel_mode = alc880_2_jack_modes,
3379 .input_mux = &alc880_medion_rim_capture_source,
3380 .unsol_event = alc880_medion_rim_unsol_event,
3381 .init_hook = alc880_medion_rim_automute,
3383 #ifdef CONFIG_SND_DEBUG
3385 .mixers = { alc880_test_mixer },
3386 .init_verbs = { alc880_test_init_verbs },
3387 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3388 .dac_nids = alc880_test_dac_nids,
3389 .dig_out_nid = ALC880_DIGOUT_NID,
3390 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3391 .channel_mode = alc880_test_modes,
3392 .input_mux = &alc880_test_capture_source,
3398 * Automatic parse of I/O pins from the BIOS configuration
3401 #define NUM_CONTROL_ALLOC 32
3402 #define NUM_VERB_ALLOC 32
3406 ALC_CTL_WIDGET_MUTE,
3409 static struct snd_kcontrol_new alc880_control_templates[] = {
3410 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3411 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3412 HDA_BIND_MUTE(NULL, 0, 0, 0),
3415 /* add dynamic controls */
3416 static int add_control(struct alc_spec *spec, int type, const char *name,
3419 struct snd_kcontrol_new *knew;
3421 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3422 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3424 /* array + terminator */
3425 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3428 if (spec->kctl_alloc) {
3429 memcpy(knew, spec->kctl_alloc,
3430 sizeof(*knew) * spec->num_kctl_alloc);
3431 kfree(spec->kctl_alloc);
3433 spec->kctl_alloc = knew;
3434 spec->num_kctl_alloc = num;
3437 knew = &spec->kctl_alloc[spec->num_kctl_used];
3438 *knew = alc880_control_templates[type];
3439 knew->name = kstrdup(name, GFP_KERNEL);
3442 knew->private_value = val;
3443 spec->num_kctl_used++;
3447 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3448 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3449 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3450 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3451 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3452 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3453 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3454 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3455 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3456 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3457 #define ALC880_PIN_CD_NID 0x1c
3459 /* fill in the dac_nids table from the parsed pin configuration */
3460 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3461 const struct auto_pin_cfg *cfg)
3467 memset(assigned, 0, sizeof(assigned));
3468 spec->multiout.dac_nids = spec->private_dac_nids;
3470 /* check the pins hardwired to audio widget */
3471 for (i = 0; i < cfg->line_outs; i++) {
3472 nid = cfg->line_out_pins[i];
3473 if (alc880_is_fixed_pin(nid)) {
3474 int idx = alc880_fixed_pin_idx(nid);
3475 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3479 /* left pins can be connect to any audio widget */
3480 for (i = 0; i < cfg->line_outs; i++) {
3481 nid = cfg->line_out_pins[i];
3482 if (alc880_is_fixed_pin(nid))
3484 /* search for an empty channel */
3485 for (j = 0; j < cfg->line_outs; j++) {
3487 spec->multiout.dac_nids[i] =
3488 alc880_idx_to_dac(j);
3494 spec->multiout.num_dacs = cfg->line_outs;
3498 /* add playback controls from the parsed DAC table */
3499 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3500 const struct auto_pin_cfg *cfg)
3503 static const char *chname[4] = {
3504 "Front", "Surround", NULL /*CLFE*/, "Side"
3509 for (i = 0; i < cfg->line_outs; i++) {
3510 if (!spec->multiout.dac_nids[i])
3512 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3515 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3516 "Center Playback Volume",
3517 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3521 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3522 "LFE Playback Volume",
3523 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3527 err = add_control(spec, ALC_CTL_BIND_MUTE,
3528 "Center Playback Switch",
3529 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3533 err = add_control(spec, ALC_CTL_BIND_MUTE,
3534 "LFE Playback Switch",
3535 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3540 sprintf(name, "%s Playback Volume", chname[i]);
3541 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3542 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3546 sprintf(name, "%s Playback Switch", chname[i]);
3547 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3548 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3557 /* add playback controls for speaker and HP outputs */
3558 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3568 if (alc880_is_fixed_pin(pin)) {
3569 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3570 /* specify the DAC as the extra output */
3571 if (!spec->multiout.hp_nid)
3572 spec->multiout.hp_nid = nid;
3574 spec->multiout.extra_out_nid[0] = nid;
3575 /* control HP volume/switch on the output mixer amp */
3576 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3577 sprintf(name, "%s Playback Volume", pfx);
3578 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3579 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3582 sprintf(name, "%s Playback Switch", pfx);
3583 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3584 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3587 } else if (alc880_is_multi_pin(pin)) {
3588 /* set manual connection */
3589 /* we have only a switch on HP-out PIN */
3590 sprintf(name, "%s Playback Switch", pfx);
3591 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3592 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3599 /* create input playback/capture controls for the given pin */
3600 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3601 const char *ctlname,
3602 int idx, hda_nid_t mix_nid)
3607 sprintf(name, "%s Playback Volume", ctlname);
3608 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3609 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3612 sprintf(name, "%s Playback Switch", ctlname);
3613 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3614 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3620 /* create playback/capture controls for input pins */
3621 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3622 const struct auto_pin_cfg *cfg)
3624 struct hda_input_mux *imux = &spec->private_imux;
3627 for (i = 0; i < AUTO_PIN_LAST; i++) {
3628 if (alc880_is_input_pin(cfg->input_pins[i])) {
3629 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3630 err = new_analog_input(spec, cfg->input_pins[i],
3631 auto_pin_cfg_labels[i],
3635 imux->items[imux->num_items].label =
3636 auto_pin_cfg_labels[i];
3637 imux->items[imux->num_items].index =
3638 alc880_input_pin_idx(cfg->input_pins[i]);
3645 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3646 unsigned int pin_type)
3648 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3651 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3655 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3656 hda_nid_t nid, int pin_type,
3659 alc_set_pin_output(codec, nid, pin_type);
3660 /* need the manual connection? */
3661 if (alc880_is_multi_pin(nid)) {
3662 struct alc_spec *spec = codec->spec;
3663 int idx = alc880_multi_pin_idx(nid);
3664 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3665 AC_VERB_SET_CONNECT_SEL,
3666 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3670 static int get_pin_type(int line_out_type)
3672 if (line_out_type == AUTO_PIN_HP_OUT)
3678 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3680 struct alc_spec *spec = codec->spec;
3683 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3684 for (i = 0; i < spec->autocfg.line_outs; i++) {
3685 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3686 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3687 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3691 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3693 struct alc_spec *spec = codec->spec;
3696 pin = spec->autocfg.speaker_pins[0];
3697 if (pin) /* connect to front */
3698 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3699 pin = spec->autocfg.hp_pins[0];
3700 if (pin) /* connect to front */
3701 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3704 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3706 struct alc_spec *spec = codec->spec;
3709 for (i = 0; i < AUTO_PIN_LAST; i++) {
3710 hda_nid_t nid = spec->autocfg.input_pins[i];
3711 if (alc880_is_input_pin(nid)) {
3712 snd_hda_codec_write(codec, nid, 0,
3713 AC_VERB_SET_PIN_WIDGET_CONTROL,
3714 i <= AUTO_PIN_FRONT_MIC ?
3715 PIN_VREF80 : PIN_IN);
3716 if (nid != ALC880_PIN_CD_NID)
3717 snd_hda_codec_write(codec, nid, 0,
3718 AC_VERB_SET_AMP_GAIN_MUTE,
3724 /* parse the BIOS configuration and set up the alc_spec */
3725 /* return 1 if successful, 0 if the proper config is not found,
3726 * or a negative error code
3728 static int alc880_parse_auto_config(struct hda_codec *codec)
3730 struct alc_spec *spec = codec->spec;
3732 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3734 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3738 if (!spec->autocfg.line_outs)
3739 return 0; /* can't find valid BIOS pin config */
3741 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3744 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3747 err = alc880_auto_create_extra_out(spec,
3748 spec->autocfg.speaker_pins[0],
3752 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3756 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3760 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3762 if (spec->autocfg.dig_out_pin)
3763 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3764 if (spec->autocfg.dig_in_pin)
3765 spec->dig_in_nid = ALC880_DIGIN_NID;
3767 if (spec->kctl_alloc)
3768 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3770 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3772 spec->num_mux_defs = 1;
3773 spec->input_mux = &spec->private_imux;
3778 /* additional initialization for auto-configuration model */
3779 static void alc880_auto_init(struct hda_codec *codec)
3781 struct alc_spec *spec = codec->spec;
3782 alc880_auto_init_multi_out(codec);
3783 alc880_auto_init_extra_out(codec);
3784 alc880_auto_init_analog_input(codec);
3785 if (spec->unsol_event)
3786 alc_sku_automute(codec);
3790 * OK, here we have finally the patch for ALC880
3793 static int patch_alc880(struct hda_codec *codec)
3795 struct alc_spec *spec;
3799 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3805 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3808 if (board_config < 0) {
3809 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3810 "trying auto-probe from BIOS...\n");
3811 board_config = ALC880_AUTO;
3814 if (board_config == ALC880_AUTO) {
3815 /* automatic parse from the BIOS config */
3816 err = alc880_parse_auto_config(codec);
3822 "hda_codec: Cannot set up configuration "
3823 "from BIOS. Using 3-stack mode...\n");
3824 board_config = ALC880_3ST;
3828 if (board_config != ALC880_AUTO)
3829 setup_preset(spec, &alc880_presets[board_config]);
3831 spec->stream_name_analog = "ALC880 Analog";
3832 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3833 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3834 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3836 spec->stream_name_digital = "ALC880 Digital";
3837 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3838 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3840 if (!spec->adc_nids && spec->input_mux) {
3841 /* check whether NID 0x07 is valid */
3842 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3844 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3845 if (wcap != AC_WID_AUD_IN) {
3846 spec->adc_nids = alc880_adc_nids_alt;
3847 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3848 spec->mixers[spec->num_mixers] =
3849 alc880_capture_alt_mixer;
3852 spec->adc_nids = alc880_adc_nids;
3853 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3854 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3859 spec->vmaster_nid = 0x0c;
3861 codec->patch_ops = alc_patch_ops;
3862 if (board_config == ALC880_AUTO)
3863 spec->init_hook = alc880_auto_init;
3864 #ifdef CONFIG_SND_HDA_POWER_SAVE
3865 if (!spec->loopback.amplist)
3866 spec->loopback.amplist = alc880_loopbacks;
3877 static hda_nid_t alc260_dac_nids[1] = {
3882 static hda_nid_t alc260_adc_nids[1] = {
3887 static hda_nid_t alc260_adc_nids_alt[1] = {
3892 static hda_nid_t alc260_hp_adc_nids[2] = {
3897 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3898 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3900 static hda_nid_t alc260_dual_adc_nids[2] = {
3905 #define ALC260_DIGOUT_NID 0x03
3906 #define ALC260_DIGIN_NID 0x06
3908 static struct hda_input_mux alc260_capture_source = {
3912 { "Front Mic", 0x1 },
3918 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3919 * headphone jack and the internal CD lines since these are the only pins at
3920 * which audio can appear. For flexibility, also allow the option of
3921 * recording the mixer output on the second ADC (ADC0 doesn't have a
3922 * connection to the mixer output).
3924 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3928 { "Mic/Line", 0x0 },
3930 { "Headphone", 0x2 },
3936 { "Mic/Line", 0x0 },
3938 { "Headphone", 0x2 },
3945 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3946 * the Fujitsu S702x, but jacks are marked differently.
3948 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3955 { "Headphone", 0x5 },
3964 { "Headphone", 0x6 },
3970 * This is just place-holder, so there's something for alc_build_pcms to look
3971 * at when it calculates the maximum number of channels. ALC260 has no mixer
3972 * element which allows changing the channel mode, so the verb list is
3975 static struct hda_channel_mode alc260_modes[1] = {
3980 /* Mixer combinations
3982 * basic: base_output + input + pc_beep + capture
3983 * HP: base_output + input + capture_alt
3984 * HP_3013: hp_3013 + input + capture
3985 * fujitsu: fujitsu + capture
3986 * acer: acer + capture
3989 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3990 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3991 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3992 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3993 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3994 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3995 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3999 static struct snd_kcontrol_new alc260_input_mixer[] = {
4000 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4001 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4002 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4003 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4005 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4006 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4007 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4011 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4012 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4013 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4017 /* update HP, line and mono out pins according to the master switch */
4018 static void alc260_hp_master_update(struct hda_codec *codec,
4019 hda_nid_t hp, hda_nid_t line,
4022 struct alc_spec *spec = codec->spec;
4023 unsigned int val = spec->master_sw ? PIN_HP : 0;
4024 /* change HP and line-out pins */
4025 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4027 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4029 /* mono (speaker) depending on the HP jack sense */
4030 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4031 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4035 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4036 struct snd_ctl_elem_value *ucontrol)
4038 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4039 struct alc_spec *spec = codec->spec;
4040 *ucontrol->value.integer.value = spec->master_sw;
4044 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4045 struct snd_ctl_elem_value *ucontrol)
4047 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4048 struct alc_spec *spec = codec->spec;
4049 int val = !!*ucontrol->value.integer.value;
4050 hda_nid_t hp, line, mono;
4052 if (val == spec->master_sw)
4054 spec->master_sw = val;
4055 hp = (kcontrol->private_value >> 16) & 0xff;
4056 line = (kcontrol->private_value >> 8) & 0xff;
4057 mono = kcontrol->private_value & 0xff;
4058 alc260_hp_master_update(codec, hp, line, mono);
4062 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4064 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4065 .name = "Master Playback Switch",
4066 .info = snd_ctl_boolean_mono_info,
4067 .get = alc260_hp_master_sw_get,
4068 .put = alc260_hp_master_sw_put,
4069 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4071 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4072 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4073 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4074 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4075 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4077 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4081 static struct hda_verb alc260_hp_unsol_verbs[] = {
4082 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4086 static void alc260_hp_automute(struct hda_codec *codec)
4088 struct alc_spec *spec = codec->spec;
4089 unsigned int present;
4091 present = snd_hda_codec_read(codec, 0x10, 0,
4092 AC_VERB_GET_PIN_SENSE, 0);
4093 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4094 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4097 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4099 if ((res >> 26) == ALC880_HP_EVENT)
4100 alc260_hp_automute(codec);
4103 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4106 .name = "Master Playback Switch",
4107 .info = snd_ctl_boolean_mono_info,
4108 .get = alc260_hp_master_sw_get,
4109 .put = alc260_hp_master_sw_put,
4110 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4112 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4113 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4114 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4115 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4116 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4118 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4119 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4123 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4124 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4128 static void alc260_hp_3013_automute(struct hda_codec *codec)
4130 struct alc_spec *spec = codec->spec;
4131 unsigned int present;
4133 present = snd_hda_codec_read(codec, 0x15, 0,
4134 AC_VERB_GET_PIN_SENSE, 0);
4135 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4136 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4139 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4142 if ((res >> 26) == ALC880_HP_EVENT)
4143 alc260_hp_3013_automute(codec);
4146 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4147 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4149 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4150 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4151 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4152 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4153 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4154 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4155 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4156 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4157 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4158 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4159 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4160 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4161 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4165 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4166 * versions of the ALC260 don't act on requests to enable mic bias from NID
4167 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4168 * datasheet doesn't mention this restriction. At this stage it's not clear
4169 * whether this behaviour is intentional or is a hardware bug in chip
4170 * revisions available in early 2006. Therefore for now allow the
4171 * "Headphone Jack Mode" control to span all choices, but if it turns out
4172 * that the lack of mic bias for this NID is intentional we could change the
4173 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4175 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4176 * don't appear to make the mic bias available from the "line" jack, even
4177 * though the NID used for this jack (0x14) can supply it. The theory is
4178 * that perhaps Acer have included blocking capacitors between the ALC260
4179 * and the output jack. If this turns out to be the case for all such
4180 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4181 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4183 * The C20x Tablet series have a mono internal speaker which is controlled
4184 * via the chip's Mono sum widget and pin complex, so include the necessary
4185 * controls for such models. On models without a "mono speaker" the control
4186 * won't do anything.
4188 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4189 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4190 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4191 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4192 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4194 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4196 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4197 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4199 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4200 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4201 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4202 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4203 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4204 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4205 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4209 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4210 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4212 static struct snd_kcontrol_new alc260_will_mixer[] = {
4213 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4214 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4216 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4217 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4218 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4219 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4220 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4221 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4222 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4223 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4224 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4228 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4229 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4231 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4232 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4233 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4235 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4236 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4237 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4238 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4239 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4240 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4241 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4245 /* capture mixer elements */
4246 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4247 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4248 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4249 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4250 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4252 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4253 /* The multiple "Capture Source" controls confuse alsamixer
4254 * So call somewhat different..
4256 /* .name = "Capture Source", */
4257 .name = "Input Source",
4259 .info = alc_mux_enum_info,
4260 .get = alc_mux_enum_get,
4261 .put = alc_mux_enum_put,
4266 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4267 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4268 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4270 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4271 /* The multiple "Capture Source" controls confuse alsamixer
4272 * So call somewhat different..
4274 /* .name = "Capture Source", */
4275 .name = "Input Source",
4277 .info = alc_mux_enum_info,
4278 .get = alc_mux_enum_get,
4279 .put = alc_mux_enum_put,
4285 * initialization verbs
4287 static struct hda_verb alc260_init_verbs[] = {
4288 /* Line In pin widget for input */
4289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4290 /* CD pin widget for input */
4291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4292 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4293 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4294 /* Mic2 (front panel) pin widget for input and vref at 80% */
4295 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4296 /* LINE-2 is used for line-out in rear */
4297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4298 /* select line-out */
4299 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4301 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4303 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4305 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4306 /* mute capture amp left and right */
4307 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4308 /* set connection select to line in (default select for this ADC) */
4309 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4310 /* mute capture amp left and right */
4311 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4312 /* set connection select to line in (default select for this ADC) */
4313 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4314 /* set vol=0 Line-Out mixer amp left and right */
4315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4316 /* unmute pin widget amp left and right (no gain on this amp) */
4317 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4318 /* set vol=0 HP mixer amp left and right */
4319 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4320 /* unmute pin widget amp left and right (no gain on this amp) */
4321 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4322 /* set vol=0 Mono mixer amp left and right */
4323 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4324 /* unmute pin widget amp left and right (no gain on this amp) */
4325 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4326 /* unmute LINE-2 out pin */
4327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4328 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4331 /* mute analog inputs */
4332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4337 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4338 /* mute Front out path */
4339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4340 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4341 /* mute Headphone out path */
4342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4344 /* mute Mono out path */
4345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4346 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4350 #if 0 /* should be identical with alc260_init_verbs? */
4351 static struct hda_verb alc260_hp_init_verbs[] = {
4352 /* Headphone and output */
4353 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4355 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4356 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4357 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4358 /* Mic2 (front panel) pin widget for input and vref at 80% */
4359 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4360 /* Line In pin widget for input */
4361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4362 /* Line-2 pin widget for output */
4363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4364 /* CD pin widget for input */
4365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4366 /* unmute amp left and right */
4367 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4368 /* set connection select to line in (default select for this ADC) */
4369 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4370 /* unmute Line-Out mixer amp left and right (volume = 0) */
4371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4372 /* mute pin widget amp left and right (no gain on this amp) */
4373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4374 /* unmute HP mixer amp left and right (volume = 0) */
4375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4376 /* mute pin widget amp left and right (no gain on this amp) */
4377 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4378 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4381 /* mute analog inputs */
4382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4383 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4387 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4388 /* Unmute Front out path */
4389 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4391 /* Unmute Headphone out path */
4392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4394 /* Unmute Mono out path */
4395 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4396 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4401 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4402 /* Line out and output */
4403 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4405 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4406 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4407 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4408 /* Mic2 (front panel) pin widget for input and vref at 80% */
4409 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4410 /* Line In pin widget for input */
4411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4412 /* Headphone pin widget for output */
4413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4414 /* CD pin widget for input */
4415 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4416 /* unmute amp left and right */
4417 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4418 /* set connection select to line in (default select for this ADC) */
4419 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4420 /* unmute Line-Out mixer amp left and right (volume = 0) */
4421 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4422 /* mute pin widget amp left and right (no gain on this amp) */
4423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4424 /* unmute HP mixer amp left and right (volume = 0) */
4425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4426 /* mute pin widget amp left and right (no gain on this amp) */
4427 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4428 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4431 /* mute analog inputs */
4432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4437 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4438 /* Unmute Front out path */
4439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4440 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4441 /* Unmute Headphone out path */
4442 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4443 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4444 /* Unmute Mono out path */
4445 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4446 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4450 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4451 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4452 * audio = 0x16, internal speaker = 0x10.
4454 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4455 /* Disable all GPIOs */
4456 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4457 /* Internal speaker is connected to headphone pin */
4458 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4459 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4460 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4461 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4462 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4463 /* Ensure all other unused pins are disabled and muted. */
4464 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4466 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4467 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4468 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4469 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4473 /* Disable digital (SPDIF) pins */
4474 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4475 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4477 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4478 * when acting as an output.
4480 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4482 /* Start with output sum widgets muted and their output gains at min */
4483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4485 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4488 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4489 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4491 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4493 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4494 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4495 /* Unmute Line1 pin widget output buffer since it starts as an output.
4496 * If the pin mode is changed by the user the pin mode control will
4497 * take care of enabling the pin's input/output buffers as needed.
4498 * Therefore there's no need to enable the input buffer at this
4501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4502 /* Unmute input buffer of pin widget used for Line-in (no equiv
4505 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4507 /* Mute capture amp left and right */
4508 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4509 /* Set ADC connection select to match default mixer setting - line
4512 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4514 /* Do the same for the second ADC: mute capture input amp and
4515 * set ADC connection to line in (on mic1 pin)
4517 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4518 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4520 /* Mute all inputs to mixer widget (even unconnected ones) */
4521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4533 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4534 * similar laptops (adapted from Fujitsu init verbs).
4536 static struct hda_verb alc260_acer_init_verbs[] = {
4537 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4538 * the headphone jack. Turn this on and rely on the standard mute
4539 * methods whenever the user wants to turn these outputs off.
4541 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4542 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4543 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4544 /* Internal speaker/Headphone jack is connected to Line-out pin */
4545 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4546 /* Internal microphone/Mic jack is connected to Mic1 pin */
4547 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4548 /* Line In jack is connected to Line1 pin */
4549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4550 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4551 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4552 /* Ensure all other unused pins are disabled and muted. */
4553 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4554 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4555 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4556 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4559 /* Disable digital (SPDIF) pins */
4560 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4561 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4563 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4564 * bus when acting as outputs.
4566 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4567 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4569 /* Start with output sum widgets muted and their output gains at min */
4570 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4573 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4576 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4578 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4580 /* Unmute Line-out pin widget amp left and right
4581 * (no equiv mixer ctrl)
4583 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4584 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4585 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4586 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4587 * inputs. If the pin mode is changed by the user the pin mode control
4588 * will take care of enabling the pin's input/output buffers as needed.
4589 * Therefore there's no need to enable the input buffer at this
4592 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4595 /* Mute capture amp left and right */
4596 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4597 /* Set ADC connection select to match default mixer setting - mic
4600 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4602 /* Do similar with the second ADC: mute capture input amp and
4603 * set ADC connection to mic to match ALSA's default state.
4605 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4606 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4608 /* Mute all inputs to mixer widget (even unconnected ones) */
4609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4621 static struct hda_verb alc260_will_verbs[] = {
4622 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4623 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4624 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4625 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4626 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4627 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4631 static struct hda_verb alc260_replacer_672v_verbs[] = {
4632 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4633 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4634 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4636 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4637 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4638 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4640 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4644 /* toggle speaker-output according to the hp-jack state */
4645 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4647 unsigned int present;
4649 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4650 present = snd_hda_codec_read(codec, 0x0f, 0,
4651 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4653 snd_hda_codec_write_cache(codec, 0x01, 0,
4654 AC_VERB_SET_GPIO_DATA, 1);
4655 snd_hda_codec_write_cache(codec, 0x0f, 0,
4656 AC_VERB_SET_PIN_WIDGET_CONTROL,
4659 snd_hda_codec_write_cache(codec, 0x01, 0,
4660 AC_VERB_SET_GPIO_DATA, 0);
4661 snd_hda_codec_write_cache(codec, 0x0f, 0,
4662 AC_VERB_SET_PIN_WIDGET_CONTROL,
4667 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4670 if ((res >> 26) == ALC880_HP_EVENT)
4671 alc260_replacer_672v_automute(codec);
4674 /* Test configuration for debugging, modelled after the ALC880 test
4677 #ifdef CONFIG_SND_DEBUG
4678 static hda_nid_t alc260_test_dac_nids[1] = {
4681 static hda_nid_t alc260_test_adc_nids[2] = {
4684 /* For testing the ALC260, each input MUX needs its own definition since
4685 * the signal assignments are different. This assumes that the first ADC
4688 static struct hda_input_mux alc260_test_capture_sources[2] = {
4692 { "MIC1 pin", 0x0 },
4693 { "MIC2 pin", 0x1 },
4694 { "LINE1 pin", 0x2 },
4695 { "LINE2 pin", 0x3 },
4697 { "LINE-OUT pin", 0x5 },
4698 { "HP-OUT pin", 0x6 },
4704 { "MIC1 pin", 0x0 },
4705 { "MIC2 pin", 0x1 },
4706 { "LINE1 pin", 0x2 },
4707 { "LINE2 pin", 0x3 },
4710 { "LINE-OUT pin", 0x6 },
4711 { "HP-OUT pin", 0x7 },
4715 static struct snd_kcontrol_new alc260_test_mixer[] = {
4716 /* Output driver widgets */
4717 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4718 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4719 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4720 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4721 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4722 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4724 /* Modes for retasking pin widgets
4725 * Note: the ALC260 doesn't seem to act on requests to enable mic
4726 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4727 * mention this restriction. At this stage it's not clear whether
4728 * this behaviour is intentional or is a hardware bug in chip
4729 * revisions available at least up until early 2006. Therefore for
4730 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4731 * choices, but if it turns out that the lack of mic bias for these
4732 * NIDs is intentional we could change their modes from
4733 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4735 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4736 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4737 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4738 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4739 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4740 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4742 /* Loopback mixer controls */
4743 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4744 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4745 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4746 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4747 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4748 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4749 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4750 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4751 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4752 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4753 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4754 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4755 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4756 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4757 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4758 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4760 /* Controls for GPIO pins, assuming they are configured as outputs */
4761 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4762 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4763 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4764 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4766 /* Switches to allow the digital IO pins to be enabled. The datasheet
4767 * is ambigious as to which NID is which; testing on laptops which
4768 * make this output available should provide clarification.
4770 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4771 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4773 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4774 * this output to turn on an external amplifier.
4776 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4777 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4781 static struct hda_verb alc260_test_init_verbs[] = {
4782 /* Enable all GPIOs as outputs with an initial value of 0 */
4783 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4784 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4785 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4787 /* Enable retasking pins as output, initially without power amp */
4788 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4789 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4791 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4792 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4793 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4795 /* Disable digital (SPDIF) pins initially, but users can enable
4796 * them via a mixer switch. In the case of SPDIF-out, this initverb
4797 * payload also sets the generation to 0, output to be in "consumer"
4798 * PCM format, copyright asserted, no pre-emphasis and no validity
4801 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4802 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4804 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4805 * OUT1 sum bus when acting as an output.
4807 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4808 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4809 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4810 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4812 /* Start with output sum widgets muted and their output gains at min */
4813 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4814 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4815 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4816 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4817 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4818 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4819 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4820 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4821 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4823 /* Unmute retasking pin widget output buffers since the default
4824 * state appears to be output. As the pin mode is changed by the
4825 * user the pin mode control will take care of enabling the pin's
4826 * input/output buffers as needed.
4828 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4829 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4831 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4832 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4833 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4834 /* Also unmute the mono-out pin widget */
4835 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4837 /* Mute capture amp left and right */
4838 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4839 /* Set ADC connection select to match default mixer setting (mic1
4842 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4844 /* Do the same for the second ADC: mute capture input amp and
4845 * set ADC connection to mic1 pin
4847 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4848 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4850 /* Mute all inputs to mixer widget (even unconnected ones) */
4851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4864 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4865 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4867 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4868 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4871 * for BIOS auto-configuration
4874 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4878 unsigned long vol_val, sw_val;
4882 if (nid >= 0x0f && nid < 0x11) {
4883 nid_vol = nid - 0x7;
4884 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4885 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4886 } else if (nid == 0x11) {
4887 nid_vol = nid - 0x7;
4888 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4889 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4890 } else if (nid >= 0x12 && nid <= 0x15) {
4892 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4893 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4897 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4898 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4901 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4902 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4908 /* add playback controls from the parsed DAC table */
4909 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4910 const struct auto_pin_cfg *cfg)
4915 spec->multiout.num_dacs = 1;
4916 spec->multiout.dac_nids = spec->private_dac_nids;
4917 spec->multiout.dac_nids[0] = 0x02;
4919 nid = cfg->line_out_pins[0];
4921 err = alc260_add_playback_controls(spec, nid, "Front");
4926 nid = cfg->speaker_pins[0];
4928 err = alc260_add_playback_controls(spec, nid, "Speaker");
4933 nid = cfg->hp_pins[0];
4935 err = alc260_add_playback_controls(spec, nid, "Headphone");
4942 /* create playback/capture controls for input pins */
4943 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4944 const struct auto_pin_cfg *cfg)
4946 struct hda_input_mux *imux = &spec->private_imux;
4949 for (i = 0; i < AUTO_PIN_LAST; i++) {
4950 if (cfg->input_pins[i] >= 0x12) {
4951 idx = cfg->input_pins[i] - 0x12;
4952 err = new_analog_input(spec, cfg->input_pins[i],
4953 auto_pin_cfg_labels[i], idx,
4957 imux->items[imux->num_items].label =
4958 auto_pin_cfg_labels[i];
4959 imux->items[imux->num_items].index = idx;
4962 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4963 idx = cfg->input_pins[i] - 0x09;
4964 err = new_analog_input(spec, cfg->input_pins[i],
4965 auto_pin_cfg_labels[i], idx,
4969 imux->items[imux->num_items].label =
4970 auto_pin_cfg_labels[i];
4971 imux->items[imux->num_items].index = idx;
4978 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4979 hda_nid_t nid, int pin_type,
4982 alc_set_pin_output(codec, nid, pin_type);
4983 /* need the manual connection? */
4985 int idx = nid - 0x12;
4986 snd_hda_codec_write(codec, idx + 0x0b, 0,
4987 AC_VERB_SET_CONNECT_SEL, sel_idx);
4991 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4993 struct alc_spec *spec = codec->spec;
4996 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4997 nid = spec->autocfg.line_out_pins[0];
4999 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5000 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5003 nid = spec->autocfg.speaker_pins[0];
5005 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5007 nid = spec->autocfg.hp_pins[0];
5009 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5012 #define ALC260_PIN_CD_NID 0x16
5013 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5015 struct alc_spec *spec = codec->spec;
5018 for (i = 0; i < AUTO_PIN_LAST; i++) {
5019 hda_nid_t nid = spec->autocfg.input_pins[i];
5021 snd_hda_codec_write(codec, nid, 0,
5022 AC_VERB_SET_PIN_WIDGET_CONTROL,
5023 i <= AUTO_PIN_FRONT_MIC ?
5024 PIN_VREF80 : PIN_IN);
5025 if (nid != ALC260_PIN_CD_NID)
5026 snd_hda_codec_write(codec, nid, 0,
5027 AC_VERB_SET_AMP_GAIN_MUTE,
5034 * generic initialization of ADC, input mixers and output mixers
5036 static struct hda_verb alc260_volume_init_verbs[] = {
5038 * Unmute ADC0-1 and set the default input to mic-in
5040 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5041 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5042 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5043 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5045 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5047 * Note: PASD motherboards uses the Line In 2 as the input for
5048 * front panel mic (mic 2)
5050 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5051 /* mute analog inputs */
5052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5053 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5059 * Set up output mixers (0x08 - 0x0a)
5061 /* set vol=0 to output mixers */
5062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5063 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5064 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5065 /* set up input amps for analog loopback */
5066 /* Amp Indices: DAC = 0, mixer = 1 */
5067 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5069 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5071 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5072 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5077 static int alc260_parse_auto_config(struct hda_codec *codec)
5079 struct alc_spec *spec = codec->spec;
5082 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5084 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5088 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5091 if (!spec->kctl_alloc)
5092 return 0; /* can't find valid BIOS pin config */
5093 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5097 spec->multiout.max_channels = 2;
5099 if (spec->autocfg.dig_out_pin)
5100 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5101 if (spec->kctl_alloc)
5102 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5104 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5106 spec->num_mux_defs = 1;
5107 spec->input_mux = &spec->private_imux;
5109 /* check whether NID 0x04 is valid */
5110 wcap = get_wcaps(codec, 0x04);
5111 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5112 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5113 spec->adc_nids = alc260_adc_nids_alt;
5114 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5115 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5117 spec->adc_nids = alc260_adc_nids;
5118 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5119 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5126 /* additional initialization for auto-configuration model */
5127 static void alc260_auto_init(struct hda_codec *codec)
5129 struct alc_spec *spec = codec->spec;
5130 alc260_auto_init_multi_out(codec);
5131 alc260_auto_init_analog_input(codec);
5132 if (spec->unsol_event)
5133 alc_sku_automute(codec);
5136 #ifdef CONFIG_SND_HDA_POWER_SAVE
5137 static struct hda_amp_list alc260_loopbacks[] = {
5138 { 0x07, HDA_INPUT, 0 },
5139 { 0x07, HDA_INPUT, 1 },
5140 { 0x07, HDA_INPUT, 2 },
5141 { 0x07, HDA_INPUT, 3 },
5142 { 0x07, HDA_INPUT, 4 },
5148 * ALC260 configurations
5150 static const char *alc260_models[ALC260_MODEL_LAST] = {
5151 [ALC260_BASIC] = "basic",
5153 [ALC260_HP_3013] = "hp-3013",
5154 [ALC260_FUJITSU_S702X] = "fujitsu",
5155 [ALC260_ACER] = "acer",
5156 [ALC260_WILL] = "will",
5157 [ALC260_REPLACER_672V] = "replacer",
5158 #ifdef CONFIG_SND_DEBUG
5159 [ALC260_TEST] = "test",
5161 [ALC260_AUTO] = "auto",
5164 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5165 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5166 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5167 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5168 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5169 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5170 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5171 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5172 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5173 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5174 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5175 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5176 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5177 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5178 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5179 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5180 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5181 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5182 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5186 static struct alc_config_preset alc260_presets[] = {
5188 .mixers = { alc260_base_output_mixer,
5190 alc260_pc_beep_mixer,
5191 alc260_capture_mixer },
5192 .init_verbs = { alc260_init_verbs },
5193 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5194 .dac_nids = alc260_dac_nids,
5195 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5196 .adc_nids = alc260_adc_nids,
5197 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5198 .channel_mode = alc260_modes,
5199 .input_mux = &alc260_capture_source,
5202 .mixers = { alc260_hp_output_mixer,
5204 alc260_capture_alt_mixer },
5205 .init_verbs = { alc260_init_verbs,
5206 alc260_hp_unsol_verbs },
5207 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5208 .dac_nids = alc260_dac_nids,
5209 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5210 .adc_nids = alc260_hp_adc_nids,
5211 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5212 .channel_mode = alc260_modes,
5213 .input_mux = &alc260_capture_source,
5214 .unsol_event = alc260_hp_unsol_event,
5215 .init_hook = alc260_hp_automute,
5217 [ALC260_HP_3013] = {
5218 .mixers = { alc260_hp_3013_mixer,
5220 alc260_capture_alt_mixer },
5221 .init_verbs = { alc260_hp_3013_init_verbs,
5222 alc260_hp_3013_unsol_verbs },
5223 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5224 .dac_nids = alc260_dac_nids,
5225 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5226 .adc_nids = alc260_hp_adc_nids,
5227 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5228 .channel_mode = alc260_modes,
5229 .input_mux = &alc260_capture_source,
5230 .unsol_event = alc260_hp_3013_unsol_event,
5231 .init_hook = alc260_hp_3013_automute,
5233 [ALC260_FUJITSU_S702X] = {
5234 .mixers = { alc260_fujitsu_mixer,
5235 alc260_capture_mixer },
5236 .init_verbs = { alc260_fujitsu_init_verbs },
5237 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5238 .dac_nids = alc260_dac_nids,
5239 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5240 .adc_nids = alc260_dual_adc_nids,
5241 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5242 .channel_mode = alc260_modes,
5243 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5244 .input_mux = alc260_fujitsu_capture_sources,
5247 .mixers = { alc260_acer_mixer,
5248 alc260_capture_mixer },
5249 .init_verbs = { alc260_acer_init_verbs },
5250 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5251 .dac_nids = alc260_dac_nids,
5252 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5253 .adc_nids = alc260_dual_adc_nids,
5254 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5255 .channel_mode = alc260_modes,
5256 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5257 .input_mux = alc260_acer_capture_sources,
5260 .mixers = { alc260_will_mixer,
5261 alc260_capture_mixer },
5262 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5263 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5264 .dac_nids = alc260_dac_nids,
5265 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5266 .adc_nids = alc260_adc_nids,
5267 .dig_out_nid = ALC260_DIGOUT_NID,
5268 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5269 .channel_mode = alc260_modes,
5270 .input_mux = &alc260_capture_source,
5272 [ALC260_REPLACER_672V] = {
5273 .mixers = { alc260_replacer_672v_mixer,
5274 alc260_capture_mixer },
5275 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5276 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5277 .dac_nids = alc260_dac_nids,
5278 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5279 .adc_nids = alc260_adc_nids,
5280 .dig_out_nid = ALC260_DIGOUT_NID,
5281 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5282 .channel_mode = alc260_modes,
5283 .input_mux = &alc260_capture_source,
5284 .unsol_event = alc260_replacer_672v_unsol_event,
5285 .init_hook = alc260_replacer_672v_automute,
5287 #ifdef CONFIG_SND_DEBUG
5289 .mixers = { alc260_test_mixer,
5290 alc260_capture_mixer },
5291 .init_verbs = { alc260_test_init_verbs },
5292 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5293 .dac_nids = alc260_test_dac_nids,
5294 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5295 .adc_nids = alc260_test_adc_nids,
5296 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5297 .channel_mode = alc260_modes,
5298 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5299 .input_mux = alc260_test_capture_sources,
5304 static int patch_alc260(struct hda_codec *codec)
5306 struct alc_spec *spec;
5307 int err, board_config;
5309 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5315 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5318 if (board_config < 0) {
5319 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5320 "trying auto-probe from BIOS...\n");
5321 board_config = ALC260_AUTO;
5324 if (board_config == ALC260_AUTO) {
5325 /* automatic parse from the BIOS config */
5326 err = alc260_parse_auto_config(codec);
5332 "hda_codec: Cannot set up configuration "
5333 "from BIOS. Using base mode...\n");
5334 board_config = ALC260_BASIC;
5338 if (board_config != ALC260_AUTO)
5339 setup_preset(spec, &alc260_presets[board_config]);
5341 spec->stream_name_analog = "ALC260 Analog";
5342 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5343 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5345 spec->stream_name_digital = "ALC260 Digital";
5346 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5347 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5349 spec->vmaster_nid = 0x08;
5351 codec->patch_ops = alc_patch_ops;
5352 if (board_config == ALC260_AUTO)
5353 spec->init_hook = alc260_auto_init;
5354 #ifdef CONFIG_SND_HDA_POWER_SAVE
5355 if (!spec->loopback.amplist)
5356 spec->loopback.amplist = alc260_loopbacks;
5366 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5367 * configuration. Each pin widget can choose any input DACs and a mixer.
5368 * Each ADC is connected from a mixer of all inputs. This makes possible
5369 * 6-channel independent captures.
5371 * In addition, an independent DAC for the multi-playback (not used in this
5374 #define ALC882_DIGOUT_NID 0x06
5375 #define ALC882_DIGIN_NID 0x0a
5377 static struct hda_channel_mode alc882_ch_modes[1] = {
5381 static hda_nid_t alc882_dac_nids[4] = {
5382 /* front, rear, clfe, rear_surr */
5383 0x02, 0x03, 0x04, 0x05
5386 /* identical with ALC880 */
5387 #define alc882_adc_nids alc880_adc_nids
5388 #define alc882_adc_nids_alt alc880_adc_nids_alt
5390 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5391 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5394 /* FIXME: should be a matrix-type input source selection */
5396 static struct hda_input_mux alc882_capture_source = {
5400 { "Front Mic", 0x1 },
5405 #define alc882_mux_enum_info alc_mux_enum_info
5406 #define alc882_mux_enum_get alc_mux_enum_get
5408 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5409 struct snd_ctl_elem_value *ucontrol)
5411 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5412 struct alc_spec *spec = codec->spec;
5413 const struct hda_input_mux *imux = spec->input_mux;
5414 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5415 hda_nid_t nid = spec->capsrc_nids ?
5416 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5417 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5418 unsigned int i, idx;
5420 idx = ucontrol->value.enumerated.item[0];
5421 if (idx >= imux->num_items)
5422 idx = imux->num_items - 1;
5423 if (*cur_val == idx)
5425 for (i = 0; i < imux->num_items; i++) {
5426 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5427 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5428 imux->items[i].index,
5438 static struct hda_verb alc882_3ST_ch2_init[] = {
5439 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5440 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5441 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5442 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5449 static struct hda_verb alc882_3ST_ch6_init[] = {
5450 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5451 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5452 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5453 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5454 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5455 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5459 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5460 { 2, alc882_3ST_ch2_init },
5461 { 6, alc882_3ST_ch6_init },
5467 static struct hda_verb alc882_sixstack_ch6_init[] = {
5468 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5469 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5470 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5471 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5478 static struct hda_verb alc882_sixstack_ch8_init[] = {
5479 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5480 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5481 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5482 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5486 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5487 { 6, alc882_sixstack_ch6_init },
5488 { 8, alc882_sixstack_ch8_init },
5492 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5498 static struct hda_verb alc885_mbp_ch2_init[] = {
5499 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5500 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5501 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5508 static struct hda_verb alc885_mbp_ch6_init[] = {
5509 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5510 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5511 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5512 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5513 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5517 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5518 { 2, alc885_mbp_ch2_init },
5519 { 6, alc885_mbp_ch6_init },
5523 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5524 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5526 static struct snd_kcontrol_new alc882_base_mixer[] = {
5527 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5528 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5529 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5530 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5531 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5532 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5533 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5534 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5535 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5536 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5538 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5539 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5540 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5541 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5542 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5543 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5544 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5545 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5546 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5547 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5548 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5549 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5553 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5554 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5555 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5556 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5557 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5558 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5559 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5561 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5562 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5563 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5566 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5567 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5568 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5569 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5570 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5571 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5572 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5573 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5574 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5575 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5576 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5577 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5581 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5582 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5583 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5585 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5586 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5587 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5588 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5590 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5591 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5592 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5593 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5594 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5598 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5599 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5601 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5602 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5603 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5604 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5605 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5606 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5607 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5608 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5609 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5610 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5611 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5613 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5614 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5618 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5619 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5620 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5622 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5623 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5624 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5625 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5627 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5629 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5630 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5634 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5636 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5637 .name = "Channel Mode",
5638 .info = alc_ch_mode_info,
5639 .get = alc_ch_mode_get,
5640 .put = alc_ch_mode_put,
5645 static struct hda_verb alc882_init_verbs[] = {
5646 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5653 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5656 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5657 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5659 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5661 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5663 /* Front Pin: output 0 (0x0c) */
5664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5666 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5667 /* Rear Pin: output 1 (0x0d) */
5668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5669 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5670 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5671 /* CLFE Pin: output 2 (0x0e) */
5672 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5673 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5674 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5675 /* Side Pin: output 3 (0x0f) */
5676 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5677 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5678 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5679 /* Mic (rear) pin: input vref at 80% */
5680 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5681 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5682 /* Front Mic pin: input vref at 80% */
5683 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5684 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5685 /* Line In pin: input */
5686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5688 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5689 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5690 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5691 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5692 /* CD pin widget for input */
5693 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5695 /* FIXME: use matrix-type input source selection */
5696 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5697 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5712 /* ADC1: mute amp left and right */
5713 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5714 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5715 /* ADC2: mute amp left and right */
5716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5717 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5718 /* ADC3: mute amp left and right */
5719 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5720 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5725 static struct hda_verb alc882_eapd_verbs[] = {
5726 /* change to EAPD mode */
5727 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5728 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5733 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5734 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5735 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5736 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5737 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5738 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5739 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5740 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5744 static struct hda_verb alc882_macpro_init_verbs[] = {
5745 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5749 /* Front Pin: output 0 (0x0c) */
5750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5752 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5753 /* Front Mic pin: input vref at 80% */
5754 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5755 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5756 /* Speaker: output */
5757 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5758 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5759 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5760 /* Headphone output (output 0 - 0x0c) */
5761 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5762 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5763 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5765 /* FIXME: use matrix-type input source selection */
5766 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5767 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5771 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5782 /* ADC1: mute amp left and right */
5783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5784 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5785 /* ADC2: mute amp left and right */
5786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5787 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5788 /* ADC3: mute amp left and right */
5789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5790 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5795 /* Macbook Pro rev3 */
5796 static struct hda_verb alc885_mbp3_init_verbs[] = {
5797 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5805 /* Front Pin: output 0 (0x0c) */
5806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5808 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5809 /* HP Pin: output 0 (0x0d) */
5810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5812 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5813 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5814 /* Mic (rear) pin: input vref at 80% */
5815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5817 /* Front Mic pin: input vref at 80% */
5818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5820 /* Line In pin: use output 1 when in LineOut mode */
5821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5823 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5825 /* FIXME: use matrix-type input source selection */
5826 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5827 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5828 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5829 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5830 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5831 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5833 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5834 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5835 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5836 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5839 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5842 /* ADC1: mute amp left and right */
5843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5844 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5845 /* ADC2: mute amp left and right */
5846 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5847 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5848 /* ADC3: mute amp left and right */
5849 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5850 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5855 /* iMac 24 mixer. */
5856 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5857 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5858 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5862 /* iMac 24 init verbs. */
5863 static struct hda_verb alc885_imac24_init_verbs[] = {
5864 /* Internal speakers: output 0 (0x0c) */
5865 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5866 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5867 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5868 /* Internal speakers: output 0 (0x0c) */
5869 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5870 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5871 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5872 /* Headphone: output 0 (0x0c) */
5873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5874 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5875 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5876 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5877 /* Front Mic: input vref at 80% */
5878 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5879 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5883 /* Toggle speaker-output according to the hp-jack state */
5884 static void alc885_imac24_automute(struct hda_codec *codec)
5886 unsigned int present;
5888 present = snd_hda_codec_read(codec, 0x14, 0,
5889 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5890 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5891 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5892 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5893 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5896 /* Processes unsolicited events. */
5897 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5900 /* Headphone insertion or removal. */
5901 if ((res >> 26) == ALC880_HP_EVENT)
5902 alc885_imac24_automute(codec);
5905 static void alc885_mbp3_automute(struct hda_codec *codec)
5907 unsigned int present;
5909 present = snd_hda_codec_read(codec, 0x15, 0,
5910 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5911 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5912 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5913 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5914 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5917 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5920 /* Headphone insertion or removal. */
5921 if ((res >> 26) == ALC880_HP_EVENT)
5922 alc885_mbp3_automute(codec);
5926 static struct hda_verb alc882_targa_verbs[] = {
5927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5930 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5931 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5933 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5934 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5935 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5937 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5938 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5939 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5940 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5944 /* toggle speaker-output according to the hp-jack state */
5945 static void alc882_targa_automute(struct hda_codec *codec)
5947 unsigned int present;
5949 present = snd_hda_codec_read(codec, 0x14, 0,
5950 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5951 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5952 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5953 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5957 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5959 /* Looks like the unsol event is incompatible with the standard
5960 * definition. 4bit tag is placed at 26 bit!
5962 if (((res >> 26) == ALC880_HP_EVENT)) {
5963 alc882_targa_automute(codec);
5967 static struct hda_verb alc882_asus_a7j_verbs[] = {
5968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5969 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5972 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5973 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5975 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5976 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5977 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5979 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5980 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5981 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5985 static struct hda_verb alc882_asus_a7m_verbs[] = {
5986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5987 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5991 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5993 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5994 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5995 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5997 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5998 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5999 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6003 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6005 unsigned int gpiostate, gpiomask, gpiodir;
6007 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6008 AC_VERB_GET_GPIO_DATA, 0);
6011 gpiostate |= (1 << pin);
6013 gpiostate &= ~(1 << pin);
6015 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6016 AC_VERB_GET_GPIO_MASK, 0);
6017 gpiomask |= (1 << pin);
6019 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6020 AC_VERB_GET_GPIO_DIRECTION, 0);
6021 gpiodir |= (1 << pin);
6024 snd_hda_codec_write(codec, codec->afg, 0,
6025 AC_VERB_SET_GPIO_MASK, gpiomask);
6026 snd_hda_codec_write(codec, codec->afg, 0,
6027 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6031 snd_hda_codec_write(codec, codec->afg, 0,
6032 AC_VERB_SET_GPIO_DATA, gpiostate);
6035 /* set up GPIO at initialization */
6036 static void alc885_macpro_init_hook(struct hda_codec *codec)
6038 alc882_gpio_mute(codec, 0, 0);
6039 alc882_gpio_mute(codec, 1, 0);
6042 /* set up GPIO and update auto-muting at initialization */
6043 static void alc885_imac24_init_hook(struct hda_codec *codec)
6045 alc885_macpro_init_hook(codec);
6046 alc885_imac24_automute(codec);
6050 * generic initialization of ADC, input mixers and output mixers
6052 static struct hda_verb alc882_auto_init_verbs[] = {
6054 * Unmute ADC0-2 and set the default input to mic-in
6056 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6058 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6059 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6060 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6063 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6065 * Note: PASD motherboards uses the Line In 2 as the input for
6066 * front panel mic (mic 2)
6068 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6073 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6076 * Set up output mixers (0x0c - 0x0f)
6078 /* set vol=0 to output mixers */
6079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6080 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6083 /* set up input amps for analog loopback */
6084 /* Amp Indices: DAC = 0, mixer = 1 */
6085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6086 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6088 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6089 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6090 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6092 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6093 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6094 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6096 /* FIXME: use matrix-type input source selection */
6097 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6098 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6100 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6101 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6102 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6105 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6106 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6107 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6112 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6117 /* capture mixer elements */
6118 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6119 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6120 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6121 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6122 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6125 /* The multiple "Capture Source" controls confuse alsamixer
6126 * So call somewhat different..
6128 /* .name = "Capture Source", */
6129 .name = "Input Source",
6131 .info = alc882_mux_enum_info,
6132 .get = alc882_mux_enum_get,
6133 .put = alc882_mux_enum_put,
6138 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6139 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6140 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6141 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6142 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6143 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6144 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6147 /* The multiple "Capture Source" controls confuse alsamixer
6148 * So call somewhat different..
6150 /* .name = "Capture Source", */
6151 .name = "Input Source",
6153 .info = alc882_mux_enum_info,
6154 .get = alc882_mux_enum_get,
6155 .put = alc882_mux_enum_put,
6160 #ifdef CONFIG_SND_HDA_POWER_SAVE
6161 #define alc882_loopbacks alc880_loopbacks
6164 /* pcm configuration: identiacal with ALC880 */
6165 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6166 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6167 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6168 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6171 * configuration and preset
6173 static const char *alc882_models[ALC882_MODEL_LAST] = {
6174 [ALC882_3ST_DIG] = "3stack-dig",
6175 [ALC882_6ST_DIG] = "6stack-dig",
6176 [ALC882_ARIMA] = "arima",
6177 [ALC882_W2JC] = "w2jc",
6178 [ALC882_TARGA] = "targa",
6179 [ALC882_ASUS_A7J] = "asus-a7j",
6180 [ALC882_ASUS_A7M] = "asus-a7m",
6181 [ALC885_MACPRO] = "macpro",
6182 [ALC885_MBP3] = "mbp3",
6183 [ALC885_IMAC24] = "imac24",
6184 [ALC882_AUTO] = "auto",
6187 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6188 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6189 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6190 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6191 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6192 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6193 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6194 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6195 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6196 SND_PCI_QUIRK(0x106b, 0x00a0, "Apple iMac 24''", ALC885_IMAC24),
6197 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6198 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6199 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6200 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6204 static struct alc_config_preset alc882_presets[] = {
6205 [ALC882_3ST_DIG] = {
6206 .mixers = { alc882_base_mixer },
6207 .init_verbs = { alc882_init_verbs },
6208 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6209 .dac_nids = alc882_dac_nids,
6210 .dig_out_nid = ALC882_DIGOUT_NID,
6211 .dig_in_nid = ALC882_DIGIN_NID,
6212 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6213 .channel_mode = alc882_ch_modes,
6215 .input_mux = &alc882_capture_source,
6217 [ALC882_6ST_DIG] = {
6218 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6219 .init_verbs = { alc882_init_verbs },
6220 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6221 .dac_nids = alc882_dac_nids,
6222 .dig_out_nid = ALC882_DIGOUT_NID,
6223 .dig_in_nid = ALC882_DIGIN_NID,
6224 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6225 .channel_mode = alc882_sixstack_modes,
6226 .input_mux = &alc882_capture_source,
6229 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6230 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6231 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6232 .dac_nids = alc882_dac_nids,
6233 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6234 .channel_mode = alc882_sixstack_modes,
6235 .input_mux = &alc882_capture_source,
6238 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6239 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6240 alc880_gpio1_init_verbs },
6241 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6242 .dac_nids = alc882_dac_nids,
6243 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6244 .channel_mode = alc880_threestack_modes,
6246 .input_mux = &alc882_capture_source,
6247 .dig_out_nid = ALC882_DIGOUT_NID,
6250 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6251 .init_verbs = { alc885_mbp3_init_verbs,
6252 alc880_gpio1_init_verbs },
6253 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6254 .dac_nids = alc882_dac_nids,
6255 .channel_mode = alc885_mbp_6ch_modes,
6256 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6257 .input_mux = &alc882_capture_source,
6258 .dig_out_nid = ALC882_DIGOUT_NID,
6259 .dig_in_nid = ALC882_DIGIN_NID,
6260 .unsol_event = alc885_mbp3_unsol_event,
6261 .init_hook = alc885_mbp3_automute,
6264 .mixers = { alc882_macpro_mixer },
6265 .init_verbs = { alc882_macpro_init_verbs },
6266 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6267 .dac_nids = alc882_dac_nids,
6268 .dig_out_nid = ALC882_DIGOUT_NID,
6269 .dig_in_nid = ALC882_DIGIN_NID,
6270 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6271 .channel_mode = alc882_ch_modes,
6272 .input_mux = &alc882_capture_source,
6273 .init_hook = alc885_macpro_init_hook,
6276 .mixers = { alc885_imac24_mixer },
6277 .init_verbs = { alc885_imac24_init_verbs },
6278 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6279 .dac_nids = alc882_dac_nids,
6280 .dig_out_nid = ALC882_DIGOUT_NID,
6281 .dig_in_nid = ALC882_DIGIN_NID,
6282 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6283 .channel_mode = alc882_ch_modes,
6284 .input_mux = &alc882_capture_source,
6285 .unsol_event = alc885_imac24_unsol_event,
6286 .init_hook = alc885_imac24_init_hook,
6289 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6290 alc882_capture_mixer },
6291 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6292 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6293 .dac_nids = alc882_dac_nids,
6294 .dig_out_nid = ALC882_DIGOUT_NID,
6295 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6296 .adc_nids = alc882_adc_nids,
6297 .capsrc_nids = alc882_capsrc_nids,
6298 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6299 .channel_mode = alc882_3ST_6ch_modes,
6301 .input_mux = &alc882_capture_source,
6302 .unsol_event = alc882_targa_unsol_event,
6303 .init_hook = alc882_targa_automute,
6305 [ALC882_ASUS_A7J] = {
6306 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6307 alc882_capture_mixer },
6308 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6309 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6310 .dac_nids = alc882_dac_nids,
6311 .dig_out_nid = ALC882_DIGOUT_NID,
6312 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6313 .adc_nids = alc882_adc_nids,
6314 .capsrc_nids = alc882_capsrc_nids,
6315 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6316 .channel_mode = alc882_3ST_6ch_modes,
6318 .input_mux = &alc882_capture_source,
6320 [ALC882_ASUS_A7M] = {
6321 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6322 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6323 alc880_gpio1_init_verbs,
6324 alc882_asus_a7m_verbs },
6325 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6326 .dac_nids = alc882_dac_nids,
6327 .dig_out_nid = ALC882_DIGOUT_NID,
6328 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6329 .channel_mode = alc880_threestack_modes,
6331 .input_mux = &alc882_capture_source,
6340 PINFIX_ABIT_AW9D_MAX
6343 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6344 { 0x15, 0x01080104 }, /* side */
6345 { 0x16, 0x01011012 }, /* rear */
6346 { 0x17, 0x01016011 }, /* clfe */
6350 static const struct alc_pincfg *alc882_pin_fixes[] = {
6351 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6354 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6355 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6360 * BIOS auto configuration
6362 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6363 hda_nid_t nid, int pin_type,
6367 struct alc_spec *spec = codec->spec;
6370 alc_set_pin_output(codec, nid, pin_type);
6371 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6374 idx = spec->multiout.dac_nids[dac_idx] - 2;
6375 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6379 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6381 struct alc_spec *spec = codec->spec;
6384 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6385 for (i = 0; i <= HDA_SIDE; i++) {
6386 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6387 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6389 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6394 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6396 struct alc_spec *spec = codec->spec;
6399 pin = spec->autocfg.hp_pins[0];
6400 if (pin) /* connect to front */
6402 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6403 pin = spec->autocfg.speaker_pins[0];
6405 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6408 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6409 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6411 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6413 struct alc_spec *spec = codec->spec;
6416 for (i = 0; i < AUTO_PIN_LAST; i++) {
6417 hda_nid_t nid = spec->autocfg.input_pins[i];
6422 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6423 unsigned int pincap;
6424 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6425 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6429 snd_hda_codec_write(codec, nid, 0,
6430 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6431 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6432 snd_hda_codec_write(codec, nid, 0,
6433 AC_VERB_SET_AMP_GAIN_MUTE,
6438 /* add mic boosts if needed */
6439 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6441 struct alc_spec *spec = codec->spec;
6445 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6446 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6447 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6449 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6453 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6454 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6455 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6457 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6464 /* almost identical with ALC880 parser... */
6465 static int alc882_parse_auto_config(struct hda_codec *codec)
6467 struct alc_spec *spec = codec->spec;
6468 int err = alc880_parse_auto_config(codec);
6473 return 0; /* no config found */
6475 err = alc_auto_add_mic_boost(codec);
6479 /* hack - override the init verbs */
6480 spec->init_verbs[0] = alc882_auto_init_verbs;
6482 return 1; /* config found */
6485 /* additional initialization for auto-configuration model */
6486 static void alc882_auto_init(struct hda_codec *codec)
6488 struct alc_spec *spec = codec->spec;
6489 alc882_auto_init_multi_out(codec);
6490 alc882_auto_init_hp_out(codec);
6491 alc882_auto_init_analog_input(codec);
6492 if (spec->unsol_event)
6493 alc_sku_automute(codec);
6496 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6498 static int patch_alc882(struct hda_codec *codec)
6500 struct alc_spec *spec;
6501 int err, board_config;
6503 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6509 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6513 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6514 /* Pick up systems that don't supply PCI SSID */
6515 switch (codec->subsystem_id) {
6516 case 0x106b0c00: /* Mac Pro */
6517 board_config = ALC885_MACPRO;
6519 case 0x106b1000: /* iMac 24 */
6520 board_config = ALC885_IMAC24;
6522 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6523 case 0x106b2c00: /* Macbook Pro rev3 */
6524 case 0x106b3600: /* Macbook 3.1 */
6525 board_config = ALC885_MBP3;
6528 /* ALC889A is handled better as ALC888-compatible */
6529 if (codec->revision_id == 0x100103) {
6531 return patch_alc883(codec);
6533 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6534 "trying auto-probe from BIOS...\n");
6535 board_config = ALC882_AUTO;
6539 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6541 if (board_config == ALC882_AUTO) {
6542 /* automatic parse from the BIOS config */
6543 err = alc882_parse_auto_config(codec);
6549 "hda_codec: Cannot set up configuration "
6550 "from BIOS. Using base mode...\n");
6551 board_config = ALC882_3ST_DIG;
6555 if (board_config != ALC882_AUTO)
6556 setup_preset(spec, &alc882_presets[board_config]);
6558 if (codec->vendor_id == 0x10ec0885) {
6559 spec->stream_name_analog = "ALC885 Analog";
6560 spec->stream_name_digital = "ALC885 Digital";
6562 spec->stream_name_analog = "ALC882 Analog";
6563 spec->stream_name_digital = "ALC882 Digital";
6566 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6567 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6568 /* FIXME: setup DAC5 */
6569 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6570 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6572 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6573 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6575 if (!spec->adc_nids && spec->input_mux) {
6576 /* check whether NID 0x07 is valid */
6577 unsigned int wcap = get_wcaps(codec, 0x07);
6579 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6580 if (wcap != AC_WID_AUD_IN) {
6581 spec->adc_nids = alc882_adc_nids_alt;
6582 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6583 spec->capsrc_nids = alc882_capsrc_nids_alt;
6584 spec->mixers[spec->num_mixers] =
6585 alc882_capture_alt_mixer;
6588 spec->adc_nids = alc882_adc_nids;
6589 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6590 spec->capsrc_nids = alc882_capsrc_nids;
6591 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6596 spec->vmaster_nid = 0x0c;
6598 codec->patch_ops = alc_patch_ops;
6599 if (board_config == ALC882_AUTO)
6600 spec->init_hook = alc882_auto_init;
6601 #ifdef CONFIG_SND_HDA_POWER_SAVE
6602 if (!spec->loopback.amplist)
6603 spec->loopback.amplist = alc882_loopbacks;
6612 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6613 * configuration. Each pin widget can choose any input DACs and a mixer.
6614 * Each ADC is connected from a mixer of all inputs. This makes possible
6615 * 6-channel independent captures.
6617 * In addition, an independent DAC for the multi-playback (not used in this
6620 #define ALC883_DIGOUT_NID 0x06
6621 #define ALC883_DIGIN_NID 0x0a
6623 static hda_nid_t alc883_dac_nids[4] = {
6624 /* front, rear, clfe, rear_surr */
6625 0x02, 0x03, 0x04, 0x05
6628 static hda_nid_t alc883_adc_nids[2] = {
6633 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6636 /* FIXME: should be a matrix-type input source selection */
6638 static struct hda_input_mux alc883_capture_source = {
6642 { "Front Mic", 0x1 },
6648 static struct hda_input_mux alc883_3stack_6ch_intel = {
6652 { "Front Mic", 0x0 },
6658 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6666 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6676 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6684 #define alc883_mux_enum_info alc_mux_enum_info
6685 #define alc883_mux_enum_get alc_mux_enum_get
6686 /* ALC883 has the ALC882-type input selection */
6687 #define alc883_mux_enum_put alc882_mux_enum_put
6692 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6699 static struct hda_verb alc883_3ST_ch2_init[] = {
6700 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6701 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6702 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6703 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6710 static struct hda_verb alc883_3ST_ch4_init[] = {
6711 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6712 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6713 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6714 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6715 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6722 static struct hda_verb alc883_3ST_ch6_init[] = {
6723 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6724 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6725 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6726 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6727 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6728 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6732 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6733 { 2, alc883_3ST_ch2_init },
6734 { 4, alc883_3ST_ch4_init },
6735 { 6, alc883_3ST_ch6_init },
6741 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6742 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6743 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6744 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6745 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6752 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6753 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6754 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6755 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6756 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6757 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6764 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6765 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6766 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6767 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6770 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6774 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6775 { 2, alc883_3ST_ch2_intel_init },
6776 { 4, alc883_3ST_ch4_intel_init },
6777 { 6, alc883_3ST_ch6_intel_init },
6783 static struct hda_verb alc883_sixstack_ch6_init[] = {
6784 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6785 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6786 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6787 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6794 static struct hda_verb alc883_sixstack_ch8_init[] = {
6795 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6796 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6797 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6798 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6802 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6803 { 6, alc883_sixstack_ch6_init },
6804 { 8, alc883_sixstack_ch8_init },
6807 static struct hda_verb alc883_medion_eapd_verbs[] = {
6808 /* eanable EAPD on medion laptop */
6809 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6810 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6814 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6815 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6818 static struct snd_kcontrol_new alc883_base_mixer[] = {
6819 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6820 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6821 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6822 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6823 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6824 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6825 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6826 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6827 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6828 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6829 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6830 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6831 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6832 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6833 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6834 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6835 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6837 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6838 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6839 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6840 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6841 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6842 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6843 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6844 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6845 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6847 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6848 /* .name = "Capture Source", */
6849 .name = "Input Source",
6851 .info = alc883_mux_enum_info,
6852 .get = alc883_mux_enum_get,
6853 .put = alc883_mux_enum_put,
6858 static struct snd_kcontrol_new alc883_mitac_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_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6862 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6863 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6864 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6869 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6870 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6871 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6872 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6873 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6874 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6875 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6877 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6878 /* .name = "Capture Source", */
6879 .name = "Input Source",
6881 .info = alc883_mux_enum_info,
6882 .get = alc883_mux_enum_get,
6883 .put = alc883_mux_enum_put,
6888 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6889 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6890 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6891 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6892 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6894 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6896 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6897 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6898 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6899 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6900 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6901 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6902 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6904 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6905 /* .name = "Capture Source", */
6906 .name = "Input Source",
6908 .info = alc883_mux_enum_info,
6909 .get = alc883_mux_enum_get,
6910 .put = alc883_mux_enum_put,
6915 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6916 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6917 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6918 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6919 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6922 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6923 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6924 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6925 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6926 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6927 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6928 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6929 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6932 /* .name = "Capture Source", */
6933 .name = "Input Source",
6935 .info = alc883_mux_enum_info,
6936 .get = alc883_mux_enum_get,
6937 .put = alc883_mux_enum_put,
6942 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6943 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6944 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6945 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6946 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6947 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6948 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6949 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6951 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6953 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6954 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6955 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6956 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6957 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6958 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6959 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6960 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6961 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6963 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6964 /* .name = "Capture Source", */
6965 .name = "Input Source",
6967 .info = alc883_mux_enum_info,
6968 .get = alc883_mux_enum_get,
6969 .put = alc883_mux_enum_put,
6974 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6975 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6976 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6977 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6978 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6979 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6980 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6981 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6982 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6984 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6985 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6986 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6987 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6989 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6991 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6992 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6993 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6994 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6995 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6997 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6998 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6999 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7001 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7002 /* .name = "Capture Source", */
7003 .name = "Input Source",
7005 .info = alc883_mux_enum_info,
7006 .get = alc883_mux_enum_get,
7007 .put = alc883_mux_enum_put,
7012 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7013 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7014 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7016 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7017 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7019 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7020 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7021 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7023 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7024 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7026 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7028 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7032 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7033 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7034 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7035 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7036 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7037 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7038 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7041 /* .name = "Capture Source", */
7042 .name = "Input Source",
7044 .info = alc883_mux_enum_info,
7045 .get = alc883_mux_enum_get,
7046 .put = alc883_mux_enum_put,
7051 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7054 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7055 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7056 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7057 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7058 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7059 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7060 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7061 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7062 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7065 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7068 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7069 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7070 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7071 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7072 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7073 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7074 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7077 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7078 /* .name = "Capture Source", */
7079 .name = "Input Source",
7081 .info = alc883_mux_enum_info,
7082 .get = alc883_mux_enum_get,
7083 .put = alc883_mux_enum_put,
7088 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7091 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7092 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7093 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7094 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7095 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7096 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7097 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7098 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7099 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7100 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7101 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7105 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7106 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7107 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7108 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7111 /* .name = "Capture Source", */
7112 .name = "Input Source",
7114 .info = alc883_mux_enum_info,
7115 .get = alc883_mux_enum_get,
7116 .put = alc883_mux_enum_put,
7121 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7122 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7123 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7124 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7130 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7131 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7132 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7133 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7134 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7135 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7136 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7138 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7139 /* .name = "Capture Source", */
7140 .name = "Input Source",
7142 .info = alc883_mux_enum_info,
7143 .get = alc883_mux_enum_get,
7144 .put = alc883_mux_enum_put,
7149 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7150 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7151 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7152 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7153 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7156 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7158 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7159 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7161 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7162 /* .name = "Capture Source", */
7163 .name = "Input Source",
7165 .info = alc883_mux_enum_info,
7166 .get = alc883_mux_enum_get,
7167 .put = alc883_mux_enum_put,
7172 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7173 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7174 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7180 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7181 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7182 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7183 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7184 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7185 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7187 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7188 /* .name = "Capture Source", */
7189 .name = "Input Source",
7191 .info = alc883_mux_enum_info,
7192 .get = alc883_mux_enum_get,
7193 .put = alc883_mux_enum_put,
7198 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7199 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7200 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7201 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7202 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7203 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7207 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7208 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7209 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7210 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7211 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7213 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7214 /* .name = "Capture Source", */
7215 .name = "Input Source",
7217 .info = alc883_mux_enum_info,
7218 .get = alc883_mux_enum_get,
7219 .put = alc883_mux_enum_put,
7224 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7225 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7226 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7228 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7229 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7233 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7234 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7235 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7236 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7238 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7239 /* .name = "Capture Source", */
7240 .name = "Input Source",
7242 .info = alc883_mux_enum_info,
7243 .get = alc883_mux_enum_get,
7244 .put = alc883_mux_enum_put,
7249 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7252 .name = "Channel Mode",
7253 .info = alc_ch_mode_info,
7254 .get = alc_ch_mode_get,
7255 .put = alc_ch_mode_put,
7260 static struct hda_verb alc883_init_verbs[] = {
7261 /* ADC1: mute amp left and right */
7262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7263 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7264 /* ADC2: mute amp left and right */
7265 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7266 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7267 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7272 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7273 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7274 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7276 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7277 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7280 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7281 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7282 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7284 /* mute analog input loopbacks */
7285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7291 /* Front Pin: output 0 (0x0c) */
7292 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7293 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7294 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7295 /* Rear Pin: output 1 (0x0d) */
7296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7297 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7299 /* CLFE Pin: output 2 (0x0e) */
7300 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7301 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7302 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7303 /* Side Pin: output 3 (0x0f) */
7304 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7305 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7306 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7307 /* Mic (rear) pin: input vref at 80% */
7308 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7309 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7310 /* Front Mic pin: input vref at 80% */
7311 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7312 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7313 /* Line In pin: input */
7314 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7315 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7316 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7317 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7318 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7319 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7320 /* CD pin widget for input */
7321 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7323 /* FIXME: use matrix-type input source selection */
7324 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7338 /* toggle speaker-output according to the hp-jack state */
7339 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7341 unsigned int present;
7343 present = snd_hda_codec_read(codec, 0x15, 0,
7344 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7345 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7346 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7347 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7348 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7351 /* auto-toggle front mic */
7353 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7355 unsigned int present;
7358 present = snd_hda_codec_read(codec, 0x18, 0,
7359 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7360 bits = present ? HDA_AMP_MUTE : 0;
7361 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7365 static void alc883_mitac_automute(struct hda_codec *codec)
7367 alc883_mitac_hp_automute(codec);
7368 /* alc883_mitac_mic_automute(codec); */
7371 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7374 switch (res >> 26) {
7375 case ALC880_HP_EVENT:
7376 alc883_mitac_hp_automute(codec);
7378 case ALC880_MIC_EVENT:
7379 /* alc883_mitac_mic_automute(codec); */
7384 static struct hda_verb alc883_mitac_verbs[] = {
7386 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7389 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7390 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7392 /* enable unsolicited event */
7393 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7394 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7399 static struct hda_verb alc883_clevo_m720_verbs[] = {
7401 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7402 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7404 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7405 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7407 /* enable unsolicited event */
7408 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7409 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7414 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7416 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7419 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7420 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7422 /* enable unsolicited event */
7423 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7428 static struct hda_verb alc883_tagra_verbs[] = {
7429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7432 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7433 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7435 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7436 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7437 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7439 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7440 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7441 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7442 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7447 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7448 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7449 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7450 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7454 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7455 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7456 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7457 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7462 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7466 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7467 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7471 static struct hda_verb alc883_haier_w66_verbs[] = {
7472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7475 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7477 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7478 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7479 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7480 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7484 static struct hda_verb alc888_3st_hp_verbs[] = {
7485 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7486 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7487 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7491 static struct hda_verb alc888_6st_dell_verbs[] = {
7492 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7496 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7497 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7498 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7499 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7500 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7504 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7505 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7506 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7507 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7508 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7512 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7513 { 2, alc888_3st_hp_2ch_init },
7514 { 6, alc888_3st_hp_6ch_init },
7517 /* toggle front-jack and RCA according to the hp-jack state */
7518 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7520 unsigned int present;
7522 present = snd_hda_codec_read(codec, 0x1b, 0,
7523 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7524 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7525 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7526 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7527 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7530 /* toggle RCA according to the front-jack state */
7531 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7533 unsigned int present;
7535 present = snd_hda_codec_read(codec, 0x14, 0,
7536 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7537 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7538 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7541 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7544 if ((res >> 26) == ALC880_HP_EVENT)
7545 alc888_lenovo_ms7195_front_automute(codec);
7546 if ((res >> 26) == ALC880_FRONT_EVENT)
7547 alc888_lenovo_ms7195_rca_automute(codec);
7550 static struct hda_verb alc883_medion_md2_verbs[] = {
7551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7554 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7556 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7560 /* toggle speaker-output according to the hp-jack state */
7561 static void alc883_medion_md2_automute(struct hda_codec *codec)
7563 unsigned int present;
7565 present = snd_hda_codec_read(codec, 0x14, 0,
7566 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7567 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7568 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7571 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7574 if ((res >> 26) == ALC880_HP_EVENT)
7575 alc883_medion_md2_automute(codec);
7578 /* toggle speaker-output according to the hp-jack state */
7579 static void alc883_tagra_automute(struct hda_codec *codec)
7581 unsigned int present;
7584 present = snd_hda_codec_read(codec, 0x14, 0,
7585 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7586 bits = present ? HDA_AMP_MUTE : 0;
7587 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7588 HDA_AMP_MUTE, bits);
7589 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7593 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7595 if ((res >> 26) == ALC880_HP_EVENT)
7596 alc883_tagra_automute(codec);
7599 /* toggle speaker-output according to the hp-jack state */
7600 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7602 unsigned int present;
7605 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7606 & AC_PINSENSE_PRESENCE;
7607 bits = present ? HDA_AMP_MUTE : 0;
7608 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7609 HDA_AMP_MUTE, bits);
7612 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7614 unsigned int present;
7616 present = snd_hda_codec_read(codec, 0x18, 0,
7617 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7618 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7619 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7622 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7624 alc883_clevo_m720_hp_automute(codec);
7625 alc883_clevo_m720_mic_automute(codec);
7628 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7631 switch (res >> 26) {
7632 case ALC880_HP_EVENT:
7633 alc883_clevo_m720_hp_automute(codec);
7635 case ALC880_MIC_EVENT:
7636 alc883_clevo_m720_mic_automute(codec);
7641 /* toggle speaker-output according to the hp-jack state */
7642 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7644 unsigned int present;
7647 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7648 & AC_PINSENSE_PRESENCE;
7649 bits = present ? HDA_AMP_MUTE : 0;
7650 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7651 HDA_AMP_MUTE, bits);
7654 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7657 if ((res >> 26) == ALC880_HP_EVENT)
7658 alc883_2ch_fujitsu_pi2515_automute(codec);
7661 static void alc883_haier_w66_automute(struct hda_codec *codec)
7663 unsigned int present;
7666 present = snd_hda_codec_read(codec, 0x1b, 0,
7667 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7668 bits = present ? 0x80 : 0;
7669 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7673 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7676 if ((res >> 26) == ALC880_HP_EVENT)
7677 alc883_haier_w66_automute(codec);
7680 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7682 unsigned int present;
7685 present = snd_hda_codec_read(codec, 0x14, 0,
7686 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7687 bits = present ? HDA_AMP_MUTE : 0;
7688 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7689 HDA_AMP_MUTE, bits);
7692 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7694 unsigned int present;
7697 present = snd_hda_codec_read(codec, 0x1b, 0,
7698 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7699 bits = present ? HDA_AMP_MUTE : 0;
7700 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7701 HDA_AMP_MUTE, bits);
7702 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7703 HDA_AMP_MUTE, bits);
7706 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7709 if ((res >> 26) == ALC880_HP_EVENT)
7710 alc883_lenovo_101e_all_automute(codec);
7711 if ((res >> 26) == ALC880_FRONT_EVENT)
7712 alc883_lenovo_101e_ispeaker_automute(codec);
7715 /* toggle speaker-output according to the hp-jack state */
7716 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7718 unsigned int present;
7720 present = snd_hda_codec_read(codec, 0x14, 0,
7721 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7722 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7723 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7724 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7725 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7728 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7731 if ((res >> 26) == ALC880_HP_EVENT)
7732 alc883_acer_aspire_automute(codec);
7735 static struct hda_verb alc883_acer_eapd_verbs[] = {
7736 /* HP Pin: output 0 (0x0c) */
7737 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7738 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7739 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7740 /* Front Pin: output 0 (0x0c) */
7741 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7742 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7743 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7744 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7745 /* eanable EAPD on medion laptop */
7746 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7747 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7748 /* enable unsolicited event */
7749 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7753 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7755 unsigned int present;
7757 present = snd_hda_codec_read(codec, 0x1b, 0,
7758 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7759 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7760 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7761 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7762 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7763 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7764 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7765 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7766 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7769 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7772 switch (res >> 26) {
7773 case ALC880_HP_EVENT:
7774 printk("hp_event\n");
7775 alc888_6st_dell_front_automute(codec);
7781 * generic initialization of ADC, input mixers and output mixers
7783 static struct hda_verb alc883_auto_init_verbs[] = {
7785 * Unmute ADC0-2 and set the default input to mic-in
7787 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7788 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7789 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7790 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7792 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7794 * Note: PASD motherboards uses the Line In 2 as the input for
7795 * front panel mic (mic 2)
7797 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7800 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7802 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7805 * Set up output mixers (0x0c - 0x0f)
7807 /* set vol=0 to output mixers */
7808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7811 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7812 /* set up input amps for analog loopback */
7813 /* Amp Indices: DAC = 0, mixer = 1 */
7814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7820 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7821 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7822 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7823 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7825 /* FIXME: use matrix-type input source selection */
7826 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7828 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7829 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7830 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7831 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7832 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7834 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7835 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7836 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7837 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7843 /* capture mixer elements */
7844 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7845 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7846 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7847 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7848 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7850 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7851 /* The multiple "Capture Source" controls confuse alsamixer
7852 * So call somewhat different..
7854 /* .name = "Capture Source", */
7855 .name = "Input Source",
7857 .info = alc882_mux_enum_info,
7858 .get = alc882_mux_enum_get,
7859 .put = alc882_mux_enum_put,
7864 #ifdef CONFIG_SND_HDA_POWER_SAVE
7865 #define alc883_loopbacks alc880_loopbacks
7868 /* pcm configuration: identiacal with ALC880 */
7869 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7870 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7871 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7872 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7873 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7876 * configuration and preset
7878 static const char *alc883_models[ALC883_MODEL_LAST] = {
7879 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7880 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7881 [ALC883_3ST_6ch] = "3stack-6ch",
7882 [ALC883_6ST_DIG] = "6stack-dig",
7883 [ALC883_TARGA_DIG] = "targa-dig",
7884 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7885 [ALC883_ACER] = "acer",
7886 [ALC883_ACER_ASPIRE] = "acer-aspire",
7887 [ALC883_MEDION] = "medion",
7888 [ALC883_MEDION_MD2] = "medion-md2",
7889 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7890 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7891 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7892 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7893 [ALC883_HAIER_W66] = "haier-w66",
7894 [ALC888_3ST_HP] = "3stack-hp",
7895 [ALC888_6ST_DELL] = "6stack-dell",
7896 [ALC883_MITAC] = "mitac",
7897 [ALC883_CLEVO_M720] = "clevo-m720",
7898 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7899 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
7900 [ALC883_AUTO] = "auto",
7903 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7904 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7905 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7906 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7907 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7908 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7909 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7910 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7911 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7912 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7913 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7914 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7915 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7916 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7917 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7918 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7919 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7920 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7921 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7922 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7923 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7924 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7925 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7926 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7927 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7928 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7929 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7930 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7931 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7932 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7933 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7934 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7935 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7936 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7937 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7938 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7939 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7940 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7941 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7942 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7943 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7944 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7945 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7946 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7947 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7948 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7949 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7950 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7951 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7952 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7953 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7954 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7955 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7956 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7957 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
7958 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
7959 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7963 static struct alc_config_preset alc883_presets[] = {
7964 [ALC883_3ST_2ch_DIG] = {
7965 .mixers = { alc883_3ST_2ch_mixer },
7966 .init_verbs = { alc883_init_verbs },
7967 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7968 .dac_nids = alc883_dac_nids,
7969 .dig_out_nid = ALC883_DIGOUT_NID,
7970 .dig_in_nid = ALC883_DIGIN_NID,
7971 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7972 .channel_mode = alc883_3ST_2ch_modes,
7973 .input_mux = &alc883_capture_source,
7975 [ALC883_3ST_6ch_DIG] = {
7976 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7977 .init_verbs = { alc883_init_verbs },
7978 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7979 .dac_nids = alc883_dac_nids,
7980 .dig_out_nid = ALC883_DIGOUT_NID,
7981 .dig_in_nid = ALC883_DIGIN_NID,
7982 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7983 .channel_mode = alc883_3ST_6ch_modes,
7985 .input_mux = &alc883_capture_source,
7987 [ALC883_3ST_6ch] = {
7988 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7989 .init_verbs = { alc883_init_verbs },
7990 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7991 .dac_nids = alc883_dac_nids,
7992 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7993 .channel_mode = alc883_3ST_6ch_modes,
7995 .input_mux = &alc883_capture_source,
7997 [ALC883_3ST_6ch_INTEL] = {
7998 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
7999 .init_verbs = { alc883_init_verbs },
8000 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8001 .dac_nids = alc883_dac_nids,
8002 .dig_out_nid = ALC883_DIGOUT_NID,
8003 .dig_in_nid = ALC883_DIGIN_NID,
8004 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8005 .channel_mode = alc883_3ST_6ch_intel_modes,
8007 .input_mux = &alc883_3stack_6ch_intel,
8009 [ALC883_6ST_DIG] = {
8010 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8011 .init_verbs = { alc883_init_verbs },
8012 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8013 .dac_nids = alc883_dac_nids,
8014 .dig_out_nid = ALC883_DIGOUT_NID,
8015 .dig_in_nid = ALC883_DIGIN_NID,
8016 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8017 .channel_mode = alc883_sixstack_modes,
8018 .input_mux = &alc883_capture_source,
8020 [ALC883_TARGA_DIG] = {
8021 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8022 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8023 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8024 .dac_nids = alc883_dac_nids,
8025 .dig_out_nid = ALC883_DIGOUT_NID,
8026 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8027 .channel_mode = alc883_3ST_6ch_modes,
8029 .input_mux = &alc883_capture_source,
8030 .unsol_event = alc883_tagra_unsol_event,
8031 .init_hook = alc883_tagra_automute,
8033 [ALC883_TARGA_2ch_DIG] = {
8034 .mixers = { alc883_tagra_2ch_mixer},
8035 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8036 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8037 .dac_nids = alc883_dac_nids,
8038 .dig_out_nid = ALC883_DIGOUT_NID,
8039 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8040 .channel_mode = alc883_3ST_2ch_modes,
8041 .input_mux = &alc883_capture_source,
8042 .unsol_event = alc883_tagra_unsol_event,
8043 .init_hook = alc883_tagra_automute,
8046 .mixers = { alc883_base_mixer },
8047 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8048 * and the headphone jack. Turn this on and rely on the
8049 * standard mute methods whenever the user wants to turn
8050 * these outputs off.
8052 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8053 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8054 .dac_nids = alc883_dac_nids,
8055 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8056 .channel_mode = alc883_3ST_2ch_modes,
8057 .input_mux = &alc883_capture_source,
8059 [ALC883_ACER_ASPIRE] = {
8060 .mixers = { alc883_acer_aspire_mixer },
8061 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8062 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8063 .dac_nids = alc883_dac_nids,
8064 .dig_out_nid = ALC883_DIGOUT_NID,
8065 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8066 .channel_mode = alc883_3ST_2ch_modes,
8067 .input_mux = &alc883_capture_source,
8068 .unsol_event = alc883_acer_aspire_unsol_event,
8069 .init_hook = alc883_acer_aspire_automute,
8072 .mixers = { alc883_fivestack_mixer,
8073 alc883_chmode_mixer },
8074 .init_verbs = { alc883_init_verbs,
8075 alc883_medion_eapd_verbs },
8076 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8077 .dac_nids = alc883_dac_nids,
8078 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8079 .channel_mode = alc883_sixstack_modes,
8080 .input_mux = &alc883_capture_source,
8082 [ALC883_MEDION_MD2] = {
8083 .mixers = { alc883_medion_md2_mixer},
8084 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8086 .dac_nids = alc883_dac_nids,
8087 .dig_out_nid = ALC883_DIGOUT_NID,
8088 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8089 .channel_mode = alc883_3ST_2ch_modes,
8090 .input_mux = &alc883_capture_source,
8091 .unsol_event = alc883_medion_md2_unsol_event,
8092 .init_hook = alc883_medion_md2_automute,
8094 [ALC883_LAPTOP_EAPD] = {
8095 .mixers = { alc883_base_mixer },
8096 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8097 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8098 .dac_nids = alc883_dac_nids,
8099 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8100 .channel_mode = alc883_3ST_2ch_modes,
8101 .input_mux = &alc883_capture_source,
8103 [ALC883_CLEVO_M720] = {
8104 .mixers = { alc883_clevo_m720_mixer },
8105 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8106 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8107 .dac_nids = alc883_dac_nids,
8108 .dig_out_nid = ALC883_DIGOUT_NID,
8109 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8110 .channel_mode = alc883_3ST_2ch_modes,
8111 .input_mux = &alc883_capture_source,
8112 .unsol_event = alc883_clevo_m720_unsol_event,
8113 .init_hook = alc883_clevo_m720_automute,
8115 [ALC883_LENOVO_101E_2ch] = {
8116 .mixers = { alc883_lenovo_101e_2ch_mixer},
8117 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8118 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8119 .dac_nids = alc883_dac_nids,
8120 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8121 .channel_mode = alc883_3ST_2ch_modes,
8122 .input_mux = &alc883_lenovo_101e_capture_source,
8123 .unsol_event = alc883_lenovo_101e_unsol_event,
8124 .init_hook = alc883_lenovo_101e_all_automute,
8126 [ALC883_LENOVO_NB0763] = {
8127 .mixers = { alc883_lenovo_nb0763_mixer },
8128 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8129 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8130 .dac_nids = alc883_dac_nids,
8131 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8132 .channel_mode = alc883_3ST_2ch_modes,
8134 .input_mux = &alc883_lenovo_nb0763_capture_source,
8135 .unsol_event = alc883_medion_md2_unsol_event,
8136 .init_hook = alc883_medion_md2_automute,
8138 [ALC888_LENOVO_MS7195_DIG] = {
8139 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8140 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8141 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8142 .dac_nids = alc883_dac_nids,
8143 .dig_out_nid = ALC883_DIGOUT_NID,
8144 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8145 .channel_mode = alc883_3ST_6ch_modes,
8147 .input_mux = &alc883_capture_source,
8148 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8149 .init_hook = alc888_lenovo_ms7195_front_automute,
8151 [ALC883_HAIER_W66] = {
8152 .mixers = { alc883_tagra_2ch_mixer},
8153 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8154 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8155 .dac_nids = alc883_dac_nids,
8156 .dig_out_nid = ALC883_DIGOUT_NID,
8157 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8158 .channel_mode = alc883_3ST_2ch_modes,
8159 .input_mux = &alc883_capture_source,
8160 .unsol_event = alc883_haier_w66_unsol_event,
8161 .init_hook = alc883_haier_w66_automute,
8164 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8165 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8166 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8167 .dac_nids = alc883_dac_nids,
8168 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8169 .channel_mode = alc888_3st_hp_modes,
8171 .input_mux = &alc883_capture_source,
8173 [ALC888_6ST_DELL] = {
8174 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8175 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8176 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8177 .dac_nids = alc883_dac_nids,
8178 .dig_out_nid = ALC883_DIGOUT_NID,
8179 .dig_in_nid = ALC883_DIGIN_NID,
8180 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8181 .channel_mode = alc883_sixstack_modes,
8182 .input_mux = &alc883_capture_source,
8183 .unsol_event = alc888_6st_dell_unsol_event,
8184 .init_hook = alc888_6st_dell_front_automute,
8187 .mixers = { alc883_mitac_mixer },
8188 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8189 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8190 .dac_nids = alc883_dac_nids,
8191 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8192 .channel_mode = alc883_3ST_2ch_modes,
8193 .input_mux = &alc883_capture_source,
8194 .unsol_event = alc883_mitac_unsol_event,
8195 .init_hook = alc883_mitac_automute,
8197 [ALC883_FUJITSU_PI2515] = {
8198 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8199 .init_verbs = { alc883_init_verbs,
8200 alc883_2ch_fujitsu_pi2515_verbs},
8201 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8202 .dac_nids = alc883_dac_nids,
8203 .dig_out_nid = ALC883_DIGOUT_NID,
8204 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8205 .channel_mode = alc883_3ST_2ch_modes,
8206 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8207 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8208 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8214 * BIOS auto configuration
8216 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8217 hda_nid_t nid, int pin_type,
8221 struct alc_spec *spec = codec->spec;
8224 alc_set_pin_output(codec, nid, pin_type);
8225 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8228 idx = spec->multiout.dac_nids[dac_idx] - 2;
8229 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8233 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8235 struct alc_spec *spec = codec->spec;
8238 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8239 for (i = 0; i <= HDA_SIDE; i++) {
8240 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8241 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8243 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8248 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8250 struct alc_spec *spec = codec->spec;
8253 pin = spec->autocfg.hp_pins[0];
8254 if (pin) /* connect to front */
8256 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8257 pin = spec->autocfg.speaker_pins[0];
8259 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8262 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8263 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8265 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8267 struct alc_spec *spec = codec->spec;
8270 for (i = 0; i < AUTO_PIN_LAST; i++) {
8271 hda_nid_t nid = spec->autocfg.input_pins[i];
8272 if (alc883_is_input_pin(nid)) {
8273 snd_hda_codec_write(codec, nid, 0,
8274 AC_VERB_SET_PIN_WIDGET_CONTROL,
8275 (i <= AUTO_PIN_FRONT_MIC ?
8276 PIN_VREF80 : PIN_IN));
8277 if (nid != ALC883_PIN_CD_NID)
8278 snd_hda_codec_write(codec, nid, 0,
8279 AC_VERB_SET_AMP_GAIN_MUTE,
8285 /* almost identical with ALC880 parser... */
8286 static int alc883_parse_auto_config(struct hda_codec *codec)
8288 struct alc_spec *spec = codec->spec;
8289 int err = alc880_parse_auto_config(codec);
8294 return 0; /* no config found */
8296 err = alc_auto_add_mic_boost(codec);
8300 /* hack - override the init verbs */
8301 spec->init_verbs[0] = alc883_auto_init_verbs;
8302 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8305 return 1; /* config found */
8308 /* additional initialization for auto-configuration model */
8309 static void alc883_auto_init(struct hda_codec *codec)
8311 struct alc_spec *spec = codec->spec;
8312 alc883_auto_init_multi_out(codec);
8313 alc883_auto_init_hp_out(codec);
8314 alc883_auto_init_analog_input(codec);
8315 if (spec->unsol_event)
8316 alc_sku_automute(codec);
8319 static int patch_alc883(struct hda_codec *codec)
8321 struct alc_spec *spec;
8322 int err, board_config;
8324 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8330 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8332 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8335 if (board_config < 0) {
8336 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8337 "trying auto-probe from BIOS...\n");
8338 board_config = ALC883_AUTO;
8341 if (board_config == ALC883_AUTO) {
8342 /* automatic parse from the BIOS config */
8343 err = alc883_parse_auto_config(codec);
8349 "hda_codec: Cannot set up configuration "
8350 "from BIOS. Using base mode...\n");
8351 board_config = ALC883_3ST_2ch_DIG;
8355 if (board_config != ALC883_AUTO)
8356 setup_preset(spec, &alc883_presets[board_config]);
8358 switch (codec->vendor_id) {
8360 spec->stream_name_analog = "ALC888 Analog";
8361 spec->stream_name_digital = "ALC888 Digital";
8364 spec->stream_name_analog = "ALC889 Analog";
8365 spec->stream_name_digital = "ALC889 Digital";
8368 spec->stream_name_analog = "ALC883 Analog";
8369 spec->stream_name_digital = "ALC883 Digital";
8373 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8374 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8375 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8377 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8378 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8380 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8381 spec->adc_nids = alc883_adc_nids;
8382 spec->capsrc_nids = alc883_capsrc_nids;
8384 spec->vmaster_nid = 0x0c;
8386 codec->patch_ops = alc_patch_ops;
8387 if (board_config == ALC883_AUTO)
8388 spec->init_hook = alc883_auto_init;
8389 else if (codec->vendor_id == 0x10ec0888)
8390 spec->init_hook = alc888_coef_init;
8392 #ifdef CONFIG_SND_HDA_POWER_SAVE
8393 if (!spec->loopback.amplist)
8394 spec->loopback.amplist = alc883_loopbacks;
8404 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8405 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8407 #define alc262_dac_nids alc260_dac_nids
8408 #define alc262_adc_nids alc882_adc_nids
8409 #define alc262_adc_nids_alt alc882_adc_nids_alt
8410 #define alc262_capsrc_nids alc882_capsrc_nids
8411 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8413 #define alc262_modes alc260_modes
8414 #define alc262_capture_source alc882_capture_source
8416 static struct snd_kcontrol_new alc262_base_mixer[] = {
8417 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8418 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8419 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8420 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8421 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8422 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8425 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8426 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8427 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8428 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8429 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8430 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8431 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8433 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8434 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8438 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8439 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8440 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8441 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8442 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8443 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8444 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8445 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8446 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8447 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8448 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8449 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8450 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8451 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8452 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8453 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8454 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8458 /* update HP, line and mono-out pins according to the master switch */
8459 static void alc262_hp_master_update(struct hda_codec *codec)
8461 struct alc_spec *spec = codec->spec;
8462 int val = spec->master_sw;
8465 snd_hda_codec_write_cache(codec, 0x1b, 0,
8466 AC_VERB_SET_PIN_WIDGET_CONTROL,
8468 snd_hda_codec_write_cache(codec, 0x15, 0,
8469 AC_VERB_SET_PIN_WIDGET_CONTROL,
8471 /* mono (speaker) depending on the HP jack sense */
8472 val = val && !spec->jack_present;
8473 snd_hda_codec_write_cache(codec, 0x16, 0,
8474 AC_VERB_SET_PIN_WIDGET_CONTROL,
8478 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8480 struct alc_spec *spec = codec->spec;
8481 unsigned int presence;
8482 presence = snd_hda_codec_read(codec, 0x1b, 0,
8483 AC_VERB_GET_PIN_SENSE, 0);
8484 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8485 alc262_hp_master_update(codec);
8488 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8490 if ((res >> 26) != ALC880_HP_EVENT)
8492 alc262_hp_bpc_automute(codec);
8495 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8497 struct alc_spec *spec = codec->spec;
8498 unsigned int presence;
8499 presence = snd_hda_codec_read(codec, 0x15, 0,
8500 AC_VERB_GET_PIN_SENSE, 0);
8501 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8502 alc262_hp_master_update(codec);
8505 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8508 if ((res >> 26) != ALC880_HP_EVENT)
8510 alc262_hp_wildwest_automute(codec);
8513 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8514 struct snd_ctl_elem_value *ucontrol)
8516 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8517 struct alc_spec *spec = codec->spec;
8518 *ucontrol->value.integer.value = spec->master_sw;
8522 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8523 struct snd_ctl_elem_value *ucontrol)
8525 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8526 struct alc_spec *spec = codec->spec;
8527 int val = !!*ucontrol->value.integer.value;
8529 if (val == spec->master_sw)
8531 spec->master_sw = val;
8532 alc262_hp_master_update(codec);
8536 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8538 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8539 .name = "Master Playback Switch",
8540 .info = snd_ctl_boolean_mono_info,
8541 .get = alc262_hp_master_sw_get,
8542 .put = alc262_hp_master_sw_put,
8544 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8545 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8547 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8549 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8552 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8553 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8554 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8555 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8556 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8557 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8558 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8559 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8560 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8561 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8562 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8563 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8564 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8568 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8570 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8571 .name = "Master Playback Switch",
8572 .info = snd_ctl_boolean_mono_info,
8573 .get = alc262_hp_master_sw_get,
8574 .put = alc262_hp_master_sw_put,
8576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8577 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8578 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8579 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8580 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8582 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8584 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8585 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8586 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8587 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8588 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8589 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8590 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8591 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8592 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8596 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8597 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8598 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8599 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8603 /* mute/unmute internal speaker according to the hp jack and mute state */
8604 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8606 struct alc_spec *spec = codec->spec;
8608 if (force || !spec->sense_updated) {
8609 unsigned int present;
8610 present = snd_hda_codec_read(codec, 0x15, 0,
8611 AC_VERB_GET_PIN_SENSE, 0);
8612 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8613 spec->sense_updated = 1;
8615 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8616 spec->jack_present ? HDA_AMP_MUTE : 0);
8619 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8622 if ((res >> 26) != ALC880_HP_EVENT)
8624 alc262_hp_t5735_automute(codec, 1);
8627 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8629 alc262_hp_t5735_automute(codec, 1);
8632 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8633 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8634 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8635 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8643 static struct hda_verb alc262_hp_t5735_verbs[] = {
8644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8647 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8651 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8652 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8654 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8655 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8656 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8657 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8661 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8662 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8665 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8666 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8667 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8669 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8671 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8675 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8682 /* bind hp and internal speaker mute (with plug check) */
8683 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8684 struct snd_ctl_elem_value *ucontrol)
8686 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8687 long *valp = ucontrol->value.integer.value;
8690 /* change hp mute */
8691 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8693 valp[0] ? 0 : HDA_AMP_MUTE);
8694 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8696 valp[1] ? 0 : HDA_AMP_MUTE);
8698 /* change speaker according to HP jack state */
8699 struct alc_spec *spec = codec->spec;
8701 if (spec->jack_present)
8702 mute = HDA_AMP_MUTE;
8704 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8706 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8707 HDA_AMP_MUTE, mute);
8712 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8713 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8716 .name = "Master Playback Switch",
8717 .info = snd_hda_mixer_amp_switch_info,
8718 .get = snd_hda_mixer_amp_switch_get,
8719 .put = alc262_sony_master_sw_put,
8720 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8724 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8725 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8729 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8730 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8731 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8733 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8734 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8735 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8736 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8740 #define alc262_capture_mixer alc882_capture_mixer
8741 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8744 * generic initialization of ADC, input mixers and output mixers
8746 static struct hda_verb alc262_init_verbs[] = {
8748 * Unmute ADC0-2 and set the default input to mic-in
8750 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8752 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8754 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8755 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8757 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8759 * Note: PASD motherboards uses the Line In 2 as the input for
8760 * front panel mic (mic 2)
8762 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8770 * Set up output mixers (0x0c - 0x0e)
8772 /* set vol=0 to output mixers */
8773 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8774 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8775 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8776 /* set up input amps for analog loopback */
8777 /* Amp Indices: DAC = 0, mixer = 1 */
8778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8781 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8787 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8789 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8790 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8792 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8794 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8798 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8799 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8801 /* FIXME: use matrix-type input source selection */
8802 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8803 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8804 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8805 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8806 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8807 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8809 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8810 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8811 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8812 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8814 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8815 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8822 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8823 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8824 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8828 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8830 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8831 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8833 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8834 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8838 static struct hda_verb alc262_sony_unsol_verbs[] = {
8839 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8840 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8841 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8843 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8844 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8848 /* mute/unmute internal speaker according to the hp jack and mute state */
8849 static void alc262_hippo_automute(struct hda_codec *codec)
8851 struct alc_spec *spec = codec->spec;
8853 unsigned int present;
8855 /* need to execute and sync at first */
8856 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8857 present = snd_hda_codec_read(codec, 0x15, 0,
8858 AC_VERB_GET_PIN_SENSE, 0);
8859 spec->jack_present = (present & 0x80000000) != 0;
8860 if (spec->jack_present) {
8861 /* mute internal speaker */
8862 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8863 HDA_AMP_MUTE, HDA_AMP_MUTE);
8865 /* unmute internal speaker if necessary */
8866 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8867 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8868 HDA_AMP_MUTE, mute);
8872 /* unsolicited event for HP jack sensing */
8873 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8876 if ((res >> 26) != ALC880_HP_EVENT)
8878 alc262_hippo_automute(codec);
8881 static void alc262_hippo1_automute(struct hda_codec *codec)
8884 unsigned int present;
8886 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8887 present = snd_hda_codec_read(codec, 0x1b, 0,
8888 AC_VERB_GET_PIN_SENSE, 0);
8889 present = (present & 0x80000000) != 0;
8891 /* mute internal speaker */
8892 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8893 HDA_AMP_MUTE, HDA_AMP_MUTE);
8895 /* unmute internal speaker if necessary */
8896 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8897 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8898 HDA_AMP_MUTE, mute);
8902 /* unsolicited event for HP jack sensing */
8903 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8906 if ((res >> 26) != ALC880_HP_EVENT)
8908 alc262_hippo1_automute(codec);
8913 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8914 * 0x1b = port replicator headphone out
8917 #define ALC_HP_EVENT 0x37
8919 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8920 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8922 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8923 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8927 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
8928 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8929 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8933 static struct hda_input_mux alc262_fujitsu_capture_source = {
8942 static struct hda_input_mux alc262_HP_capture_source = {
8946 { "Front Mic", 0x1 },
8953 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8957 { "Front Mic", 0x2 },
8963 /* mute/unmute internal speaker according to the hp jacks and mute state */
8964 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8966 struct alc_spec *spec = codec->spec;
8969 if (force || !spec->sense_updated) {
8970 unsigned int present;
8971 /* need to execute and sync at first */
8972 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8973 /* check laptop HP jack */
8974 present = snd_hda_codec_read(codec, 0x14, 0,
8975 AC_VERB_GET_PIN_SENSE, 0);
8976 /* need to execute and sync at first */
8977 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8978 /* check docking HP jack */
8979 present |= snd_hda_codec_read(codec, 0x1b, 0,
8980 AC_VERB_GET_PIN_SENSE, 0);
8981 if (present & AC_PINSENSE_PRESENCE)
8982 spec->jack_present = 1;
8984 spec->jack_present = 0;
8985 spec->sense_updated = 1;
8987 /* unmute internal speaker only if both HPs are unplugged and
8988 * master switch is on
8990 if (spec->jack_present)
8991 mute = HDA_AMP_MUTE;
8993 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8994 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8995 HDA_AMP_MUTE, mute);
8998 /* unsolicited event for HP jack sensing */
8999 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9002 if ((res >> 26) != ALC_HP_EVENT)
9004 alc262_fujitsu_automute(codec, 1);
9007 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9009 alc262_fujitsu_automute(codec, 1);
9012 /* bind volumes of both NID 0x0c and 0x0d */
9013 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9014 .ops = &snd_hda_bind_vol,
9016 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9017 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9022 /* mute/unmute internal speaker according to the hp jack and mute state */
9023 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9025 struct alc_spec *spec = codec->spec;
9028 if (force || !spec->sense_updated) {
9029 unsigned int present_int_hp;
9030 /* need to execute and sync at first */
9031 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9032 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9033 AC_VERB_GET_PIN_SENSE, 0);
9034 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9035 spec->sense_updated = 1;
9037 if (spec->jack_present) {
9038 /* mute internal speaker */
9039 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9040 HDA_AMP_MUTE, HDA_AMP_MUTE);
9041 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9042 HDA_AMP_MUTE, HDA_AMP_MUTE);
9044 /* unmute internal speaker if necessary */
9045 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9046 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9047 HDA_AMP_MUTE, mute);
9048 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9049 HDA_AMP_MUTE, mute);
9053 /* unsolicited event for HP jack sensing */
9054 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9057 if ((res >> 26) != ALC_HP_EVENT)
9059 alc262_lenovo_3000_automute(codec, 1);
9062 /* bind hp and internal speaker mute (with plug check) */
9063 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9064 struct snd_ctl_elem_value *ucontrol)
9066 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9067 long *valp = ucontrol->value.integer.value;
9070 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9072 valp ? 0 : HDA_AMP_MUTE);
9073 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9075 valp ? 0 : HDA_AMP_MUTE);
9078 alc262_fujitsu_automute(codec, 0);
9082 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9083 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9086 .name = "Master Playback Switch",
9087 .info = snd_hda_mixer_amp_switch_info,
9088 .get = snd_hda_mixer_amp_switch_get,
9089 .put = alc262_fujitsu_master_sw_put,
9090 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9094 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9095 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9099 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9100 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9101 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9105 /* bind hp and internal speaker mute (with plug check) */
9106 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9107 struct snd_ctl_elem_value *ucontrol)
9109 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9110 long *valp = ucontrol->value.integer.value;
9113 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9115 valp ? 0 : HDA_AMP_MUTE);
9118 alc262_lenovo_3000_automute(codec, 0);
9122 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9123 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9125 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9126 .name = "Master Playback Switch",
9127 .info = snd_hda_mixer_amp_switch_info,
9128 .get = snd_hda_mixer_amp_switch_get,
9129 .put = alc262_lenovo_3000_master_sw_put,
9130 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9132 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9133 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9134 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9137 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9138 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9139 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9143 /* additional init verbs for Benq laptops */
9144 static struct hda_verb alc262_EAPD_verbs[] = {
9145 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9146 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9150 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9151 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9152 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9154 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9155 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9159 /* Samsung Q1 Ultra Vista model setup */
9160 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9161 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9162 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9165 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9166 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9170 static struct hda_verb alc262_ultra_verbs[] = {
9172 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9174 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9178 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9179 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9183 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9184 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9185 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9187 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9189 /* ADC, choose mic */
9190 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9203 /* mute/unmute internal speaker according to the hp jack and mute state */
9204 static void alc262_ultra_automute(struct hda_codec *codec)
9206 struct alc_spec *spec = codec->spec;
9210 /* auto-mute only when HP is used as HP */
9211 if (!spec->cur_mux[0]) {
9212 unsigned int present;
9213 /* need to execute and sync at first */
9214 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9215 present = snd_hda_codec_read(codec, 0x15, 0,
9216 AC_VERB_GET_PIN_SENSE, 0);
9217 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9218 if (spec->jack_present)
9219 mute = HDA_AMP_MUTE;
9221 /* mute/unmute internal speaker */
9222 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9223 HDA_AMP_MUTE, mute);
9224 /* mute/unmute HP */
9225 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9226 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9229 /* unsolicited event for HP jack sensing */
9230 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9233 if ((res >> 26) != ALC880_HP_EVENT)
9235 alc262_ultra_automute(codec);
9238 static struct hda_input_mux alc262_ultra_capture_source = {
9242 { "Headphone", 0x7 },
9246 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9247 struct snd_ctl_elem_value *ucontrol)
9249 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9250 struct alc_spec *spec = codec->spec;
9253 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9256 /* reprogram the HP pin as mic or HP according to the input source */
9257 snd_hda_codec_write_cache(codec, 0x15, 0,
9258 AC_VERB_SET_PIN_WIDGET_CONTROL,
9259 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9260 alc262_ultra_automute(codec); /* mute/unmute HP */
9264 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9265 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9266 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9268 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9269 .name = "Capture Source",
9270 .info = alc882_mux_enum_info,
9271 .get = alc882_mux_enum_get,
9272 .put = alc262_ultra_mux_enum_put,
9277 /* add playback controls from the parsed DAC table */
9278 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9279 const struct auto_pin_cfg *cfg)
9284 spec->multiout.num_dacs = 1; /* only use one dac */
9285 spec->multiout.dac_nids = spec->private_dac_nids;
9286 spec->multiout.dac_nids[0] = 2;
9288 nid = cfg->line_out_pins[0];
9290 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9291 "Front Playback Volume",
9292 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9295 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9296 "Front Playback Switch",
9297 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9302 nid = cfg->speaker_pins[0];
9305 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9306 "Speaker Playback Volume",
9307 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9311 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9312 "Speaker Playback Switch",
9313 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9318 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9319 "Speaker Playback Switch",
9320 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9326 nid = cfg->hp_pins[0];
9328 /* spec->multiout.hp_nid = 2; */
9330 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9331 "Headphone Playback Volume",
9332 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9336 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9337 "Headphone Playback Switch",
9338 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9343 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9344 "Headphone Playback Switch",
9345 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9354 /* identical with ALC880 */
9355 #define alc262_auto_create_analog_input_ctls \
9356 alc880_auto_create_analog_input_ctls
9359 * generic initialization of ADC, input mixers and output mixers
9361 static struct hda_verb alc262_volume_init_verbs[] = {
9363 * Unmute ADC0-2 and set the default input to mic-in
9365 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9367 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9368 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9369 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9370 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9372 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9374 * Note: PASD motherboards uses the Line In 2 as the input for
9375 * front panel mic (mic 2)
9377 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9382 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9385 * Set up output mixers (0x0c - 0x0f)
9387 /* set vol=0 to output mixers */
9388 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9389 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9390 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9392 /* set up input amps for analog loopback */
9393 /* Amp Indices: DAC = 0, mixer = 1 */
9394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9396 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9397 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9398 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9399 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9401 /* FIXME: use matrix-type input source selection */
9402 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9403 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9410 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9422 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9424 * Unmute ADC0-2 and set the default input to mic-in
9426 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9428 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9429 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9430 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9431 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9433 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9435 * Note: PASD motherboards uses the Line In 2 as the input for
9436 * front panel mic (mic 2)
9438 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9442 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9448 * Set up output mixers (0x0c - 0x0e)
9450 /* set vol=0 to output mixers */
9451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9452 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9453 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9455 /* set up input amps for analog loopback */
9456 /* Amp Indices: DAC = 0, mixer = 1 */
9457 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9458 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9459 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9460 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9461 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9462 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9464 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9466 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9468 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9471 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9472 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9475 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9476 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9478 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9481 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9482 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9483 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9484 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9485 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9488 /* FIXME: use matrix-type input source selection */
9489 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9490 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9496 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9497 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9499 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9506 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9511 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9513 * Unmute ADC0-2 and set the default input to mic-in
9515 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9516 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9517 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9518 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9519 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9520 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9522 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9524 * Note: PASD motherboards uses the Line In 2 as the input for front
9527 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9531 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9532 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9533 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9535 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9537 * Set up output mixers (0x0c - 0x0e)
9539 /* set vol=0 to output mixers */
9540 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9541 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9544 /* set up input amps for analog loopback */
9545 /* Amp Indices: DAC = 0, mixer = 1 */
9546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9550 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9551 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9554 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9555 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9556 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9557 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9558 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9560 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9562 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9565 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9566 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9568 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9569 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9570 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9571 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9572 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9573 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9575 /* FIXME: use matrix-type input source selection */
9576 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9577 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9580 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9581 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9582 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9583 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9584 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9586 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9588 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9591 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9598 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9599 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9602 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9607 #ifdef CONFIG_SND_HDA_POWER_SAVE
9608 #define alc262_loopbacks alc880_loopbacks
9611 /* pcm configuration: identiacal with ALC880 */
9612 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9613 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9614 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9615 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9618 * BIOS auto configuration
9620 static int alc262_parse_auto_config(struct hda_codec *codec)
9622 struct alc_spec *spec = codec->spec;
9624 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9626 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9630 if (!spec->autocfg.line_outs)
9631 return 0; /* can't find valid BIOS pin config */
9632 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9635 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9639 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9641 if (spec->autocfg.dig_out_pin)
9642 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9643 if (spec->autocfg.dig_in_pin)
9644 spec->dig_in_nid = ALC262_DIGIN_NID;
9646 if (spec->kctl_alloc)
9647 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9649 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9650 spec->num_mux_defs = 1;
9651 spec->input_mux = &spec->private_imux;
9653 err = alc_auto_add_mic_boost(codec);
9660 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9661 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9662 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9665 /* init callback for auto-configuration model -- overriding the default init */
9666 static void alc262_auto_init(struct hda_codec *codec)
9668 struct alc_spec *spec = codec->spec;
9669 alc262_auto_init_multi_out(codec);
9670 alc262_auto_init_hp_out(codec);
9671 alc262_auto_init_analog_input(codec);
9672 if (spec->unsol_event)
9673 alc_sku_automute(codec);
9677 * configuration and preset
9679 static const char *alc262_models[ALC262_MODEL_LAST] = {
9680 [ALC262_BASIC] = "basic",
9681 [ALC262_HIPPO] = "hippo",
9682 [ALC262_HIPPO_1] = "hippo_1",
9683 [ALC262_FUJITSU] = "fujitsu",
9684 [ALC262_HP_BPC] = "hp-bpc",
9685 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9686 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9687 [ALC262_HP_RP5700] = "hp-rp5700",
9688 [ALC262_BENQ_ED8] = "benq",
9689 [ALC262_BENQ_T31] = "benq-t31",
9690 [ALC262_SONY_ASSAMD] = "sony-assamd",
9691 [ALC262_ULTRA] = "ultra",
9692 [ALC262_LENOVO_3000] = "lenovo-3000",
9693 [ALC262_AUTO] = "auto",
9696 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9697 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9698 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9699 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9700 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9701 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9702 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9703 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9704 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9705 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9706 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9707 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9708 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9709 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9710 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9711 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9712 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9713 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9714 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9715 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9716 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9717 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9718 ALC262_HP_TC_T5735),
9719 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9720 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9721 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9722 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9723 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9724 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9725 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9726 ALC262_SONY_ASSAMD),
9727 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9728 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9729 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9730 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9731 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9732 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9733 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9734 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9738 static struct alc_config_preset alc262_presets[] = {
9740 .mixers = { alc262_base_mixer },
9741 .init_verbs = { alc262_init_verbs },
9742 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9743 .dac_nids = alc262_dac_nids,
9745 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9746 .channel_mode = alc262_modes,
9747 .input_mux = &alc262_capture_source,
9750 .mixers = { alc262_base_mixer },
9751 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9752 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9753 .dac_nids = alc262_dac_nids,
9755 .dig_out_nid = ALC262_DIGOUT_NID,
9756 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9757 .channel_mode = alc262_modes,
9758 .input_mux = &alc262_capture_source,
9759 .unsol_event = alc262_hippo_unsol_event,
9760 .init_hook = alc262_hippo_automute,
9762 [ALC262_HIPPO_1] = {
9763 .mixers = { alc262_hippo1_mixer },
9764 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9765 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9766 .dac_nids = alc262_dac_nids,
9768 .dig_out_nid = ALC262_DIGOUT_NID,
9769 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9770 .channel_mode = alc262_modes,
9771 .input_mux = &alc262_capture_source,
9772 .unsol_event = alc262_hippo1_unsol_event,
9773 .init_hook = alc262_hippo1_automute,
9775 [ALC262_FUJITSU] = {
9776 .mixers = { alc262_fujitsu_mixer },
9777 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9778 alc262_fujitsu_unsol_verbs },
9779 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9780 .dac_nids = alc262_dac_nids,
9782 .dig_out_nid = ALC262_DIGOUT_NID,
9783 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9784 .channel_mode = alc262_modes,
9785 .input_mux = &alc262_fujitsu_capture_source,
9786 .unsol_event = alc262_fujitsu_unsol_event,
9787 .init_hook = alc262_fujitsu_init_hook,
9790 .mixers = { alc262_HP_BPC_mixer },
9791 .init_verbs = { alc262_HP_BPC_init_verbs },
9792 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9793 .dac_nids = alc262_dac_nids,
9795 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9796 .channel_mode = alc262_modes,
9797 .input_mux = &alc262_HP_capture_source,
9798 .unsol_event = alc262_hp_bpc_unsol_event,
9799 .init_hook = alc262_hp_bpc_automute,
9801 [ALC262_HP_BPC_D7000_WF] = {
9802 .mixers = { alc262_HP_BPC_WildWest_mixer },
9803 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9804 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9805 .dac_nids = alc262_dac_nids,
9807 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9808 .channel_mode = alc262_modes,
9809 .input_mux = &alc262_HP_D7000_capture_source,
9810 .unsol_event = alc262_hp_wildwest_unsol_event,
9811 .init_hook = alc262_hp_wildwest_automute,
9813 [ALC262_HP_BPC_D7000_WL] = {
9814 .mixers = { alc262_HP_BPC_WildWest_mixer,
9815 alc262_HP_BPC_WildWest_option_mixer },
9816 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9817 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9818 .dac_nids = alc262_dac_nids,
9820 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9821 .channel_mode = alc262_modes,
9822 .input_mux = &alc262_HP_D7000_capture_source,
9823 .unsol_event = alc262_hp_wildwest_unsol_event,
9824 .init_hook = alc262_hp_wildwest_automute,
9826 [ALC262_HP_TC_T5735] = {
9827 .mixers = { alc262_hp_t5735_mixer },
9828 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9829 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9830 .dac_nids = alc262_dac_nids,
9832 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9833 .channel_mode = alc262_modes,
9834 .input_mux = &alc262_capture_source,
9835 .unsol_event = alc262_hp_t5735_unsol_event,
9836 .init_hook = alc262_hp_t5735_init_hook,
9838 [ALC262_HP_RP5700] = {
9839 .mixers = { alc262_hp_rp5700_mixer },
9840 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9841 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9842 .dac_nids = alc262_dac_nids,
9843 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9844 .channel_mode = alc262_modes,
9845 .input_mux = &alc262_hp_rp5700_capture_source,
9847 [ALC262_BENQ_ED8] = {
9848 .mixers = { alc262_base_mixer },
9849 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9850 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9851 .dac_nids = alc262_dac_nids,
9853 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9854 .channel_mode = alc262_modes,
9855 .input_mux = &alc262_capture_source,
9857 [ALC262_SONY_ASSAMD] = {
9858 .mixers = { alc262_sony_mixer },
9859 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9860 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9861 .dac_nids = alc262_dac_nids,
9863 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9864 .channel_mode = alc262_modes,
9865 .input_mux = &alc262_capture_source,
9866 .unsol_event = alc262_hippo_unsol_event,
9867 .init_hook = alc262_hippo_automute,
9869 [ALC262_BENQ_T31] = {
9870 .mixers = { alc262_benq_t31_mixer },
9871 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9872 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9873 .dac_nids = alc262_dac_nids,
9875 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9876 .channel_mode = alc262_modes,
9877 .input_mux = &alc262_capture_source,
9878 .unsol_event = alc262_hippo_unsol_event,
9879 .init_hook = alc262_hippo_automute,
9882 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9883 .init_verbs = { alc262_ultra_verbs },
9884 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9885 .dac_nids = alc262_dac_nids,
9886 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9887 .channel_mode = alc262_modes,
9888 .input_mux = &alc262_ultra_capture_source,
9889 .adc_nids = alc262_adc_nids, /* ADC0 */
9890 .capsrc_nids = alc262_capsrc_nids,
9891 .num_adc_nids = 1, /* single ADC */
9892 .unsol_event = alc262_ultra_unsol_event,
9893 .init_hook = alc262_ultra_automute,
9895 [ALC262_LENOVO_3000] = {
9896 .mixers = { alc262_lenovo_3000_mixer },
9897 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9898 alc262_lenovo_3000_unsol_verbs },
9899 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9900 .dac_nids = alc262_dac_nids,
9902 .dig_out_nid = ALC262_DIGOUT_NID,
9903 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9904 .channel_mode = alc262_modes,
9905 .input_mux = &alc262_fujitsu_capture_source,
9906 .unsol_event = alc262_lenovo_3000_unsol_event,
9910 static int patch_alc262(struct hda_codec *codec)
9912 struct alc_spec *spec;
9916 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9922 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9927 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9928 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9929 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9930 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9934 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9936 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9940 if (board_config < 0) {
9941 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9942 "trying auto-probe from BIOS...\n");
9943 board_config = ALC262_AUTO;
9946 if (board_config == ALC262_AUTO) {
9947 /* automatic parse from the BIOS config */
9948 err = alc262_parse_auto_config(codec);
9954 "hda_codec: Cannot set up configuration "
9955 "from BIOS. Using base mode...\n");
9956 board_config = ALC262_BASIC;
9960 if (board_config != ALC262_AUTO)
9961 setup_preset(spec, &alc262_presets[board_config]);
9963 spec->stream_name_analog = "ALC262 Analog";
9964 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9965 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9967 spec->stream_name_digital = "ALC262 Digital";
9968 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9969 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9971 if (!spec->adc_nids && spec->input_mux) {
9972 /* check whether NID 0x07 is valid */
9973 unsigned int wcap = get_wcaps(codec, 0x07);
9976 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9977 if (wcap != AC_WID_AUD_IN) {
9978 spec->adc_nids = alc262_adc_nids_alt;
9979 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9980 spec->capsrc_nids = alc262_capsrc_nids_alt;
9981 spec->mixers[spec->num_mixers] =
9982 alc262_capture_alt_mixer;
9985 spec->adc_nids = alc262_adc_nids;
9986 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9987 spec->capsrc_nids = alc262_capsrc_nids;
9988 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9993 spec->vmaster_nid = 0x0c;
9995 codec->patch_ops = alc_patch_ops;
9996 if (board_config == ALC262_AUTO)
9997 spec->init_hook = alc262_auto_init;
9998 #ifdef CONFIG_SND_HDA_POWER_SAVE
9999 if (!spec->loopback.amplist)
10000 spec->loopback.amplist = alc262_loopbacks;
10007 * ALC268 channel source setting (2 channel)
10009 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10010 #define alc268_modes alc260_modes
10012 static hda_nid_t alc268_dac_nids[2] = {
10017 static hda_nid_t alc268_adc_nids[2] = {
10022 static hda_nid_t alc268_adc_nids_alt[1] = {
10027 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10029 static struct snd_kcontrol_new alc268_base_mixer[] = {
10030 /* output mixer control */
10031 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10032 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10033 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10034 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10036 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10037 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10041 /* bind Beep switches of both NID 0x0f and 0x10 */
10042 static struct hda_bind_ctls alc268_bind_beep_sw = {
10043 .ops = &snd_hda_bind_sw,
10045 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10046 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10051 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10052 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10053 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10057 static struct hda_verb alc268_eapd_verbs[] = {
10058 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10059 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10063 /* Toshiba specific */
10064 #define alc268_toshiba_automute alc262_hippo_automute
10066 static struct hda_verb alc268_toshiba_verbs[] = {
10067 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10071 /* Acer specific */
10072 /* bind volumes of both NID 0x02 and 0x03 */
10073 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10074 .ops = &snd_hda_bind_vol,
10076 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10077 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10082 /* mute/unmute internal speaker according to the hp jack and mute state */
10083 static void alc268_acer_automute(struct hda_codec *codec, int force)
10085 struct alc_spec *spec = codec->spec;
10088 if (force || !spec->sense_updated) {
10089 unsigned int present;
10090 present = snd_hda_codec_read(codec, 0x14, 0,
10091 AC_VERB_GET_PIN_SENSE, 0);
10092 spec->jack_present = (present & 0x80000000) != 0;
10093 spec->sense_updated = 1;
10095 if (spec->jack_present)
10096 mute = HDA_AMP_MUTE; /* mute internal speaker */
10097 else /* unmute internal speaker if necessary */
10098 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10099 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10100 HDA_AMP_MUTE, mute);
10104 /* bind hp and internal speaker mute (with plug check) */
10105 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10106 struct snd_ctl_elem_value *ucontrol)
10108 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10109 long *valp = ucontrol->value.integer.value;
10112 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10114 valp[0] ? 0 : HDA_AMP_MUTE);
10115 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10117 valp[1] ? 0 : HDA_AMP_MUTE);
10119 alc268_acer_automute(codec, 0);
10123 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10124 /* output mixer control */
10125 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10127 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10128 .name = "Master Playback Switch",
10129 .info = snd_hda_mixer_amp_switch_info,
10130 .get = snd_hda_mixer_amp_switch_get,
10131 .put = alc268_acer_master_sw_put,
10132 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10134 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10135 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10136 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10140 static struct hda_verb alc268_acer_verbs[] = {
10141 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10142 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10143 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10145 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10146 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10148 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10152 /* unsolicited event for HP jack sensing */
10153 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10156 if ((res >> 26) != ALC880_HP_EVENT)
10158 alc268_toshiba_automute(codec);
10161 static void alc268_acer_unsol_event(struct hda_codec *codec,
10164 if ((res >> 26) != ALC880_HP_EVENT)
10166 alc268_acer_automute(codec, 1);
10169 static void alc268_acer_init_hook(struct hda_codec *codec)
10171 alc268_acer_automute(codec, 1);
10174 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10175 /* output mixer control */
10176 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10177 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10178 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10179 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10180 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10181 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10185 static struct hda_verb alc268_dell_verbs[] = {
10186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10187 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10188 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10192 /* mute/unmute internal speaker according to the hp jack and mute state */
10193 static void alc268_dell_automute(struct hda_codec *codec)
10195 unsigned int present;
10198 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10199 if (present & 0x80000000)
10200 mute = HDA_AMP_MUTE;
10202 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10203 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10204 HDA_AMP_MUTE, mute);
10207 static void alc268_dell_unsol_event(struct hda_codec *codec,
10210 if ((res >> 26) != ALC880_HP_EVENT)
10212 alc268_dell_automute(codec);
10215 #define alc268_dell_init_hook alc268_dell_automute
10217 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10218 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10219 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10220 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10221 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10222 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10223 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10224 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10225 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10229 static struct hda_verb alc267_quanta_il1_verbs[] = {
10230 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10231 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10235 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10237 unsigned int present;
10239 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10240 & AC_PINSENSE_PRESENCE;
10241 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10242 present ? 0 : PIN_OUT);
10245 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10247 unsigned int present;
10249 present = snd_hda_codec_read(codec, 0x18, 0,
10250 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10251 snd_hda_codec_write(codec, 0x23, 0,
10252 AC_VERB_SET_CONNECT_SEL,
10253 present ? 0x00 : 0x01);
10256 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10258 alc267_quanta_il1_hp_automute(codec);
10259 alc267_quanta_il1_mic_automute(codec);
10262 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10265 switch (res >> 26) {
10266 case ALC880_HP_EVENT:
10267 alc267_quanta_il1_hp_automute(codec);
10269 case ALC880_MIC_EVENT:
10270 alc267_quanta_il1_mic_automute(codec);
10276 * generic initialization of ADC, input mixers and output mixers
10278 static struct hda_verb alc268_base_init_verbs[] = {
10279 /* Unmute DAC0-1 and set vol = 0 */
10280 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10281 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10282 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10283 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10284 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10285 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10288 * Set up output mixers (0x0c - 0x0e)
10290 /* set vol=0 to output mixers */
10291 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10293 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10294 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10296 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10297 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10300 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10301 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10302 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10303 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10305 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10306 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10308 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10309 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10310 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10311 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10312 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10313 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10314 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10316 /* set PCBEEP vol = 0, mute connections */
10317 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10318 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10319 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10321 /* Unmute Selector 23h,24h and set the default input to mic-in */
10323 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10325 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10332 * generic initialization of ADC, input mixers and output mixers
10334 static struct hda_verb alc268_volume_init_verbs[] = {
10335 /* set output DAC */
10336 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10337 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10338 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10339 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10342 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10343 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10344 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10345 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10349 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10351 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10353 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10354 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10355 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10356 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10358 /* set PCBEEP vol = 0, mute connections */
10359 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10360 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10361 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10366 #define alc268_mux_enum_info alc_mux_enum_info
10367 #define alc268_mux_enum_get alc_mux_enum_get
10368 #define alc268_mux_enum_put alc_mux_enum_put
10370 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10371 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10372 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10374 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10375 /* The multiple "Capture Source" controls confuse alsamixer
10376 * So call somewhat different..
10378 /* .name = "Capture Source", */
10379 .name = "Input Source",
10381 .info = alc268_mux_enum_info,
10382 .get = alc268_mux_enum_get,
10383 .put = alc268_mux_enum_put,
10388 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10389 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10390 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10391 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10392 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10394 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10395 /* The multiple "Capture Source" controls confuse alsamixer
10396 * So call somewhat different..
10398 /* .name = "Capture Source", */
10399 .name = "Input Source",
10401 .info = alc268_mux_enum_info,
10402 .get = alc268_mux_enum_get,
10403 .put = alc268_mux_enum_put,
10408 static struct hda_input_mux alc268_capture_source = {
10412 { "Front Mic", 0x1 },
10418 static struct hda_input_mux alc268_acer_capture_source = {
10422 { "Internal Mic", 0x6 },
10427 #ifdef CONFIG_SND_DEBUG
10428 static struct snd_kcontrol_new alc268_test_mixer[] = {
10429 /* Volume widgets */
10430 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10431 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10432 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10433 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10434 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10435 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10436 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10437 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10438 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10439 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10440 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10441 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10442 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10443 /* The below appears problematic on some hardwares */
10444 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10445 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10446 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10447 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10448 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10450 /* Modes for retasking pin widgets */
10451 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10452 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10453 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10454 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10456 /* Controls for GPIO pins, assuming they are configured as outputs */
10457 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10458 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10459 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10460 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10462 /* Switches to allow the digital SPDIF output pin to be enabled.
10463 * The ALC268 does not have an SPDIF input.
10465 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10467 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10468 * this output to turn on an external amplifier.
10470 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10471 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10477 /* create input playback/capture controls for the given pin */
10478 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10479 const char *ctlname, int idx)
10484 sprintf(name, "%s Playback Volume", ctlname);
10486 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10487 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10491 } else if (nid == 0x15) {
10492 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10493 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10499 sprintf(name, "%s Playback Switch", ctlname);
10500 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10501 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10507 /* add playback controls from the parsed DAC table */
10508 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10509 const struct auto_pin_cfg *cfg)
10514 spec->multiout.num_dacs = 2; /* only use one dac */
10515 spec->multiout.dac_nids = spec->private_dac_nids;
10516 spec->multiout.dac_nids[0] = 2;
10517 spec->multiout.dac_nids[1] = 3;
10519 nid = cfg->line_out_pins[0];
10521 alc268_new_analog_output(spec, nid, "Front", 0);
10523 nid = cfg->speaker_pins[0];
10525 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10526 "Speaker Playback Volume",
10527 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10531 nid = cfg->hp_pins[0];
10533 alc268_new_analog_output(spec, nid, "Headphone", 0);
10535 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10537 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10538 "Mono Playback Switch",
10539 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10546 /* create playback/capture controls for input pins */
10547 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10548 const struct auto_pin_cfg *cfg)
10550 struct hda_input_mux *imux = &spec->private_imux;
10553 for (i = 0; i < AUTO_PIN_LAST; i++) {
10554 switch(cfg->input_pins[i]) {
10556 idx1 = 0; /* Mic 1 */
10559 idx1 = 1; /* Mic 2 */
10562 idx1 = 2; /* Line In */
10569 idx1 = 6; /* digital mics */
10574 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10575 imux->items[imux->num_items].index = idx1;
10581 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10583 struct alc_spec *spec = codec->spec;
10584 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10585 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10586 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10587 unsigned int dac_vol1, dac_vol2;
10590 snd_hda_codec_write(codec, speaker_nid, 0,
10591 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10592 snd_hda_codec_write(codec, 0x0f, 0,
10593 AC_VERB_SET_AMP_GAIN_MUTE,
10595 snd_hda_codec_write(codec, 0x10, 0,
10596 AC_VERB_SET_AMP_GAIN_MUTE,
10599 snd_hda_codec_write(codec, 0x0f, 0,
10600 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10601 snd_hda_codec_write(codec, 0x10, 0,
10602 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10605 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10606 if (line_nid == 0x14)
10607 dac_vol2 = AMP_OUT_ZERO;
10608 else if (line_nid == 0x15)
10609 dac_vol1 = AMP_OUT_ZERO;
10610 if (hp_nid == 0x14)
10611 dac_vol2 = AMP_OUT_ZERO;
10612 else if (hp_nid == 0x15)
10613 dac_vol1 = AMP_OUT_ZERO;
10614 if (line_nid != 0x16 || hp_nid != 0x16 ||
10615 spec->autocfg.line_out_pins[1] != 0x16 ||
10616 spec->autocfg.line_out_pins[2] != 0x16)
10617 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10619 snd_hda_codec_write(codec, 0x02, 0,
10620 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10621 snd_hda_codec_write(codec, 0x03, 0,
10622 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10625 /* pcm configuration: identiacal with ALC880 */
10626 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10627 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10628 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10629 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10632 * BIOS auto configuration
10634 static int alc268_parse_auto_config(struct hda_codec *codec)
10636 struct alc_spec *spec = codec->spec;
10638 static hda_nid_t alc268_ignore[] = { 0 };
10640 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10644 if (!spec->autocfg.line_outs)
10645 return 0; /* can't find valid BIOS pin config */
10647 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10650 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10654 spec->multiout.max_channels = 2;
10656 /* digital only support output */
10657 if (spec->autocfg.dig_out_pin)
10658 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10660 if (spec->kctl_alloc)
10661 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10663 if (spec->autocfg.speaker_pins[0] != 0x1d)
10664 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10666 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10667 spec->num_mux_defs = 1;
10668 spec->input_mux = &spec->private_imux;
10670 err = alc_auto_add_mic_boost(codec);
10677 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10678 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10679 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10681 /* init callback for auto-configuration model -- overriding the default init */
10682 static void alc268_auto_init(struct hda_codec *codec)
10684 struct alc_spec *spec = codec->spec;
10685 alc268_auto_init_multi_out(codec);
10686 alc268_auto_init_hp_out(codec);
10687 alc268_auto_init_mono_speaker_out(codec);
10688 alc268_auto_init_analog_input(codec);
10689 if (spec->unsol_event)
10690 alc_sku_automute(codec);
10694 * configuration and preset
10696 static const char *alc268_models[ALC268_MODEL_LAST] = {
10697 [ALC267_QUANTA_IL1] = "quanta-il1",
10698 [ALC268_3ST] = "3stack",
10699 [ALC268_TOSHIBA] = "toshiba",
10700 [ALC268_ACER] = "acer",
10701 [ALC268_DELL] = "dell",
10702 [ALC268_ZEPTO] = "zepto",
10703 #ifdef CONFIG_SND_DEBUG
10704 [ALC268_TEST] = "test",
10706 [ALC268_AUTO] = "auto",
10709 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10710 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10711 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10712 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10713 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10714 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10715 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10716 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10717 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10718 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10719 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10720 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10721 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10722 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10723 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10727 static struct alc_config_preset alc268_presets[] = {
10728 [ALC267_QUANTA_IL1] = {
10729 .mixers = { alc267_quanta_il1_mixer },
10730 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10731 alc267_quanta_il1_verbs },
10732 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10733 .dac_nids = alc268_dac_nids,
10734 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10735 .adc_nids = alc268_adc_nids_alt,
10737 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10738 .channel_mode = alc268_modes,
10739 .input_mux = &alc268_capture_source,
10740 .unsol_event = alc267_quanta_il1_unsol_event,
10741 .init_hook = alc267_quanta_il1_automute,
10744 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10745 alc268_beep_mixer },
10746 .init_verbs = { alc268_base_init_verbs },
10747 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10748 .dac_nids = alc268_dac_nids,
10749 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10750 .adc_nids = alc268_adc_nids_alt,
10751 .capsrc_nids = alc268_capsrc_nids,
10753 .dig_out_nid = ALC268_DIGOUT_NID,
10754 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10755 .channel_mode = alc268_modes,
10756 .input_mux = &alc268_capture_source,
10758 [ALC268_TOSHIBA] = {
10759 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10760 alc268_beep_mixer },
10761 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10762 alc268_toshiba_verbs },
10763 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10764 .dac_nids = alc268_dac_nids,
10765 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10766 .adc_nids = alc268_adc_nids_alt,
10767 .capsrc_nids = alc268_capsrc_nids,
10769 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10770 .channel_mode = alc268_modes,
10771 .input_mux = &alc268_capture_source,
10772 .unsol_event = alc268_toshiba_unsol_event,
10773 .init_hook = alc268_toshiba_automute,
10776 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10777 alc268_beep_mixer },
10778 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10779 alc268_acer_verbs },
10780 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10781 .dac_nids = alc268_dac_nids,
10782 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10783 .adc_nids = alc268_adc_nids_alt,
10784 .capsrc_nids = alc268_capsrc_nids,
10786 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10787 .channel_mode = alc268_modes,
10788 .input_mux = &alc268_acer_capture_source,
10789 .unsol_event = alc268_acer_unsol_event,
10790 .init_hook = alc268_acer_init_hook,
10793 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10794 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10795 alc268_dell_verbs },
10796 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10797 .dac_nids = alc268_dac_nids,
10799 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10800 .channel_mode = alc268_modes,
10801 .unsol_event = alc268_dell_unsol_event,
10802 .init_hook = alc268_dell_init_hook,
10803 .input_mux = &alc268_capture_source,
10806 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10807 alc268_beep_mixer },
10808 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10809 alc268_toshiba_verbs },
10810 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10811 .dac_nids = alc268_dac_nids,
10812 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10813 .adc_nids = alc268_adc_nids_alt,
10814 .capsrc_nids = alc268_capsrc_nids,
10816 .dig_out_nid = ALC268_DIGOUT_NID,
10817 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10818 .channel_mode = alc268_modes,
10819 .input_mux = &alc268_capture_source,
10820 .unsol_event = alc268_toshiba_unsol_event,
10821 .init_hook = alc268_toshiba_automute
10823 #ifdef CONFIG_SND_DEBUG
10825 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10826 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10827 alc268_volume_init_verbs },
10828 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10829 .dac_nids = alc268_dac_nids,
10830 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10831 .adc_nids = alc268_adc_nids_alt,
10832 .capsrc_nids = alc268_capsrc_nids,
10834 .dig_out_nid = ALC268_DIGOUT_NID,
10835 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10836 .channel_mode = alc268_modes,
10837 .input_mux = &alc268_capture_source,
10842 static int patch_alc268(struct hda_codec *codec)
10844 struct alc_spec *spec;
10848 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10852 codec->spec = spec;
10854 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10858 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10859 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10860 "trying auto-probe from BIOS...\n");
10861 board_config = ALC268_AUTO;
10864 if (board_config == ALC268_AUTO) {
10865 /* automatic parse from the BIOS config */
10866 err = alc268_parse_auto_config(codec);
10872 "hda_codec: Cannot set up configuration "
10873 "from BIOS. Using base mode...\n");
10874 board_config = ALC268_3ST;
10878 if (board_config != ALC268_AUTO)
10879 setup_preset(spec, &alc268_presets[board_config]);
10881 if (codec->vendor_id == 0x10ec0267) {
10882 spec->stream_name_analog = "ALC267 Analog";
10883 spec->stream_name_digital = "ALC267 Digital";
10885 spec->stream_name_analog = "ALC268 Analog";
10886 spec->stream_name_digital = "ALC268 Digital";
10889 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10890 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10891 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10893 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10895 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10896 /* override the amp caps for beep generator */
10897 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10898 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10899 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10900 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10901 (0 << AC_AMPCAP_MUTE_SHIFT));
10903 if (!spec->adc_nids && spec->input_mux) {
10904 /* check whether NID 0x07 is valid */
10905 unsigned int wcap = get_wcaps(codec, 0x07);
10909 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10910 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10911 spec->adc_nids = alc268_adc_nids_alt;
10912 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10913 spec->mixers[spec->num_mixers] =
10914 alc268_capture_alt_mixer;
10915 spec->num_mixers++;
10917 spec->adc_nids = alc268_adc_nids;
10918 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10919 spec->mixers[spec->num_mixers] =
10920 alc268_capture_mixer;
10921 spec->num_mixers++;
10923 spec->capsrc_nids = alc268_capsrc_nids;
10924 /* set default input source */
10925 for (i = 0; i < spec->num_adc_nids; i++)
10926 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10927 0, AC_VERB_SET_CONNECT_SEL,
10928 spec->input_mux->items[0].index);
10931 spec->vmaster_nid = 0x02;
10933 codec->patch_ops = alc_patch_ops;
10934 if (board_config == ALC268_AUTO)
10935 spec->init_hook = alc268_auto_init;
10941 * ALC269 channel source setting (2 channel)
10943 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10945 #define alc269_dac_nids alc260_dac_nids
10947 static hda_nid_t alc269_adc_nids[1] = {
10952 #define alc269_modes alc260_modes
10953 #define alc269_capture_source alc880_lg_lw_capture_source
10955 static struct snd_kcontrol_new alc269_base_mixer[] = {
10956 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10957 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10958 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10959 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10962 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10963 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10964 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10965 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10966 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10967 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10971 /* capture mixer elements */
10972 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10973 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10974 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10976 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10977 /* The multiple "Capture Source" controls confuse alsamixer
10978 * So call somewhat different..
10980 /* .name = "Capture Source", */
10981 .name = "Input Source",
10983 .info = alc_mux_enum_info,
10984 .get = alc_mux_enum_get,
10985 .put = alc_mux_enum_put,
10991 * generic initialization of ADC, input mixers and output mixers
10993 static struct hda_verb alc269_init_verbs[] = {
10995 * Unmute ADC0 and set the default input to mic-in
10997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10999 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11000 * analog-loopback mixer widget
11001 * Note: PASD motherboards uses the Line In 2 as the input for
11002 * front panel mic (mic 2)
11004 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11007 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11008 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11009 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11012 * Set up output mixers (0x0c - 0x0e)
11014 /* set vol=0 to output mixers */
11015 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11016 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11018 /* set up input amps for analog loopback */
11019 /* Amp Indices: DAC = 0, mixer = 1 */
11020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11022 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11023 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11025 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11027 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11028 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11029 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11030 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11031 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11032 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11033 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11035 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11036 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11037 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11038 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11039 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11040 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11041 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11043 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11044 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11046 /* FIXME: use matrix-type input source selection */
11047 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11048 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11049 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11050 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11051 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11052 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11055 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11056 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11060 /* add playback controls from the parsed DAC table */
11061 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11062 const struct auto_pin_cfg *cfg)
11067 spec->multiout.num_dacs = 1; /* only use one dac */
11068 spec->multiout.dac_nids = spec->private_dac_nids;
11069 spec->multiout.dac_nids[0] = 2;
11071 nid = cfg->line_out_pins[0];
11073 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11074 "Front Playback Volume",
11075 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
11078 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11079 "Front Playback Switch",
11080 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11085 nid = cfg->speaker_pins[0];
11087 if (!cfg->line_out_pins[0]) {
11088 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11089 "Speaker Playback Volume",
11090 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11096 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11097 "Speaker Playback Switch",
11098 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11103 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11104 "Speaker Playback Switch",
11105 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11111 nid = cfg->hp_pins[0];
11113 /* spec->multiout.hp_nid = 2; */
11114 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
11115 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11116 "Headphone Playback Volume",
11117 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11123 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11124 "Headphone Playback Switch",
11125 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11130 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11131 "Headphone Playback Switch",
11132 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11141 #define alc269_auto_create_analog_input_ctls \
11142 alc880_auto_create_analog_input_ctls
11144 #ifdef CONFIG_SND_HDA_POWER_SAVE
11145 #define alc269_loopbacks alc880_loopbacks
11148 /* pcm configuration: identiacal with ALC880 */
11149 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11150 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11151 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11152 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
11155 * BIOS auto configuration
11157 static int alc269_parse_auto_config(struct hda_codec *codec)
11159 struct alc_spec *spec = codec->spec;
11161 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
11163 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11168 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
11171 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
11175 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11177 if (spec->autocfg.dig_out_pin)
11178 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
11180 if (spec->kctl_alloc)
11181 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11183 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
11184 spec->num_mux_defs = 1;
11185 spec->input_mux = &spec->private_imux;
11187 err = alc_auto_add_mic_boost(codec);
11194 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11195 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11196 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11199 /* init callback for auto-configuration model -- overriding the default init */
11200 static void alc269_auto_init(struct hda_codec *codec)
11202 struct alc_spec *spec = codec->spec;
11203 alc269_auto_init_multi_out(codec);
11204 alc269_auto_init_hp_out(codec);
11205 alc269_auto_init_analog_input(codec);
11206 if (spec->unsol_event)
11207 alc_sku_automute(codec);
11211 * configuration and preset
11213 static const char *alc269_models[ALC269_MODEL_LAST] = {
11214 [ALC269_BASIC] = "basic",
11217 static struct snd_pci_quirk alc269_cfg_tbl[] = {
11221 static struct alc_config_preset alc269_presets[] = {
11223 .mixers = { alc269_base_mixer },
11224 .init_verbs = { alc269_init_verbs },
11225 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11226 .dac_nids = alc269_dac_nids,
11228 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11229 .channel_mode = alc269_modes,
11230 .input_mux = &alc269_capture_source,
11234 static int patch_alc269(struct hda_codec *codec)
11236 struct alc_spec *spec;
11240 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11244 codec->spec = spec;
11246 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11248 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
11252 if (board_config < 0) {
11253 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
11254 "trying auto-probe from BIOS...\n");
11255 board_config = ALC269_AUTO;
11258 if (board_config == ALC269_AUTO) {
11259 /* automatic parse from the BIOS config */
11260 err = alc269_parse_auto_config(codec);
11266 "hda_codec: Cannot set up configuration "
11267 "from BIOS. Using base mode...\n");
11268 board_config = ALC269_BASIC;
11272 if (board_config != ALC269_AUTO)
11273 setup_preset(spec, &alc269_presets[board_config]);
11275 spec->stream_name_analog = "ALC269 Analog";
11276 spec->stream_analog_playback = &alc269_pcm_analog_playback;
11277 spec->stream_analog_capture = &alc269_pcm_analog_capture;
11279 spec->stream_name_digital = "ALC269 Digital";
11280 spec->stream_digital_playback = &alc269_pcm_digital_playback;
11281 spec->stream_digital_capture = &alc269_pcm_digital_capture;
11283 spec->adc_nids = alc269_adc_nids;
11284 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
11285 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
11286 spec->num_mixers++;
11288 codec->patch_ops = alc_patch_ops;
11289 if (board_config == ALC269_AUTO)
11290 spec->init_hook = alc269_auto_init;
11291 #ifdef CONFIG_SND_HDA_POWER_SAVE
11292 if (!spec->loopback.amplist)
11293 spec->loopback.amplist = alc269_loopbacks;
11300 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11304 * set the path ways for 2 channel output
11305 * need to set the codec line out and mic 1 pin widgets to inputs
11307 static struct hda_verb alc861_threestack_ch2_init[] = {
11308 /* set pin widget 1Ah (line in) for input */
11309 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11310 /* set pin widget 18h (mic1/2) for input, for mic also enable
11313 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11315 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11317 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11318 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11324 * need to set the codec line out and mic 1 pin widgets to outputs
11326 static struct hda_verb alc861_threestack_ch6_init[] = {
11327 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11328 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11329 /* set pin widget 18h (mic1) for output (CLFE)*/
11330 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11332 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11333 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11335 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11337 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11338 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11343 static struct hda_channel_mode alc861_threestack_modes[2] = {
11344 { 2, alc861_threestack_ch2_init },
11345 { 6, alc861_threestack_ch6_init },
11347 /* Set mic1 as input and unmute the mixer */
11348 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11349 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11350 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11353 /* Set mic1 as output and mute mixer */
11354 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11355 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11356 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11360 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11361 { 2, alc861_uniwill_m31_ch2_init },
11362 { 4, alc861_uniwill_m31_ch4_init },
11365 /* Set mic1 and line-in as input and unmute the mixer */
11366 static struct hda_verb alc861_asus_ch2_init[] = {
11367 /* set pin widget 1Ah (line in) for input */
11368 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11369 /* set pin widget 18h (mic1/2) for input, for mic also enable
11372 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11374 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11376 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11377 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11381 /* Set mic1 nad line-in as output and mute mixer */
11382 static struct hda_verb alc861_asus_ch6_init[] = {
11383 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11384 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11385 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11386 /* set pin widget 18h (mic1) for output (CLFE)*/
11387 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11388 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11389 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11390 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11392 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11394 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11395 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11400 static struct hda_channel_mode alc861_asus_modes[2] = {
11401 { 2, alc861_asus_ch2_init },
11402 { 6, alc861_asus_ch6_init },
11407 static struct snd_kcontrol_new alc861_base_mixer[] = {
11408 /* output mixer control */
11409 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11410 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11411 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11412 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11413 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11415 /*Input mixer control */
11416 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11417 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11418 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11419 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11420 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11421 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11423 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11424 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11427 /* Capture mixer control */
11428 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11429 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11431 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11432 .name = "Capture Source",
11434 .info = alc_mux_enum_info,
11435 .get = alc_mux_enum_get,
11436 .put = alc_mux_enum_put,
11441 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11442 /* output mixer control */
11443 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11444 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11445 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11446 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11447 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11449 /* Input mixer control */
11450 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11451 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11452 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11453 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11454 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11455 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11457 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11458 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11461 /* Capture mixer control */
11462 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11463 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11465 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11466 .name = "Capture Source",
11468 .info = alc_mux_enum_info,
11469 .get = alc_mux_enum_get,
11470 .put = alc_mux_enum_put,
11473 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11474 .name = "Channel Mode",
11475 .info = alc_ch_mode_info,
11476 .get = alc_ch_mode_get,
11477 .put = alc_ch_mode_put,
11478 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11483 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11484 /* output mixer control */
11485 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11487 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11489 /*Capture mixer control */
11490 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11491 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11493 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11494 .name = "Capture Source",
11496 .info = alc_mux_enum_info,
11497 .get = alc_mux_enum_get,
11498 .put = alc_mux_enum_put,
11504 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11505 /* output mixer control */
11506 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11507 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11508 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11509 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11510 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11512 /* Input mixer control */
11513 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11514 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11515 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11516 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11517 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11518 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11520 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11521 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11524 /* Capture mixer control */
11525 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11526 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11528 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11529 .name = "Capture Source",
11531 .info = alc_mux_enum_info,
11532 .get = alc_mux_enum_get,
11533 .put = alc_mux_enum_put,
11536 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11537 .name = "Channel Mode",
11538 .info = alc_ch_mode_info,
11539 .get = alc_ch_mode_get,
11540 .put = alc_ch_mode_put,
11541 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11546 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11547 /* output mixer control */
11548 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11549 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11550 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11551 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11552 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11554 /* Input mixer control */
11555 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11556 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11557 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11558 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11559 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11560 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11562 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11563 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11564 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11566 /* Capture mixer control */
11567 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11568 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11570 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11571 .name = "Capture Source",
11573 .info = alc_mux_enum_info,
11574 .get = alc_mux_enum_get,
11575 .put = alc_mux_enum_put,
11578 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11579 .name = "Channel Mode",
11580 .info = alc_ch_mode_info,
11581 .get = alc_ch_mode_get,
11582 .put = alc_ch_mode_put,
11583 .private_value = ARRAY_SIZE(alc861_asus_modes),
11588 /* additional mixer */
11589 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11590 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11591 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11592 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11593 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11598 * generic initialization of ADC, input mixers and output mixers
11600 static struct hda_verb alc861_base_init_verbs[] = {
11602 * Unmute ADC0 and set the default input to mic-in
11604 /* port-A for surround (rear panel) */
11605 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11606 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11607 /* port-B for mic-in (rear panel) with vref */
11608 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11609 /* port-C for line-in (rear panel) */
11610 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11611 /* port-D for Front */
11612 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11613 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11614 /* port-E for HP out (front panel) */
11615 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11616 /* route front PCM to HP */
11617 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11618 /* port-F for mic-in (front panel) with vref */
11619 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11620 /* port-G for CLFE (rear panel) */
11621 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11622 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11623 /* port-H for side (rear panel) */
11624 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11625 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11627 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11628 /* route front mic to ADC1*/
11629 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11632 /* Unmute DAC0~3 & spdif out*/
11633 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11634 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11635 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11636 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11639 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11640 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11641 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11642 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11643 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11645 /* Unmute Stereo Mixer 15 */
11646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11651 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11652 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11653 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11654 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11655 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11656 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11657 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11658 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11659 /* hp used DAC 3 (Front) */
11660 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11661 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11666 static struct hda_verb alc861_threestack_init_verbs[] = {
11668 * Unmute ADC0 and set the default input to mic-in
11670 /* port-A for surround (rear panel) */
11671 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11672 /* port-B for mic-in (rear panel) with vref */
11673 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11674 /* port-C for line-in (rear panel) */
11675 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11676 /* port-D for Front */
11677 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11678 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11679 /* port-E for HP out (front panel) */
11680 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11681 /* route front PCM to HP */
11682 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11683 /* port-F for mic-in (front panel) with vref */
11684 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11685 /* port-G for CLFE (rear panel) */
11686 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11687 /* port-H for side (rear panel) */
11688 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11690 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11691 /* route front mic to ADC1*/
11692 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11693 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11694 /* Unmute DAC0~3 & spdif out*/
11695 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11696 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11697 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11698 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11701 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11702 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11703 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11704 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11705 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11707 /* Unmute Stereo Mixer 15 */
11708 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11709 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11710 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11711 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11713 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11714 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11715 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11716 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11717 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11718 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11719 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11720 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11721 /* hp used DAC 3 (Front) */
11722 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11723 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11727 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11729 * Unmute ADC0 and set the default input to mic-in
11731 /* port-A for surround (rear panel) */
11732 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11733 /* port-B for mic-in (rear panel) with vref */
11734 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11735 /* port-C for line-in (rear panel) */
11736 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11737 /* port-D for Front */
11738 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11739 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11740 /* port-E for HP out (front panel) */
11741 /* this has to be set to VREF80 */
11742 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11743 /* route front PCM to HP */
11744 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11745 /* port-F for mic-in (front panel) with vref */
11746 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11747 /* port-G for CLFE (rear panel) */
11748 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11749 /* port-H for side (rear panel) */
11750 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11752 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11753 /* route front mic to ADC1*/
11754 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11755 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11756 /* Unmute DAC0~3 & spdif out*/
11757 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11758 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11759 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11760 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11761 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11763 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11764 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11765 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11766 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11767 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11769 /* Unmute Stereo Mixer 15 */
11770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11772 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11775 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11776 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11777 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11778 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11779 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11780 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11781 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11782 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11783 /* hp used DAC 3 (Front) */
11784 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11785 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11789 static struct hda_verb alc861_asus_init_verbs[] = {
11791 * Unmute ADC0 and set the default input to mic-in
11793 /* port-A for surround (rear panel)
11794 * according to codec#0 this is the HP jack
11796 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11797 /* route front PCM to HP */
11798 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11799 /* port-B for mic-in (rear panel) with vref */
11800 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11801 /* port-C for line-in (rear panel) */
11802 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11803 /* port-D for Front */
11804 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11805 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11806 /* port-E for HP out (front panel) */
11807 /* this has to be set to VREF80 */
11808 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11809 /* route front PCM to HP */
11810 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11811 /* port-F for mic-in (front panel) with vref */
11812 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11813 /* port-G for CLFE (rear panel) */
11814 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11815 /* port-H for side (rear panel) */
11816 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11818 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11819 /* route front mic to ADC1*/
11820 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11821 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11822 /* Unmute DAC0~3 & spdif out*/
11823 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11824 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11825 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11826 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11827 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11828 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11829 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11830 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11831 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11832 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11834 /* Unmute Stereo Mixer 15 */
11835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11840 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11841 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11842 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11843 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11844 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11845 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11846 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11847 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11848 /* hp used DAC 3 (Front) */
11849 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11850 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11854 /* additional init verbs for ASUS laptops */
11855 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11856 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11857 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11862 * generic initialization of ADC, input mixers and output mixers
11864 static struct hda_verb alc861_auto_init_verbs[] = {
11866 * Unmute ADC0 and set the default input to mic-in
11868 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11869 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11871 /* Unmute DAC0~3 & spdif out*/
11872 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11873 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11874 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11875 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11876 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11878 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11879 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11880 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11881 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11882 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11884 /* Unmute Stereo Mixer 15 */
11885 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11886 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11887 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11890 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11891 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11892 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11893 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11894 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11895 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11896 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11897 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11899 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11900 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11901 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11902 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11903 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11904 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11905 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11906 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11908 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11913 static struct hda_verb alc861_toshiba_init_verbs[] = {
11914 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11919 /* toggle speaker-output according to the hp-jack state */
11920 static void alc861_toshiba_automute(struct hda_codec *codec)
11922 unsigned int present;
11924 present = snd_hda_codec_read(codec, 0x0f, 0,
11925 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11926 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11927 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11928 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11929 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11932 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11935 if ((res >> 26) == ALC880_HP_EVENT)
11936 alc861_toshiba_automute(codec);
11939 /* pcm configuration: identiacal with ALC880 */
11940 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11941 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11942 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11943 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11946 #define ALC861_DIGOUT_NID 0x07
11948 static struct hda_channel_mode alc861_8ch_modes[1] = {
11952 static hda_nid_t alc861_dac_nids[4] = {
11953 /* front, surround, clfe, side */
11954 0x03, 0x06, 0x05, 0x04
11957 static hda_nid_t alc660_dac_nids[3] = {
11958 /* front, clfe, surround */
11962 static hda_nid_t alc861_adc_nids[1] = {
11967 static struct hda_input_mux alc861_capture_source = {
11971 { "Front Mic", 0x3 },
11978 /* fill in the dac_nids table from the parsed pin configuration */
11979 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11980 const struct auto_pin_cfg *cfg)
11985 spec->multiout.dac_nids = spec->private_dac_nids;
11986 for (i = 0; i < cfg->line_outs; i++) {
11987 nid = cfg->line_out_pins[i];
11989 if (i >= ARRAY_SIZE(alc861_dac_nids))
11991 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11994 spec->multiout.num_dacs = cfg->line_outs;
11998 /* add playback controls from the parsed DAC table */
11999 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
12000 const struct auto_pin_cfg *cfg)
12003 static const char *chname[4] = {
12004 "Front", "Surround", NULL /*CLFE*/, "Side"
12009 for (i = 0; i < cfg->line_outs; i++) {
12010 nid = spec->multiout.dac_nids[i];
12015 err = add_control(spec, ALC_CTL_BIND_MUTE,
12016 "Center Playback Switch",
12017 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12021 err = add_control(spec, ALC_CTL_BIND_MUTE,
12022 "LFE Playback Switch",
12023 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12028 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
12030 if (nid == alc861_dac_nids[idx])
12032 sprintf(name, "%s Playback Switch", chname[idx]);
12033 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12034 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12043 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
12051 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
12053 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12054 "Headphone Playback Switch",
12055 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12058 spec->multiout.hp_nid = nid;
12063 /* create playback/capture controls for input pins */
12064 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
12065 const struct auto_pin_cfg *cfg)
12067 struct hda_input_mux *imux = &spec->private_imux;
12068 int i, err, idx, idx1;
12070 for (i = 0; i < AUTO_PIN_LAST; i++) {
12071 switch (cfg->input_pins[i]) {
12074 idx = 2; /* Line In */
12078 idx = 2; /* Line In */
12082 idx = 1; /* Mic In */
12086 idx = 1; /* Mic In */
12096 err = new_analog_input(spec, cfg->input_pins[i],
12097 auto_pin_cfg_labels[i], idx, 0x15);
12101 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12102 imux->items[imux->num_items].index = idx1;
12108 static struct snd_kcontrol_new alc861_capture_mixer[] = {
12109 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12110 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12114 /* The multiple "Capture Source" controls confuse alsamixer
12115 * So call somewhat different..
12117 /* .name = "Capture Source", */
12118 .name = "Input Source",
12120 .info = alc_mux_enum_info,
12121 .get = alc_mux_enum_get,
12122 .put = alc_mux_enum_put,
12127 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
12129 int pin_type, int dac_idx)
12131 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12133 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12137 static void alc861_auto_init_multi_out(struct hda_codec *codec)
12139 struct alc_spec *spec = codec->spec;
12142 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
12143 for (i = 0; i < spec->autocfg.line_outs; i++) {
12144 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12145 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12147 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
12148 spec->multiout.dac_nids[i]);
12152 static void alc861_auto_init_hp_out(struct hda_codec *codec)
12154 struct alc_spec *spec = codec->spec;
12157 pin = spec->autocfg.hp_pins[0];
12158 if (pin) /* connect to front */
12159 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
12160 spec->multiout.dac_nids[0]);
12161 pin = spec->autocfg.speaker_pins[0];
12163 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12166 static void alc861_auto_init_analog_input(struct hda_codec *codec)
12168 struct alc_spec *spec = codec->spec;
12171 for (i = 0; i < AUTO_PIN_LAST; i++) {
12172 hda_nid_t nid = spec->autocfg.input_pins[i];
12173 if (nid >= 0x0c && nid <= 0x11) {
12174 snd_hda_codec_write(codec, nid, 0,
12175 AC_VERB_SET_PIN_WIDGET_CONTROL,
12176 i <= AUTO_PIN_FRONT_MIC ?
12177 PIN_VREF80 : PIN_IN);
12182 /* parse the BIOS configuration and set up the alc_spec */
12183 /* return 1 if successful, 0 if the proper config is not found,
12184 * or a negative error code
12186 static int alc861_parse_auto_config(struct hda_codec *codec)
12188 struct alc_spec *spec = codec->spec;
12190 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12192 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12196 if (!spec->autocfg.line_outs)
12197 return 0; /* can't find valid BIOS pin config */
12199 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
12202 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
12205 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
12208 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
12212 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12214 if (spec->autocfg.dig_out_pin)
12215 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
12217 if (spec->kctl_alloc)
12218 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12220 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
12222 spec->num_mux_defs = 1;
12223 spec->input_mux = &spec->private_imux;
12225 spec->adc_nids = alc861_adc_nids;
12226 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
12227 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
12228 spec->num_mixers++;
12233 /* additional initialization for auto-configuration model */
12234 static void alc861_auto_init(struct hda_codec *codec)
12236 struct alc_spec *spec = codec->spec;
12237 alc861_auto_init_multi_out(codec);
12238 alc861_auto_init_hp_out(codec);
12239 alc861_auto_init_analog_input(codec);
12240 if (spec->unsol_event)
12241 alc_sku_automute(codec);
12244 #ifdef CONFIG_SND_HDA_POWER_SAVE
12245 static struct hda_amp_list alc861_loopbacks[] = {
12246 { 0x15, HDA_INPUT, 0 },
12247 { 0x15, HDA_INPUT, 1 },
12248 { 0x15, HDA_INPUT, 2 },
12249 { 0x15, HDA_INPUT, 3 },
12256 * configuration and preset
12258 static const char *alc861_models[ALC861_MODEL_LAST] = {
12259 [ALC861_3ST] = "3stack",
12260 [ALC660_3ST] = "3stack-660",
12261 [ALC861_3ST_DIG] = "3stack-dig",
12262 [ALC861_6ST_DIG] = "6stack-dig",
12263 [ALC861_UNIWILL_M31] = "uniwill-m31",
12264 [ALC861_TOSHIBA] = "toshiba",
12265 [ALC861_ASUS] = "asus",
12266 [ALC861_ASUS_LAPTOP] = "asus-laptop",
12267 [ALC861_AUTO] = "auto",
12270 static struct snd_pci_quirk alc861_cfg_tbl[] = {
12271 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
12272 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12273 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12274 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
12275 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
12276 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
12277 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
12278 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12279 * Any other models that need this preset?
12281 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12282 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
12283 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
12284 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
12285 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
12286 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
12287 /* FIXME: the below seems conflict */
12288 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12289 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
12290 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
12294 static struct alc_config_preset alc861_presets[] = {
12296 .mixers = { alc861_3ST_mixer },
12297 .init_verbs = { alc861_threestack_init_verbs },
12298 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12299 .dac_nids = alc861_dac_nids,
12300 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12301 .channel_mode = alc861_threestack_modes,
12303 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12304 .adc_nids = alc861_adc_nids,
12305 .input_mux = &alc861_capture_source,
12307 [ALC861_3ST_DIG] = {
12308 .mixers = { alc861_base_mixer },
12309 .init_verbs = { alc861_threestack_init_verbs },
12310 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12311 .dac_nids = alc861_dac_nids,
12312 .dig_out_nid = ALC861_DIGOUT_NID,
12313 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12314 .channel_mode = alc861_threestack_modes,
12316 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12317 .adc_nids = alc861_adc_nids,
12318 .input_mux = &alc861_capture_source,
12320 [ALC861_6ST_DIG] = {
12321 .mixers = { alc861_base_mixer },
12322 .init_verbs = { alc861_base_init_verbs },
12323 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12324 .dac_nids = alc861_dac_nids,
12325 .dig_out_nid = ALC861_DIGOUT_NID,
12326 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12327 .channel_mode = alc861_8ch_modes,
12328 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12329 .adc_nids = alc861_adc_nids,
12330 .input_mux = &alc861_capture_source,
12333 .mixers = { alc861_3ST_mixer },
12334 .init_verbs = { alc861_threestack_init_verbs },
12335 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12336 .dac_nids = alc660_dac_nids,
12337 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12338 .channel_mode = alc861_threestack_modes,
12340 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12341 .adc_nids = alc861_adc_nids,
12342 .input_mux = &alc861_capture_source,
12344 [ALC861_UNIWILL_M31] = {
12345 .mixers = { alc861_uniwill_m31_mixer },
12346 .init_verbs = { alc861_uniwill_m31_init_verbs },
12347 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12348 .dac_nids = alc861_dac_nids,
12349 .dig_out_nid = ALC861_DIGOUT_NID,
12350 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12351 .channel_mode = alc861_uniwill_m31_modes,
12353 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12354 .adc_nids = alc861_adc_nids,
12355 .input_mux = &alc861_capture_source,
12357 [ALC861_TOSHIBA] = {
12358 .mixers = { alc861_toshiba_mixer },
12359 .init_verbs = { alc861_base_init_verbs,
12360 alc861_toshiba_init_verbs },
12361 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12362 .dac_nids = alc861_dac_nids,
12363 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12364 .channel_mode = alc883_3ST_2ch_modes,
12365 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12366 .adc_nids = alc861_adc_nids,
12367 .input_mux = &alc861_capture_source,
12368 .unsol_event = alc861_toshiba_unsol_event,
12369 .init_hook = alc861_toshiba_automute,
12372 .mixers = { alc861_asus_mixer },
12373 .init_verbs = { alc861_asus_init_verbs },
12374 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12375 .dac_nids = alc861_dac_nids,
12376 .dig_out_nid = ALC861_DIGOUT_NID,
12377 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12378 .channel_mode = alc861_asus_modes,
12381 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12382 .adc_nids = alc861_adc_nids,
12383 .input_mux = &alc861_capture_source,
12385 [ALC861_ASUS_LAPTOP] = {
12386 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12387 .init_verbs = { alc861_asus_init_verbs,
12388 alc861_asus_laptop_init_verbs },
12389 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12390 .dac_nids = alc861_dac_nids,
12391 .dig_out_nid = ALC861_DIGOUT_NID,
12392 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12393 .channel_mode = alc883_3ST_2ch_modes,
12395 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12396 .adc_nids = alc861_adc_nids,
12397 .input_mux = &alc861_capture_source,
12402 static int patch_alc861(struct hda_codec *codec)
12404 struct alc_spec *spec;
12408 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12412 codec->spec = spec;
12414 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12418 if (board_config < 0) {
12419 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12420 "trying auto-probe from BIOS...\n");
12421 board_config = ALC861_AUTO;
12424 if (board_config == ALC861_AUTO) {
12425 /* automatic parse from the BIOS config */
12426 err = alc861_parse_auto_config(codec);
12432 "hda_codec: Cannot set up configuration "
12433 "from BIOS. Using base mode...\n");
12434 board_config = ALC861_3ST_DIG;
12438 if (board_config != ALC861_AUTO)
12439 setup_preset(spec, &alc861_presets[board_config]);
12441 spec->stream_name_analog = "ALC861 Analog";
12442 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12443 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12445 spec->stream_name_digital = "ALC861 Digital";
12446 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12447 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12449 spec->vmaster_nid = 0x03;
12451 codec->patch_ops = alc_patch_ops;
12452 if (board_config == ALC861_AUTO)
12453 spec->init_hook = alc861_auto_init;
12454 #ifdef CONFIG_SND_HDA_POWER_SAVE
12455 if (!spec->loopback.amplist)
12456 spec->loopback.amplist = alc861_loopbacks;
12463 * ALC861-VD support
12467 * In addition, an independent DAC
12469 #define ALC861VD_DIGOUT_NID 0x06
12471 static hda_nid_t alc861vd_dac_nids[4] = {
12472 /* front, surr, clfe, side surr */
12473 0x02, 0x03, 0x04, 0x05
12476 /* dac_nids for ALC660vd are in a different order - according to
12477 * Realtek's driver.
12478 * This should probably tesult in a different mixer for 6stack models
12479 * of ALC660vd codecs, but for now there is only 3stack mixer
12480 * - and it is the same as in 861vd.
12481 * adc_nids in ALC660vd are (is) the same as in 861vd
12483 static hda_nid_t alc660vd_dac_nids[3] = {
12484 /* front, rear, clfe, rear_surr */
12488 static hda_nid_t alc861vd_adc_nids[1] = {
12493 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12496 /* FIXME: should be a matrix-type input source selection */
12497 static struct hda_input_mux alc861vd_capture_source = {
12501 { "Front Mic", 0x1 },
12507 static struct hda_input_mux alc861vd_dallas_capture_source = {
12510 { "Ext Mic", 0x0 },
12511 { "Int Mic", 0x1 },
12515 static struct hda_input_mux alc861vd_hp_capture_source = {
12518 { "Front Mic", 0x0 },
12519 { "ATAPI Mic", 0x1 },
12523 #define alc861vd_mux_enum_info alc_mux_enum_info
12524 #define alc861vd_mux_enum_get alc_mux_enum_get
12525 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12526 #define alc861vd_mux_enum_put alc882_mux_enum_put
12531 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12538 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12539 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12540 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12541 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12542 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12549 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12550 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12551 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12552 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12553 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12557 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12558 { 6, alc861vd_6stack_ch6_init },
12559 { 8, alc861vd_6stack_ch8_init },
12562 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12564 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12565 .name = "Channel Mode",
12566 .info = alc_ch_mode_info,
12567 .get = alc_ch_mode_get,
12568 .put = alc_ch_mode_put,
12573 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12574 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12575 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12578 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12579 /* The multiple "Capture Source" controls confuse alsamixer
12580 * So call somewhat different..
12582 /* .name = "Capture Source", */
12583 .name = "Input Source",
12585 .info = alc861vd_mux_enum_info,
12586 .get = alc861vd_mux_enum_get,
12587 .put = alc861vd_mux_enum_put,
12592 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12593 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12595 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12596 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12597 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12599 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12600 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12602 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12604 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12606 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12607 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12609 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12610 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12614 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12618 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12619 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12620 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12622 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12623 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12625 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12626 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12628 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12629 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12634 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12635 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12636 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12640 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12644 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12645 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12648 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12649 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12651 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12652 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12654 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12655 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12660 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12661 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12662 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12663 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12667 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12669 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12671 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12675 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12676 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12681 /* Pin assignment: Speaker=0x14, HP = 0x15,
12682 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12684 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12685 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12686 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12687 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12688 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12689 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12690 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12691 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12692 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12693 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12694 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12695 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12696 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12700 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12701 * Front Mic=0x18, ATAPI Mic = 0x19,
12703 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12704 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12705 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12706 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12707 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12708 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12709 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12710 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12711 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12717 * generic initialization of ADC, input mixers and output mixers
12719 static struct hda_verb alc861vd_volume_init_verbs[] = {
12721 * Unmute ADC0 and set the default input to mic-in
12723 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12724 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12726 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12727 * the analog-loopback mixer widget
12729 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12736 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12738 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12743 * Set up output mixers (0x02 - 0x05)
12745 /* set vol=0 to output mixers */
12746 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12747 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12748 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12749 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12751 /* set up input amps for analog loopback */
12752 /* Amp Indices: DAC = 0, mixer = 1 */
12753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12756 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12758 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12759 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12760 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12766 * 3-stack pin configuration:
12767 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12769 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12771 * Set pin mode and muting
12773 /* set front pin widgets 0x14 for output */
12774 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12775 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12776 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12778 /* Mic (rear) pin: input vref at 80% */
12779 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12780 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12781 /* Front Mic pin: input vref at 80% */
12782 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12783 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12784 /* Line In pin: input */
12785 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12786 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12787 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12789 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12790 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12791 /* CD pin widget for input */
12792 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12798 * 6-stack pin configuration:
12800 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12802 * Set pin mode and muting
12804 /* set front pin widgets 0x14 for output */
12805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12807 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12809 /* Rear Pin: output 1 (0x0d) */
12810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12812 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12813 /* CLFE Pin: output 2 (0x0e) */
12814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12815 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12816 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12817 /* Side Pin: output 3 (0x0f) */
12818 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12819 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12820 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12822 /* Mic (rear) pin: input vref at 80% */
12823 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12824 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12825 /* Front Mic pin: input vref at 80% */
12826 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12827 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12828 /* Line In pin: input */
12829 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12830 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12831 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12832 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12833 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12834 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12835 /* CD pin widget for input */
12836 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12841 static struct hda_verb alc861vd_eapd_verbs[] = {
12842 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12846 static struct hda_verb alc660vd_eapd_verbs[] = {
12847 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12848 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12852 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12856 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12857 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12861 /* toggle speaker-output according to the hp-jack state */
12862 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12864 unsigned int present;
12865 unsigned char bits;
12867 present = snd_hda_codec_read(codec, 0x1b, 0,
12868 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12869 bits = present ? HDA_AMP_MUTE : 0;
12870 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12871 HDA_AMP_MUTE, bits);
12874 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12876 unsigned int present;
12877 unsigned char bits;
12879 present = snd_hda_codec_read(codec, 0x18, 0,
12880 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12881 bits = present ? HDA_AMP_MUTE : 0;
12882 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12883 HDA_AMP_MUTE, bits);
12886 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12888 alc861vd_lenovo_hp_automute(codec);
12889 alc861vd_lenovo_mic_automute(codec);
12892 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12895 switch (res >> 26) {
12896 case ALC880_HP_EVENT:
12897 alc861vd_lenovo_hp_automute(codec);
12899 case ALC880_MIC_EVENT:
12900 alc861vd_lenovo_mic_automute(codec);
12905 static struct hda_verb alc861vd_dallas_verbs[] = {
12906 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12907 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12908 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12909 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12913 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12914 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12916 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12917 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12918 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12920 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12921 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12922 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12923 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12924 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12925 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12926 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12927 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12929 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12930 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12931 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12932 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12934 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12935 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12936 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12940 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12941 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12943 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12944 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12945 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12950 /* toggle speaker-output according to the hp-jack state */
12951 static void alc861vd_dallas_automute(struct hda_codec *codec)
12953 unsigned int present;
12955 present = snd_hda_codec_read(codec, 0x15, 0,
12956 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12957 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12958 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12961 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12963 if ((res >> 26) == ALC880_HP_EVENT)
12964 alc861vd_dallas_automute(codec);
12967 #ifdef CONFIG_SND_HDA_POWER_SAVE
12968 #define alc861vd_loopbacks alc880_loopbacks
12971 /* pcm configuration: identiacal with ALC880 */
12972 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12973 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12974 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12975 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12978 * configuration and preset
12980 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12981 [ALC660VD_3ST] = "3stack-660",
12982 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12983 [ALC861VD_3ST] = "3stack",
12984 [ALC861VD_3ST_DIG] = "3stack-digout",
12985 [ALC861VD_6ST_DIG] = "6stack-digout",
12986 [ALC861VD_LENOVO] = "lenovo",
12987 [ALC861VD_DALLAS] = "dallas",
12988 [ALC861VD_HP] = "hp",
12989 [ALC861VD_AUTO] = "auto",
12992 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12993 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12994 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12995 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12996 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12997 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12998 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12999 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
13000 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
13001 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
13002 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
13003 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
13004 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
13005 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
13006 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
13007 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
13008 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
13012 static struct alc_config_preset alc861vd_presets[] = {
13014 .mixers = { alc861vd_3st_mixer },
13015 .init_verbs = { alc861vd_volume_init_verbs,
13016 alc861vd_3stack_init_verbs },
13017 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13018 .dac_nids = alc660vd_dac_nids,
13019 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13020 .channel_mode = alc861vd_3stack_2ch_modes,
13021 .input_mux = &alc861vd_capture_source,
13023 [ALC660VD_3ST_DIG] = {
13024 .mixers = { alc861vd_3st_mixer },
13025 .init_verbs = { alc861vd_volume_init_verbs,
13026 alc861vd_3stack_init_verbs },
13027 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13028 .dac_nids = alc660vd_dac_nids,
13029 .dig_out_nid = ALC861VD_DIGOUT_NID,
13030 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13031 .channel_mode = alc861vd_3stack_2ch_modes,
13032 .input_mux = &alc861vd_capture_source,
13035 .mixers = { alc861vd_3st_mixer },
13036 .init_verbs = { alc861vd_volume_init_verbs,
13037 alc861vd_3stack_init_verbs },
13038 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13039 .dac_nids = alc861vd_dac_nids,
13040 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13041 .channel_mode = alc861vd_3stack_2ch_modes,
13042 .input_mux = &alc861vd_capture_source,
13044 [ALC861VD_3ST_DIG] = {
13045 .mixers = { alc861vd_3st_mixer },
13046 .init_verbs = { alc861vd_volume_init_verbs,
13047 alc861vd_3stack_init_verbs },
13048 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13049 .dac_nids = alc861vd_dac_nids,
13050 .dig_out_nid = ALC861VD_DIGOUT_NID,
13051 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13052 .channel_mode = alc861vd_3stack_2ch_modes,
13053 .input_mux = &alc861vd_capture_source,
13055 [ALC861VD_6ST_DIG] = {
13056 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
13057 .init_verbs = { alc861vd_volume_init_verbs,
13058 alc861vd_6stack_init_verbs },
13059 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13060 .dac_nids = alc861vd_dac_nids,
13061 .dig_out_nid = ALC861VD_DIGOUT_NID,
13062 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
13063 .channel_mode = alc861vd_6stack_modes,
13064 .input_mux = &alc861vd_capture_source,
13066 [ALC861VD_LENOVO] = {
13067 .mixers = { alc861vd_lenovo_mixer },
13068 .init_verbs = { alc861vd_volume_init_verbs,
13069 alc861vd_3stack_init_verbs,
13070 alc861vd_eapd_verbs,
13071 alc861vd_lenovo_unsol_verbs },
13072 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13073 .dac_nids = alc660vd_dac_nids,
13074 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13075 .channel_mode = alc861vd_3stack_2ch_modes,
13076 .input_mux = &alc861vd_capture_source,
13077 .unsol_event = alc861vd_lenovo_unsol_event,
13078 .init_hook = alc861vd_lenovo_automute,
13080 [ALC861VD_DALLAS] = {
13081 .mixers = { alc861vd_dallas_mixer },
13082 .init_verbs = { alc861vd_dallas_verbs },
13083 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13084 .dac_nids = alc861vd_dac_nids,
13085 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13086 .channel_mode = alc861vd_3stack_2ch_modes,
13087 .input_mux = &alc861vd_dallas_capture_source,
13088 .unsol_event = alc861vd_dallas_unsol_event,
13089 .init_hook = alc861vd_dallas_automute,
13092 .mixers = { alc861vd_hp_mixer },
13093 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
13094 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13095 .dac_nids = alc861vd_dac_nids,
13096 .dig_out_nid = ALC861VD_DIGOUT_NID,
13097 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13098 .channel_mode = alc861vd_3stack_2ch_modes,
13099 .input_mux = &alc861vd_hp_capture_source,
13100 .unsol_event = alc861vd_dallas_unsol_event,
13101 .init_hook = alc861vd_dallas_automute,
13106 * BIOS auto configuration
13108 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
13109 hda_nid_t nid, int pin_type, int dac_idx)
13111 alc_set_pin_output(codec, nid, pin_type);
13114 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
13116 struct alc_spec *spec = codec->spec;
13119 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13120 for (i = 0; i <= HDA_SIDE; i++) {
13121 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13122 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13124 alc861vd_auto_set_output_and_unmute(codec, nid,
13130 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
13132 struct alc_spec *spec = codec->spec;
13135 pin = spec->autocfg.hp_pins[0];
13136 if (pin) /* connect to front and use dac 0 */
13137 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13138 pin = spec->autocfg.speaker_pins[0];
13140 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13143 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13144 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13146 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
13148 struct alc_spec *spec = codec->spec;
13151 for (i = 0; i < AUTO_PIN_LAST; i++) {
13152 hda_nid_t nid = spec->autocfg.input_pins[i];
13153 if (alc861vd_is_input_pin(nid)) {
13154 snd_hda_codec_write(codec, nid, 0,
13155 AC_VERB_SET_PIN_WIDGET_CONTROL,
13156 i <= AUTO_PIN_FRONT_MIC ?
13157 PIN_VREF80 : PIN_IN);
13158 if (nid != ALC861VD_PIN_CD_NID)
13159 snd_hda_codec_write(codec, nid, 0,
13160 AC_VERB_SET_AMP_GAIN_MUTE,
13166 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13167 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13169 /* add playback controls from the parsed DAC table */
13170 /* Based on ALC880 version. But ALC861VD has separate,
13171 * different NIDs for mute/unmute switch and volume control */
13172 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
13173 const struct auto_pin_cfg *cfg)
13176 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
13177 hda_nid_t nid_v, nid_s;
13180 for (i = 0; i < cfg->line_outs; i++) {
13181 if (!spec->multiout.dac_nids[i])
13183 nid_v = alc861vd_idx_to_mixer_vol(
13185 spec->multiout.dac_nids[i]));
13186 nid_s = alc861vd_idx_to_mixer_switch(
13188 spec->multiout.dac_nids[i]));
13192 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13193 "Center Playback Volume",
13194 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
13198 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13199 "LFE Playback Volume",
13200 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
13204 err = add_control(spec, ALC_CTL_BIND_MUTE,
13205 "Center Playback Switch",
13206 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
13210 err = add_control(spec, ALC_CTL_BIND_MUTE,
13211 "LFE Playback Switch",
13212 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
13217 sprintf(name, "%s Playback Volume", chname[i]);
13218 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13219 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
13223 sprintf(name, "%s Playback Switch", chname[i]);
13224 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13225 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
13234 /* add playback controls for speaker and HP outputs */
13235 /* Based on ALC880 version. But ALC861VD has separate,
13236 * different NIDs for mute/unmute switch and volume control */
13237 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
13238 hda_nid_t pin, const char *pfx)
13240 hda_nid_t nid_v, nid_s;
13247 if (alc880_is_fixed_pin(pin)) {
13248 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13249 /* specify the DAC as the extra output */
13250 if (!spec->multiout.hp_nid)
13251 spec->multiout.hp_nid = nid_v;
13253 spec->multiout.extra_out_nid[0] = nid_v;
13254 /* control HP volume/switch on the output mixer amp */
13255 nid_v = alc861vd_idx_to_mixer_vol(
13256 alc880_fixed_pin_idx(pin));
13257 nid_s = alc861vd_idx_to_mixer_switch(
13258 alc880_fixed_pin_idx(pin));
13260 sprintf(name, "%s Playback Volume", pfx);
13261 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13262 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
13265 sprintf(name, "%s Playback Switch", pfx);
13266 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13267 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
13270 } else if (alc880_is_multi_pin(pin)) {
13271 /* set manual connection */
13272 /* we have only a switch on HP-out PIN */
13273 sprintf(name, "%s Playback Switch", pfx);
13274 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13275 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13282 /* parse the BIOS configuration and set up the alc_spec
13283 * return 1 if successful, 0 if the proper config is not found,
13284 * or a negative error code
13285 * Based on ALC880 version - had to change it to override
13286 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13287 static int alc861vd_parse_auto_config(struct hda_codec *codec)
13289 struct alc_spec *spec = codec->spec;
13291 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
13293 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13297 if (!spec->autocfg.line_outs)
13298 return 0; /* can't find valid BIOS pin config */
13300 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13303 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
13306 err = alc861vd_auto_create_extra_out(spec,
13307 spec->autocfg.speaker_pins[0],
13311 err = alc861vd_auto_create_extra_out(spec,
13312 spec->autocfg.hp_pins[0],
13316 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
13320 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13322 if (spec->autocfg.dig_out_pin)
13323 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13325 if (spec->kctl_alloc)
13326 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13328 spec->init_verbs[spec->num_init_verbs++]
13329 = alc861vd_volume_init_verbs;
13331 spec->num_mux_defs = 1;
13332 spec->input_mux = &spec->private_imux;
13334 err = alc_auto_add_mic_boost(codec);
13341 /* additional initialization for auto-configuration model */
13342 static void alc861vd_auto_init(struct hda_codec *codec)
13344 struct alc_spec *spec = codec->spec;
13345 alc861vd_auto_init_multi_out(codec);
13346 alc861vd_auto_init_hp_out(codec);
13347 alc861vd_auto_init_analog_input(codec);
13348 if (spec->unsol_event)
13349 alc_sku_automute(codec);
13352 static int patch_alc861vd(struct hda_codec *codec)
13354 struct alc_spec *spec;
13355 int err, board_config;
13357 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13361 codec->spec = spec;
13363 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13367 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13368 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13369 "ALC861VD, trying auto-probe from BIOS...\n");
13370 board_config = ALC861VD_AUTO;
13373 if (board_config == ALC861VD_AUTO) {
13374 /* automatic parse from the BIOS config */
13375 err = alc861vd_parse_auto_config(codec);
13381 "hda_codec: Cannot set up configuration "
13382 "from BIOS. Using base mode...\n");
13383 board_config = ALC861VD_3ST;
13387 if (board_config != ALC861VD_AUTO)
13388 setup_preset(spec, &alc861vd_presets[board_config]);
13390 if (codec->vendor_id == 0x10ec0660) {
13391 spec->stream_name_analog = "ALC660-VD Analog";
13392 spec->stream_name_digital = "ALC660-VD Digital";
13393 /* always turn on EAPD */
13394 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
13396 spec->stream_name_analog = "ALC861VD Analog";
13397 spec->stream_name_digital = "ALC861VD Digital";
13400 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13401 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13403 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13404 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13406 spec->adc_nids = alc861vd_adc_nids;
13407 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13408 spec->capsrc_nids = alc861vd_capsrc_nids;
13410 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13411 spec->num_mixers++;
13413 spec->vmaster_nid = 0x02;
13415 codec->patch_ops = alc_patch_ops;
13417 if (board_config == ALC861VD_AUTO)
13418 spec->init_hook = alc861vd_auto_init;
13419 #ifdef CONFIG_SND_HDA_POWER_SAVE
13420 if (!spec->loopback.amplist)
13421 spec->loopback.amplist = alc861vd_loopbacks;
13430 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13431 * configuration. Each pin widget can choose any input DACs and a mixer.
13432 * Each ADC is connected from a mixer of all inputs. This makes possible
13433 * 6-channel independent captures.
13435 * In addition, an independent DAC for the multi-playback (not used in this
13438 #define ALC662_DIGOUT_NID 0x06
13439 #define ALC662_DIGIN_NID 0x0a
13441 static hda_nid_t alc662_dac_nids[4] = {
13442 /* front, rear, clfe, rear_surr */
13446 static hda_nid_t alc662_adc_nids[1] = {
13451 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13454 /* FIXME: should be a matrix-type input source selection */
13455 static struct hda_input_mux alc662_capture_source = {
13459 { "Front Mic", 0x1 },
13465 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13473 static struct hda_input_mux alc662_eeepc_capture_source = {
13481 static struct hda_input_mux alc663_capture_source = {
13485 { "Front Mic", 0x1 },
13490 static struct hda_input_mux alc663_m51va_capture_source = {
13493 { "Ext-Mic", 0x0 },
13498 #define alc662_mux_enum_info alc_mux_enum_info
13499 #define alc662_mux_enum_get alc_mux_enum_get
13500 #define alc662_mux_enum_put alc882_mux_enum_put
13505 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13512 static struct hda_verb alc662_3ST_ch2_init[] = {
13513 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13514 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13515 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13516 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13523 static struct hda_verb alc662_3ST_ch6_init[] = {
13524 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13525 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13526 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13527 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13528 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13529 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13533 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13534 { 2, alc662_3ST_ch2_init },
13535 { 6, alc662_3ST_ch6_init },
13541 static struct hda_verb alc662_sixstack_ch6_init[] = {
13542 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13543 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13544 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13551 static struct hda_verb alc662_sixstack_ch8_init[] = {
13552 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13553 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13554 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13558 static struct hda_channel_mode alc662_5stack_modes[2] = {
13559 { 2, alc662_sixstack_ch6_init },
13560 { 6, alc662_sixstack_ch8_init },
13563 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13564 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13567 static struct snd_kcontrol_new alc662_base_mixer[] = {
13568 /* output mixer control */
13569 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13570 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13571 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13572 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13573 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13574 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13575 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13576 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13579 /*Input mixer control */
13580 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13581 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13582 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13583 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13584 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13585 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13586 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13587 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13591 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13592 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13593 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13594 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13595 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13596 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13597 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13598 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13599 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13600 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13601 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13602 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13603 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13604 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13608 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13609 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13610 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13611 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13612 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13613 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13614 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13615 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13616 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13617 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13618 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13619 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13620 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13621 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13623 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13624 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13625 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13626 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13627 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13631 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13632 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13633 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13634 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13635 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13637 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13638 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13644 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13645 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13647 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13648 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13650 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13651 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13652 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13654 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13655 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13656 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13660 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13661 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13662 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13663 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13664 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13665 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13666 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13667 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13668 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13669 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13670 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13671 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13672 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13678 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
13679 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13680 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13684 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT),
13688 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
13689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13690 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13691 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13692 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13697 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13698 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13702 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
13703 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13704 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13705 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13709 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13710 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13716 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13718 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13719 .name = "Channel Mode",
13720 .info = alc_ch_mode_info,
13721 .get = alc_ch_mode_get,
13722 .put = alc_ch_mode_put,
13727 static struct hda_verb alc662_init_verbs[] = {
13728 /* ADC: mute amp left and right */
13729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13730 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13731 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13737 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13743 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13744 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13746 /* Front Pin: output 0 (0x0c) */
13747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13750 /* Rear Pin: output 1 (0x0d) */
13751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13754 /* CLFE Pin: output 2 (0x0e) */
13755 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13756 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13758 /* Mic (rear) pin: input vref at 80% */
13759 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13761 /* Front Mic pin: input vref at 80% */
13762 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13763 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13764 /* Line In pin: input */
13765 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13767 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13768 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13769 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13770 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13771 /* CD pin widget for input */
13772 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13774 /* FIXME: use matrix-type input source selection */
13775 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13787 /* always trun on EAPD */
13788 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13789 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13794 static struct hda_verb alc662_sue_init_verbs[] = {
13795 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13796 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13800 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13801 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13802 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13806 /* Set Unsolicited Event*/
13807 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13808 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13809 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13814 * generic initialization of ADC, input mixers and output mixers
13816 static struct hda_verb alc662_auto_init_verbs[] = {
13818 * Unmute ADC and set the default input to mic-in
13820 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13821 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13823 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13825 * Note: PASD motherboards uses the Line In 2 as the input for front
13826 * panel mic (mic 2)
13828 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13836 * Set up output mixers (0x0c - 0x0f)
13838 /* set vol=0 to output mixers */
13839 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13840 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13841 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13843 /* set up input amps for analog loopback */
13844 /* Amp Indices: DAC = 0, mixer = 1 */
13845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13853 /* FIXME: use matrix-type input source selection */
13854 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13861 static struct hda_verb alc663_m51va_init_verbs[] = {
13862 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13863 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13864 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
13868 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13869 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13873 static struct hda_verb alc663_g71v_init_verbs[] = {
13874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13875 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
13876 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
13878 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13879 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13880 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13882 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13883 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
13884 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13888 static struct hda_verb alc663_g50v_init_verbs[] = {
13889 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13890 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13891 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13894 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13898 /* capture mixer elements */
13899 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13900 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13901 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13903 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13904 /* The multiple "Capture Source" controls confuse alsamixer
13905 * So call somewhat different..
13907 /* .name = "Capture Source", */
13908 .name = "Input Source",
13910 .info = alc662_mux_enum_info,
13911 .get = alc662_mux_enum_get,
13912 .put = alc662_mux_enum_put,
13917 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13919 unsigned int present;
13920 unsigned char bits;
13922 present = snd_hda_codec_read(codec, 0x14, 0,
13923 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13924 bits = present ? HDA_AMP_MUTE : 0;
13925 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13926 HDA_AMP_MUTE, bits);
13929 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13931 unsigned int present;
13932 unsigned char bits;
13934 present = snd_hda_codec_read(codec, 0x1b, 0,
13935 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13936 bits = present ? HDA_AMP_MUTE : 0;
13937 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13938 HDA_AMP_MUTE, bits);
13939 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13940 HDA_AMP_MUTE, bits);
13943 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13946 if ((res >> 26) == ALC880_HP_EVENT)
13947 alc662_lenovo_101e_all_automute(codec);
13948 if ((res >> 26) == ALC880_FRONT_EVENT)
13949 alc662_lenovo_101e_ispeaker_automute(codec);
13952 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13954 unsigned int present;
13956 present = snd_hda_codec_read(codec, 0x18, 0,
13957 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13958 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13959 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13960 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13961 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13962 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13963 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13964 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13965 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13968 /* unsolicited event for HP jack sensing */
13969 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13972 if ((res >> 26) == ALC880_HP_EVENT)
13973 alc262_hippo1_automute( codec );
13975 if ((res >> 26) == ALC880_MIC_EVENT)
13976 alc662_eeepc_mic_automute(codec);
13979 static void alc662_eeepc_inithook(struct hda_codec *codec)
13981 alc262_hippo1_automute( codec );
13982 alc662_eeepc_mic_automute(codec);
13985 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13988 unsigned int present;
13990 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13991 present = snd_hda_codec_read(codec, 0x14, 0,
13992 AC_VERB_GET_PIN_SENSE, 0);
13993 present = (present & 0x80000000) != 0;
13995 /* mute internal speaker */
13996 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13997 HDA_AMP_MUTE, HDA_AMP_MUTE);
13999 /* unmute internal speaker if necessary */
14000 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
14001 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
14002 HDA_AMP_MUTE, mute);
14006 /* unsolicited event for HP jack sensing */
14007 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
14010 if ((res >> 26) == ALC880_HP_EVENT)
14011 alc662_eeepc_ep20_automute(codec);
14014 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
14016 alc662_eeepc_ep20_automute(codec);
14019 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
14021 unsigned int present;
14022 unsigned char bits;
14024 present = snd_hda_codec_read(codec, 0x21, 0,
14025 AC_VERB_GET_PIN_SENSE, 0)
14026 & AC_PINSENSE_PRESENCE;
14027 bits = present ? HDA_AMP_MUTE : 0;
14028 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14029 HDA_AMP_MUTE, bits);
14032 static void alc663_m51va_mic_automute(struct hda_codec *codec)
14034 unsigned int present;
14036 present = snd_hda_codec_read(codec, 0x18, 0,
14037 AC_VERB_GET_PIN_SENSE, 0)
14038 & AC_PINSENSE_PRESENCE;
14039 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14040 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14041 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14042 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14043 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14044 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14045 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14046 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14049 static void alc663_m51va_unsol_event(struct hda_codec *codec,
14052 switch (res >> 26) {
14053 case ALC880_HP_EVENT:
14054 alc663_m51va_speaker_automute(codec);
14056 case ALC880_MIC_EVENT:
14057 alc663_m51va_mic_automute(codec);
14062 static void alc663_m51va_inithook(struct hda_codec *codec)
14064 alc663_m51va_speaker_automute(codec);
14065 alc663_m51va_mic_automute(codec);
14068 static void alc663_g71v_hp_automute(struct hda_codec *codec)
14070 unsigned int present;
14071 unsigned char bits;
14073 present = snd_hda_codec_read(codec, 0x21, 0,
14074 AC_VERB_GET_PIN_SENSE, 0)
14075 & AC_PINSENSE_PRESENCE;
14076 bits = present ? HDA_AMP_MUTE : 0;
14077 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14078 HDA_AMP_MUTE, bits);
14079 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14080 HDA_AMP_MUTE, bits);
14083 static void alc663_g71v_front_automute(struct hda_codec *codec)
14085 unsigned int present;
14086 unsigned char bits;
14088 present = snd_hda_codec_read(codec, 0x15, 0,
14089 AC_VERB_GET_PIN_SENSE, 0)
14090 & AC_PINSENSE_PRESENCE;
14091 bits = present ? HDA_AMP_MUTE : 0;
14092 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14093 HDA_AMP_MUTE, bits);
14096 static void alc663_g71v_unsol_event(struct hda_codec *codec,
14099 switch (res >> 26) {
14100 case ALC880_HP_EVENT:
14101 alc663_g71v_hp_automute(codec);
14103 case ALC880_FRONT_EVENT:
14104 alc663_g71v_front_automute(codec);
14106 case ALC880_MIC_EVENT:
14107 alc662_eeepc_mic_automute(codec);
14112 static void alc663_g71v_inithook(struct hda_codec *codec)
14114 alc663_g71v_front_automute(codec);
14115 alc663_g71v_hp_automute(codec);
14116 alc662_eeepc_mic_automute(codec);
14119 static void alc663_g50v_unsol_event(struct hda_codec *codec,
14122 switch (res >> 26) {
14123 case ALC880_HP_EVENT:
14124 alc663_m51va_speaker_automute(codec);
14126 case ALC880_MIC_EVENT:
14127 alc662_eeepc_mic_automute(codec);
14132 static void alc663_g50v_inithook(struct hda_codec *codec)
14134 alc663_m51va_speaker_automute(codec);
14135 alc662_eeepc_mic_automute(codec);
14138 #ifdef CONFIG_SND_HDA_POWER_SAVE
14139 #define alc662_loopbacks alc880_loopbacks
14143 /* pcm configuration: identiacal with ALC880 */
14144 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
14145 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
14146 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
14147 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
14150 * configuration and preset
14152 static const char *alc662_models[ALC662_MODEL_LAST] = {
14153 [ALC662_3ST_2ch_DIG] = "3stack-dig",
14154 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
14155 [ALC662_3ST_6ch] = "3stack-6ch",
14156 [ALC662_5ST_DIG] = "6stack-dig",
14157 [ALC662_LENOVO_101E] = "lenovo-101e",
14158 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
14159 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
14160 [ALC663_ASUS_M51VA] = "m51va",
14161 [ALC663_ASUS_G71V] = "g71v",
14162 [ALC663_ASUS_H13] = "h13",
14163 [ALC663_ASUS_G50V] = "g50v",
14164 [ALC662_AUTO] = "auto",
14167 static struct snd_pci_quirk alc662_cfg_tbl[] = {
14168 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
14169 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
14170 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
14171 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
14172 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
14173 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
14174 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
14175 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
14176 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
14177 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
14181 static struct alc_config_preset alc662_presets[] = {
14182 [ALC662_3ST_2ch_DIG] = {
14183 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
14184 .init_verbs = { alc662_init_verbs },
14185 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14186 .dac_nids = alc662_dac_nids,
14187 .dig_out_nid = ALC662_DIGOUT_NID,
14188 .dig_in_nid = ALC662_DIGIN_NID,
14189 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14190 .channel_mode = alc662_3ST_2ch_modes,
14191 .input_mux = &alc662_capture_source,
14193 [ALC662_3ST_6ch_DIG] = {
14194 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14195 alc662_capture_mixer },
14196 .init_verbs = { alc662_init_verbs },
14197 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14198 .dac_nids = alc662_dac_nids,
14199 .dig_out_nid = ALC662_DIGOUT_NID,
14200 .dig_in_nid = ALC662_DIGIN_NID,
14201 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14202 .channel_mode = alc662_3ST_6ch_modes,
14204 .input_mux = &alc662_capture_source,
14206 [ALC662_3ST_6ch] = {
14207 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14208 alc662_capture_mixer },
14209 .init_verbs = { alc662_init_verbs },
14210 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14211 .dac_nids = alc662_dac_nids,
14212 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14213 .channel_mode = alc662_3ST_6ch_modes,
14215 .input_mux = &alc662_capture_source,
14217 [ALC662_5ST_DIG] = {
14218 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
14219 alc662_capture_mixer },
14220 .init_verbs = { alc662_init_verbs },
14221 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14222 .dac_nids = alc662_dac_nids,
14223 .dig_out_nid = ALC662_DIGOUT_NID,
14224 .dig_in_nid = ALC662_DIGIN_NID,
14225 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
14226 .channel_mode = alc662_5stack_modes,
14227 .input_mux = &alc662_capture_source,
14229 [ALC662_LENOVO_101E] = {
14230 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
14231 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
14232 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14233 .dac_nids = alc662_dac_nids,
14234 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14235 .channel_mode = alc662_3ST_2ch_modes,
14236 .input_mux = &alc662_lenovo_101e_capture_source,
14237 .unsol_event = alc662_lenovo_101e_unsol_event,
14238 .init_hook = alc662_lenovo_101e_all_automute,
14240 [ALC662_ASUS_EEEPC_P701] = {
14241 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
14242 .init_verbs = { alc662_init_verbs,
14243 alc662_eeepc_sue_init_verbs },
14244 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14245 .dac_nids = alc662_dac_nids,
14246 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14247 .channel_mode = alc662_3ST_2ch_modes,
14248 .input_mux = &alc662_eeepc_capture_source,
14249 .unsol_event = alc662_eeepc_unsol_event,
14250 .init_hook = alc662_eeepc_inithook,
14252 [ALC662_ASUS_EEEPC_EP20] = {
14253 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
14254 alc662_chmode_mixer },
14255 .init_verbs = { alc662_init_verbs,
14256 alc662_eeepc_ep20_sue_init_verbs },
14257 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14258 .dac_nids = alc662_dac_nids,
14259 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14260 .channel_mode = alc662_3ST_6ch_modes,
14261 .input_mux = &alc662_lenovo_101e_capture_source,
14262 .unsol_event = alc662_eeepc_ep20_unsol_event,
14263 .init_hook = alc662_eeepc_ep20_inithook,
14265 [ALC663_ASUS_M51VA] = {
14266 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14267 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14268 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14269 .dac_nids = alc662_dac_nids,
14270 .dig_out_nid = ALC662_DIGOUT_NID,
14271 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14272 .channel_mode = alc662_3ST_2ch_modes,
14273 .input_mux = &alc663_m51va_capture_source,
14274 .unsol_event = alc663_m51va_unsol_event,
14275 .init_hook = alc663_m51va_inithook,
14277 [ALC663_ASUS_G71V] = {
14278 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
14279 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
14280 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14281 .dac_nids = alc662_dac_nids,
14282 .dig_out_nid = ALC662_DIGOUT_NID,
14283 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14284 .channel_mode = alc662_3ST_2ch_modes,
14285 .input_mux = &alc662_eeepc_capture_source,
14286 .unsol_event = alc663_g71v_unsol_event,
14287 .init_hook = alc663_g71v_inithook,
14289 [ALC663_ASUS_H13] = {
14290 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14291 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14292 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14293 .dac_nids = alc662_dac_nids,
14294 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14295 .channel_mode = alc662_3ST_2ch_modes,
14296 .input_mux = &alc663_m51va_capture_source,
14297 .unsol_event = alc663_m51va_unsol_event,
14298 .init_hook = alc663_m51va_inithook,
14300 [ALC663_ASUS_G50V] = {
14301 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
14302 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
14303 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14304 .dac_nids = alc662_dac_nids,
14305 .dig_out_nid = ALC662_DIGOUT_NID,
14306 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14307 .channel_mode = alc662_3ST_6ch_modes,
14308 .input_mux = &alc663_capture_source,
14309 .unsol_event = alc663_g50v_unsol_event,
14310 .init_hook = alc663_g50v_inithook,
14316 * BIOS auto configuration
14319 /* add playback controls from the parsed DAC table */
14320 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14321 const struct auto_pin_cfg *cfg)
14324 static const char *chname[4] = {
14325 "Front", "Surround", NULL /*CLFE*/, "Side"
14330 for (i = 0; i < cfg->line_outs; i++) {
14331 if (!spec->multiout.dac_nids[i])
14333 nid = alc880_idx_to_dac(i);
14336 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14337 "Center Playback Volume",
14338 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14342 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14343 "LFE Playback Volume",
14344 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14348 err = add_control(spec, ALC_CTL_BIND_MUTE,
14349 "Center Playback Switch",
14350 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
14354 err = add_control(spec, ALC_CTL_BIND_MUTE,
14355 "LFE Playback Switch",
14356 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
14361 sprintf(name, "%s Playback Volume", chname[i]);
14362 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14363 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14367 sprintf(name, "%s Playback Switch", chname[i]);
14368 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14369 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
14378 /* add playback controls for speaker and HP outputs */
14379 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
14389 if (alc880_is_fixed_pin(pin)) {
14390 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14391 /* printk("DAC nid=%x\n",nid); */
14392 /* specify the DAC as the extra output */
14393 if (!spec->multiout.hp_nid)
14394 spec->multiout.hp_nid = nid;
14396 spec->multiout.extra_out_nid[0] = nid;
14397 /* control HP volume/switch on the output mixer amp */
14398 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14399 sprintf(name, "%s Playback Volume", pfx);
14400 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14401 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14404 sprintf(name, "%s Playback Switch", pfx);
14405 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14406 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
14409 } else if (alc880_is_multi_pin(pin)) {
14410 /* set manual connection */
14411 /* we have only a switch on HP-out PIN */
14412 sprintf(name, "%s Playback Switch", pfx);
14413 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14414 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14421 /* create playback/capture controls for input pins */
14422 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
14423 const struct auto_pin_cfg *cfg)
14425 struct hda_input_mux *imux = &spec->private_imux;
14428 for (i = 0; i < AUTO_PIN_LAST; i++) {
14429 if (alc880_is_input_pin(cfg->input_pins[i])) {
14430 idx = alc880_input_pin_idx(cfg->input_pins[i]);
14431 err = new_analog_input(spec, cfg->input_pins[i],
14432 auto_pin_cfg_labels[i],
14436 imux->items[imux->num_items].label =
14437 auto_pin_cfg_labels[i];
14438 imux->items[imux->num_items].index =
14439 alc880_input_pin_idx(cfg->input_pins[i]);
14446 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
14447 hda_nid_t nid, int pin_type,
14450 alc_set_pin_output(codec, nid, pin_type);
14451 /* need the manual connection? */
14452 if (alc880_is_multi_pin(nid)) {
14453 struct alc_spec *spec = codec->spec;
14454 int idx = alc880_multi_pin_idx(nid);
14455 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
14456 AC_VERB_SET_CONNECT_SEL,
14457 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
14461 static void alc662_auto_init_multi_out(struct hda_codec *codec)
14463 struct alc_spec *spec = codec->spec;
14466 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14467 for (i = 0; i <= HDA_SIDE; i++) {
14468 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14469 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14471 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
14476 static void alc662_auto_init_hp_out(struct hda_codec *codec)
14478 struct alc_spec *spec = codec->spec;
14481 pin = spec->autocfg.hp_pins[0];
14482 if (pin) /* connect to front */
14484 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14485 pin = spec->autocfg.speaker_pins[0];
14487 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14490 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14491 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14493 static void alc662_auto_init_analog_input(struct hda_codec *codec)
14495 struct alc_spec *spec = codec->spec;
14498 for (i = 0; i < AUTO_PIN_LAST; i++) {
14499 hda_nid_t nid = spec->autocfg.input_pins[i];
14500 if (alc662_is_input_pin(nid)) {
14501 snd_hda_codec_write(codec, nid, 0,
14502 AC_VERB_SET_PIN_WIDGET_CONTROL,
14503 (i <= AUTO_PIN_FRONT_MIC ?
14504 PIN_VREF80 : PIN_IN));
14505 if (nid != ALC662_PIN_CD_NID)
14506 snd_hda_codec_write(codec, nid, 0,
14507 AC_VERB_SET_AMP_GAIN_MUTE,
14513 static int alc662_parse_auto_config(struct hda_codec *codec)
14515 struct alc_spec *spec = codec->spec;
14517 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
14519 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14523 if (!spec->autocfg.line_outs)
14524 return 0; /* can't find valid BIOS pin config */
14526 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14529 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
14532 err = alc662_auto_create_extra_out(spec,
14533 spec->autocfg.speaker_pins[0],
14537 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
14541 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
14545 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14547 if (spec->autocfg.dig_out_pin)
14548 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
14550 if (spec->kctl_alloc)
14551 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14553 spec->num_mux_defs = 1;
14554 spec->input_mux = &spec->private_imux;
14556 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14557 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
14558 spec->num_mixers++;
14562 /* additional initialization for auto-configuration model */
14563 static void alc662_auto_init(struct hda_codec *codec)
14565 struct alc_spec *spec = codec->spec;
14566 alc662_auto_init_multi_out(codec);
14567 alc662_auto_init_hp_out(codec);
14568 alc662_auto_init_analog_input(codec);
14569 if (spec->unsol_event)
14570 alc_sku_automute(codec);
14573 static int patch_alc662(struct hda_codec *codec)
14575 struct alc_spec *spec;
14576 int err, board_config;
14578 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14582 codec->spec = spec;
14584 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14586 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
14589 if (board_config < 0) {
14590 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
14591 "trying auto-probe from BIOS...\n");
14592 board_config = ALC662_AUTO;
14595 if (board_config == ALC662_AUTO) {
14596 /* automatic parse from the BIOS config */
14597 err = alc662_parse_auto_config(codec);
14603 "hda_codec: Cannot set up configuration "
14604 "from BIOS. Using base mode...\n");
14605 board_config = ALC662_3ST_2ch_DIG;
14609 if (board_config != ALC662_AUTO)
14610 setup_preset(spec, &alc662_presets[board_config]);
14612 if (codec->vendor_id == 0x10ec0663) {
14613 spec->stream_name_analog = "ALC663 Analog";
14614 spec->stream_name_digital = "ALC663 Digital";
14616 spec->stream_name_analog = "ALC662 Analog";
14617 spec->stream_name_digital = "ALC662 Digital";
14620 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14621 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14623 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14624 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14626 spec->adc_nids = alc662_adc_nids;
14627 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14628 spec->capsrc_nids = alc662_capsrc_nids;
14630 spec->vmaster_nid = 0x02;
14632 codec->patch_ops = alc_patch_ops;
14633 if (board_config == ALC662_AUTO)
14634 spec->init_hook = alc662_auto_init;
14635 #ifdef CONFIG_SND_HDA_POWER_SAVE
14636 if (!spec->loopback.amplist)
14637 spec->loopback.amplist = alc662_loopbacks;
14646 struct hda_codec_preset snd_hda_preset_realtek[] = {
14647 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14648 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14649 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14650 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14651 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14652 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14653 .patch = patch_alc861 },
14654 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14655 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14656 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14657 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14658 .patch = patch_alc883 },
14659 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14660 .patch = patch_alc662 },
14661 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
14662 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14663 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14664 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14665 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14666 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14667 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14668 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14669 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14670 {} /* terminator */