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, 0x10ac, "FSC", ALC880_UNIWILL),
3078 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3079 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3080 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3081 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3082 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3083 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3084 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3085 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3086 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3087 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3088 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3089 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3090 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3091 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3092 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3093 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3094 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3095 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3096 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3097 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3098 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3103 * ALC880 codec presets
3105 static struct alc_config_preset alc880_presets[] = {
3107 .mixers = { alc880_three_stack_mixer },
3108 .init_verbs = { alc880_volume_init_verbs,
3109 alc880_pin_3stack_init_verbs },
3110 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3111 .dac_nids = alc880_dac_nids,
3112 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3113 .channel_mode = alc880_threestack_modes,
3115 .input_mux = &alc880_capture_source,
3117 [ALC880_3ST_DIG] = {
3118 .mixers = { alc880_three_stack_mixer },
3119 .init_verbs = { alc880_volume_init_verbs,
3120 alc880_pin_3stack_init_verbs },
3121 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3122 .dac_nids = alc880_dac_nids,
3123 .dig_out_nid = ALC880_DIGOUT_NID,
3124 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3125 .channel_mode = alc880_threestack_modes,
3127 .input_mux = &alc880_capture_source,
3129 [ALC880_TCL_S700] = {
3130 .mixers = { alc880_tcl_s700_mixer },
3131 .init_verbs = { alc880_volume_init_verbs,
3132 alc880_pin_tcl_S700_init_verbs,
3133 alc880_gpio2_init_verbs },
3134 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3135 .dac_nids = alc880_dac_nids,
3137 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3138 .channel_mode = alc880_2_jack_modes,
3139 .input_mux = &alc880_capture_source,
3142 .mixers = { alc880_three_stack_mixer,
3143 alc880_five_stack_mixer},
3144 .init_verbs = { alc880_volume_init_verbs,
3145 alc880_pin_5stack_init_verbs },
3146 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3147 .dac_nids = alc880_dac_nids,
3148 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3149 .channel_mode = alc880_fivestack_modes,
3150 .input_mux = &alc880_capture_source,
3152 [ALC880_5ST_DIG] = {
3153 .mixers = { alc880_three_stack_mixer,
3154 alc880_five_stack_mixer },
3155 .init_verbs = { alc880_volume_init_verbs,
3156 alc880_pin_5stack_init_verbs },
3157 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3158 .dac_nids = alc880_dac_nids,
3159 .dig_out_nid = ALC880_DIGOUT_NID,
3160 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3161 .channel_mode = alc880_fivestack_modes,
3162 .input_mux = &alc880_capture_source,
3165 .mixers = { alc880_six_stack_mixer },
3166 .init_verbs = { alc880_volume_init_verbs,
3167 alc880_pin_6stack_init_verbs },
3168 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3169 .dac_nids = alc880_6st_dac_nids,
3170 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3171 .channel_mode = alc880_sixstack_modes,
3172 .input_mux = &alc880_6stack_capture_source,
3174 [ALC880_6ST_DIG] = {
3175 .mixers = { alc880_six_stack_mixer },
3176 .init_verbs = { alc880_volume_init_verbs,
3177 alc880_pin_6stack_init_verbs },
3178 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3179 .dac_nids = alc880_6st_dac_nids,
3180 .dig_out_nid = ALC880_DIGOUT_NID,
3181 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3182 .channel_mode = alc880_sixstack_modes,
3183 .input_mux = &alc880_6stack_capture_source,
3186 .mixers = { alc880_w810_base_mixer },
3187 .init_verbs = { alc880_volume_init_verbs,
3188 alc880_pin_w810_init_verbs,
3189 alc880_gpio2_init_verbs },
3190 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3191 .dac_nids = alc880_w810_dac_nids,
3192 .dig_out_nid = ALC880_DIGOUT_NID,
3193 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3194 .channel_mode = alc880_w810_modes,
3195 .input_mux = &alc880_capture_source,
3198 .mixers = { alc880_z71v_mixer },
3199 .init_verbs = { alc880_volume_init_verbs,
3200 alc880_pin_z71v_init_verbs },
3201 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3202 .dac_nids = alc880_z71v_dac_nids,
3203 .dig_out_nid = ALC880_DIGOUT_NID,
3205 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3206 .channel_mode = alc880_2_jack_modes,
3207 .input_mux = &alc880_capture_source,
3210 .mixers = { alc880_f1734_mixer },
3211 .init_verbs = { alc880_volume_init_verbs,
3212 alc880_pin_f1734_init_verbs },
3213 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3214 .dac_nids = alc880_f1734_dac_nids,
3216 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3217 .channel_mode = alc880_2_jack_modes,
3218 .input_mux = &alc880_f1734_capture_source,
3219 .unsol_event = alc880_uniwill_p53_unsol_event,
3220 .init_hook = alc880_uniwill_p53_hp_automute,
3223 .mixers = { alc880_asus_mixer },
3224 .init_verbs = { alc880_volume_init_verbs,
3225 alc880_pin_asus_init_verbs,
3226 alc880_gpio1_init_verbs },
3227 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3228 .dac_nids = alc880_asus_dac_nids,
3229 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3230 .channel_mode = alc880_asus_modes,
3232 .input_mux = &alc880_capture_source,
3234 [ALC880_ASUS_DIG] = {
3235 .mixers = { alc880_asus_mixer },
3236 .init_verbs = { alc880_volume_init_verbs,
3237 alc880_pin_asus_init_verbs,
3238 alc880_gpio1_init_verbs },
3239 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3240 .dac_nids = alc880_asus_dac_nids,
3241 .dig_out_nid = ALC880_DIGOUT_NID,
3242 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3243 .channel_mode = alc880_asus_modes,
3245 .input_mux = &alc880_capture_source,
3247 [ALC880_ASUS_DIG2] = {
3248 .mixers = { alc880_asus_mixer },
3249 .init_verbs = { alc880_volume_init_verbs,
3250 alc880_pin_asus_init_verbs,
3251 alc880_gpio2_init_verbs }, /* use GPIO2 */
3252 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3253 .dac_nids = alc880_asus_dac_nids,
3254 .dig_out_nid = ALC880_DIGOUT_NID,
3255 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3256 .channel_mode = alc880_asus_modes,
3258 .input_mux = &alc880_capture_source,
3260 [ALC880_ASUS_W1V] = {
3261 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3262 .init_verbs = { alc880_volume_init_verbs,
3263 alc880_pin_asus_init_verbs,
3264 alc880_gpio1_init_verbs },
3265 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3266 .dac_nids = alc880_asus_dac_nids,
3267 .dig_out_nid = ALC880_DIGOUT_NID,
3268 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3269 .channel_mode = alc880_asus_modes,
3271 .input_mux = &alc880_capture_source,
3273 [ALC880_UNIWILL_DIG] = {
3274 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3275 .init_verbs = { alc880_volume_init_verbs,
3276 alc880_pin_asus_init_verbs },
3277 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3278 .dac_nids = alc880_asus_dac_nids,
3279 .dig_out_nid = ALC880_DIGOUT_NID,
3280 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3281 .channel_mode = alc880_asus_modes,
3283 .input_mux = &alc880_capture_source,
3285 [ALC880_UNIWILL] = {
3286 .mixers = { alc880_uniwill_mixer },
3287 .init_verbs = { alc880_volume_init_verbs,
3288 alc880_uniwill_init_verbs },
3289 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3290 .dac_nids = alc880_asus_dac_nids,
3291 .dig_out_nid = ALC880_DIGOUT_NID,
3292 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3293 .channel_mode = alc880_threestack_modes,
3295 .input_mux = &alc880_capture_source,
3296 .unsol_event = alc880_uniwill_unsol_event,
3297 .init_hook = alc880_uniwill_automute,
3299 [ALC880_UNIWILL_P53] = {
3300 .mixers = { alc880_uniwill_p53_mixer },
3301 .init_verbs = { alc880_volume_init_verbs,
3302 alc880_uniwill_p53_init_verbs },
3303 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3304 .dac_nids = alc880_asus_dac_nids,
3305 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3306 .channel_mode = alc880_threestack_modes,
3307 .input_mux = &alc880_capture_source,
3308 .unsol_event = alc880_uniwill_p53_unsol_event,
3309 .init_hook = alc880_uniwill_p53_hp_automute,
3311 [ALC880_FUJITSU] = {
3312 .mixers = { alc880_fujitsu_mixer,
3313 alc880_pcbeep_mixer, },
3314 .init_verbs = { alc880_volume_init_verbs,
3315 alc880_uniwill_p53_init_verbs,
3316 alc880_beep_init_verbs },
3317 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3318 .dac_nids = alc880_dac_nids,
3319 .dig_out_nid = ALC880_DIGOUT_NID,
3320 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3321 .channel_mode = alc880_2_jack_modes,
3322 .input_mux = &alc880_capture_source,
3323 .unsol_event = alc880_uniwill_p53_unsol_event,
3324 .init_hook = alc880_uniwill_p53_hp_automute,
3327 .mixers = { alc880_three_stack_mixer },
3328 .init_verbs = { alc880_volume_init_verbs,
3329 alc880_pin_clevo_init_verbs },
3330 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3331 .dac_nids = alc880_dac_nids,
3333 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3334 .channel_mode = alc880_threestack_modes,
3336 .input_mux = &alc880_capture_source,
3339 .mixers = { alc880_lg_mixer },
3340 .init_verbs = { alc880_volume_init_verbs,
3341 alc880_lg_init_verbs },
3342 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3343 .dac_nids = alc880_lg_dac_nids,
3344 .dig_out_nid = ALC880_DIGOUT_NID,
3345 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3346 .channel_mode = alc880_lg_ch_modes,
3348 .input_mux = &alc880_lg_capture_source,
3349 .unsol_event = alc880_lg_unsol_event,
3350 .init_hook = alc880_lg_automute,
3351 #ifdef CONFIG_SND_HDA_POWER_SAVE
3352 .loopbacks = alc880_lg_loopbacks,
3356 .mixers = { alc880_lg_lw_mixer },
3357 .init_verbs = { alc880_volume_init_verbs,
3358 alc880_lg_lw_init_verbs },
3359 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3360 .dac_nids = alc880_dac_nids,
3361 .dig_out_nid = ALC880_DIGOUT_NID,
3362 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3363 .channel_mode = alc880_lg_lw_modes,
3364 .input_mux = &alc880_lg_lw_capture_source,
3365 .unsol_event = alc880_lg_lw_unsol_event,
3366 .init_hook = alc880_lg_lw_automute,
3368 [ALC880_MEDION_RIM] = {
3369 .mixers = { alc880_medion_rim_mixer },
3370 .init_verbs = { alc880_volume_init_verbs,
3371 alc880_medion_rim_init_verbs,
3372 alc_gpio2_init_verbs },
3373 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3374 .dac_nids = alc880_dac_nids,
3375 .dig_out_nid = ALC880_DIGOUT_NID,
3376 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3377 .channel_mode = alc880_2_jack_modes,
3378 .input_mux = &alc880_medion_rim_capture_source,
3379 .unsol_event = alc880_medion_rim_unsol_event,
3380 .init_hook = alc880_medion_rim_automute,
3382 #ifdef CONFIG_SND_DEBUG
3384 .mixers = { alc880_test_mixer },
3385 .init_verbs = { alc880_test_init_verbs },
3386 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3387 .dac_nids = alc880_test_dac_nids,
3388 .dig_out_nid = ALC880_DIGOUT_NID,
3389 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3390 .channel_mode = alc880_test_modes,
3391 .input_mux = &alc880_test_capture_source,
3397 * Automatic parse of I/O pins from the BIOS configuration
3400 #define NUM_CONTROL_ALLOC 32
3401 #define NUM_VERB_ALLOC 32
3405 ALC_CTL_WIDGET_MUTE,
3408 static struct snd_kcontrol_new alc880_control_templates[] = {
3409 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3410 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3411 HDA_BIND_MUTE(NULL, 0, 0, 0),
3414 /* add dynamic controls */
3415 static int add_control(struct alc_spec *spec, int type, const char *name,
3418 struct snd_kcontrol_new *knew;
3420 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3421 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3423 /* array + terminator */
3424 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3427 if (spec->kctl_alloc) {
3428 memcpy(knew, spec->kctl_alloc,
3429 sizeof(*knew) * spec->num_kctl_alloc);
3430 kfree(spec->kctl_alloc);
3432 spec->kctl_alloc = knew;
3433 spec->num_kctl_alloc = num;
3436 knew = &spec->kctl_alloc[spec->num_kctl_used];
3437 *knew = alc880_control_templates[type];
3438 knew->name = kstrdup(name, GFP_KERNEL);
3441 knew->private_value = val;
3442 spec->num_kctl_used++;
3446 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3447 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3448 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3449 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3450 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3451 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3452 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3453 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3454 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3455 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3456 #define ALC880_PIN_CD_NID 0x1c
3458 /* fill in the dac_nids table from the parsed pin configuration */
3459 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3460 const struct auto_pin_cfg *cfg)
3466 memset(assigned, 0, sizeof(assigned));
3467 spec->multiout.dac_nids = spec->private_dac_nids;
3469 /* check the pins hardwired to audio widget */
3470 for (i = 0; i < cfg->line_outs; i++) {
3471 nid = cfg->line_out_pins[i];
3472 if (alc880_is_fixed_pin(nid)) {
3473 int idx = alc880_fixed_pin_idx(nid);
3474 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3478 /* left pins can be connect to any audio widget */
3479 for (i = 0; i < cfg->line_outs; i++) {
3480 nid = cfg->line_out_pins[i];
3481 if (alc880_is_fixed_pin(nid))
3483 /* search for an empty channel */
3484 for (j = 0; j < cfg->line_outs; j++) {
3486 spec->multiout.dac_nids[i] =
3487 alc880_idx_to_dac(j);
3493 spec->multiout.num_dacs = cfg->line_outs;
3497 /* add playback controls from the parsed DAC table */
3498 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3499 const struct auto_pin_cfg *cfg)
3502 static const char *chname[4] = {
3503 "Front", "Surround", NULL /*CLFE*/, "Side"
3508 for (i = 0; i < cfg->line_outs; i++) {
3509 if (!spec->multiout.dac_nids[i])
3511 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3514 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3515 "Center Playback Volume",
3516 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3520 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3521 "LFE Playback Volume",
3522 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3526 err = add_control(spec, ALC_CTL_BIND_MUTE,
3527 "Center Playback Switch",
3528 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3532 err = add_control(spec, ALC_CTL_BIND_MUTE,
3533 "LFE Playback Switch",
3534 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3539 sprintf(name, "%s Playback Volume", chname[i]);
3540 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3541 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3545 sprintf(name, "%s Playback Switch", chname[i]);
3546 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3547 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3556 /* add playback controls for speaker and HP outputs */
3557 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3567 if (alc880_is_fixed_pin(pin)) {
3568 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3569 /* specify the DAC as the extra output */
3570 if (!spec->multiout.hp_nid)
3571 spec->multiout.hp_nid = nid;
3573 spec->multiout.extra_out_nid[0] = nid;
3574 /* control HP volume/switch on the output mixer amp */
3575 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3576 sprintf(name, "%s Playback Volume", pfx);
3577 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3578 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3581 sprintf(name, "%s Playback Switch", pfx);
3582 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3583 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3586 } else if (alc880_is_multi_pin(pin)) {
3587 /* set manual connection */
3588 /* we have only a switch on HP-out PIN */
3589 sprintf(name, "%s Playback Switch", pfx);
3590 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3591 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3598 /* create input playback/capture controls for the given pin */
3599 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3600 const char *ctlname,
3601 int idx, hda_nid_t mix_nid)
3606 sprintf(name, "%s Playback Volume", ctlname);
3607 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3608 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3611 sprintf(name, "%s Playback Switch", ctlname);
3612 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3613 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3619 /* create playback/capture controls for input pins */
3620 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3621 const struct auto_pin_cfg *cfg)
3623 struct hda_input_mux *imux = &spec->private_imux;
3626 for (i = 0; i < AUTO_PIN_LAST; i++) {
3627 if (alc880_is_input_pin(cfg->input_pins[i])) {
3628 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3629 err = new_analog_input(spec, cfg->input_pins[i],
3630 auto_pin_cfg_labels[i],
3634 imux->items[imux->num_items].label =
3635 auto_pin_cfg_labels[i];
3636 imux->items[imux->num_items].index =
3637 alc880_input_pin_idx(cfg->input_pins[i]);
3644 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3645 unsigned int pin_type)
3647 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3650 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3654 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3655 hda_nid_t nid, int pin_type,
3658 alc_set_pin_output(codec, nid, pin_type);
3659 /* need the manual connection? */
3660 if (alc880_is_multi_pin(nid)) {
3661 struct alc_spec *spec = codec->spec;
3662 int idx = alc880_multi_pin_idx(nid);
3663 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3664 AC_VERB_SET_CONNECT_SEL,
3665 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3669 static int get_pin_type(int line_out_type)
3671 if (line_out_type == AUTO_PIN_HP_OUT)
3677 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3679 struct alc_spec *spec = codec->spec;
3682 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3683 for (i = 0; i < spec->autocfg.line_outs; i++) {
3684 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3685 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3686 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3690 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3692 struct alc_spec *spec = codec->spec;
3695 pin = spec->autocfg.speaker_pins[0];
3696 if (pin) /* connect to front */
3697 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3698 pin = spec->autocfg.hp_pins[0];
3699 if (pin) /* connect to front */
3700 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3703 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3705 struct alc_spec *spec = codec->spec;
3708 for (i = 0; i < AUTO_PIN_LAST; i++) {
3709 hda_nid_t nid = spec->autocfg.input_pins[i];
3710 if (alc880_is_input_pin(nid)) {
3711 snd_hda_codec_write(codec, nid, 0,
3712 AC_VERB_SET_PIN_WIDGET_CONTROL,
3713 i <= AUTO_PIN_FRONT_MIC ?
3714 PIN_VREF80 : PIN_IN);
3715 if (nid != ALC880_PIN_CD_NID)
3716 snd_hda_codec_write(codec, nid, 0,
3717 AC_VERB_SET_AMP_GAIN_MUTE,
3723 /* parse the BIOS configuration and set up the alc_spec */
3724 /* return 1 if successful, 0 if the proper config is not found,
3725 * or a negative error code
3727 static int alc880_parse_auto_config(struct hda_codec *codec)
3729 struct alc_spec *spec = codec->spec;
3731 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3733 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3737 if (!spec->autocfg.line_outs)
3738 return 0; /* can't find valid BIOS pin config */
3740 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3743 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3746 err = alc880_auto_create_extra_out(spec,
3747 spec->autocfg.speaker_pins[0],
3751 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3755 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3759 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3761 if (spec->autocfg.dig_out_pin)
3762 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3763 if (spec->autocfg.dig_in_pin)
3764 spec->dig_in_nid = ALC880_DIGIN_NID;
3766 if (spec->kctl_alloc)
3767 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3769 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3771 spec->num_mux_defs = 1;
3772 spec->input_mux = &spec->private_imux;
3777 /* additional initialization for auto-configuration model */
3778 static void alc880_auto_init(struct hda_codec *codec)
3780 struct alc_spec *spec = codec->spec;
3781 alc880_auto_init_multi_out(codec);
3782 alc880_auto_init_extra_out(codec);
3783 alc880_auto_init_analog_input(codec);
3784 if (spec->unsol_event)
3785 alc_sku_automute(codec);
3789 * OK, here we have finally the patch for ALC880
3792 static int patch_alc880(struct hda_codec *codec)
3794 struct alc_spec *spec;
3798 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3804 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3807 if (board_config < 0) {
3808 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3809 "trying auto-probe from BIOS...\n");
3810 board_config = ALC880_AUTO;
3813 if (board_config == ALC880_AUTO) {
3814 /* automatic parse from the BIOS config */
3815 err = alc880_parse_auto_config(codec);
3821 "hda_codec: Cannot set up configuration "
3822 "from BIOS. Using 3-stack mode...\n");
3823 board_config = ALC880_3ST;
3827 if (board_config != ALC880_AUTO)
3828 setup_preset(spec, &alc880_presets[board_config]);
3830 spec->stream_name_analog = "ALC880 Analog";
3831 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3832 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3833 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3835 spec->stream_name_digital = "ALC880 Digital";
3836 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3837 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3839 if (!spec->adc_nids && spec->input_mux) {
3840 /* check whether NID 0x07 is valid */
3841 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3843 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3844 if (wcap != AC_WID_AUD_IN) {
3845 spec->adc_nids = alc880_adc_nids_alt;
3846 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3847 spec->mixers[spec->num_mixers] =
3848 alc880_capture_alt_mixer;
3851 spec->adc_nids = alc880_adc_nids;
3852 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3853 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3858 spec->vmaster_nid = 0x0c;
3860 codec->patch_ops = alc_patch_ops;
3861 if (board_config == ALC880_AUTO)
3862 spec->init_hook = alc880_auto_init;
3863 #ifdef CONFIG_SND_HDA_POWER_SAVE
3864 if (!spec->loopback.amplist)
3865 spec->loopback.amplist = alc880_loopbacks;
3876 static hda_nid_t alc260_dac_nids[1] = {
3881 static hda_nid_t alc260_adc_nids[1] = {
3886 static hda_nid_t alc260_adc_nids_alt[1] = {
3891 static hda_nid_t alc260_hp_adc_nids[2] = {
3896 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3897 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3899 static hda_nid_t alc260_dual_adc_nids[2] = {
3904 #define ALC260_DIGOUT_NID 0x03
3905 #define ALC260_DIGIN_NID 0x06
3907 static struct hda_input_mux alc260_capture_source = {
3911 { "Front Mic", 0x1 },
3917 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3918 * headphone jack and the internal CD lines since these are the only pins at
3919 * which audio can appear. For flexibility, also allow the option of
3920 * recording the mixer output on the second ADC (ADC0 doesn't have a
3921 * connection to the mixer output).
3923 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3927 { "Mic/Line", 0x0 },
3929 { "Headphone", 0x2 },
3935 { "Mic/Line", 0x0 },
3937 { "Headphone", 0x2 },
3944 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3945 * the Fujitsu S702x, but jacks are marked differently.
3947 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3954 { "Headphone", 0x5 },
3963 { "Headphone", 0x6 },
3969 * This is just place-holder, so there's something for alc_build_pcms to look
3970 * at when it calculates the maximum number of channels. ALC260 has no mixer
3971 * element which allows changing the channel mode, so the verb list is
3974 static struct hda_channel_mode alc260_modes[1] = {
3979 /* Mixer combinations
3981 * basic: base_output + input + pc_beep + capture
3982 * HP: base_output + input + capture_alt
3983 * HP_3013: hp_3013 + input + capture
3984 * fujitsu: fujitsu + capture
3985 * acer: acer + capture
3988 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3989 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3990 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3991 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3992 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3993 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3994 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3998 static struct snd_kcontrol_new alc260_input_mixer[] = {
3999 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4000 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4001 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4002 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4003 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4004 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4006 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4010 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4011 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4012 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4016 /* update HP, line and mono out pins according to the master switch */
4017 static void alc260_hp_master_update(struct hda_codec *codec,
4018 hda_nid_t hp, hda_nid_t line,
4021 struct alc_spec *spec = codec->spec;
4022 unsigned int val = spec->master_sw ? PIN_HP : 0;
4023 /* change HP and line-out pins */
4024 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4026 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4028 /* mono (speaker) depending on the HP jack sense */
4029 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4030 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4034 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4035 struct snd_ctl_elem_value *ucontrol)
4037 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4038 struct alc_spec *spec = codec->spec;
4039 *ucontrol->value.integer.value = spec->master_sw;
4043 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4044 struct snd_ctl_elem_value *ucontrol)
4046 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4047 struct alc_spec *spec = codec->spec;
4048 int val = !!*ucontrol->value.integer.value;
4049 hda_nid_t hp, line, mono;
4051 if (val == spec->master_sw)
4053 spec->master_sw = val;
4054 hp = (kcontrol->private_value >> 16) & 0xff;
4055 line = (kcontrol->private_value >> 8) & 0xff;
4056 mono = kcontrol->private_value & 0xff;
4057 alc260_hp_master_update(codec, hp, line, mono);
4061 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4063 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4064 .name = "Master Playback Switch",
4065 .info = snd_ctl_boolean_mono_info,
4066 .get = alc260_hp_master_sw_get,
4067 .put = alc260_hp_master_sw_put,
4068 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4070 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4071 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4072 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4073 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4074 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4076 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4080 static struct hda_verb alc260_hp_unsol_verbs[] = {
4081 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4085 static void alc260_hp_automute(struct hda_codec *codec)
4087 struct alc_spec *spec = codec->spec;
4088 unsigned int present;
4090 present = snd_hda_codec_read(codec, 0x10, 0,
4091 AC_VERB_GET_PIN_SENSE, 0);
4092 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4093 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4096 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4098 if ((res >> 26) == ALC880_HP_EVENT)
4099 alc260_hp_automute(codec);
4102 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4105 .name = "Master Playback Switch",
4106 .info = snd_ctl_boolean_mono_info,
4107 .get = alc260_hp_master_sw_get,
4108 .put = alc260_hp_master_sw_put,
4109 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4111 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4112 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4113 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4114 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4115 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4117 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4118 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4122 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4123 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4127 static void alc260_hp_3013_automute(struct hda_codec *codec)
4129 struct alc_spec *spec = codec->spec;
4130 unsigned int present;
4132 present = snd_hda_codec_read(codec, 0x15, 0,
4133 AC_VERB_GET_PIN_SENSE, 0);
4134 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4135 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4138 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4141 if ((res >> 26) == ALC880_HP_EVENT)
4142 alc260_hp_3013_automute(codec);
4145 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4146 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4148 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4149 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4150 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4151 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4152 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4153 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4154 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4155 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4156 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4157 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4158 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4159 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4160 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4164 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4165 * versions of the ALC260 don't act on requests to enable mic bias from NID
4166 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4167 * datasheet doesn't mention this restriction. At this stage it's not clear
4168 * whether this behaviour is intentional or is a hardware bug in chip
4169 * revisions available in early 2006. Therefore for now allow the
4170 * "Headphone Jack Mode" control to span all choices, but if it turns out
4171 * that the lack of mic bias for this NID is intentional we could change the
4172 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4174 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4175 * don't appear to make the mic bias available from the "line" jack, even
4176 * though the NID used for this jack (0x14) can supply it. The theory is
4177 * that perhaps Acer have included blocking capacitors between the ALC260
4178 * and the output jack. If this turns out to be the case for all such
4179 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4180 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4182 * The C20x Tablet series have a mono internal speaker which is controlled
4183 * via the chip's Mono sum widget and pin complex, so include the necessary
4184 * controls for such models. On models without a "mono speaker" the control
4185 * won't do anything.
4187 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4188 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4189 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4190 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4191 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4193 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4195 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4196 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4198 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4199 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4200 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4201 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4202 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4203 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4204 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4208 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4209 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4211 static struct snd_kcontrol_new alc260_will_mixer[] = {
4212 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4213 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4215 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4216 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4217 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4218 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4219 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4220 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4221 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4222 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4223 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4227 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4228 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4230 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4231 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4232 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4234 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4235 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4236 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4237 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4238 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4239 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4240 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4244 /* capture mixer elements */
4245 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4246 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4247 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4248 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4249 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4252 /* The multiple "Capture Source" controls confuse alsamixer
4253 * So call somewhat different..
4255 /* .name = "Capture Source", */
4256 .name = "Input Source",
4258 .info = alc_mux_enum_info,
4259 .get = alc_mux_enum_get,
4260 .put = alc_mux_enum_put,
4265 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4266 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4267 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4269 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4270 /* The multiple "Capture Source" controls confuse alsamixer
4271 * So call somewhat different..
4273 /* .name = "Capture Source", */
4274 .name = "Input Source",
4276 .info = alc_mux_enum_info,
4277 .get = alc_mux_enum_get,
4278 .put = alc_mux_enum_put,
4284 * initialization verbs
4286 static struct hda_verb alc260_init_verbs[] = {
4287 /* Line In pin widget for input */
4288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4289 /* CD pin widget for input */
4290 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4291 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4292 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4293 /* Mic2 (front panel) pin widget for input and vref at 80% */
4294 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4295 /* LINE-2 is used for line-out in rear */
4296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4297 /* select line-out */
4298 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4300 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4302 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4304 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4305 /* mute capture amp left and right */
4306 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4307 /* set connection select to line in (default select for this ADC) */
4308 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4309 /* mute capture amp left and right */
4310 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4311 /* set connection select to line in (default select for this ADC) */
4312 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4313 /* set vol=0 Line-Out mixer amp left and right */
4314 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4315 /* unmute pin widget amp left and right (no gain on this amp) */
4316 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4317 /* set vol=0 HP mixer amp left and right */
4318 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4319 /* unmute pin widget amp left and right (no gain on this amp) */
4320 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4321 /* set vol=0 Mono mixer amp left and right */
4322 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4323 /* unmute pin widget amp left and right (no gain on this amp) */
4324 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4325 /* unmute LINE-2 out pin */
4326 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4327 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4330 /* mute analog inputs */
4331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4336 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4337 /* mute Front out path */
4338 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4340 /* mute Headphone out path */
4341 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4343 /* mute Mono out path */
4344 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4349 #if 0 /* should be identical with alc260_init_verbs? */
4350 static struct hda_verb alc260_hp_init_verbs[] = {
4351 /* Headphone and output */
4352 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4354 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4355 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4356 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4357 /* Mic2 (front panel) pin widget for input and vref at 80% */
4358 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4359 /* Line In pin widget for input */
4360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4361 /* Line-2 pin widget for output */
4362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4363 /* CD pin widget for input */
4364 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4365 /* unmute amp left and right */
4366 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4367 /* set connection select to line in (default select for this ADC) */
4368 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4369 /* unmute Line-Out mixer amp left and right (volume = 0) */
4370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4371 /* mute pin widget amp left and right (no gain on this amp) */
4372 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4373 /* unmute HP mixer amp left and right (volume = 0) */
4374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4375 /* mute pin widget amp left and right (no gain on this amp) */
4376 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4377 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4380 /* mute analog inputs */
4381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4383 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4386 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4387 /* Unmute Front out path */
4388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4389 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4390 /* Unmute Headphone out path */
4391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4393 /* Unmute Mono out path */
4394 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4395 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4400 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4401 /* Line out and output */
4402 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4404 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4405 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4406 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4407 /* Mic2 (front panel) pin widget for input and vref at 80% */
4408 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4409 /* Line In pin widget for input */
4410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4411 /* Headphone pin widget for output */
4412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4413 /* CD pin widget for input */
4414 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4415 /* unmute amp left and right */
4416 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4417 /* set connection select to line in (default select for this ADC) */
4418 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4419 /* unmute Line-Out mixer amp left and right (volume = 0) */
4420 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4421 /* mute pin widget amp left and right (no gain on this amp) */
4422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4423 /* unmute HP mixer amp left and right (volume = 0) */
4424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4425 /* mute pin widget amp left and right (no gain on this amp) */
4426 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4427 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4430 /* mute analog inputs */
4431 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4436 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4437 /* Unmute Front out path */
4438 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4440 /* Unmute Headphone out path */
4441 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4442 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4443 /* Unmute Mono out path */
4444 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4445 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4449 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4450 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4451 * audio = 0x16, internal speaker = 0x10.
4453 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4454 /* Disable all GPIOs */
4455 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4456 /* Internal speaker is connected to headphone pin */
4457 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4458 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4459 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4460 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4461 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4462 /* Ensure all other unused pins are disabled and muted. */
4463 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4465 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4466 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4467 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4468 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4472 /* Disable digital (SPDIF) pins */
4473 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4474 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4476 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4477 * when acting as an output.
4479 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4481 /* Start with output sum widgets muted and their output gains at min */
4482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4488 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4489 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4492 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4493 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4494 /* Unmute Line1 pin widget output buffer since it starts as an output.
4495 * If the pin mode is changed by the user the pin mode control will
4496 * take care of enabling the pin's input/output buffers as needed.
4497 * Therefore there's no need to enable the input buffer at this
4500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4501 /* Unmute input buffer of pin widget used for Line-in (no equiv
4504 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4506 /* Mute capture amp left and right */
4507 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4508 /* Set ADC connection select to match default mixer setting - line
4511 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4513 /* Do the same for the second ADC: mute capture input amp and
4514 * set ADC connection to line in (on mic1 pin)
4516 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4517 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4519 /* Mute all inputs to mixer widget (even unconnected ones) */
4520 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4532 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4533 * similar laptops (adapted from Fujitsu init verbs).
4535 static struct hda_verb alc260_acer_init_verbs[] = {
4536 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4537 * the headphone jack. Turn this on and rely on the standard mute
4538 * methods whenever the user wants to turn these outputs off.
4540 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4541 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4542 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4543 /* Internal speaker/Headphone jack is connected to Line-out pin */
4544 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4545 /* Internal microphone/Mic jack is connected to Mic1 pin */
4546 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4547 /* Line In jack is connected to Line1 pin */
4548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4549 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4550 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4551 /* Ensure all other unused pins are disabled and muted. */
4552 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4553 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4554 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4555 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4558 /* Disable digital (SPDIF) pins */
4559 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4560 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4562 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4563 * bus when acting as outputs.
4565 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4566 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4568 /* Start with output sum widgets muted and their output gains at min */
4569 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4570 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4572 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4573 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4575 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4576 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4579 /* Unmute Line-out pin widget amp left and right
4580 * (no equiv mixer ctrl)
4582 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4583 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4584 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4585 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4586 * inputs. If the pin mode is changed by the user the pin mode control
4587 * will take care of enabling the pin's input/output buffers as needed.
4588 * Therefore there's no need to enable the input buffer at this
4591 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4592 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4594 /* Mute capture amp left and right */
4595 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4596 /* Set ADC connection select to match default mixer setting - mic
4599 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4601 /* Do similar with the second ADC: mute capture input amp and
4602 * set ADC connection to mic to match ALSA's default state.
4604 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4605 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4607 /* Mute all inputs to mixer widget (even unconnected ones) */
4608 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4620 static struct hda_verb alc260_will_verbs[] = {
4621 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4622 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4623 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4624 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4625 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4626 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4630 static struct hda_verb alc260_replacer_672v_verbs[] = {
4631 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4632 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4633 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4635 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4636 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4637 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4639 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4643 /* toggle speaker-output according to the hp-jack state */
4644 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4646 unsigned int present;
4648 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4649 present = snd_hda_codec_read(codec, 0x0f, 0,
4650 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4652 snd_hda_codec_write_cache(codec, 0x01, 0,
4653 AC_VERB_SET_GPIO_DATA, 1);
4654 snd_hda_codec_write_cache(codec, 0x0f, 0,
4655 AC_VERB_SET_PIN_WIDGET_CONTROL,
4658 snd_hda_codec_write_cache(codec, 0x01, 0,
4659 AC_VERB_SET_GPIO_DATA, 0);
4660 snd_hda_codec_write_cache(codec, 0x0f, 0,
4661 AC_VERB_SET_PIN_WIDGET_CONTROL,
4666 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4669 if ((res >> 26) == ALC880_HP_EVENT)
4670 alc260_replacer_672v_automute(codec);
4673 /* Test configuration for debugging, modelled after the ALC880 test
4676 #ifdef CONFIG_SND_DEBUG
4677 static hda_nid_t alc260_test_dac_nids[1] = {
4680 static hda_nid_t alc260_test_adc_nids[2] = {
4683 /* For testing the ALC260, each input MUX needs its own definition since
4684 * the signal assignments are different. This assumes that the first ADC
4687 static struct hda_input_mux alc260_test_capture_sources[2] = {
4691 { "MIC1 pin", 0x0 },
4692 { "MIC2 pin", 0x1 },
4693 { "LINE1 pin", 0x2 },
4694 { "LINE2 pin", 0x3 },
4696 { "LINE-OUT pin", 0x5 },
4697 { "HP-OUT pin", 0x6 },
4703 { "MIC1 pin", 0x0 },
4704 { "MIC2 pin", 0x1 },
4705 { "LINE1 pin", 0x2 },
4706 { "LINE2 pin", 0x3 },
4709 { "LINE-OUT pin", 0x6 },
4710 { "HP-OUT pin", 0x7 },
4714 static struct snd_kcontrol_new alc260_test_mixer[] = {
4715 /* Output driver widgets */
4716 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4717 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4718 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4719 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4720 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4721 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4723 /* Modes for retasking pin widgets
4724 * Note: the ALC260 doesn't seem to act on requests to enable mic
4725 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4726 * mention this restriction. At this stage it's not clear whether
4727 * this behaviour is intentional or is a hardware bug in chip
4728 * revisions available at least up until early 2006. Therefore for
4729 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4730 * choices, but if it turns out that the lack of mic bias for these
4731 * NIDs is intentional we could change their modes from
4732 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4734 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4735 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4736 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4737 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4738 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4739 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4741 /* Loopback mixer controls */
4742 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4743 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4744 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4745 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4746 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4747 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4748 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4749 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4750 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4751 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4752 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4753 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4754 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4755 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4756 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4757 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4759 /* Controls for GPIO pins, assuming they are configured as outputs */
4760 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4761 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4762 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4763 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4765 /* Switches to allow the digital IO pins to be enabled. The datasheet
4766 * is ambigious as to which NID is which; testing on laptops which
4767 * make this output available should provide clarification.
4769 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4770 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4772 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4773 * this output to turn on an external amplifier.
4775 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4776 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4780 static struct hda_verb alc260_test_init_verbs[] = {
4781 /* Enable all GPIOs as outputs with an initial value of 0 */
4782 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4783 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4784 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4786 /* Enable retasking pins as output, initially without power amp */
4787 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4788 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4790 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4791 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4792 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4794 /* Disable digital (SPDIF) pins initially, but users can enable
4795 * them via a mixer switch. In the case of SPDIF-out, this initverb
4796 * payload also sets the generation to 0, output to be in "consumer"
4797 * PCM format, copyright asserted, no pre-emphasis and no validity
4800 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4801 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4803 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4804 * OUT1 sum bus when acting as an output.
4806 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4807 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4808 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4809 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4811 /* Start with output sum widgets muted and their output gains at min */
4812 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4813 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4814 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4815 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4816 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4817 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4818 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4819 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4820 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4822 /* Unmute retasking pin widget output buffers since the default
4823 * state appears to be output. As the pin mode is changed by the
4824 * user the pin mode control will take care of enabling the pin's
4825 * input/output buffers as needed.
4827 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4828 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4830 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4831 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4832 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4833 /* Also unmute the mono-out pin widget */
4834 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4836 /* Mute capture amp left and right */
4837 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4838 /* Set ADC connection select to match default mixer setting (mic1
4841 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4843 /* Do the same for the second ADC: mute capture input amp and
4844 * set ADC connection to mic1 pin
4846 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4847 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4849 /* Mute all inputs to mixer widget (even unconnected ones) */
4850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4863 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4864 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4866 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4867 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4870 * for BIOS auto-configuration
4873 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4877 unsigned long vol_val, sw_val;
4881 if (nid >= 0x0f && nid < 0x11) {
4882 nid_vol = nid - 0x7;
4883 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4884 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4885 } else if (nid == 0x11) {
4886 nid_vol = nid - 0x7;
4887 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4888 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4889 } else if (nid >= 0x12 && nid <= 0x15) {
4891 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4892 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4896 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4897 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4900 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4901 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4907 /* add playback controls from the parsed DAC table */
4908 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4909 const struct auto_pin_cfg *cfg)
4914 spec->multiout.num_dacs = 1;
4915 spec->multiout.dac_nids = spec->private_dac_nids;
4916 spec->multiout.dac_nids[0] = 0x02;
4918 nid = cfg->line_out_pins[0];
4920 err = alc260_add_playback_controls(spec, nid, "Front");
4925 nid = cfg->speaker_pins[0];
4927 err = alc260_add_playback_controls(spec, nid, "Speaker");
4932 nid = cfg->hp_pins[0];
4934 err = alc260_add_playback_controls(spec, nid, "Headphone");
4941 /* create playback/capture controls for input pins */
4942 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4943 const struct auto_pin_cfg *cfg)
4945 struct hda_input_mux *imux = &spec->private_imux;
4948 for (i = 0; i < AUTO_PIN_LAST; i++) {
4949 if (cfg->input_pins[i] >= 0x12) {
4950 idx = cfg->input_pins[i] - 0x12;
4951 err = new_analog_input(spec, cfg->input_pins[i],
4952 auto_pin_cfg_labels[i], idx,
4956 imux->items[imux->num_items].label =
4957 auto_pin_cfg_labels[i];
4958 imux->items[imux->num_items].index = idx;
4961 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4962 idx = cfg->input_pins[i] - 0x09;
4963 err = new_analog_input(spec, cfg->input_pins[i],
4964 auto_pin_cfg_labels[i], idx,
4968 imux->items[imux->num_items].label =
4969 auto_pin_cfg_labels[i];
4970 imux->items[imux->num_items].index = idx;
4977 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4978 hda_nid_t nid, int pin_type,
4981 alc_set_pin_output(codec, nid, pin_type);
4982 /* need the manual connection? */
4984 int idx = nid - 0x12;
4985 snd_hda_codec_write(codec, idx + 0x0b, 0,
4986 AC_VERB_SET_CONNECT_SEL, sel_idx);
4990 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4992 struct alc_spec *spec = codec->spec;
4995 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4996 nid = spec->autocfg.line_out_pins[0];
4998 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4999 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5002 nid = spec->autocfg.speaker_pins[0];
5004 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5006 nid = spec->autocfg.hp_pins[0];
5008 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5011 #define ALC260_PIN_CD_NID 0x16
5012 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5014 struct alc_spec *spec = codec->spec;
5017 for (i = 0; i < AUTO_PIN_LAST; i++) {
5018 hda_nid_t nid = spec->autocfg.input_pins[i];
5020 snd_hda_codec_write(codec, nid, 0,
5021 AC_VERB_SET_PIN_WIDGET_CONTROL,
5022 i <= AUTO_PIN_FRONT_MIC ?
5023 PIN_VREF80 : PIN_IN);
5024 if (nid != ALC260_PIN_CD_NID)
5025 snd_hda_codec_write(codec, nid, 0,
5026 AC_VERB_SET_AMP_GAIN_MUTE,
5033 * generic initialization of ADC, input mixers and output mixers
5035 static struct hda_verb alc260_volume_init_verbs[] = {
5037 * Unmute ADC0-1 and set the default input to mic-in
5039 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5040 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5041 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5042 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5044 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5046 * Note: PASD motherboards uses the Line In 2 as the input for
5047 * front panel mic (mic 2)
5049 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5050 /* mute analog inputs */
5051 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5053 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5058 * Set up output mixers (0x08 - 0x0a)
5060 /* set vol=0 to output mixers */
5061 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5062 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5063 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5064 /* set up input amps for analog loopback */
5065 /* Amp Indices: DAC = 0, mixer = 1 */
5066 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5067 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5068 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5069 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5070 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5071 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5076 static int alc260_parse_auto_config(struct hda_codec *codec)
5078 struct alc_spec *spec = codec->spec;
5081 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5083 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5087 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5090 if (!spec->kctl_alloc)
5091 return 0; /* can't find valid BIOS pin config */
5092 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5096 spec->multiout.max_channels = 2;
5098 if (spec->autocfg.dig_out_pin)
5099 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5100 if (spec->kctl_alloc)
5101 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5103 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5105 spec->num_mux_defs = 1;
5106 spec->input_mux = &spec->private_imux;
5108 /* check whether NID 0x04 is valid */
5109 wcap = get_wcaps(codec, 0x04);
5110 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5111 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5112 spec->adc_nids = alc260_adc_nids_alt;
5113 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5114 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5116 spec->adc_nids = alc260_adc_nids;
5117 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5118 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5125 /* additional initialization for auto-configuration model */
5126 static void alc260_auto_init(struct hda_codec *codec)
5128 struct alc_spec *spec = codec->spec;
5129 alc260_auto_init_multi_out(codec);
5130 alc260_auto_init_analog_input(codec);
5131 if (spec->unsol_event)
5132 alc_sku_automute(codec);
5135 #ifdef CONFIG_SND_HDA_POWER_SAVE
5136 static struct hda_amp_list alc260_loopbacks[] = {
5137 { 0x07, HDA_INPUT, 0 },
5138 { 0x07, HDA_INPUT, 1 },
5139 { 0x07, HDA_INPUT, 2 },
5140 { 0x07, HDA_INPUT, 3 },
5141 { 0x07, HDA_INPUT, 4 },
5147 * ALC260 configurations
5149 static const char *alc260_models[ALC260_MODEL_LAST] = {
5150 [ALC260_BASIC] = "basic",
5152 [ALC260_HP_3013] = "hp-3013",
5153 [ALC260_FUJITSU_S702X] = "fujitsu",
5154 [ALC260_ACER] = "acer",
5155 [ALC260_WILL] = "will",
5156 [ALC260_REPLACER_672V] = "replacer",
5157 #ifdef CONFIG_SND_DEBUG
5158 [ALC260_TEST] = "test",
5160 [ALC260_AUTO] = "auto",
5163 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5164 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5165 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5166 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5167 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5168 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5169 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
5170 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5171 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5172 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5173 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5174 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5175 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5176 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5177 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5178 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5179 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5180 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5181 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5185 static struct alc_config_preset alc260_presets[] = {
5187 .mixers = { alc260_base_output_mixer,
5189 alc260_pc_beep_mixer,
5190 alc260_capture_mixer },
5191 .init_verbs = { alc260_init_verbs },
5192 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5193 .dac_nids = alc260_dac_nids,
5194 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5195 .adc_nids = alc260_adc_nids,
5196 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5197 .channel_mode = alc260_modes,
5198 .input_mux = &alc260_capture_source,
5201 .mixers = { alc260_hp_output_mixer,
5203 alc260_capture_alt_mixer },
5204 .init_verbs = { alc260_init_verbs,
5205 alc260_hp_unsol_verbs },
5206 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5207 .dac_nids = alc260_dac_nids,
5208 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5209 .adc_nids = alc260_hp_adc_nids,
5210 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5211 .channel_mode = alc260_modes,
5212 .input_mux = &alc260_capture_source,
5213 .unsol_event = alc260_hp_unsol_event,
5214 .init_hook = alc260_hp_automute,
5216 [ALC260_HP_3013] = {
5217 .mixers = { alc260_hp_3013_mixer,
5219 alc260_capture_alt_mixer },
5220 .init_verbs = { alc260_hp_3013_init_verbs,
5221 alc260_hp_3013_unsol_verbs },
5222 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5223 .dac_nids = alc260_dac_nids,
5224 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5225 .adc_nids = alc260_hp_adc_nids,
5226 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5227 .channel_mode = alc260_modes,
5228 .input_mux = &alc260_capture_source,
5229 .unsol_event = alc260_hp_3013_unsol_event,
5230 .init_hook = alc260_hp_3013_automute,
5232 [ALC260_FUJITSU_S702X] = {
5233 .mixers = { alc260_fujitsu_mixer,
5234 alc260_capture_mixer },
5235 .init_verbs = { alc260_fujitsu_init_verbs },
5236 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5237 .dac_nids = alc260_dac_nids,
5238 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5239 .adc_nids = alc260_dual_adc_nids,
5240 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5241 .channel_mode = alc260_modes,
5242 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5243 .input_mux = alc260_fujitsu_capture_sources,
5246 .mixers = { alc260_acer_mixer,
5247 alc260_capture_mixer },
5248 .init_verbs = { alc260_acer_init_verbs },
5249 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5250 .dac_nids = alc260_dac_nids,
5251 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5252 .adc_nids = alc260_dual_adc_nids,
5253 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5254 .channel_mode = alc260_modes,
5255 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5256 .input_mux = alc260_acer_capture_sources,
5259 .mixers = { alc260_will_mixer,
5260 alc260_capture_mixer },
5261 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5262 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5263 .dac_nids = alc260_dac_nids,
5264 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5265 .adc_nids = alc260_adc_nids,
5266 .dig_out_nid = ALC260_DIGOUT_NID,
5267 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5268 .channel_mode = alc260_modes,
5269 .input_mux = &alc260_capture_source,
5271 [ALC260_REPLACER_672V] = {
5272 .mixers = { alc260_replacer_672v_mixer,
5273 alc260_capture_mixer },
5274 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5275 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5276 .dac_nids = alc260_dac_nids,
5277 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5278 .adc_nids = alc260_adc_nids,
5279 .dig_out_nid = ALC260_DIGOUT_NID,
5280 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5281 .channel_mode = alc260_modes,
5282 .input_mux = &alc260_capture_source,
5283 .unsol_event = alc260_replacer_672v_unsol_event,
5284 .init_hook = alc260_replacer_672v_automute,
5286 #ifdef CONFIG_SND_DEBUG
5288 .mixers = { alc260_test_mixer,
5289 alc260_capture_mixer },
5290 .init_verbs = { alc260_test_init_verbs },
5291 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5292 .dac_nids = alc260_test_dac_nids,
5293 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5294 .adc_nids = alc260_test_adc_nids,
5295 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5296 .channel_mode = alc260_modes,
5297 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5298 .input_mux = alc260_test_capture_sources,
5303 static int patch_alc260(struct hda_codec *codec)
5305 struct alc_spec *spec;
5306 int err, board_config;
5308 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5314 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5317 if (board_config < 0) {
5318 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5319 "trying auto-probe from BIOS...\n");
5320 board_config = ALC260_AUTO;
5323 if (board_config == ALC260_AUTO) {
5324 /* automatic parse from the BIOS config */
5325 err = alc260_parse_auto_config(codec);
5331 "hda_codec: Cannot set up configuration "
5332 "from BIOS. Using base mode...\n");
5333 board_config = ALC260_BASIC;
5337 if (board_config != ALC260_AUTO)
5338 setup_preset(spec, &alc260_presets[board_config]);
5340 spec->stream_name_analog = "ALC260 Analog";
5341 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5342 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5344 spec->stream_name_digital = "ALC260 Digital";
5345 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5346 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5348 spec->vmaster_nid = 0x08;
5350 codec->patch_ops = alc_patch_ops;
5351 if (board_config == ALC260_AUTO)
5352 spec->init_hook = alc260_auto_init;
5353 #ifdef CONFIG_SND_HDA_POWER_SAVE
5354 if (!spec->loopback.amplist)
5355 spec->loopback.amplist = alc260_loopbacks;
5365 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5366 * configuration. Each pin widget can choose any input DACs and a mixer.
5367 * Each ADC is connected from a mixer of all inputs. This makes possible
5368 * 6-channel independent captures.
5370 * In addition, an independent DAC for the multi-playback (not used in this
5373 #define ALC882_DIGOUT_NID 0x06
5374 #define ALC882_DIGIN_NID 0x0a
5376 static struct hda_channel_mode alc882_ch_modes[1] = {
5380 static hda_nid_t alc882_dac_nids[4] = {
5381 /* front, rear, clfe, rear_surr */
5382 0x02, 0x03, 0x04, 0x05
5385 /* identical with ALC880 */
5386 #define alc882_adc_nids alc880_adc_nids
5387 #define alc882_adc_nids_alt alc880_adc_nids_alt
5389 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5390 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5393 /* FIXME: should be a matrix-type input source selection */
5395 static struct hda_input_mux alc882_capture_source = {
5399 { "Front Mic", 0x1 },
5404 #define alc882_mux_enum_info alc_mux_enum_info
5405 #define alc882_mux_enum_get alc_mux_enum_get
5407 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5408 struct snd_ctl_elem_value *ucontrol)
5410 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5411 struct alc_spec *spec = codec->spec;
5412 const struct hda_input_mux *imux = spec->input_mux;
5413 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5414 hda_nid_t nid = spec->capsrc_nids ?
5415 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5416 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5417 unsigned int i, idx;
5419 idx = ucontrol->value.enumerated.item[0];
5420 if (idx >= imux->num_items)
5421 idx = imux->num_items - 1;
5422 if (*cur_val == idx)
5424 for (i = 0; i < imux->num_items; i++) {
5425 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5426 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5427 imux->items[i].index,
5437 static struct hda_verb alc882_3ST_ch2_init[] = {
5438 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5439 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5440 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5441 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5448 static struct hda_verb alc882_3ST_ch6_init[] = {
5449 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5450 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5451 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5452 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5453 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5454 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5458 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5459 { 2, alc882_3ST_ch2_init },
5460 { 6, alc882_3ST_ch6_init },
5466 static struct hda_verb alc882_sixstack_ch6_init[] = {
5467 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5468 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5469 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5470 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5477 static struct hda_verb alc882_sixstack_ch8_init[] = {
5478 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5479 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5480 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5481 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5485 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5486 { 6, alc882_sixstack_ch6_init },
5487 { 8, alc882_sixstack_ch8_init },
5491 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5497 static struct hda_verb alc885_mbp_ch2_init[] = {
5498 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5499 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5500 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5507 static struct hda_verb alc885_mbp_ch6_init[] = {
5508 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5509 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5510 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5511 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5512 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5516 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5517 { 2, alc885_mbp_ch2_init },
5518 { 6, alc885_mbp_ch6_init },
5522 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5523 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5525 static struct snd_kcontrol_new alc882_base_mixer[] = {
5526 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5527 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5528 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5529 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5530 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5531 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5532 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5533 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5534 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5535 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5537 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5538 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5539 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5540 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5542 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5543 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5544 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5545 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5546 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5547 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5548 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5552 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5553 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5554 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5555 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5556 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5557 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5558 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5560 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5561 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5562 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5565 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5566 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5567 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5568 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5569 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5570 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5571 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5573 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5574 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5575 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5576 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5580 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5581 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5582 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5583 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5584 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5585 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5586 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5587 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5591 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5592 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5593 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5597 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5598 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5600 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5601 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5602 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5603 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5604 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5605 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5606 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5607 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5608 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5609 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5610 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5611 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5612 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5613 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5617 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5618 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5619 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5620 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5621 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5622 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5623 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5624 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5626 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5627 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5628 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5629 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5633 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5635 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5636 .name = "Channel Mode",
5637 .info = alc_ch_mode_info,
5638 .get = alc_ch_mode_get,
5639 .put = alc_ch_mode_put,
5644 static struct hda_verb alc882_init_verbs[] = {
5645 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5646 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5650 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5656 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5658 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5659 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5662 /* Front Pin: output 0 (0x0c) */
5663 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5664 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5665 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5666 /* Rear Pin: output 1 (0x0d) */
5667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5669 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5670 /* CLFE Pin: output 2 (0x0e) */
5671 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5672 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5673 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5674 /* Side Pin: output 3 (0x0f) */
5675 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5676 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5677 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5678 /* Mic (rear) pin: input vref at 80% */
5679 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5680 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5681 /* Front Mic pin: input vref at 80% */
5682 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5684 /* Line In pin: input */
5685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5687 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5689 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5690 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5691 /* CD pin widget for input */
5692 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5694 /* FIXME: use matrix-type input source selection */
5695 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5696 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5702 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5711 /* ADC1: mute amp left and right */
5712 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5713 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5714 /* ADC2: mute amp left and right */
5715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5716 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5717 /* ADC3: mute amp left and right */
5718 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5719 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5724 static struct hda_verb alc882_eapd_verbs[] = {
5725 /* change to EAPD mode */
5726 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5727 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5732 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5733 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5734 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5736 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5737 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5738 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5739 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5743 static struct hda_verb alc882_macpro_init_verbs[] = {
5744 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5748 /* Front Pin: output 0 (0x0c) */
5749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5752 /* Front Mic pin: input vref at 80% */
5753 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5754 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5755 /* Speaker: output */
5756 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5758 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5759 /* Headphone output (output 0 - 0x0c) */
5760 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5761 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5762 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5764 /* FIXME: use matrix-type input source selection */
5765 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5766 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5781 /* ADC1: mute amp left and right */
5782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5783 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5784 /* ADC2: mute amp left and right */
5785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5786 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5787 /* ADC3: mute amp left and right */
5788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5789 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5794 /* Macbook Pro rev3 */
5795 static struct hda_verb alc885_mbp3_init_verbs[] = {
5796 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5804 /* Front Pin: output 0 (0x0c) */
5805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5807 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5808 /* HP Pin: output 0 (0x0d) */
5809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5811 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5812 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5813 /* Mic (rear) pin: input vref at 80% */
5814 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5815 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5816 /* Front Mic pin: input vref at 80% */
5817 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5818 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5819 /* Line In pin: use output 1 when in LineOut mode */
5820 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5821 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5822 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5824 /* FIXME: use matrix-type input source selection */
5825 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5826 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5827 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5828 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5829 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5830 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5832 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5833 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5834 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5835 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5837 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5839 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5841 /* ADC1: mute amp left and right */
5842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5843 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5844 /* ADC2: mute amp left and right */
5845 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5846 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5847 /* ADC3: mute amp left and right */
5848 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5849 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5854 /* iMac 24 mixer. */
5855 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5856 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5857 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5861 /* iMac 24 init verbs. */
5862 static struct hda_verb alc885_imac24_init_verbs[] = {
5863 /* Internal speakers: output 0 (0x0c) */
5864 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5865 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5866 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5867 /* Internal speakers: output 0 (0x0c) */
5868 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5869 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5870 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5871 /* Headphone: output 0 (0x0c) */
5872 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5873 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5874 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5875 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5876 /* Front Mic: input vref at 80% */
5877 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5882 /* Toggle speaker-output according to the hp-jack state */
5883 static void alc885_imac24_automute(struct hda_codec *codec)
5885 unsigned int present;
5887 present = snd_hda_codec_read(codec, 0x14, 0,
5888 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5889 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5890 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5891 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5892 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5895 /* Processes unsolicited events. */
5896 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5899 /* Headphone insertion or removal. */
5900 if ((res >> 26) == ALC880_HP_EVENT)
5901 alc885_imac24_automute(codec);
5904 static void alc885_mbp3_automute(struct hda_codec *codec)
5906 unsigned int present;
5908 present = snd_hda_codec_read(codec, 0x15, 0,
5909 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5910 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5911 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5912 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5913 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5916 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5919 /* Headphone insertion or removal. */
5920 if ((res >> 26) == ALC880_HP_EVENT)
5921 alc885_mbp3_automute(codec);
5925 static struct hda_verb alc882_targa_verbs[] = {
5926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5930 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5932 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5933 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5934 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5936 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5937 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5938 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5939 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5943 /* toggle speaker-output according to the hp-jack state */
5944 static void alc882_targa_automute(struct hda_codec *codec)
5946 unsigned int present;
5948 present = snd_hda_codec_read(codec, 0x14, 0,
5949 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5950 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5951 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5952 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5956 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5958 /* Looks like the unsol event is incompatible with the standard
5959 * definition. 4bit tag is placed at 26 bit!
5961 if (((res >> 26) == ALC880_HP_EVENT)) {
5962 alc882_targa_automute(codec);
5966 static struct hda_verb alc882_asus_a7j_verbs[] = {
5967 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5971 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5974 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5976 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5978 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5979 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5980 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5984 static struct hda_verb alc882_asus_a7m_verbs[] = {
5985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5989 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5990 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5992 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5994 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5996 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5997 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5998 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6002 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6004 unsigned int gpiostate, gpiomask, gpiodir;
6006 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6007 AC_VERB_GET_GPIO_DATA, 0);
6010 gpiostate |= (1 << pin);
6012 gpiostate &= ~(1 << pin);
6014 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6015 AC_VERB_GET_GPIO_MASK, 0);
6016 gpiomask |= (1 << pin);
6018 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6019 AC_VERB_GET_GPIO_DIRECTION, 0);
6020 gpiodir |= (1 << pin);
6023 snd_hda_codec_write(codec, codec->afg, 0,
6024 AC_VERB_SET_GPIO_MASK, gpiomask);
6025 snd_hda_codec_write(codec, codec->afg, 0,
6026 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6030 snd_hda_codec_write(codec, codec->afg, 0,
6031 AC_VERB_SET_GPIO_DATA, gpiostate);
6034 /* set up GPIO at initialization */
6035 static void alc885_macpro_init_hook(struct hda_codec *codec)
6037 alc882_gpio_mute(codec, 0, 0);
6038 alc882_gpio_mute(codec, 1, 0);
6041 /* set up GPIO and update auto-muting at initialization */
6042 static void alc885_imac24_init_hook(struct hda_codec *codec)
6044 alc885_macpro_init_hook(codec);
6045 alc885_imac24_automute(codec);
6049 * generic initialization of ADC, input mixers and output mixers
6051 static struct hda_verb alc882_auto_init_verbs[] = {
6053 * Unmute ADC0-2 and set the default input to mic-in
6055 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6057 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6058 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6059 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6060 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6062 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6064 * Note: PASD motherboards uses the Line In 2 as the input for
6065 * front panel mic (mic 2)
6067 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6075 * Set up output mixers (0x0c - 0x0f)
6077 /* set vol=0 to output mixers */
6078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6082 /* set up input amps for analog loopback */
6083 /* Amp Indices: DAC = 0, mixer = 1 */
6084 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6086 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6088 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6089 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6092 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6093 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6095 /* FIXME: use matrix-type input source selection */
6096 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6097 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6098 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6100 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6101 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6103 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6105 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6106 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6116 /* capture mixer elements */
6117 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6118 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6119 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6120 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6121 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6123 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6124 /* The multiple "Capture Source" controls confuse alsamixer
6125 * So call somewhat different..
6127 /* .name = "Capture Source", */
6128 .name = "Input Source",
6130 .info = alc882_mux_enum_info,
6131 .get = alc882_mux_enum_get,
6132 .put = alc882_mux_enum_put,
6137 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6138 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6139 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6140 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6141 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6142 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6143 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6145 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6146 /* The multiple "Capture Source" controls confuse alsamixer
6147 * So call somewhat different..
6149 /* .name = "Capture Source", */
6150 .name = "Input Source",
6152 .info = alc882_mux_enum_info,
6153 .get = alc882_mux_enum_get,
6154 .put = alc882_mux_enum_put,
6159 #ifdef CONFIG_SND_HDA_POWER_SAVE
6160 #define alc882_loopbacks alc880_loopbacks
6163 /* pcm configuration: identiacal with ALC880 */
6164 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6165 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6166 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6167 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6170 * configuration and preset
6172 static const char *alc882_models[ALC882_MODEL_LAST] = {
6173 [ALC882_3ST_DIG] = "3stack-dig",
6174 [ALC882_6ST_DIG] = "6stack-dig",
6175 [ALC882_ARIMA] = "arima",
6176 [ALC882_W2JC] = "w2jc",
6177 [ALC882_TARGA] = "targa",
6178 [ALC882_ASUS_A7J] = "asus-a7j",
6179 [ALC882_ASUS_A7M] = "asus-a7m",
6180 [ALC885_MACPRO] = "macpro",
6181 [ALC885_MBP3] = "mbp3",
6182 [ALC885_IMAC24] = "imac24",
6183 [ALC882_AUTO] = "auto",
6186 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6187 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6188 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6189 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6190 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6191 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6192 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6193 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6194 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6195 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6196 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6197 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6198 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6202 static struct alc_config_preset alc882_presets[] = {
6203 [ALC882_3ST_DIG] = {
6204 .mixers = { alc882_base_mixer },
6205 .init_verbs = { alc882_init_verbs },
6206 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6207 .dac_nids = alc882_dac_nids,
6208 .dig_out_nid = ALC882_DIGOUT_NID,
6209 .dig_in_nid = ALC882_DIGIN_NID,
6210 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6211 .channel_mode = alc882_ch_modes,
6213 .input_mux = &alc882_capture_source,
6215 [ALC882_6ST_DIG] = {
6216 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6217 .init_verbs = { alc882_init_verbs },
6218 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6219 .dac_nids = alc882_dac_nids,
6220 .dig_out_nid = ALC882_DIGOUT_NID,
6221 .dig_in_nid = ALC882_DIGIN_NID,
6222 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6223 .channel_mode = alc882_sixstack_modes,
6224 .input_mux = &alc882_capture_source,
6227 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6228 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6229 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6230 .dac_nids = alc882_dac_nids,
6231 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6232 .channel_mode = alc882_sixstack_modes,
6233 .input_mux = &alc882_capture_source,
6236 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6237 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6238 alc880_gpio1_init_verbs },
6239 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6240 .dac_nids = alc882_dac_nids,
6241 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6242 .channel_mode = alc880_threestack_modes,
6244 .input_mux = &alc882_capture_source,
6245 .dig_out_nid = ALC882_DIGOUT_NID,
6248 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6249 .init_verbs = { alc885_mbp3_init_verbs,
6250 alc880_gpio1_init_verbs },
6251 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6252 .dac_nids = alc882_dac_nids,
6253 .channel_mode = alc885_mbp_6ch_modes,
6254 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6255 .input_mux = &alc882_capture_source,
6256 .dig_out_nid = ALC882_DIGOUT_NID,
6257 .dig_in_nid = ALC882_DIGIN_NID,
6258 .unsol_event = alc885_mbp3_unsol_event,
6259 .init_hook = alc885_mbp3_automute,
6262 .mixers = { alc882_macpro_mixer },
6263 .init_verbs = { alc882_macpro_init_verbs },
6264 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6265 .dac_nids = alc882_dac_nids,
6266 .dig_out_nid = ALC882_DIGOUT_NID,
6267 .dig_in_nid = ALC882_DIGIN_NID,
6268 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6269 .channel_mode = alc882_ch_modes,
6270 .input_mux = &alc882_capture_source,
6271 .init_hook = alc885_macpro_init_hook,
6274 .mixers = { alc885_imac24_mixer },
6275 .init_verbs = { alc885_imac24_init_verbs },
6276 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6277 .dac_nids = alc882_dac_nids,
6278 .dig_out_nid = ALC882_DIGOUT_NID,
6279 .dig_in_nid = ALC882_DIGIN_NID,
6280 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6281 .channel_mode = alc882_ch_modes,
6282 .input_mux = &alc882_capture_source,
6283 .unsol_event = alc885_imac24_unsol_event,
6284 .init_hook = alc885_imac24_init_hook,
6287 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6288 alc882_capture_mixer },
6289 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6290 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6291 .dac_nids = alc882_dac_nids,
6292 .dig_out_nid = ALC882_DIGOUT_NID,
6293 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6294 .adc_nids = alc882_adc_nids,
6295 .capsrc_nids = alc882_capsrc_nids,
6296 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6297 .channel_mode = alc882_3ST_6ch_modes,
6299 .input_mux = &alc882_capture_source,
6300 .unsol_event = alc882_targa_unsol_event,
6301 .init_hook = alc882_targa_automute,
6303 [ALC882_ASUS_A7J] = {
6304 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6305 alc882_capture_mixer },
6306 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6307 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6308 .dac_nids = alc882_dac_nids,
6309 .dig_out_nid = ALC882_DIGOUT_NID,
6310 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6311 .adc_nids = alc882_adc_nids,
6312 .capsrc_nids = alc882_capsrc_nids,
6313 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6314 .channel_mode = alc882_3ST_6ch_modes,
6316 .input_mux = &alc882_capture_source,
6318 [ALC882_ASUS_A7M] = {
6319 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6320 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6321 alc880_gpio1_init_verbs,
6322 alc882_asus_a7m_verbs },
6323 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6324 .dac_nids = alc882_dac_nids,
6325 .dig_out_nid = ALC882_DIGOUT_NID,
6326 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6327 .channel_mode = alc880_threestack_modes,
6329 .input_mux = &alc882_capture_source,
6338 PINFIX_ABIT_AW9D_MAX
6341 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6342 { 0x15, 0x01080104 }, /* side */
6343 { 0x16, 0x01011012 }, /* rear */
6344 { 0x17, 0x01016011 }, /* clfe */
6348 static const struct alc_pincfg *alc882_pin_fixes[] = {
6349 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6352 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6353 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6358 * BIOS auto configuration
6360 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6361 hda_nid_t nid, int pin_type,
6365 struct alc_spec *spec = codec->spec;
6368 alc_set_pin_output(codec, nid, pin_type);
6369 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6372 idx = spec->multiout.dac_nids[dac_idx] - 2;
6373 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6377 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6379 struct alc_spec *spec = codec->spec;
6382 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6383 for (i = 0; i <= HDA_SIDE; i++) {
6384 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6385 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6387 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6392 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6394 struct alc_spec *spec = codec->spec;
6397 pin = spec->autocfg.hp_pins[0];
6398 if (pin) /* connect to front */
6400 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6401 pin = spec->autocfg.speaker_pins[0];
6403 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6406 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6407 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6409 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6411 struct alc_spec *spec = codec->spec;
6414 for (i = 0; i < AUTO_PIN_LAST; i++) {
6415 hda_nid_t nid = spec->autocfg.input_pins[i];
6420 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6421 unsigned int pincap;
6422 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6423 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6427 snd_hda_codec_write(codec, nid, 0,
6428 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6429 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6430 snd_hda_codec_write(codec, nid, 0,
6431 AC_VERB_SET_AMP_GAIN_MUTE,
6436 /* add mic boosts if needed */
6437 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6439 struct alc_spec *spec = codec->spec;
6443 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6444 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6445 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6447 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6451 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6452 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6453 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6455 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6462 /* almost identical with ALC880 parser... */
6463 static int alc882_parse_auto_config(struct hda_codec *codec)
6465 struct alc_spec *spec = codec->spec;
6466 int err = alc880_parse_auto_config(codec);
6471 return 0; /* no config found */
6473 err = alc_auto_add_mic_boost(codec);
6477 /* hack - override the init verbs */
6478 spec->init_verbs[0] = alc882_auto_init_verbs;
6480 return 1; /* config found */
6483 /* additional initialization for auto-configuration model */
6484 static void alc882_auto_init(struct hda_codec *codec)
6486 struct alc_spec *spec = codec->spec;
6487 alc882_auto_init_multi_out(codec);
6488 alc882_auto_init_hp_out(codec);
6489 alc882_auto_init_analog_input(codec);
6490 if (spec->unsol_event)
6491 alc_sku_automute(codec);
6494 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6496 static int patch_alc882(struct hda_codec *codec)
6498 struct alc_spec *spec;
6499 int err, board_config;
6501 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6507 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6511 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6512 /* Pick up systems that don't supply PCI SSID */
6513 switch (codec->subsystem_id) {
6514 case 0x106b0c00: /* Mac Pro */
6515 board_config = ALC885_MACPRO;
6517 case 0x106b1000: /* iMac 24 */
6518 board_config = ALC885_IMAC24;
6520 case 0x106b00a1: /* Macbook */
6521 case 0x106b2c00: /* Macbook Pro rev3 */
6522 board_config = ALC885_MBP3;
6525 /* ALC889A is handled better as ALC888-compatible */
6526 if (codec->revision_id == 0x100103) {
6528 return patch_alc883(codec);
6530 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6531 "trying auto-probe from BIOS...\n");
6532 board_config = ALC882_AUTO;
6536 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6538 if (board_config == ALC882_AUTO) {
6539 /* automatic parse from the BIOS config */
6540 err = alc882_parse_auto_config(codec);
6546 "hda_codec: Cannot set up configuration "
6547 "from BIOS. Using base mode...\n");
6548 board_config = ALC882_3ST_DIG;
6552 if (board_config != ALC882_AUTO)
6553 setup_preset(spec, &alc882_presets[board_config]);
6555 if (codec->vendor_id == 0x10ec0885) {
6556 spec->stream_name_analog = "ALC885 Analog";
6557 spec->stream_name_digital = "ALC885 Digital";
6559 spec->stream_name_analog = "ALC882 Analog";
6560 spec->stream_name_digital = "ALC882 Digital";
6563 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6564 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6565 /* FIXME: setup DAC5 */
6566 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6567 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6569 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6570 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6572 if (!spec->adc_nids && spec->input_mux) {
6573 /* check whether NID 0x07 is valid */
6574 unsigned int wcap = get_wcaps(codec, 0x07);
6576 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6577 if (wcap != AC_WID_AUD_IN) {
6578 spec->adc_nids = alc882_adc_nids_alt;
6579 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6580 spec->capsrc_nids = alc882_capsrc_nids_alt;
6581 spec->mixers[spec->num_mixers] =
6582 alc882_capture_alt_mixer;
6585 spec->adc_nids = alc882_adc_nids;
6586 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6587 spec->capsrc_nids = alc882_capsrc_nids;
6588 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6593 spec->vmaster_nid = 0x0c;
6595 codec->patch_ops = alc_patch_ops;
6596 if (board_config == ALC882_AUTO)
6597 spec->init_hook = alc882_auto_init;
6598 #ifdef CONFIG_SND_HDA_POWER_SAVE
6599 if (!spec->loopback.amplist)
6600 spec->loopback.amplist = alc882_loopbacks;
6609 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6610 * configuration. Each pin widget can choose any input DACs and a mixer.
6611 * Each ADC is connected from a mixer of all inputs. This makes possible
6612 * 6-channel independent captures.
6614 * In addition, an independent DAC for the multi-playback (not used in this
6617 #define ALC883_DIGOUT_NID 0x06
6618 #define ALC883_DIGIN_NID 0x0a
6620 static hda_nid_t alc883_dac_nids[4] = {
6621 /* front, rear, clfe, rear_surr */
6622 0x02, 0x03, 0x04, 0x05
6625 static hda_nid_t alc883_adc_nids[2] = {
6630 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6633 /* FIXME: should be a matrix-type input source selection */
6635 static struct hda_input_mux alc883_capture_source = {
6639 { "Front Mic", 0x1 },
6645 static struct hda_input_mux alc883_3stack_6ch_intel = {
6649 { "Front Mic", 0x0 },
6655 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6663 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6673 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6681 #define alc883_mux_enum_info alc_mux_enum_info
6682 #define alc883_mux_enum_get alc_mux_enum_get
6683 /* ALC883 has the ALC882-type input selection */
6684 #define alc883_mux_enum_put alc882_mux_enum_put
6689 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6696 static struct hda_verb alc883_3ST_ch2_init[] = {
6697 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6698 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6699 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6700 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6707 static struct hda_verb alc883_3ST_ch4_init[] = {
6708 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6709 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6710 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6711 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6712 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6719 static struct hda_verb alc883_3ST_ch6_init[] = {
6720 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6721 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6722 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6723 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6724 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6725 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6729 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6730 { 2, alc883_3ST_ch2_init },
6731 { 4, alc883_3ST_ch4_init },
6732 { 6, alc883_3ST_ch6_init },
6738 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6739 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6740 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6741 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6742 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6749 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6750 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6751 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6752 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6753 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6754 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6761 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6762 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6763 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6764 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6765 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6766 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6767 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6771 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6772 { 2, alc883_3ST_ch2_intel_init },
6773 { 4, alc883_3ST_ch4_intel_init },
6774 { 6, alc883_3ST_ch6_intel_init },
6780 static struct hda_verb alc883_sixstack_ch6_init[] = {
6781 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6782 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6783 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6784 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6791 static struct hda_verb alc883_sixstack_ch8_init[] = {
6792 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6793 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6794 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6795 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6800 { 6, alc883_sixstack_ch6_init },
6801 { 8, alc883_sixstack_ch8_init },
6804 static struct hda_verb alc883_medion_eapd_verbs[] = {
6805 /* eanable EAPD on medion laptop */
6806 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6807 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6811 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6812 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6815 static struct snd_kcontrol_new alc883_base_mixer[] = {
6816 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6817 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6818 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6819 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6820 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6821 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6822 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6823 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6824 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6825 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6826 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6827 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6828 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6829 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6830 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6832 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6833 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6834 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6835 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6836 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6837 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6838 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6839 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6840 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6841 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6842 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6844 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6845 /* .name = "Capture Source", */
6846 .name = "Input Source",
6848 .info = alc883_mux_enum_info,
6849 .get = alc883_mux_enum_get,
6850 .put = alc883_mux_enum_put,
6855 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6856 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6857 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6858 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6859 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6860 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6861 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6862 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6863 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6864 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6865 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6866 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6867 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6868 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6869 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6870 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6871 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6872 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6874 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6875 /* .name = "Capture Source", */
6876 .name = "Input Source",
6878 .info = alc883_mux_enum_info,
6879 .get = alc883_mux_enum_get,
6880 .put = alc883_mux_enum_put,
6885 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6886 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6887 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6888 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6889 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6891 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6893 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6894 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6895 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6896 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6897 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6898 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6899 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6901 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6902 /* .name = "Capture Source", */
6903 .name = "Input Source",
6905 .info = alc883_mux_enum_info,
6906 .get = alc883_mux_enum_get,
6907 .put = alc883_mux_enum_put,
6912 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6913 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6914 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6915 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6916 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6918 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6920 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6921 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6922 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6923 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6924 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6925 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6926 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6928 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6929 /* .name = "Capture Source", */
6930 .name = "Input Source",
6932 .info = alc883_mux_enum_info,
6933 .get = alc883_mux_enum_get,
6934 .put = alc883_mux_enum_put,
6939 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6940 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6941 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6942 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6943 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6944 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6950 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6951 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6953 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6954 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6955 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6956 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6957 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6958 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6961 /* .name = "Capture Source", */
6962 .name = "Input Source",
6964 .info = alc883_mux_enum_info,
6965 .get = alc883_mux_enum_get,
6966 .put = alc883_mux_enum_put,
6971 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6973 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6974 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6975 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6976 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6977 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6978 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6979 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6981 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6982 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6983 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6984 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6986 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6987 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6989 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6990 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6991 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6992 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6993 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6994 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6995 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6996 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6998 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6999 /* .name = "Capture Source", */
7000 .name = "Input Source",
7002 .info = alc883_mux_enum_info,
7003 .get = alc883_mux_enum_get,
7004 .put = alc883_mux_enum_put,
7009 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7010 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7011 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7012 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7013 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7014 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7016 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7017 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7018 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7019 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7025 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7027 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7028 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7029 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7030 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7031 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7033 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7034 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7035 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7037 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7038 /* .name = "Capture Source", */
7039 .name = "Input Source",
7041 .info = alc883_mux_enum_info,
7042 .get = alc883_mux_enum_get,
7043 .put = alc883_mux_enum_put,
7048 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7049 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7050 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7051 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7052 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7053 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7054 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7055 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
7056 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7057 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7058 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7059 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7060 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7061 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7065 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7068 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7069 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7071 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7074 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7075 /* .name = "Capture Source", */
7076 .name = "Input Source",
7078 .info = alc883_mux_enum_info,
7079 .get = alc883_mux_enum_get,
7080 .put = alc883_mux_enum_put,
7085 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7088 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7089 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7090 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7091 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7092 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7093 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7094 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7095 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7096 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7098 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7100 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7102 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7103 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7104 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7105 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7107 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7108 /* .name = "Capture Source", */
7109 .name = "Input Source",
7111 .info = alc883_mux_enum_info,
7112 .get = alc883_mux_enum_get,
7113 .put = alc883_mux_enum_put,
7118 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7120 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7121 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7125 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7126 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7127 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7128 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7129 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7130 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7131 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7132 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7133 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7136 /* .name = "Capture Source", */
7137 .name = "Input Source",
7139 .info = alc883_mux_enum_info,
7140 .get = alc883_mux_enum_get,
7141 .put = alc883_mux_enum_put,
7146 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7147 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7148 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7149 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7150 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7153 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7155 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7156 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7158 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7159 /* .name = "Capture Source", */
7160 .name = "Input Source",
7162 .info = alc883_mux_enum_info,
7163 .get = alc883_mux_enum_get,
7164 .put = alc883_mux_enum_put,
7169 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7170 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7171 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7173 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7174 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7177 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7178 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7179 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7180 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7181 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7182 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7184 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7185 /* .name = "Capture Source", */
7186 .name = "Input Source",
7188 .info = alc883_mux_enum_info,
7189 .get = alc883_mux_enum_get,
7190 .put = alc883_mux_enum_put,
7195 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7198 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7199 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7200 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7203 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7204 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7205 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7206 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7207 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7208 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7210 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7211 /* .name = "Capture Source", */
7212 .name = "Input Source",
7214 .info = alc883_mux_enum_info,
7215 .get = alc883_mux_enum_get,
7216 .put = alc883_mux_enum_put,
7221 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7224 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7225 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7226 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7227 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7228 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7230 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7231 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7232 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7233 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7235 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7236 /* .name = "Capture Source", */
7237 .name = "Input Source",
7239 .info = alc883_mux_enum_info,
7240 .get = alc883_mux_enum_get,
7241 .put = alc883_mux_enum_put,
7246 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7248 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7249 .name = "Channel Mode",
7250 .info = alc_ch_mode_info,
7251 .get = alc_ch_mode_get,
7252 .put = alc_ch_mode_put,
7257 static struct hda_verb alc883_init_verbs[] = {
7258 /* ADC1: mute amp left and right */
7259 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7260 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7261 /* ADC2: mute amp left and right */
7262 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7263 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7264 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7265 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7266 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7269 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7271 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7273 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7274 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7275 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7277 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7278 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7279 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7281 /* mute analog input loopbacks */
7282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7288 /* Front Pin: output 0 (0x0c) */
7289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7291 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7292 /* Rear Pin: output 1 (0x0d) */
7293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7295 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7296 /* CLFE Pin: output 2 (0x0e) */
7297 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7298 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7299 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7300 /* Side Pin: output 3 (0x0f) */
7301 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7302 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7303 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7304 /* Mic (rear) pin: input vref at 80% */
7305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7307 /* Front Mic pin: input vref at 80% */
7308 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7309 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7310 /* Line In pin: input */
7311 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7312 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7313 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7314 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7315 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7316 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7317 /* CD pin widget for input */
7318 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7320 /* FIXME: use matrix-type input source selection */
7321 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7335 /* toggle speaker-output according to the hp-jack state */
7336 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7338 unsigned int present;
7340 present = snd_hda_codec_read(codec, 0x15, 0,
7341 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7342 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7343 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7344 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7345 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7348 /* auto-toggle front mic */
7350 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7352 unsigned int present;
7355 present = snd_hda_codec_read(codec, 0x18, 0,
7356 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7357 bits = present ? HDA_AMP_MUTE : 0;
7358 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7362 static void alc883_mitac_automute(struct hda_codec *codec)
7364 alc883_mitac_hp_automute(codec);
7365 /* alc883_mitac_mic_automute(codec); */
7368 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7371 switch (res >> 26) {
7372 case ALC880_HP_EVENT:
7373 alc883_mitac_hp_automute(codec);
7375 case ALC880_MIC_EVENT:
7376 /* alc883_mitac_mic_automute(codec); */
7381 static struct hda_verb alc883_mitac_verbs[] = {
7383 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7384 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7386 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7387 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7389 /* enable unsolicited event */
7390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7391 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7396 static struct hda_verb alc883_clevo_m720_verbs[] = {
7398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7399 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7401 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7402 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7404 /* enable unsolicited event */
7405 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7406 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7411 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7413 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7416 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7417 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7419 /* enable unsolicited event */
7420 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7425 static struct hda_verb alc883_tagra_verbs[] = {
7426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7429 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7430 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7432 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7433 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7434 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7436 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7437 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7438 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7439 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7444 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7446 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7447 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7451 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7452 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7453 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7454 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7455 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7459 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7463 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7464 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7468 static struct hda_verb alc883_haier_w66_verbs[] = {
7469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7474 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7476 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7481 static struct hda_verb alc888_3st_hp_verbs[] = {
7482 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7483 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7484 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7488 static struct hda_verb alc888_6st_dell_verbs[] = {
7489 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7493 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7494 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7495 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7496 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7497 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7501 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7502 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7503 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7504 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7505 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7509 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7510 { 2, alc888_3st_hp_2ch_init },
7511 { 6, alc888_3st_hp_6ch_init },
7514 /* toggle front-jack and RCA according to the hp-jack state */
7515 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7517 unsigned int present;
7519 present = snd_hda_codec_read(codec, 0x1b, 0,
7520 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7521 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7522 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7523 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7524 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7527 /* toggle RCA according to the front-jack state */
7528 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7530 unsigned int present;
7532 present = snd_hda_codec_read(codec, 0x14, 0,
7533 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7534 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7535 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7538 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7541 if ((res >> 26) == ALC880_HP_EVENT)
7542 alc888_lenovo_ms7195_front_automute(codec);
7543 if ((res >> 26) == ALC880_FRONT_EVENT)
7544 alc888_lenovo_ms7195_rca_automute(codec);
7547 static struct hda_verb alc883_medion_md2_verbs[] = {
7548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7553 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7557 /* toggle speaker-output according to the hp-jack state */
7558 static void alc883_medion_md2_automute(struct hda_codec *codec)
7560 unsigned int present;
7562 present = snd_hda_codec_read(codec, 0x14, 0,
7563 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7564 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7565 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7568 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7571 if ((res >> 26) == ALC880_HP_EVENT)
7572 alc883_medion_md2_automute(codec);
7575 /* toggle speaker-output according to the hp-jack state */
7576 static void alc883_tagra_automute(struct hda_codec *codec)
7578 unsigned int present;
7581 present = snd_hda_codec_read(codec, 0x14, 0,
7582 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7583 bits = present ? HDA_AMP_MUTE : 0;
7584 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7585 HDA_AMP_MUTE, bits);
7586 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7590 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7592 if ((res >> 26) == ALC880_HP_EVENT)
7593 alc883_tagra_automute(codec);
7596 /* toggle speaker-output according to the hp-jack state */
7597 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7599 unsigned int present;
7602 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7603 & AC_PINSENSE_PRESENCE;
7604 bits = present ? HDA_AMP_MUTE : 0;
7605 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7606 HDA_AMP_MUTE, bits);
7609 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7611 unsigned int present;
7613 present = snd_hda_codec_read(codec, 0x18, 0,
7614 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7615 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7616 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7619 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7621 alc883_clevo_m720_hp_automute(codec);
7622 alc883_clevo_m720_mic_automute(codec);
7625 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7628 switch (res >> 26) {
7629 case ALC880_HP_EVENT:
7630 alc883_clevo_m720_hp_automute(codec);
7632 case ALC880_MIC_EVENT:
7633 alc883_clevo_m720_mic_automute(codec);
7638 /* toggle speaker-output according to the hp-jack state */
7639 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7641 unsigned int present;
7644 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7645 & AC_PINSENSE_PRESENCE;
7646 bits = present ? HDA_AMP_MUTE : 0;
7647 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7648 HDA_AMP_MUTE, bits);
7651 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7654 if ((res >> 26) == ALC880_HP_EVENT)
7655 alc883_2ch_fujitsu_pi2515_automute(codec);
7658 static void alc883_haier_w66_automute(struct hda_codec *codec)
7660 unsigned int present;
7663 present = snd_hda_codec_read(codec, 0x1b, 0,
7664 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7665 bits = present ? 0x80 : 0;
7666 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7670 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7673 if ((res >> 26) == ALC880_HP_EVENT)
7674 alc883_haier_w66_automute(codec);
7677 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7679 unsigned int present;
7682 present = snd_hda_codec_read(codec, 0x14, 0,
7683 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7684 bits = present ? HDA_AMP_MUTE : 0;
7685 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7686 HDA_AMP_MUTE, bits);
7689 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7691 unsigned int present;
7694 present = snd_hda_codec_read(codec, 0x1b, 0,
7695 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7696 bits = present ? HDA_AMP_MUTE : 0;
7697 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7698 HDA_AMP_MUTE, bits);
7699 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7700 HDA_AMP_MUTE, bits);
7703 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7706 if ((res >> 26) == ALC880_HP_EVENT)
7707 alc883_lenovo_101e_all_automute(codec);
7708 if ((res >> 26) == ALC880_FRONT_EVENT)
7709 alc883_lenovo_101e_ispeaker_automute(codec);
7712 /* toggle speaker-output according to the hp-jack state */
7713 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7715 unsigned int present;
7717 present = snd_hda_codec_read(codec, 0x14, 0,
7718 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7719 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7720 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7721 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7722 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7725 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7728 if ((res >> 26) == ALC880_HP_EVENT)
7729 alc883_acer_aspire_automute(codec);
7732 static struct hda_verb alc883_acer_eapd_verbs[] = {
7733 /* HP Pin: output 0 (0x0c) */
7734 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7735 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7736 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7737 /* Front Pin: output 0 (0x0c) */
7738 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7739 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7740 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7741 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7742 /* eanable EAPD on medion laptop */
7743 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7744 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7745 /* enable unsolicited event */
7746 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7750 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7752 unsigned int present;
7754 present = snd_hda_codec_read(codec, 0x1b, 0,
7755 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7756 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7757 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7758 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7759 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7760 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7761 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7762 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7763 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7766 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7769 switch (res >> 26) {
7770 case ALC880_HP_EVENT:
7771 printk("hp_event\n");
7772 alc888_6st_dell_front_automute(codec);
7778 * generic initialization of ADC, input mixers and output mixers
7780 static struct hda_verb alc883_auto_init_verbs[] = {
7782 * Unmute ADC0-2 and set the default input to mic-in
7784 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7786 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7787 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7789 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7791 * Note: PASD motherboards uses the Line In 2 as the input for
7792 * front panel mic (mic 2)
7794 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7802 * Set up output mixers (0x0c - 0x0f)
7804 /* set vol=0 to output mixers */
7805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7807 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7808 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7809 /* set up input amps for analog loopback */
7810 /* Amp Indices: DAC = 0, mixer = 1 */
7811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7817 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7818 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7819 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7820 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7822 /* FIXME: use matrix-type input source selection */
7823 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7826 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7827 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7828 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7829 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7831 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7832 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7833 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7834 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7835 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7840 /* capture mixer elements */
7841 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7842 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7843 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7844 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7845 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7847 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7848 /* The multiple "Capture Source" controls confuse alsamixer
7849 * So call somewhat different..
7851 /* .name = "Capture Source", */
7852 .name = "Input Source",
7854 .info = alc882_mux_enum_info,
7855 .get = alc882_mux_enum_get,
7856 .put = alc882_mux_enum_put,
7861 #ifdef CONFIG_SND_HDA_POWER_SAVE
7862 #define alc883_loopbacks alc880_loopbacks
7865 /* pcm configuration: identiacal with ALC880 */
7866 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7867 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7868 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7869 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7870 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7873 * configuration and preset
7875 static const char *alc883_models[ALC883_MODEL_LAST] = {
7876 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7877 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7878 [ALC883_3ST_6ch] = "3stack-6ch",
7879 [ALC883_6ST_DIG] = "6stack-dig",
7880 [ALC883_TARGA_DIG] = "targa-dig",
7881 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7882 [ALC883_ACER] = "acer",
7883 [ALC883_ACER_ASPIRE] = "acer-aspire",
7884 [ALC883_MEDION] = "medion",
7885 [ALC883_MEDION_MD2] = "medion-md2",
7886 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7887 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7888 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7889 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7890 [ALC883_HAIER_W66] = "haier-w66",
7891 [ALC888_3ST_HP] = "3stack-hp",
7892 [ALC888_6ST_DELL] = "6stack-dell",
7893 [ALC883_MITAC] = "mitac",
7894 [ALC883_CLEVO_M720] = "clevo-m720",
7895 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7896 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
7897 [ALC883_AUTO] = "auto",
7900 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7901 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7902 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7903 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7904 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7905 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7906 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7907 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7908 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7909 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7910 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7911 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7912 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7913 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7914 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7915 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7916 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7917 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7918 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7919 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7920 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7921 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7922 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7923 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7924 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7925 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7926 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7927 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7928 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7929 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7930 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7931 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7932 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7933 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7934 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7935 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7936 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7937 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7938 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7939 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7940 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7941 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7942 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7943 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7944 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7945 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7946 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7947 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7948 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7949 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7950 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7951 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7952 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7953 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7954 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
7955 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
7956 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7960 static struct alc_config_preset alc883_presets[] = {
7961 [ALC883_3ST_2ch_DIG] = {
7962 .mixers = { alc883_3ST_2ch_mixer },
7963 .init_verbs = { alc883_init_verbs },
7964 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7965 .dac_nids = alc883_dac_nids,
7966 .dig_out_nid = ALC883_DIGOUT_NID,
7967 .dig_in_nid = ALC883_DIGIN_NID,
7968 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7969 .channel_mode = alc883_3ST_2ch_modes,
7970 .input_mux = &alc883_capture_source,
7972 [ALC883_3ST_6ch_DIG] = {
7973 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7974 .init_verbs = { alc883_init_verbs },
7975 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7976 .dac_nids = alc883_dac_nids,
7977 .dig_out_nid = ALC883_DIGOUT_NID,
7978 .dig_in_nid = ALC883_DIGIN_NID,
7979 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7980 .channel_mode = alc883_3ST_6ch_modes,
7982 .input_mux = &alc883_capture_source,
7984 [ALC883_3ST_6ch] = {
7985 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7986 .init_verbs = { alc883_init_verbs },
7987 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7988 .dac_nids = alc883_dac_nids,
7989 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7990 .channel_mode = alc883_3ST_6ch_modes,
7992 .input_mux = &alc883_capture_source,
7994 [ALC883_3ST_6ch_INTEL] = {
7995 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
7996 .init_verbs = { alc883_init_verbs },
7997 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7998 .dac_nids = alc883_dac_nids,
7999 .dig_out_nid = ALC883_DIGOUT_NID,
8000 .dig_in_nid = ALC883_DIGIN_NID,
8001 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8002 .channel_mode = alc883_3ST_6ch_intel_modes,
8004 .input_mux = &alc883_3stack_6ch_intel,
8006 [ALC883_6ST_DIG] = {
8007 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8008 .init_verbs = { alc883_init_verbs },
8009 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8010 .dac_nids = alc883_dac_nids,
8011 .dig_out_nid = ALC883_DIGOUT_NID,
8012 .dig_in_nid = ALC883_DIGIN_NID,
8013 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8014 .channel_mode = alc883_sixstack_modes,
8015 .input_mux = &alc883_capture_source,
8017 [ALC883_TARGA_DIG] = {
8018 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8019 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8020 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8021 .dac_nids = alc883_dac_nids,
8022 .dig_out_nid = ALC883_DIGOUT_NID,
8023 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8024 .channel_mode = alc883_3ST_6ch_modes,
8026 .input_mux = &alc883_capture_source,
8027 .unsol_event = alc883_tagra_unsol_event,
8028 .init_hook = alc883_tagra_automute,
8030 [ALC883_TARGA_2ch_DIG] = {
8031 .mixers = { alc883_tagra_2ch_mixer},
8032 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8033 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8034 .dac_nids = alc883_dac_nids,
8035 .dig_out_nid = ALC883_DIGOUT_NID,
8036 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8037 .channel_mode = alc883_3ST_2ch_modes,
8038 .input_mux = &alc883_capture_source,
8039 .unsol_event = alc883_tagra_unsol_event,
8040 .init_hook = alc883_tagra_automute,
8043 .mixers = { alc883_base_mixer },
8044 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8045 * and the headphone jack. Turn this on and rely on the
8046 * standard mute methods whenever the user wants to turn
8047 * these outputs off.
8049 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8050 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8051 .dac_nids = alc883_dac_nids,
8052 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8053 .channel_mode = alc883_3ST_2ch_modes,
8054 .input_mux = &alc883_capture_source,
8056 [ALC883_ACER_ASPIRE] = {
8057 .mixers = { alc883_acer_aspire_mixer },
8058 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8059 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8060 .dac_nids = alc883_dac_nids,
8061 .dig_out_nid = ALC883_DIGOUT_NID,
8062 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8063 .channel_mode = alc883_3ST_2ch_modes,
8064 .input_mux = &alc883_capture_source,
8065 .unsol_event = alc883_acer_aspire_unsol_event,
8066 .init_hook = alc883_acer_aspire_automute,
8069 .mixers = { alc883_fivestack_mixer,
8070 alc883_chmode_mixer },
8071 .init_verbs = { alc883_init_verbs,
8072 alc883_medion_eapd_verbs },
8073 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8074 .dac_nids = alc883_dac_nids,
8075 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8076 .channel_mode = alc883_sixstack_modes,
8077 .input_mux = &alc883_capture_source,
8079 [ALC883_MEDION_MD2] = {
8080 .mixers = { alc883_medion_md2_mixer},
8081 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8082 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8083 .dac_nids = alc883_dac_nids,
8084 .dig_out_nid = ALC883_DIGOUT_NID,
8085 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8086 .channel_mode = alc883_3ST_2ch_modes,
8087 .input_mux = &alc883_capture_source,
8088 .unsol_event = alc883_medion_md2_unsol_event,
8089 .init_hook = alc883_medion_md2_automute,
8091 [ALC883_LAPTOP_EAPD] = {
8092 .mixers = { alc883_base_mixer },
8093 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8094 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8095 .dac_nids = alc883_dac_nids,
8096 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8097 .channel_mode = alc883_3ST_2ch_modes,
8098 .input_mux = &alc883_capture_source,
8100 [ALC883_CLEVO_M720] = {
8101 .mixers = { alc883_clevo_m720_mixer },
8102 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8103 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8104 .dac_nids = alc883_dac_nids,
8105 .dig_out_nid = ALC883_DIGOUT_NID,
8106 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8107 .channel_mode = alc883_3ST_2ch_modes,
8108 .input_mux = &alc883_capture_source,
8109 .unsol_event = alc883_clevo_m720_unsol_event,
8110 .init_hook = alc883_clevo_m720_automute,
8112 [ALC883_LENOVO_101E_2ch] = {
8113 .mixers = { alc883_lenovo_101e_2ch_mixer},
8114 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8115 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8116 .dac_nids = alc883_dac_nids,
8117 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8118 .channel_mode = alc883_3ST_2ch_modes,
8119 .input_mux = &alc883_lenovo_101e_capture_source,
8120 .unsol_event = alc883_lenovo_101e_unsol_event,
8121 .init_hook = alc883_lenovo_101e_all_automute,
8123 [ALC883_LENOVO_NB0763] = {
8124 .mixers = { alc883_lenovo_nb0763_mixer },
8125 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8126 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8127 .dac_nids = alc883_dac_nids,
8128 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8129 .channel_mode = alc883_3ST_2ch_modes,
8131 .input_mux = &alc883_lenovo_nb0763_capture_source,
8132 .unsol_event = alc883_medion_md2_unsol_event,
8133 .init_hook = alc883_medion_md2_automute,
8135 [ALC888_LENOVO_MS7195_DIG] = {
8136 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8137 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8138 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8139 .dac_nids = alc883_dac_nids,
8140 .dig_out_nid = ALC883_DIGOUT_NID,
8141 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8142 .channel_mode = alc883_3ST_6ch_modes,
8144 .input_mux = &alc883_capture_source,
8145 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8146 .init_hook = alc888_lenovo_ms7195_front_automute,
8148 [ALC883_HAIER_W66] = {
8149 .mixers = { alc883_tagra_2ch_mixer},
8150 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8151 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8152 .dac_nids = alc883_dac_nids,
8153 .dig_out_nid = ALC883_DIGOUT_NID,
8154 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8155 .channel_mode = alc883_3ST_2ch_modes,
8156 .input_mux = &alc883_capture_source,
8157 .unsol_event = alc883_haier_w66_unsol_event,
8158 .init_hook = alc883_haier_w66_automute,
8161 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8162 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8163 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8164 .dac_nids = alc883_dac_nids,
8165 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8166 .channel_mode = alc888_3st_hp_modes,
8168 .input_mux = &alc883_capture_source,
8170 [ALC888_6ST_DELL] = {
8171 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8172 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8173 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8174 .dac_nids = alc883_dac_nids,
8175 .dig_out_nid = ALC883_DIGOUT_NID,
8176 .dig_in_nid = ALC883_DIGIN_NID,
8177 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8178 .channel_mode = alc883_sixstack_modes,
8179 .input_mux = &alc883_capture_source,
8180 .unsol_event = alc888_6st_dell_unsol_event,
8181 .init_hook = alc888_6st_dell_front_automute,
8184 .mixers = { alc883_mitac_mixer },
8185 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8186 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8187 .dac_nids = alc883_dac_nids,
8188 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8189 .channel_mode = alc883_3ST_2ch_modes,
8190 .input_mux = &alc883_capture_source,
8191 .unsol_event = alc883_mitac_unsol_event,
8192 .init_hook = alc883_mitac_automute,
8194 [ALC883_FUJITSU_PI2515] = {
8195 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8196 .init_verbs = { alc883_init_verbs,
8197 alc883_2ch_fujitsu_pi2515_verbs},
8198 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8199 .dac_nids = alc883_dac_nids,
8200 .dig_out_nid = ALC883_DIGOUT_NID,
8201 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8202 .channel_mode = alc883_3ST_2ch_modes,
8203 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8204 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8205 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8211 * BIOS auto configuration
8213 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8214 hda_nid_t nid, int pin_type,
8218 struct alc_spec *spec = codec->spec;
8221 alc_set_pin_output(codec, nid, pin_type);
8222 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8225 idx = spec->multiout.dac_nids[dac_idx] - 2;
8226 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8230 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8232 struct alc_spec *spec = codec->spec;
8235 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8236 for (i = 0; i <= HDA_SIDE; i++) {
8237 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8238 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8240 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8245 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8247 struct alc_spec *spec = codec->spec;
8250 pin = spec->autocfg.hp_pins[0];
8251 if (pin) /* connect to front */
8253 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8254 pin = spec->autocfg.speaker_pins[0];
8256 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8259 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8260 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8262 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8264 struct alc_spec *spec = codec->spec;
8267 for (i = 0; i < AUTO_PIN_LAST; i++) {
8268 hda_nid_t nid = spec->autocfg.input_pins[i];
8269 if (alc883_is_input_pin(nid)) {
8270 snd_hda_codec_write(codec, nid, 0,
8271 AC_VERB_SET_PIN_WIDGET_CONTROL,
8272 (i <= AUTO_PIN_FRONT_MIC ?
8273 PIN_VREF80 : PIN_IN));
8274 if (nid != ALC883_PIN_CD_NID)
8275 snd_hda_codec_write(codec, nid, 0,
8276 AC_VERB_SET_AMP_GAIN_MUTE,
8282 /* almost identical with ALC880 parser... */
8283 static int alc883_parse_auto_config(struct hda_codec *codec)
8285 struct alc_spec *spec = codec->spec;
8286 int err = alc880_parse_auto_config(codec);
8291 return 0; /* no config found */
8293 err = alc_auto_add_mic_boost(codec);
8297 /* hack - override the init verbs */
8298 spec->init_verbs[0] = alc883_auto_init_verbs;
8299 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8302 return 1; /* config found */
8305 /* additional initialization for auto-configuration model */
8306 static void alc883_auto_init(struct hda_codec *codec)
8308 struct alc_spec *spec = codec->spec;
8309 alc883_auto_init_multi_out(codec);
8310 alc883_auto_init_hp_out(codec);
8311 alc883_auto_init_analog_input(codec);
8312 if (spec->unsol_event)
8313 alc_sku_automute(codec);
8316 static int patch_alc883(struct hda_codec *codec)
8318 struct alc_spec *spec;
8319 int err, board_config;
8321 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8327 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8329 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8332 if (board_config < 0) {
8333 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8334 "trying auto-probe from BIOS...\n");
8335 board_config = ALC883_AUTO;
8338 if (board_config == ALC883_AUTO) {
8339 /* automatic parse from the BIOS config */
8340 err = alc883_parse_auto_config(codec);
8346 "hda_codec: Cannot set up configuration "
8347 "from BIOS. Using base mode...\n");
8348 board_config = ALC883_3ST_2ch_DIG;
8352 if (board_config != ALC883_AUTO)
8353 setup_preset(spec, &alc883_presets[board_config]);
8355 switch (codec->vendor_id) {
8357 spec->stream_name_analog = "ALC888 Analog";
8358 spec->stream_name_digital = "ALC888 Digital";
8361 spec->stream_name_analog = "ALC889 Analog";
8362 spec->stream_name_digital = "ALC889 Digital";
8365 spec->stream_name_analog = "ALC883 Analog";
8366 spec->stream_name_digital = "ALC883 Digital";
8370 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8371 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8372 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8374 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8375 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8377 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8378 spec->adc_nids = alc883_adc_nids;
8379 spec->capsrc_nids = alc883_capsrc_nids;
8381 spec->vmaster_nid = 0x0c;
8383 codec->patch_ops = alc_patch_ops;
8384 if (board_config == ALC883_AUTO)
8385 spec->init_hook = alc883_auto_init;
8386 else if (codec->vendor_id == 0x10ec0888)
8387 spec->init_hook = alc888_coef_init;
8389 #ifdef CONFIG_SND_HDA_POWER_SAVE
8390 if (!spec->loopback.amplist)
8391 spec->loopback.amplist = alc883_loopbacks;
8401 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8402 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8404 #define alc262_dac_nids alc260_dac_nids
8405 #define alc262_adc_nids alc882_adc_nids
8406 #define alc262_adc_nids_alt alc882_adc_nids_alt
8407 #define alc262_capsrc_nids alc882_capsrc_nids
8408 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8410 #define alc262_modes alc260_modes
8411 #define alc262_capture_source alc882_capture_source
8413 static struct snd_kcontrol_new alc262_base_mixer[] = {
8414 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8415 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8416 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8417 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8418 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8419 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8422 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8423 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8424 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8425 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8426 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8427 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8428 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8429 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8430 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8431 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8435 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8436 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8437 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8438 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8439 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8440 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8441 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8442 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8443 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8444 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8445 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8446 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8447 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8448 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8449 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8450 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8451 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8455 /* update HP, line and mono-out pins according to the master switch */
8456 static void alc262_hp_master_update(struct hda_codec *codec)
8458 struct alc_spec *spec = codec->spec;
8459 int val = spec->master_sw;
8462 snd_hda_codec_write_cache(codec, 0x1b, 0,
8463 AC_VERB_SET_PIN_WIDGET_CONTROL,
8465 snd_hda_codec_write_cache(codec, 0x15, 0,
8466 AC_VERB_SET_PIN_WIDGET_CONTROL,
8468 /* mono (speaker) depending on the HP jack sense */
8469 val = val && !spec->jack_present;
8470 snd_hda_codec_write_cache(codec, 0x16, 0,
8471 AC_VERB_SET_PIN_WIDGET_CONTROL,
8475 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8477 struct alc_spec *spec = codec->spec;
8478 unsigned int presence;
8479 presence = snd_hda_codec_read(codec, 0x1b, 0,
8480 AC_VERB_GET_PIN_SENSE, 0);
8481 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8482 alc262_hp_master_update(codec);
8485 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8487 if ((res >> 26) != ALC880_HP_EVENT)
8489 alc262_hp_bpc_automute(codec);
8492 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8494 struct alc_spec *spec = codec->spec;
8495 unsigned int presence;
8496 presence = snd_hda_codec_read(codec, 0x15, 0,
8497 AC_VERB_GET_PIN_SENSE, 0);
8498 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8499 alc262_hp_master_update(codec);
8502 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8505 if ((res >> 26) != ALC880_HP_EVENT)
8507 alc262_hp_wildwest_automute(codec);
8510 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8511 struct snd_ctl_elem_value *ucontrol)
8513 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8514 struct alc_spec *spec = codec->spec;
8515 *ucontrol->value.integer.value = spec->master_sw;
8519 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8520 struct snd_ctl_elem_value *ucontrol)
8522 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8523 struct alc_spec *spec = codec->spec;
8524 int val = !!*ucontrol->value.integer.value;
8526 if (val == spec->master_sw)
8528 spec->master_sw = val;
8529 alc262_hp_master_update(codec);
8533 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8535 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8536 .name = "Master Playback Switch",
8537 .info = snd_ctl_boolean_mono_info,
8538 .get = alc262_hp_master_sw_get,
8539 .put = alc262_hp_master_sw_put,
8541 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8542 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8544 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8546 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8549 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8550 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8551 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8552 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8553 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8554 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8555 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8556 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8557 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8558 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8559 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8560 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8561 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8565 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8567 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8568 .name = "Master Playback Switch",
8569 .info = snd_ctl_boolean_mono_info,
8570 .get = alc262_hp_master_sw_get,
8571 .put = alc262_hp_master_sw_put,
8573 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8574 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8575 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8577 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8579 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8581 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8582 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8583 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8584 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8585 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8586 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8587 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8588 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8589 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8593 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8594 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8595 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8596 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8600 /* mute/unmute internal speaker according to the hp jack and mute state */
8601 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8603 struct alc_spec *spec = codec->spec;
8605 if (force || !spec->sense_updated) {
8606 unsigned int present;
8607 present = snd_hda_codec_read(codec, 0x15, 0,
8608 AC_VERB_GET_PIN_SENSE, 0);
8609 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8610 spec->sense_updated = 1;
8612 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8613 spec->jack_present ? HDA_AMP_MUTE : 0);
8616 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8619 if ((res >> 26) != ALC880_HP_EVENT)
8621 alc262_hp_t5735_automute(codec, 1);
8624 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8626 alc262_hp_t5735_automute(codec, 1);
8629 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8630 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8631 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8632 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8633 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8635 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8636 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8640 static struct hda_verb alc262_hp_t5735_verbs[] = {
8641 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8648 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8649 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8650 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8651 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8652 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8653 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8654 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8658 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8659 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8660 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8661 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8662 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8663 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8664 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8668 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8672 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8679 /* bind hp and internal speaker mute (with plug check) */
8680 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8681 struct snd_ctl_elem_value *ucontrol)
8683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8684 long *valp = ucontrol->value.integer.value;
8687 /* change hp mute */
8688 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8690 valp[0] ? 0 : HDA_AMP_MUTE);
8691 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8693 valp[1] ? 0 : HDA_AMP_MUTE);
8695 /* change speaker according to HP jack state */
8696 struct alc_spec *spec = codec->spec;
8698 if (spec->jack_present)
8699 mute = HDA_AMP_MUTE;
8701 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8703 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8704 HDA_AMP_MUTE, mute);
8709 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8710 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8712 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8713 .name = "Master Playback Switch",
8714 .info = snd_hda_mixer_amp_switch_info,
8715 .get = snd_hda_mixer_amp_switch_get,
8716 .put = alc262_sony_master_sw_put,
8717 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8721 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8722 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8726 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8727 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8728 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8729 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8732 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8733 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8737 #define alc262_capture_mixer alc882_capture_mixer
8738 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8741 * generic initialization of ADC, input mixers and output mixers
8743 static struct hda_verb alc262_init_verbs[] = {
8745 * Unmute ADC0-2 and set the default input to mic-in
8747 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8749 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8750 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8751 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8752 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8754 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8756 * Note: PASD motherboards uses the Line In 2 as the input for
8757 * front panel mic (mic 2)
8759 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8761 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8762 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8767 * Set up output mixers (0x0c - 0x0e)
8769 /* set vol=0 to output mixers */
8770 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8771 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8772 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8773 /* set up input amps for analog loopback */
8774 /* Amp Indices: DAC = 0, mixer = 1 */
8775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8780 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8782 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8784 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8785 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8786 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8787 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8789 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8791 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8792 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8793 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8795 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8796 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8798 /* FIXME: use matrix-type input source selection */
8799 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8800 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8801 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8802 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8803 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8804 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8806 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8807 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8808 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8809 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8811 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8812 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8813 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8814 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8819 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8820 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8821 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8825 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8826 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8827 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8828 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8830 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8835 static struct hda_verb alc262_sony_unsol_verbs[] = {
8836 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8837 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8838 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8840 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8845 /* mute/unmute internal speaker according to the hp jack and mute state */
8846 static void alc262_hippo_automute(struct hda_codec *codec)
8848 struct alc_spec *spec = codec->spec;
8850 unsigned int present;
8852 /* need to execute and sync at first */
8853 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8854 present = snd_hda_codec_read(codec, 0x15, 0,
8855 AC_VERB_GET_PIN_SENSE, 0);
8856 spec->jack_present = (present & 0x80000000) != 0;
8857 if (spec->jack_present) {
8858 /* mute internal speaker */
8859 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8860 HDA_AMP_MUTE, HDA_AMP_MUTE);
8862 /* unmute internal speaker if necessary */
8863 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8864 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8865 HDA_AMP_MUTE, mute);
8869 /* unsolicited event for HP jack sensing */
8870 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8873 if ((res >> 26) != ALC880_HP_EVENT)
8875 alc262_hippo_automute(codec);
8878 static void alc262_hippo1_automute(struct hda_codec *codec)
8881 unsigned int present;
8883 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8884 present = snd_hda_codec_read(codec, 0x1b, 0,
8885 AC_VERB_GET_PIN_SENSE, 0);
8886 present = (present & 0x80000000) != 0;
8888 /* mute internal speaker */
8889 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8890 HDA_AMP_MUTE, HDA_AMP_MUTE);
8892 /* unmute internal speaker if necessary */
8893 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8894 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8895 HDA_AMP_MUTE, mute);
8899 /* unsolicited event for HP jack sensing */
8900 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8903 if ((res >> 26) != ALC880_HP_EVENT)
8905 alc262_hippo1_automute(codec);
8910 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8911 * 0x1b = port replicator headphone out
8914 #define ALC_HP_EVENT 0x37
8916 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8917 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8918 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8919 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8920 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8924 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
8925 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8926 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8930 static struct hda_input_mux alc262_fujitsu_capture_source = {
8939 static struct hda_input_mux alc262_HP_capture_source = {
8943 { "Front Mic", 0x1 },
8950 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8954 { "Front Mic", 0x2 },
8960 /* mute/unmute internal speaker according to the hp jacks and mute state */
8961 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8963 struct alc_spec *spec = codec->spec;
8966 if (force || !spec->sense_updated) {
8967 unsigned int present;
8968 /* need to execute and sync at first */
8969 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8970 /* check laptop HP jack */
8971 present = snd_hda_codec_read(codec, 0x14, 0,
8972 AC_VERB_GET_PIN_SENSE, 0);
8973 /* need to execute and sync at first */
8974 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8975 /* check docking HP jack */
8976 present |= snd_hda_codec_read(codec, 0x1b, 0,
8977 AC_VERB_GET_PIN_SENSE, 0);
8978 if (present & AC_PINSENSE_PRESENCE)
8979 spec->jack_present = 1;
8981 spec->jack_present = 0;
8982 spec->sense_updated = 1;
8984 /* unmute internal speaker only if both HPs are unplugged and
8985 * master switch is on
8987 if (spec->jack_present)
8988 mute = HDA_AMP_MUTE;
8990 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8991 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8992 HDA_AMP_MUTE, mute);
8995 /* unsolicited event for HP jack sensing */
8996 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8999 if ((res >> 26) != ALC_HP_EVENT)
9001 alc262_fujitsu_automute(codec, 1);
9004 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9006 alc262_fujitsu_automute(codec, 1);
9009 /* bind volumes of both NID 0x0c and 0x0d */
9010 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9011 .ops = &snd_hda_bind_vol,
9013 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9014 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9019 /* mute/unmute internal speaker according to the hp jack and mute state */
9020 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9022 struct alc_spec *spec = codec->spec;
9025 if (force || !spec->sense_updated) {
9026 unsigned int present_int_hp;
9027 /* need to execute and sync at first */
9028 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9029 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9030 AC_VERB_GET_PIN_SENSE, 0);
9031 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9032 spec->sense_updated = 1;
9034 if (spec->jack_present) {
9035 /* mute internal speaker */
9036 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9037 HDA_AMP_MUTE, HDA_AMP_MUTE);
9038 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9039 HDA_AMP_MUTE, HDA_AMP_MUTE);
9041 /* unmute internal speaker if necessary */
9042 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9043 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9044 HDA_AMP_MUTE, mute);
9045 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9046 HDA_AMP_MUTE, mute);
9050 /* unsolicited event for HP jack sensing */
9051 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9054 if ((res >> 26) != ALC_HP_EVENT)
9056 alc262_lenovo_3000_automute(codec, 1);
9059 /* bind hp and internal speaker mute (with plug check) */
9060 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9061 struct snd_ctl_elem_value *ucontrol)
9063 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9064 long *valp = ucontrol->value.integer.value;
9067 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9069 valp ? 0 : HDA_AMP_MUTE);
9070 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9072 valp ? 0 : HDA_AMP_MUTE);
9075 alc262_fujitsu_automute(codec, 0);
9079 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9080 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9082 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9083 .name = "Master Playback Switch",
9084 .info = snd_hda_mixer_amp_switch_info,
9085 .get = snd_hda_mixer_amp_switch_get,
9086 .put = alc262_fujitsu_master_sw_put,
9087 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9089 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9090 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9091 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9092 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9093 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9096 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9097 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9098 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9102 /* bind hp and internal speaker mute (with plug check) */
9103 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9104 struct snd_ctl_elem_value *ucontrol)
9106 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9107 long *valp = ucontrol->value.integer.value;
9110 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9112 valp ? 0 : HDA_AMP_MUTE);
9115 alc262_lenovo_3000_automute(codec, 0);
9119 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9120 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9122 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9123 .name = "Master Playback Switch",
9124 .info = snd_hda_mixer_amp_switch_info,
9125 .get = snd_hda_mixer_amp_switch_get,
9126 .put = alc262_lenovo_3000_master_sw_put,
9127 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9134 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9135 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9136 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9140 /* additional init verbs for Benq laptops */
9141 static struct hda_verb alc262_EAPD_verbs[] = {
9142 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9143 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9147 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9148 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9149 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9151 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9152 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9156 /* Samsung Q1 Ultra Vista model setup */
9157 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9158 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9159 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9162 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9163 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9167 static struct hda_verb alc262_ultra_verbs[] = {
9169 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9171 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9173 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9174 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9175 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9176 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9180 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9181 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9182 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9184 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9186 /* ADC, choose mic */
9187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9188 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9189 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9190 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9200 /* mute/unmute internal speaker according to the hp jack and mute state */
9201 static void alc262_ultra_automute(struct hda_codec *codec)
9203 struct alc_spec *spec = codec->spec;
9207 /* auto-mute only when HP is used as HP */
9208 if (!spec->cur_mux[0]) {
9209 unsigned int present;
9210 /* need to execute and sync at first */
9211 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9212 present = snd_hda_codec_read(codec, 0x15, 0,
9213 AC_VERB_GET_PIN_SENSE, 0);
9214 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9215 if (spec->jack_present)
9216 mute = HDA_AMP_MUTE;
9218 /* mute/unmute internal speaker */
9219 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9220 HDA_AMP_MUTE, mute);
9221 /* mute/unmute HP */
9222 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9223 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9226 /* unsolicited event for HP jack sensing */
9227 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9230 if ((res >> 26) != ALC880_HP_EVENT)
9232 alc262_ultra_automute(codec);
9235 static struct hda_input_mux alc262_ultra_capture_source = {
9239 { "Headphone", 0x7 },
9243 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9244 struct snd_ctl_elem_value *ucontrol)
9246 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9247 struct alc_spec *spec = codec->spec;
9250 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9253 /* reprogram the HP pin as mic or HP according to the input source */
9254 snd_hda_codec_write_cache(codec, 0x15, 0,
9255 AC_VERB_SET_PIN_WIDGET_CONTROL,
9256 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9257 alc262_ultra_automute(codec); /* mute/unmute HP */
9261 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9262 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9263 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9265 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9266 .name = "Capture Source",
9267 .info = alc882_mux_enum_info,
9268 .get = alc882_mux_enum_get,
9269 .put = alc262_ultra_mux_enum_put,
9274 /* add playback controls from the parsed DAC table */
9275 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9276 const struct auto_pin_cfg *cfg)
9281 spec->multiout.num_dacs = 1; /* only use one dac */
9282 spec->multiout.dac_nids = spec->private_dac_nids;
9283 spec->multiout.dac_nids[0] = 2;
9285 nid = cfg->line_out_pins[0];
9287 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9288 "Front Playback Volume",
9289 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9292 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9293 "Front Playback Switch",
9294 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9299 nid = cfg->speaker_pins[0];
9302 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9303 "Speaker Playback Volume",
9304 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9308 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9309 "Speaker Playback Switch",
9310 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9315 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9316 "Speaker Playback Switch",
9317 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9323 nid = cfg->hp_pins[0];
9325 /* spec->multiout.hp_nid = 2; */
9327 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9328 "Headphone Playback Volume",
9329 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9333 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9334 "Headphone Playback Switch",
9335 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9340 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9341 "Headphone Playback Switch",
9342 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9351 /* identical with ALC880 */
9352 #define alc262_auto_create_analog_input_ctls \
9353 alc880_auto_create_analog_input_ctls
9356 * generic initialization of ADC, input mixers and output mixers
9358 static struct hda_verb alc262_volume_init_verbs[] = {
9360 * Unmute ADC0-2 and set the default input to mic-in
9362 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9363 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9364 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9365 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9366 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9367 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9369 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9371 * Note: PASD motherboards uses the Line In 2 as the input for
9372 * front panel mic (mic 2)
9374 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9382 * Set up output mixers (0x0c - 0x0f)
9384 /* set vol=0 to output mixers */
9385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9386 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9387 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9389 /* set up input amps for analog loopback */
9390 /* Amp Indices: DAC = 0, mixer = 1 */
9391 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9393 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9395 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9396 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9398 /* FIXME: use matrix-type input source selection */
9399 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9400 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9402 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9419 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9421 * Unmute ADC0-2 and set the default input to mic-in
9423 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9425 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9426 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9427 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9428 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9430 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9432 * Note: PASD motherboards uses the Line In 2 as the input for
9433 * front panel mic (mic 2)
9435 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9438 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9442 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9445 * Set up output mixers (0x0c - 0x0e)
9447 /* set vol=0 to output mixers */
9448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9450 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9452 /* set up input amps for analog loopback */
9453 /* Amp Indices: DAC = 0, mixer = 1 */
9454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9461 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9463 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9465 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9468 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9469 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9472 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9473 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9474 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9475 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9478 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9479 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9480 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9481 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9482 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9485 /* FIXME: use matrix-type input source selection */
9486 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9487 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9489 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9494 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9496 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9498 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9499 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9503 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9508 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9510 * Unmute ADC0-2 and set the default input to mic-in
9512 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9513 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9514 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9515 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9516 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9519 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9521 * Note: PASD motherboards uses the Line In 2 as the input for front
9524 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9531 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9532 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9534 * Set up output mixers (0x0c - 0x0e)
9536 /* set vol=0 to output mixers */
9537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9541 /* set up input amps for analog loopback */
9542 /* Amp Indices: DAC = 0, mixer = 1 */
9543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9546 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9547 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9548 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9551 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9552 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9553 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9555 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9556 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9557 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9559 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9560 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9562 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9563 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9565 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9566 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9567 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9568 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9569 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9570 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9572 /* FIXME: use matrix-type input source selection */
9573 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9574 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9580 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9581 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9583 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9584 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9585 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9586 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9588 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9596 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9604 #ifdef CONFIG_SND_HDA_POWER_SAVE
9605 #define alc262_loopbacks alc880_loopbacks
9608 /* pcm configuration: identiacal with ALC880 */
9609 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9610 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9611 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9612 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9615 * BIOS auto configuration
9617 static int alc262_parse_auto_config(struct hda_codec *codec)
9619 struct alc_spec *spec = codec->spec;
9621 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9623 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9627 if (!spec->autocfg.line_outs)
9628 return 0; /* can't find valid BIOS pin config */
9629 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9632 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9636 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9638 if (spec->autocfg.dig_out_pin)
9639 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9640 if (spec->autocfg.dig_in_pin)
9641 spec->dig_in_nid = ALC262_DIGIN_NID;
9643 if (spec->kctl_alloc)
9644 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9646 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9647 spec->num_mux_defs = 1;
9648 spec->input_mux = &spec->private_imux;
9650 err = alc_auto_add_mic_boost(codec);
9657 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9658 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9659 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9662 /* init callback for auto-configuration model -- overriding the default init */
9663 static void alc262_auto_init(struct hda_codec *codec)
9665 struct alc_spec *spec = codec->spec;
9666 alc262_auto_init_multi_out(codec);
9667 alc262_auto_init_hp_out(codec);
9668 alc262_auto_init_analog_input(codec);
9669 if (spec->unsol_event)
9670 alc_sku_automute(codec);
9674 * configuration and preset
9676 static const char *alc262_models[ALC262_MODEL_LAST] = {
9677 [ALC262_BASIC] = "basic",
9678 [ALC262_HIPPO] = "hippo",
9679 [ALC262_HIPPO_1] = "hippo_1",
9680 [ALC262_FUJITSU] = "fujitsu",
9681 [ALC262_HP_BPC] = "hp-bpc",
9682 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9683 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9684 [ALC262_HP_RP5700] = "hp-rp5700",
9685 [ALC262_BENQ_ED8] = "benq",
9686 [ALC262_BENQ_T31] = "benq-t31",
9687 [ALC262_SONY_ASSAMD] = "sony-assamd",
9688 [ALC262_ULTRA] = "ultra",
9689 [ALC262_LENOVO_3000] = "lenovo-3000",
9690 [ALC262_AUTO] = "auto",
9693 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9694 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9695 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9696 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9697 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9698 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9699 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9700 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9701 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9702 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9703 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9704 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9705 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9706 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9707 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9708 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9709 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9710 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9711 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9712 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9713 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9714 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9715 ALC262_HP_TC_T5735),
9716 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9717 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9718 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9719 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9720 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9721 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9722 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9723 ALC262_SONY_ASSAMD),
9724 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9725 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9726 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9727 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9728 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9729 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9730 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9731 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9735 static struct alc_config_preset alc262_presets[] = {
9737 .mixers = { alc262_base_mixer },
9738 .init_verbs = { alc262_init_verbs },
9739 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9740 .dac_nids = alc262_dac_nids,
9742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9743 .channel_mode = alc262_modes,
9744 .input_mux = &alc262_capture_source,
9747 .mixers = { alc262_base_mixer },
9748 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9749 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9750 .dac_nids = alc262_dac_nids,
9752 .dig_out_nid = ALC262_DIGOUT_NID,
9753 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9754 .channel_mode = alc262_modes,
9755 .input_mux = &alc262_capture_source,
9756 .unsol_event = alc262_hippo_unsol_event,
9757 .init_hook = alc262_hippo_automute,
9759 [ALC262_HIPPO_1] = {
9760 .mixers = { alc262_hippo1_mixer },
9761 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9762 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9763 .dac_nids = alc262_dac_nids,
9765 .dig_out_nid = ALC262_DIGOUT_NID,
9766 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9767 .channel_mode = alc262_modes,
9768 .input_mux = &alc262_capture_source,
9769 .unsol_event = alc262_hippo1_unsol_event,
9770 .init_hook = alc262_hippo1_automute,
9772 [ALC262_FUJITSU] = {
9773 .mixers = { alc262_fujitsu_mixer },
9774 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9775 alc262_fujitsu_unsol_verbs },
9776 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9777 .dac_nids = alc262_dac_nids,
9779 .dig_out_nid = ALC262_DIGOUT_NID,
9780 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9781 .channel_mode = alc262_modes,
9782 .input_mux = &alc262_fujitsu_capture_source,
9783 .unsol_event = alc262_fujitsu_unsol_event,
9784 .init_hook = alc262_fujitsu_init_hook,
9787 .mixers = { alc262_HP_BPC_mixer },
9788 .init_verbs = { alc262_HP_BPC_init_verbs },
9789 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9790 .dac_nids = alc262_dac_nids,
9792 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9793 .channel_mode = alc262_modes,
9794 .input_mux = &alc262_HP_capture_source,
9795 .unsol_event = alc262_hp_bpc_unsol_event,
9796 .init_hook = alc262_hp_bpc_automute,
9798 [ALC262_HP_BPC_D7000_WF] = {
9799 .mixers = { alc262_HP_BPC_WildWest_mixer },
9800 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9801 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9802 .dac_nids = alc262_dac_nids,
9804 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9805 .channel_mode = alc262_modes,
9806 .input_mux = &alc262_HP_D7000_capture_source,
9807 .unsol_event = alc262_hp_wildwest_unsol_event,
9808 .init_hook = alc262_hp_wildwest_automute,
9810 [ALC262_HP_BPC_D7000_WL] = {
9811 .mixers = { alc262_HP_BPC_WildWest_mixer,
9812 alc262_HP_BPC_WildWest_option_mixer },
9813 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9814 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9815 .dac_nids = alc262_dac_nids,
9817 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9818 .channel_mode = alc262_modes,
9819 .input_mux = &alc262_HP_D7000_capture_source,
9820 .unsol_event = alc262_hp_wildwest_unsol_event,
9821 .init_hook = alc262_hp_wildwest_automute,
9823 [ALC262_HP_TC_T5735] = {
9824 .mixers = { alc262_hp_t5735_mixer },
9825 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9826 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9827 .dac_nids = alc262_dac_nids,
9829 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9830 .channel_mode = alc262_modes,
9831 .input_mux = &alc262_capture_source,
9832 .unsol_event = alc262_hp_t5735_unsol_event,
9833 .init_hook = alc262_hp_t5735_init_hook,
9835 [ALC262_HP_RP5700] = {
9836 .mixers = { alc262_hp_rp5700_mixer },
9837 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9838 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9839 .dac_nids = alc262_dac_nids,
9840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9841 .channel_mode = alc262_modes,
9842 .input_mux = &alc262_hp_rp5700_capture_source,
9844 [ALC262_BENQ_ED8] = {
9845 .mixers = { alc262_base_mixer },
9846 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9847 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9848 .dac_nids = alc262_dac_nids,
9850 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9851 .channel_mode = alc262_modes,
9852 .input_mux = &alc262_capture_source,
9854 [ALC262_SONY_ASSAMD] = {
9855 .mixers = { alc262_sony_mixer },
9856 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9857 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9858 .dac_nids = alc262_dac_nids,
9860 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9861 .channel_mode = alc262_modes,
9862 .input_mux = &alc262_capture_source,
9863 .unsol_event = alc262_hippo_unsol_event,
9864 .init_hook = alc262_hippo_automute,
9866 [ALC262_BENQ_T31] = {
9867 .mixers = { alc262_benq_t31_mixer },
9868 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9869 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9870 .dac_nids = alc262_dac_nids,
9872 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9873 .channel_mode = alc262_modes,
9874 .input_mux = &alc262_capture_source,
9875 .unsol_event = alc262_hippo_unsol_event,
9876 .init_hook = alc262_hippo_automute,
9879 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9880 .init_verbs = { alc262_ultra_verbs },
9881 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9882 .dac_nids = alc262_dac_nids,
9883 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9884 .channel_mode = alc262_modes,
9885 .input_mux = &alc262_ultra_capture_source,
9886 .adc_nids = alc262_adc_nids, /* ADC0 */
9887 .capsrc_nids = alc262_capsrc_nids,
9888 .num_adc_nids = 1, /* single ADC */
9889 .unsol_event = alc262_ultra_unsol_event,
9890 .init_hook = alc262_ultra_automute,
9892 [ALC262_LENOVO_3000] = {
9893 .mixers = { alc262_lenovo_3000_mixer },
9894 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9895 alc262_lenovo_3000_unsol_verbs },
9896 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9897 .dac_nids = alc262_dac_nids,
9899 .dig_out_nid = ALC262_DIGOUT_NID,
9900 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9901 .channel_mode = alc262_modes,
9902 .input_mux = &alc262_fujitsu_capture_source,
9903 .unsol_event = alc262_lenovo_3000_unsol_event,
9907 static int patch_alc262(struct hda_codec *codec)
9909 struct alc_spec *spec;
9913 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9919 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9924 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9925 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9926 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9927 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9931 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9933 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9937 if (board_config < 0) {
9938 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9939 "trying auto-probe from BIOS...\n");
9940 board_config = ALC262_AUTO;
9943 if (board_config == ALC262_AUTO) {
9944 /* automatic parse from the BIOS config */
9945 err = alc262_parse_auto_config(codec);
9951 "hda_codec: Cannot set up configuration "
9952 "from BIOS. Using base mode...\n");
9953 board_config = ALC262_BASIC;
9957 if (board_config != ALC262_AUTO)
9958 setup_preset(spec, &alc262_presets[board_config]);
9960 spec->stream_name_analog = "ALC262 Analog";
9961 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9962 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9964 spec->stream_name_digital = "ALC262 Digital";
9965 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9966 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9968 if (!spec->adc_nids && spec->input_mux) {
9969 /* check whether NID 0x07 is valid */
9970 unsigned int wcap = get_wcaps(codec, 0x07);
9973 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9974 if (wcap != AC_WID_AUD_IN) {
9975 spec->adc_nids = alc262_adc_nids_alt;
9976 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9977 spec->capsrc_nids = alc262_capsrc_nids_alt;
9978 spec->mixers[spec->num_mixers] =
9979 alc262_capture_alt_mixer;
9982 spec->adc_nids = alc262_adc_nids;
9983 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9984 spec->capsrc_nids = alc262_capsrc_nids;
9985 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9990 spec->vmaster_nid = 0x0c;
9992 codec->patch_ops = alc_patch_ops;
9993 if (board_config == ALC262_AUTO)
9994 spec->init_hook = alc262_auto_init;
9995 #ifdef CONFIG_SND_HDA_POWER_SAVE
9996 if (!spec->loopback.amplist)
9997 spec->loopback.amplist = alc262_loopbacks;
10004 * ALC268 channel source setting (2 channel)
10006 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10007 #define alc268_modes alc260_modes
10009 static hda_nid_t alc268_dac_nids[2] = {
10014 static hda_nid_t alc268_adc_nids[2] = {
10019 static hda_nid_t alc268_adc_nids_alt[1] = {
10024 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10026 static struct snd_kcontrol_new alc268_base_mixer[] = {
10027 /* output mixer control */
10028 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10029 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10030 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10031 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10033 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10034 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10038 /* bind Beep switches of both NID 0x0f and 0x10 */
10039 static struct hda_bind_ctls alc268_bind_beep_sw = {
10040 .ops = &snd_hda_bind_sw,
10042 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10043 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10048 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10049 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10050 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10054 static struct hda_verb alc268_eapd_verbs[] = {
10055 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10056 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10060 /* Toshiba specific */
10061 #define alc268_toshiba_automute alc262_hippo_automute
10063 static struct hda_verb alc268_toshiba_verbs[] = {
10064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10068 /* Acer specific */
10069 /* bind volumes of both NID 0x02 and 0x03 */
10070 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10071 .ops = &snd_hda_bind_vol,
10073 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10074 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10079 /* mute/unmute internal speaker according to the hp jack and mute state */
10080 static void alc268_acer_automute(struct hda_codec *codec, int force)
10082 struct alc_spec *spec = codec->spec;
10085 if (force || !spec->sense_updated) {
10086 unsigned int present;
10087 present = snd_hda_codec_read(codec, 0x14, 0,
10088 AC_VERB_GET_PIN_SENSE, 0);
10089 spec->jack_present = (present & 0x80000000) != 0;
10090 spec->sense_updated = 1;
10092 if (spec->jack_present)
10093 mute = HDA_AMP_MUTE; /* mute internal speaker */
10094 else /* unmute internal speaker if necessary */
10095 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10096 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10097 HDA_AMP_MUTE, mute);
10101 /* bind hp and internal speaker mute (with plug check) */
10102 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10103 struct snd_ctl_elem_value *ucontrol)
10105 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10106 long *valp = ucontrol->value.integer.value;
10109 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10111 valp[0] ? 0 : HDA_AMP_MUTE);
10112 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10114 valp[1] ? 0 : HDA_AMP_MUTE);
10116 alc268_acer_automute(codec, 0);
10120 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10121 /* output mixer control */
10122 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10125 .name = "Master Playback Switch",
10126 .info = snd_hda_mixer_amp_switch_info,
10127 .get = snd_hda_mixer_amp_switch_get,
10128 .put = alc268_acer_master_sw_put,
10129 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10132 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10133 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10137 static struct hda_verb alc268_acer_verbs[] = {
10138 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10139 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10140 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10142 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10143 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10145 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10149 /* unsolicited event for HP jack sensing */
10150 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10153 if ((res >> 26) != ALC880_HP_EVENT)
10155 alc268_toshiba_automute(codec);
10158 static void alc268_acer_unsol_event(struct hda_codec *codec,
10161 if ((res >> 26) != ALC880_HP_EVENT)
10163 alc268_acer_automute(codec, 1);
10166 static void alc268_acer_init_hook(struct hda_codec *codec)
10168 alc268_acer_automute(codec, 1);
10171 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10172 /* output mixer control */
10173 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10174 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10175 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10177 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10178 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10182 static struct hda_verb alc268_dell_verbs[] = {
10183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10184 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10185 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10189 /* mute/unmute internal speaker according to the hp jack and mute state */
10190 static void alc268_dell_automute(struct hda_codec *codec)
10192 unsigned int present;
10195 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10196 if (present & 0x80000000)
10197 mute = HDA_AMP_MUTE;
10199 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10200 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10201 HDA_AMP_MUTE, mute);
10204 static void alc268_dell_unsol_event(struct hda_codec *codec,
10207 if ((res >> 26) != ALC880_HP_EVENT)
10209 alc268_dell_automute(codec);
10212 #define alc268_dell_init_hook alc268_dell_automute
10214 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10215 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10216 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10219 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10220 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10221 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10222 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10226 static struct hda_verb alc267_quanta_il1_verbs[] = {
10227 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10228 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10232 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10234 unsigned int present;
10236 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10237 & AC_PINSENSE_PRESENCE;
10238 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10239 present ? 0 : PIN_OUT);
10242 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10244 unsigned int present;
10246 present = snd_hda_codec_read(codec, 0x18, 0,
10247 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10248 snd_hda_codec_write(codec, 0x23, 0,
10249 AC_VERB_SET_CONNECT_SEL,
10250 present ? 0x00 : 0x01);
10253 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10255 alc267_quanta_il1_hp_automute(codec);
10256 alc267_quanta_il1_mic_automute(codec);
10259 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10262 switch (res >> 26) {
10263 case ALC880_HP_EVENT:
10264 alc267_quanta_il1_hp_automute(codec);
10266 case ALC880_MIC_EVENT:
10267 alc267_quanta_il1_mic_automute(codec);
10273 * generic initialization of ADC, input mixers and output mixers
10275 static struct hda_verb alc268_base_init_verbs[] = {
10276 /* Unmute DAC0-1 and set vol = 0 */
10277 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10278 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10279 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10280 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10281 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10282 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10285 * Set up output mixers (0x0c - 0x0e)
10287 /* set vol=0 to output mixers */
10288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10290 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10291 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10293 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10294 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10296 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10298 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10299 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10300 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10301 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10302 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10303 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10305 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10307 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10309 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10310 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10311 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10313 /* set PCBEEP vol = 0, mute connections */
10314 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10316 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10318 /* Unmute Selector 23h,24h and set the default input to mic-in */
10320 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10321 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10322 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10329 * generic initialization of ADC, input mixers and output mixers
10331 static struct hda_verb alc268_volume_init_verbs[] = {
10332 /* set output DAC */
10333 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10334 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10335 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10336 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10338 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10341 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10342 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10348 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10351 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10353 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10355 /* set PCBEEP vol = 0, mute connections */
10356 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10358 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10363 #define alc268_mux_enum_info alc_mux_enum_info
10364 #define alc268_mux_enum_get alc_mux_enum_get
10365 #define alc268_mux_enum_put alc_mux_enum_put
10367 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10368 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10369 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10372 /* The multiple "Capture Source" controls confuse alsamixer
10373 * So call somewhat different..
10375 /* .name = "Capture Source", */
10376 .name = "Input Source",
10378 .info = alc268_mux_enum_info,
10379 .get = alc268_mux_enum_get,
10380 .put = alc268_mux_enum_put,
10385 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10386 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10387 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10388 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10389 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10391 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10392 /* The multiple "Capture Source" controls confuse alsamixer
10393 * So call somewhat different..
10395 /* .name = "Capture Source", */
10396 .name = "Input Source",
10398 .info = alc268_mux_enum_info,
10399 .get = alc268_mux_enum_get,
10400 .put = alc268_mux_enum_put,
10405 static struct hda_input_mux alc268_capture_source = {
10409 { "Front Mic", 0x1 },
10415 static struct hda_input_mux alc268_acer_capture_source = {
10419 { "Internal Mic", 0x6 },
10424 #ifdef CONFIG_SND_DEBUG
10425 static struct snd_kcontrol_new alc268_test_mixer[] = {
10426 /* Volume widgets */
10427 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10428 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10429 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10430 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10431 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10432 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10433 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10434 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10435 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10436 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10437 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10438 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10439 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10440 /* The below appears problematic on some hardwares */
10441 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10442 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10443 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10444 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10445 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10447 /* Modes for retasking pin widgets */
10448 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10449 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10450 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10451 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10453 /* Controls for GPIO pins, assuming they are configured as outputs */
10454 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10455 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10456 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10457 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10459 /* Switches to allow the digital SPDIF output pin to be enabled.
10460 * The ALC268 does not have an SPDIF input.
10462 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10464 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10465 * this output to turn on an external amplifier.
10467 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10468 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10474 /* create input playback/capture controls for the given pin */
10475 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10476 const char *ctlname, int idx)
10481 sprintf(name, "%s Playback Volume", ctlname);
10483 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10484 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10488 } else if (nid == 0x15) {
10489 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10490 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10496 sprintf(name, "%s Playback Switch", ctlname);
10497 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10498 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10504 /* add playback controls from the parsed DAC table */
10505 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10506 const struct auto_pin_cfg *cfg)
10511 spec->multiout.num_dacs = 2; /* only use one dac */
10512 spec->multiout.dac_nids = spec->private_dac_nids;
10513 spec->multiout.dac_nids[0] = 2;
10514 spec->multiout.dac_nids[1] = 3;
10516 nid = cfg->line_out_pins[0];
10518 alc268_new_analog_output(spec, nid, "Front", 0);
10520 nid = cfg->speaker_pins[0];
10522 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10523 "Speaker Playback Volume",
10524 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10528 nid = cfg->hp_pins[0];
10530 alc268_new_analog_output(spec, nid, "Headphone", 0);
10532 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10534 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10535 "Mono Playback Switch",
10536 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10543 /* create playback/capture controls for input pins */
10544 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10545 const struct auto_pin_cfg *cfg)
10547 struct hda_input_mux *imux = &spec->private_imux;
10550 for (i = 0; i < AUTO_PIN_LAST; i++) {
10551 switch(cfg->input_pins[i]) {
10553 idx1 = 0; /* Mic 1 */
10556 idx1 = 1; /* Mic 2 */
10559 idx1 = 2; /* Line In */
10566 idx1 = 6; /* digital mics */
10571 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10572 imux->items[imux->num_items].index = idx1;
10578 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10580 struct alc_spec *spec = codec->spec;
10581 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10582 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10583 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10584 unsigned int dac_vol1, dac_vol2;
10587 snd_hda_codec_write(codec, speaker_nid, 0,
10588 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10589 snd_hda_codec_write(codec, 0x0f, 0,
10590 AC_VERB_SET_AMP_GAIN_MUTE,
10592 snd_hda_codec_write(codec, 0x10, 0,
10593 AC_VERB_SET_AMP_GAIN_MUTE,
10596 snd_hda_codec_write(codec, 0x0f, 0,
10597 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10598 snd_hda_codec_write(codec, 0x10, 0,
10599 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10602 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10603 if (line_nid == 0x14)
10604 dac_vol2 = AMP_OUT_ZERO;
10605 else if (line_nid == 0x15)
10606 dac_vol1 = AMP_OUT_ZERO;
10607 if (hp_nid == 0x14)
10608 dac_vol2 = AMP_OUT_ZERO;
10609 else if (hp_nid == 0x15)
10610 dac_vol1 = AMP_OUT_ZERO;
10611 if (line_nid != 0x16 || hp_nid != 0x16 ||
10612 spec->autocfg.line_out_pins[1] != 0x16 ||
10613 spec->autocfg.line_out_pins[2] != 0x16)
10614 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10616 snd_hda_codec_write(codec, 0x02, 0,
10617 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10618 snd_hda_codec_write(codec, 0x03, 0,
10619 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10622 /* pcm configuration: identiacal with ALC880 */
10623 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10624 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10625 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10626 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10629 * BIOS auto configuration
10631 static int alc268_parse_auto_config(struct hda_codec *codec)
10633 struct alc_spec *spec = codec->spec;
10635 static hda_nid_t alc268_ignore[] = { 0 };
10637 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10641 if (!spec->autocfg.line_outs)
10642 return 0; /* can't find valid BIOS pin config */
10644 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10647 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10651 spec->multiout.max_channels = 2;
10653 /* digital only support output */
10654 if (spec->autocfg.dig_out_pin)
10655 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10657 if (spec->kctl_alloc)
10658 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10660 if (spec->autocfg.speaker_pins[0] != 0x1d)
10661 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10663 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10664 spec->num_mux_defs = 1;
10665 spec->input_mux = &spec->private_imux;
10667 err = alc_auto_add_mic_boost(codec);
10674 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10675 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10676 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10678 /* init callback for auto-configuration model -- overriding the default init */
10679 static void alc268_auto_init(struct hda_codec *codec)
10681 struct alc_spec *spec = codec->spec;
10682 alc268_auto_init_multi_out(codec);
10683 alc268_auto_init_hp_out(codec);
10684 alc268_auto_init_mono_speaker_out(codec);
10685 alc268_auto_init_analog_input(codec);
10686 if (spec->unsol_event)
10687 alc_sku_automute(codec);
10691 * configuration and preset
10693 static const char *alc268_models[ALC268_MODEL_LAST] = {
10694 [ALC267_QUANTA_IL1] = "quanta-il1",
10695 [ALC268_3ST] = "3stack",
10696 [ALC268_TOSHIBA] = "toshiba",
10697 [ALC268_ACER] = "acer",
10698 [ALC268_DELL] = "dell",
10699 [ALC268_ZEPTO] = "zepto",
10700 #ifdef CONFIG_SND_DEBUG
10701 [ALC268_TEST] = "test",
10703 [ALC268_AUTO] = "auto",
10706 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10707 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10708 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10709 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10710 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10711 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10712 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10713 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10714 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10715 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10716 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10717 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10718 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10719 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10720 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10724 static struct alc_config_preset alc268_presets[] = {
10725 [ALC267_QUANTA_IL1] = {
10726 .mixers = { alc267_quanta_il1_mixer },
10727 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10728 alc267_quanta_il1_verbs },
10729 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10730 .dac_nids = alc268_dac_nids,
10731 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10732 .adc_nids = alc268_adc_nids_alt,
10734 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10735 .channel_mode = alc268_modes,
10736 .input_mux = &alc268_capture_source,
10737 .unsol_event = alc267_quanta_il1_unsol_event,
10738 .init_hook = alc267_quanta_il1_automute,
10741 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10742 alc268_beep_mixer },
10743 .init_verbs = { alc268_base_init_verbs },
10744 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10745 .dac_nids = alc268_dac_nids,
10746 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10747 .adc_nids = alc268_adc_nids_alt,
10748 .capsrc_nids = alc268_capsrc_nids,
10750 .dig_out_nid = ALC268_DIGOUT_NID,
10751 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10752 .channel_mode = alc268_modes,
10753 .input_mux = &alc268_capture_source,
10755 [ALC268_TOSHIBA] = {
10756 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10757 alc268_beep_mixer },
10758 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10759 alc268_toshiba_verbs },
10760 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10761 .dac_nids = alc268_dac_nids,
10762 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10763 .adc_nids = alc268_adc_nids_alt,
10764 .capsrc_nids = alc268_capsrc_nids,
10766 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10767 .channel_mode = alc268_modes,
10768 .input_mux = &alc268_capture_source,
10769 .unsol_event = alc268_toshiba_unsol_event,
10770 .init_hook = alc268_toshiba_automute,
10773 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10774 alc268_beep_mixer },
10775 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10776 alc268_acer_verbs },
10777 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10778 .dac_nids = alc268_dac_nids,
10779 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10780 .adc_nids = alc268_adc_nids_alt,
10781 .capsrc_nids = alc268_capsrc_nids,
10783 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10784 .channel_mode = alc268_modes,
10785 .input_mux = &alc268_acer_capture_source,
10786 .unsol_event = alc268_acer_unsol_event,
10787 .init_hook = alc268_acer_init_hook,
10790 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10791 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10792 alc268_dell_verbs },
10793 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10794 .dac_nids = alc268_dac_nids,
10796 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10797 .channel_mode = alc268_modes,
10798 .unsol_event = alc268_dell_unsol_event,
10799 .init_hook = alc268_dell_init_hook,
10800 .input_mux = &alc268_capture_source,
10803 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10804 alc268_beep_mixer },
10805 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10806 alc268_toshiba_verbs },
10807 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10808 .dac_nids = alc268_dac_nids,
10809 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10810 .adc_nids = alc268_adc_nids_alt,
10811 .capsrc_nids = alc268_capsrc_nids,
10813 .dig_out_nid = ALC268_DIGOUT_NID,
10814 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10815 .channel_mode = alc268_modes,
10816 .input_mux = &alc268_capture_source,
10817 .unsol_event = alc268_toshiba_unsol_event,
10818 .init_hook = alc268_toshiba_automute
10820 #ifdef CONFIG_SND_DEBUG
10822 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10823 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10824 alc268_volume_init_verbs },
10825 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10826 .dac_nids = alc268_dac_nids,
10827 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10828 .adc_nids = alc268_adc_nids_alt,
10829 .capsrc_nids = alc268_capsrc_nids,
10831 .dig_out_nid = ALC268_DIGOUT_NID,
10832 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10833 .channel_mode = alc268_modes,
10834 .input_mux = &alc268_capture_source,
10839 static int patch_alc268(struct hda_codec *codec)
10841 struct alc_spec *spec;
10845 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10849 codec->spec = spec;
10851 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10855 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10856 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10857 "trying auto-probe from BIOS...\n");
10858 board_config = ALC268_AUTO;
10861 if (board_config == ALC268_AUTO) {
10862 /* automatic parse from the BIOS config */
10863 err = alc268_parse_auto_config(codec);
10869 "hda_codec: Cannot set up configuration "
10870 "from BIOS. Using base mode...\n");
10871 board_config = ALC268_3ST;
10875 if (board_config != ALC268_AUTO)
10876 setup_preset(spec, &alc268_presets[board_config]);
10878 if (codec->vendor_id == 0x10ec0267) {
10879 spec->stream_name_analog = "ALC267 Analog";
10880 spec->stream_name_digital = "ALC267 Digital";
10882 spec->stream_name_analog = "ALC268 Analog";
10883 spec->stream_name_digital = "ALC268 Digital";
10886 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10887 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10888 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10890 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10892 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10893 /* override the amp caps for beep generator */
10894 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10895 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10896 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10897 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10898 (0 << AC_AMPCAP_MUTE_SHIFT));
10900 if (!spec->adc_nids && spec->input_mux) {
10901 /* check whether NID 0x07 is valid */
10902 unsigned int wcap = get_wcaps(codec, 0x07);
10906 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10907 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10908 spec->adc_nids = alc268_adc_nids_alt;
10909 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10910 spec->mixers[spec->num_mixers] =
10911 alc268_capture_alt_mixer;
10912 spec->num_mixers++;
10914 spec->adc_nids = alc268_adc_nids;
10915 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10916 spec->mixers[spec->num_mixers] =
10917 alc268_capture_mixer;
10918 spec->num_mixers++;
10920 spec->capsrc_nids = alc268_capsrc_nids;
10921 /* set default input source */
10922 for (i = 0; i < spec->num_adc_nids; i++)
10923 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10924 0, AC_VERB_SET_CONNECT_SEL,
10925 spec->input_mux->items[0].index);
10928 spec->vmaster_nid = 0x02;
10930 codec->patch_ops = alc_patch_ops;
10931 if (board_config == ALC268_AUTO)
10932 spec->init_hook = alc268_auto_init;
10938 * ALC269 channel source setting (2 channel)
10940 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10942 #define alc269_dac_nids alc260_dac_nids
10944 static hda_nid_t alc269_adc_nids[1] = {
10949 #define alc269_modes alc260_modes
10950 #define alc269_capture_source alc880_lg_lw_capture_source
10952 static struct snd_kcontrol_new alc269_base_mixer[] = {
10953 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10954 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10955 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10956 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10958 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10959 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10960 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10961 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10962 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10964 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10968 /* capture mixer elements */
10969 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10970 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10971 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10973 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10974 /* The multiple "Capture Source" controls confuse alsamixer
10975 * So call somewhat different..
10977 /* .name = "Capture Source", */
10978 .name = "Input Source",
10980 .info = alc_mux_enum_info,
10981 .get = alc_mux_enum_get,
10982 .put = alc_mux_enum_put,
10988 * generic initialization of ADC, input mixers and output mixers
10990 static struct hda_verb alc269_init_verbs[] = {
10992 * Unmute ADC0 and set the default input to mic-in
10994 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10996 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10997 * analog-loopback mixer widget
10998 * Note: PASD motherboards uses the Line In 2 as the input for
10999 * front panel mic (mic 2)
11001 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11009 * Set up output mixers (0x0c - 0x0e)
11011 /* set vol=0 to output mixers */
11012 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11013 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11015 /* set up input amps for analog loopback */
11016 /* Amp Indices: DAC = 0, mixer = 1 */
11017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11021 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11024 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11025 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11026 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11027 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11028 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11029 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11030 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11032 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11034 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11035 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11036 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11037 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11038 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11040 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11041 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11043 /* FIXME: use matrix-type input source selection */
11044 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11045 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11049 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11052 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11053 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11057 /* add playback controls from the parsed DAC table */
11058 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11059 const struct auto_pin_cfg *cfg)
11064 spec->multiout.num_dacs = 1; /* only use one dac */
11065 spec->multiout.dac_nids = spec->private_dac_nids;
11066 spec->multiout.dac_nids[0] = 2;
11068 nid = cfg->line_out_pins[0];
11070 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11071 "Front Playback Volume",
11072 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
11075 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11076 "Front Playback Switch",
11077 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11082 nid = cfg->speaker_pins[0];
11084 if (!cfg->line_out_pins[0]) {
11085 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11086 "Speaker Playback Volume",
11087 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11093 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11094 "Speaker Playback Switch",
11095 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11100 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11101 "Speaker Playback Switch",
11102 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11108 nid = cfg->hp_pins[0];
11110 /* spec->multiout.hp_nid = 2; */
11111 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
11112 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11113 "Headphone Playback Volume",
11114 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11120 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11121 "Headphone Playback Switch",
11122 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11127 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11128 "Headphone Playback Switch",
11129 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11138 #define alc269_auto_create_analog_input_ctls \
11139 alc880_auto_create_analog_input_ctls
11141 #ifdef CONFIG_SND_HDA_POWER_SAVE
11142 #define alc269_loopbacks alc880_loopbacks
11145 /* pcm configuration: identiacal with ALC880 */
11146 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11147 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11148 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11149 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
11152 * BIOS auto configuration
11154 static int alc269_parse_auto_config(struct hda_codec *codec)
11156 struct alc_spec *spec = codec->spec;
11158 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
11160 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11165 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
11168 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
11172 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11174 if (spec->autocfg.dig_out_pin)
11175 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
11177 if (spec->kctl_alloc)
11178 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11180 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
11181 spec->num_mux_defs = 1;
11182 spec->input_mux = &spec->private_imux;
11184 err = alc_auto_add_mic_boost(codec);
11191 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11192 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11193 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11196 /* init callback for auto-configuration model -- overriding the default init */
11197 static void alc269_auto_init(struct hda_codec *codec)
11199 struct alc_spec *spec = codec->spec;
11200 alc269_auto_init_multi_out(codec);
11201 alc269_auto_init_hp_out(codec);
11202 alc269_auto_init_analog_input(codec);
11203 if (spec->unsol_event)
11204 alc_sku_automute(codec);
11208 * configuration and preset
11210 static const char *alc269_models[ALC269_MODEL_LAST] = {
11211 [ALC269_BASIC] = "basic",
11214 static struct snd_pci_quirk alc269_cfg_tbl[] = {
11218 static struct alc_config_preset alc269_presets[] = {
11220 .mixers = { alc269_base_mixer },
11221 .init_verbs = { alc269_init_verbs },
11222 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11223 .dac_nids = alc269_dac_nids,
11225 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11226 .channel_mode = alc269_modes,
11227 .input_mux = &alc269_capture_source,
11231 static int patch_alc269(struct hda_codec *codec)
11233 struct alc_spec *spec;
11237 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11241 codec->spec = spec;
11243 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11245 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
11249 if (board_config < 0) {
11250 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
11251 "trying auto-probe from BIOS...\n");
11252 board_config = ALC269_AUTO;
11255 if (board_config == ALC269_AUTO) {
11256 /* automatic parse from the BIOS config */
11257 err = alc269_parse_auto_config(codec);
11263 "hda_codec: Cannot set up configuration "
11264 "from BIOS. Using base mode...\n");
11265 board_config = ALC269_BASIC;
11269 if (board_config != ALC269_AUTO)
11270 setup_preset(spec, &alc269_presets[board_config]);
11272 spec->stream_name_analog = "ALC269 Analog";
11273 spec->stream_analog_playback = &alc269_pcm_analog_playback;
11274 spec->stream_analog_capture = &alc269_pcm_analog_capture;
11276 spec->stream_name_digital = "ALC269 Digital";
11277 spec->stream_digital_playback = &alc269_pcm_digital_playback;
11278 spec->stream_digital_capture = &alc269_pcm_digital_capture;
11280 spec->adc_nids = alc269_adc_nids;
11281 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
11282 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
11283 spec->num_mixers++;
11285 codec->patch_ops = alc_patch_ops;
11286 if (board_config == ALC269_AUTO)
11287 spec->init_hook = alc269_auto_init;
11288 #ifdef CONFIG_SND_HDA_POWER_SAVE
11289 if (!spec->loopback.amplist)
11290 spec->loopback.amplist = alc269_loopbacks;
11297 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11301 * set the path ways for 2 channel output
11302 * need to set the codec line out and mic 1 pin widgets to inputs
11304 static struct hda_verb alc861_threestack_ch2_init[] = {
11305 /* set pin widget 1Ah (line in) for input */
11306 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11307 /* set pin widget 18h (mic1/2) for input, for mic also enable
11310 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11312 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11314 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11315 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11321 * need to set the codec line out and mic 1 pin widgets to outputs
11323 static struct hda_verb alc861_threestack_ch6_init[] = {
11324 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11325 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11326 /* set pin widget 18h (mic1) for output (CLFE)*/
11327 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11329 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11330 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11332 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11334 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11335 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11340 static struct hda_channel_mode alc861_threestack_modes[2] = {
11341 { 2, alc861_threestack_ch2_init },
11342 { 6, alc861_threestack_ch6_init },
11344 /* Set mic1 as input and unmute the mixer */
11345 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11346 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11347 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11350 /* Set mic1 as output and mute mixer */
11351 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11352 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11353 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11357 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11358 { 2, alc861_uniwill_m31_ch2_init },
11359 { 4, alc861_uniwill_m31_ch4_init },
11362 /* Set mic1 and line-in as input and unmute the mixer */
11363 static struct hda_verb alc861_asus_ch2_init[] = {
11364 /* set pin widget 1Ah (line in) for input */
11365 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11366 /* set pin widget 18h (mic1/2) for input, for mic also enable
11369 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11371 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11373 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11374 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11378 /* Set mic1 nad line-in as output and mute mixer */
11379 static struct hda_verb alc861_asus_ch6_init[] = {
11380 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11381 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11382 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11383 /* set pin widget 18h (mic1) for output (CLFE)*/
11384 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11385 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11386 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11387 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11389 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11391 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11392 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11397 static struct hda_channel_mode alc861_asus_modes[2] = {
11398 { 2, alc861_asus_ch2_init },
11399 { 6, alc861_asus_ch6_init },
11404 static struct snd_kcontrol_new alc861_base_mixer[] = {
11405 /* output mixer control */
11406 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11407 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11408 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11409 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11410 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11412 /*Input mixer control */
11413 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11414 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11415 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11416 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11417 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11418 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11420 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11421 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11422 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11424 /* Capture mixer control */
11425 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11426 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11428 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11429 .name = "Capture Source",
11431 .info = alc_mux_enum_info,
11432 .get = alc_mux_enum_get,
11433 .put = alc_mux_enum_put,
11438 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11439 /* output mixer control */
11440 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11441 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11442 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11443 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11444 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11446 /* Input mixer control */
11447 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11448 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11449 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11450 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11451 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11452 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11454 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11455 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11456 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11458 /* Capture mixer control */
11459 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11460 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11462 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11463 .name = "Capture Source",
11465 .info = alc_mux_enum_info,
11466 .get = alc_mux_enum_get,
11467 .put = alc_mux_enum_put,
11470 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11471 .name = "Channel Mode",
11472 .info = alc_ch_mode_info,
11473 .get = alc_ch_mode_get,
11474 .put = alc_ch_mode_put,
11475 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11480 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11481 /* output mixer control */
11482 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11484 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11486 /*Capture mixer control */
11487 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11488 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11491 .name = "Capture Source",
11493 .info = alc_mux_enum_info,
11494 .get = alc_mux_enum_get,
11495 .put = alc_mux_enum_put,
11501 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11502 /* output mixer control */
11503 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11504 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11505 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11506 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11507 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11509 /* Input mixer control */
11510 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11511 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11512 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11513 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11514 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11515 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11516 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11517 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11518 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11519 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11521 /* Capture mixer control */
11522 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11523 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11525 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11526 .name = "Capture Source",
11528 .info = alc_mux_enum_info,
11529 .get = alc_mux_enum_get,
11530 .put = alc_mux_enum_put,
11533 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11534 .name = "Channel Mode",
11535 .info = alc_ch_mode_info,
11536 .get = alc_ch_mode_get,
11537 .put = alc_ch_mode_put,
11538 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11543 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11544 /* output mixer control */
11545 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11546 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11547 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11548 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11549 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11551 /* Input mixer control */
11552 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11553 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11554 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11555 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11556 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11557 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11559 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11560 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11563 /* Capture mixer control */
11564 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11565 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11567 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11568 .name = "Capture Source",
11570 .info = alc_mux_enum_info,
11571 .get = alc_mux_enum_get,
11572 .put = alc_mux_enum_put,
11575 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11576 .name = "Channel Mode",
11577 .info = alc_ch_mode_info,
11578 .get = alc_ch_mode_get,
11579 .put = alc_ch_mode_put,
11580 .private_value = ARRAY_SIZE(alc861_asus_modes),
11585 /* additional mixer */
11586 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11587 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11588 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11589 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11590 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11595 * generic initialization of ADC, input mixers and output mixers
11597 static struct hda_verb alc861_base_init_verbs[] = {
11599 * Unmute ADC0 and set the default input to mic-in
11601 /* port-A for surround (rear panel) */
11602 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11603 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11604 /* port-B for mic-in (rear panel) with vref */
11605 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11606 /* port-C for line-in (rear panel) */
11607 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11608 /* port-D for Front */
11609 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11610 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11611 /* port-E for HP out (front panel) */
11612 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11613 /* route front PCM to HP */
11614 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11615 /* port-F for mic-in (front panel) with vref */
11616 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11617 /* port-G for CLFE (rear panel) */
11618 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11619 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11620 /* port-H for side (rear panel) */
11621 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11622 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11624 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11625 /* route front mic to ADC1*/
11626 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11627 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11629 /* Unmute DAC0~3 & spdif out*/
11630 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11631 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11632 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11633 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11636 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11637 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11638 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11639 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11640 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11642 /* Unmute Stereo Mixer 15 */
11643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11648 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11649 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11650 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11651 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11652 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11653 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11654 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11655 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11656 /* hp used DAC 3 (Front) */
11657 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11658 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11663 static struct hda_verb alc861_threestack_init_verbs[] = {
11665 * Unmute ADC0 and set the default input to mic-in
11667 /* port-A for surround (rear panel) */
11668 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11669 /* port-B for mic-in (rear panel) with vref */
11670 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11671 /* port-C for line-in (rear panel) */
11672 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11673 /* port-D for Front */
11674 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11675 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11676 /* port-E for HP out (front panel) */
11677 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11678 /* route front PCM to HP */
11679 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11680 /* port-F for mic-in (front panel) with vref */
11681 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11682 /* port-G for CLFE (rear panel) */
11683 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11684 /* port-H for side (rear panel) */
11685 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11687 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11688 /* route front mic to ADC1*/
11689 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11690 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11691 /* Unmute DAC0~3 & spdif out*/
11692 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11693 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11694 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11695 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11698 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11699 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11700 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11701 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11702 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11704 /* Unmute Stereo Mixer 15 */
11705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11707 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11708 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11710 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11711 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11712 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11713 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11714 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11716 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11717 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11718 /* hp used DAC 3 (Front) */
11719 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11720 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11724 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11726 * Unmute ADC0 and set the default input to mic-in
11728 /* port-A for surround (rear panel) */
11729 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11730 /* port-B for mic-in (rear panel) with vref */
11731 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11732 /* port-C for line-in (rear panel) */
11733 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11734 /* port-D for Front */
11735 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11736 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11737 /* port-E for HP out (front panel) */
11738 /* this has to be set to VREF80 */
11739 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11740 /* route front PCM to HP */
11741 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11742 /* port-F for mic-in (front panel) with vref */
11743 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11744 /* port-G for CLFE (rear panel) */
11745 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11746 /* port-H for side (rear panel) */
11747 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11749 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11750 /* route front mic to ADC1*/
11751 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11752 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11753 /* Unmute DAC0~3 & spdif out*/
11754 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11755 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11756 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11757 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11760 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11761 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11762 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11763 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11764 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11766 /* Unmute Stereo Mixer 15 */
11767 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11772 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11774 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11775 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11776 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11778 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11779 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11780 /* hp used DAC 3 (Front) */
11781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11786 static struct hda_verb alc861_asus_init_verbs[] = {
11788 * Unmute ADC0 and set the default input to mic-in
11790 /* port-A for surround (rear panel)
11791 * according to codec#0 this is the HP jack
11793 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11794 /* route front PCM to HP */
11795 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11796 /* port-B for mic-in (rear panel) with vref */
11797 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11798 /* port-C for line-in (rear panel) */
11799 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11800 /* port-D for Front */
11801 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11802 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11803 /* port-E for HP out (front panel) */
11804 /* this has to be set to VREF80 */
11805 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11806 /* route front PCM to HP */
11807 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11808 /* port-F for mic-in (front panel) with vref */
11809 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11810 /* port-G for CLFE (rear panel) */
11811 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11812 /* port-H for side (rear panel) */
11813 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11815 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11816 /* route front mic to ADC1*/
11817 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11818 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11819 /* Unmute DAC0~3 & spdif out*/
11820 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11821 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11822 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11823 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11825 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11826 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11827 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11828 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11829 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11831 /* Unmute Stereo Mixer 15 */
11832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11837 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11839 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11840 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11841 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11842 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11843 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11844 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11845 /* hp used DAC 3 (Front) */
11846 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11847 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11851 /* additional init verbs for ASUS laptops */
11852 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11853 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11854 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11859 * generic initialization of ADC, input mixers and output mixers
11861 static struct hda_verb alc861_auto_init_verbs[] = {
11863 * Unmute ADC0 and set the default input to mic-in
11865 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11866 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11868 /* Unmute DAC0~3 & spdif out*/
11869 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11870 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11871 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11872 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11873 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11875 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11876 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11877 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11878 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11879 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11881 /* Unmute Stereo Mixer 15 */
11882 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11883 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11885 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11887 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11888 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11889 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11890 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11891 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11892 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11893 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11894 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11896 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11897 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11898 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11899 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11900 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11901 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11902 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11903 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11905 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11910 static struct hda_verb alc861_toshiba_init_verbs[] = {
11911 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11916 /* toggle speaker-output according to the hp-jack state */
11917 static void alc861_toshiba_automute(struct hda_codec *codec)
11919 unsigned int present;
11921 present = snd_hda_codec_read(codec, 0x0f, 0,
11922 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11923 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11924 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11925 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11926 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11929 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11932 if ((res >> 26) == ALC880_HP_EVENT)
11933 alc861_toshiba_automute(codec);
11936 /* pcm configuration: identiacal with ALC880 */
11937 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11938 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11939 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11940 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11943 #define ALC861_DIGOUT_NID 0x07
11945 static struct hda_channel_mode alc861_8ch_modes[1] = {
11949 static hda_nid_t alc861_dac_nids[4] = {
11950 /* front, surround, clfe, side */
11951 0x03, 0x06, 0x05, 0x04
11954 static hda_nid_t alc660_dac_nids[3] = {
11955 /* front, clfe, surround */
11959 static hda_nid_t alc861_adc_nids[1] = {
11964 static struct hda_input_mux alc861_capture_source = {
11968 { "Front Mic", 0x3 },
11975 /* fill in the dac_nids table from the parsed pin configuration */
11976 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11977 const struct auto_pin_cfg *cfg)
11982 spec->multiout.dac_nids = spec->private_dac_nids;
11983 for (i = 0; i < cfg->line_outs; i++) {
11984 nid = cfg->line_out_pins[i];
11986 if (i >= ARRAY_SIZE(alc861_dac_nids))
11988 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11991 spec->multiout.num_dacs = cfg->line_outs;
11995 /* add playback controls from the parsed DAC table */
11996 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11997 const struct auto_pin_cfg *cfg)
12000 static const char *chname[4] = {
12001 "Front", "Surround", NULL /*CLFE*/, "Side"
12006 for (i = 0; i < cfg->line_outs; i++) {
12007 nid = spec->multiout.dac_nids[i];
12012 err = add_control(spec, ALC_CTL_BIND_MUTE,
12013 "Center Playback Switch",
12014 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12018 err = add_control(spec, ALC_CTL_BIND_MUTE,
12019 "LFE Playback Switch",
12020 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12025 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
12027 if (nid == alc861_dac_nids[idx])
12029 sprintf(name, "%s Playback Switch", chname[idx]);
12030 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12031 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12040 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
12048 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
12050 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12051 "Headphone Playback Switch",
12052 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12055 spec->multiout.hp_nid = nid;
12060 /* create playback/capture controls for input pins */
12061 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
12062 const struct auto_pin_cfg *cfg)
12064 struct hda_input_mux *imux = &spec->private_imux;
12065 int i, err, idx, idx1;
12067 for (i = 0; i < AUTO_PIN_LAST; i++) {
12068 switch (cfg->input_pins[i]) {
12071 idx = 2; /* Line In */
12075 idx = 2; /* Line In */
12079 idx = 1; /* Mic In */
12083 idx = 1; /* Mic In */
12093 err = new_analog_input(spec, cfg->input_pins[i],
12094 auto_pin_cfg_labels[i], idx, 0x15);
12098 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12099 imux->items[imux->num_items].index = idx1;
12105 static struct snd_kcontrol_new alc861_capture_mixer[] = {
12106 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12107 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12111 /* The multiple "Capture Source" controls confuse alsamixer
12112 * So call somewhat different..
12114 /* .name = "Capture Source", */
12115 .name = "Input Source",
12117 .info = alc_mux_enum_info,
12118 .get = alc_mux_enum_get,
12119 .put = alc_mux_enum_put,
12124 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
12126 int pin_type, int dac_idx)
12128 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12130 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12134 static void alc861_auto_init_multi_out(struct hda_codec *codec)
12136 struct alc_spec *spec = codec->spec;
12139 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
12140 for (i = 0; i < spec->autocfg.line_outs; i++) {
12141 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12142 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12144 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
12145 spec->multiout.dac_nids[i]);
12149 static void alc861_auto_init_hp_out(struct hda_codec *codec)
12151 struct alc_spec *spec = codec->spec;
12154 pin = spec->autocfg.hp_pins[0];
12155 if (pin) /* connect to front */
12156 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
12157 spec->multiout.dac_nids[0]);
12158 pin = spec->autocfg.speaker_pins[0];
12160 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12163 static void alc861_auto_init_analog_input(struct hda_codec *codec)
12165 struct alc_spec *spec = codec->spec;
12168 for (i = 0; i < AUTO_PIN_LAST; i++) {
12169 hda_nid_t nid = spec->autocfg.input_pins[i];
12170 if (nid >= 0x0c && nid <= 0x11) {
12171 snd_hda_codec_write(codec, nid, 0,
12172 AC_VERB_SET_PIN_WIDGET_CONTROL,
12173 i <= AUTO_PIN_FRONT_MIC ?
12174 PIN_VREF80 : PIN_IN);
12179 /* parse the BIOS configuration and set up the alc_spec */
12180 /* return 1 if successful, 0 if the proper config is not found,
12181 * or a negative error code
12183 static int alc861_parse_auto_config(struct hda_codec *codec)
12185 struct alc_spec *spec = codec->spec;
12187 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12189 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12193 if (!spec->autocfg.line_outs)
12194 return 0; /* can't find valid BIOS pin config */
12196 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
12199 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
12202 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
12205 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
12209 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12211 if (spec->autocfg.dig_out_pin)
12212 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
12214 if (spec->kctl_alloc)
12215 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12217 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
12219 spec->num_mux_defs = 1;
12220 spec->input_mux = &spec->private_imux;
12222 spec->adc_nids = alc861_adc_nids;
12223 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
12224 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
12225 spec->num_mixers++;
12230 /* additional initialization for auto-configuration model */
12231 static void alc861_auto_init(struct hda_codec *codec)
12233 struct alc_spec *spec = codec->spec;
12234 alc861_auto_init_multi_out(codec);
12235 alc861_auto_init_hp_out(codec);
12236 alc861_auto_init_analog_input(codec);
12237 if (spec->unsol_event)
12238 alc_sku_automute(codec);
12241 #ifdef CONFIG_SND_HDA_POWER_SAVE
12242 static struct hda_amp_list alc861_loopbacks[] = {
12243 { 0x15, HDA_INPUT, 0 },
12244 { 0x15, HDA_INPUT, 1 },
12245 { 0x15, HDA_INPUT, 2 },
12246 { 0x15, HDA_INPUT, 3 },
12253 * configuration and preset
12255 static const char *alc861_models[ALC861_MODEL_LAST] = {
12256 [ALC861_3ST] = "3stack",
12257 [ALC660_3ST] = "3stack-660",
12258 [ALC861_3ST_DIG] = "3stack-dig",
12259 [ALC861_6ST_DIG] = "6stack-dig",
12260 [ALC861_UNIWILL_M31] = "uniwill-m31",
12261 [ALC861_TOSHIBA] = "toshiba",
12262 [ALC861_ASUS] = "asus",
12263 [ALC861_ASUS_LAPTOP] = "asus-laptop",
12264 [ALC861_AUTO] = "auto",
12267 static struct snd_pci_quirk alc861_cfg_tbl[] = {
12268 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
12269 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12270 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12271 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
12272 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
12273 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
12274 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
12275 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12276 * Any other models that need this preset?
12278 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12279 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
12280 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
12281 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
12282 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
12283 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
12284 /* FIXME: the below seems conflict */
12285 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12286 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
12287 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
12291 static struct alc_config_preset alc861_presets[] = {
12293 .mixers = { alc861_3ST_mixer },
12294 .init_verbs = { alc861_threestack_init_verbs },
12295 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12296 .dac_nids = alc861_dac_nids,
12297 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12298 .channel_mode = alc861_threestack_modes,
12300 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12301 .adc_nids = alc861_adc_nids,
12302 .input_mux = &alc861_capture_source,
12304 [ALC861_3ST_DIG] = {
12305 .mixers = { alc861_base_mixer },
12306 .init_verbs = { alc861_threestack_init_verbs },
12307 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12308 .dac_nids = alc861_dac_nids,
12309 .dig_out_nid = ALC861_DIGOUT_NID,
12310 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12311 .channel_mode = alc861_threestack_modes,
12313 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12314 .adc_nids = alc861_adc_nids,
12315 .input_mux = &alc861_capture_source,
12317 [ALC861_6ST_DIG] = {
12318 .mixers = { alc861_base_mixer },
12319 .init_verbs = { alc861_base_init_verbs },
12320 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12321 .dac_nids = alc861_dac_nids,
12322 .dig_out_nid = ALC861_DIGOUT_NID,
12323 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12324 .channel_mode = alc861_8ch_modes,
12325 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12326 .adc_nids = alc861_adc_nids,
12327 .input_mux = &alc861_capture_source,
12330 .mixers = { alc861_3ST_mixer },
12331 .init_verbs = { alc861_threestack_init_verbs },
12332 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12333 .dac_nids = alc660_dac_nids,
12334 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12335 .channel_mode = alc861_threestack_modes,
12337 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12338 .adc_nids = alc861_adc_nids,
12339 .input_mux = &alc861_capture_source,
12341 [ALC861_UNIWILL_M31] = {
12342 .mixers = { alc861_uniwill_m31_mixer },
12343 .init_verbs = { alc861_uniwill_m31_init_verbs },
12344 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12345 .dac_nids = alc861_dac_nids,
12346 .dig_out_nid = ALC861_DIGOUT_NID,
12347 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12348 .channel_mode = alc861_uniwill_m31_modes,
12350 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12351 .adc_nids = alc861_adc_nids,
12352 .input_mux = &alc861_capture_source,
12354 [ALC861_TOSHIBA] = {
12355 .mixers = { alc861_toshiba_mixer },
12356 .init_verbs = { alc861_base_init_verbs,
12357 alc861_toshiba_init_verbs },
12358 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12359 .dac_nids = alc861_dac_nids,
12360 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12361 .channel_mode = alc883_3ST_2ch_modes,
12362 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12363 .adc_nids = alc861_adc_nids,
12364 .input_mux = &alc861_capture_source,
12365 .unsol_event = alc861_toshiba_unsol_event,
12366 .init_hook = alc861_toshiba_automute,
12369 .mixers = { alc861_asus_mixer },
12370 .init_verbs = { alc861_asus_init_verbs },
12371 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12372 .dac_nids = alc861_dac_nids,
12373 .dig_out_nid = ALC861_DIGOUT_NID,
12374 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12375 .channel_mode = alc861_asus_modes,
12378 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12379 .adc_nids = alc861_adc_nids,
12380 .input_mux = &alc861_capture_source,
12382 [ALC861_ASUS_LAPTOP] = {
12383 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12384 .init_verbs = { alc861_asus_init_verbs,
12385 alc861_asus_laptop_init_verbs },
12386 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12387 .dac_nids = alc861_dac_nids,
12388 .dig_out_nid = ALC861_DIGOUT_NID,
12389 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12390 .channel_mode = alc883_3ST_2ch_modes,
12392 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12393 .adc_nids = alc861_adc_nids,
12394 .input_mux = &alc861_capture_source,
12399 static int patch_alc861(struct hda_codec *codec)
12401 struct alc_spec *spec;
12405 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12409 codec->spec = spec;
12411 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12415 if (board_config < 0) {
12416 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12417 "trying auto-probe from BIOS...\n");
12418 board_config = ALC861_AUTO;
12421 if (board_config == ALC861_AUTO) {
12422 /* automatic parse from the BIOS config */
12423 err = alc861_parse_auto_config(codec);
12429 "hda_codec: Cannot set up configuration "
12430 "from BIOS. Using base mode...\n");
12431 board_config = ALC861_3ST_DIG;
12435 if (board_config != ALC861_AUTO)
12436 setup_preset(spec, &alc861_presets[board_config]);
12438 spec->stream_name_analog = "ALC861 Analog";
12439 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12440 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12442 spec->stream_name_digital = "ALC861 Digital";
12443 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12444 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12446 spec->vmaster_nid = 0x03;
12448 codec->patch_ops = alc_patch_ops;
12449 if (board_config == ALC861_AUTO)
12450 spec->init_hook = alc861_auto_init;
12451 #ifdef CONFIG_SND_HDA_POWER_SAVE
12452 if (!spec->loopback.amplist)
12453 spec->loopback.amplist = alc861_loopbacks;
12460 * ALC861-VD support
12464 * In addition, an independent DAC
12466 #define ALC861VD_DIGOUT_NID 0x06
12468 static hda_nid_t alc861vd_dac_nids[4] = {
12469 /* front, surr, clfe, side surr */
12470 0x02, 0x03, 0x04, 0x05
12473 /* dac_nids for ALC660vd are in a different order - according to
12474 * Realtek's driver.
12475 * This should probably tesult in a different mixer for 6stack models
12476 * of ALC660vd codecs, but for now there is only 3stack mixer
12477 * - and it is the same as in 861vd.
12478 * adc_nids in ALC660vd are (is) the same as in 861vd
12480 static hda_nid_t alc660vd_dac_nids[3] = {
12481 /* front, rear, clfe, rear_surr */
12485 static hda_nid_t alc861vd_adc_nids[1] = {
12490 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12493 /* FIXME: should be a matrix-type input source selection */
12494 static struct hda_input_mux alc861vd_capture_source = {
12498 { "Front Mic", 0x1 },
12504 static struct hda_input_mux alc861vd_dallas_capture_source = {
12507 { "Ext Mic", 0x0 },
12508 { "Int Mic", 0x1 },
12512 static struct hda_input_mux alc861vd_hp_capture_source = {
12515 { "Front Mic", 0x0 },
12516 { "ATAPI Mic", 0x1 },
12520 #define alc861vd_mux_enum_info alc_mux_enum_info
12521 #define alc861vd_mux_enum_get alc_mux_enum_get
12522 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12523 #define alc861vd_mux_enum_put alc882_mux_enum_put
12528 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12535 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12536 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12537 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12538 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12539 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12546 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12547 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12548 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12549 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12550 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12554 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12555 { 6, alc861vd_6stack_ch6_init },
12556 { 8, alc861vd_6stack_ch8_init },
12559 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12562 .name = "Channel Mode",
12563 .info = alc_ch_mode_info,
12564 .get = alc_ch_mode_get,
12565 .put = alc_ch_mode_put,
12570 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12571 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12572 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12575 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12576 /* The multiple "Capture Source" controls confuse alsamixer
12577 * So call somewhat different..
12579 /* .name = "Capture Source", */
12580 .name = "Input Source",
12582 .info = alc861vd_mux_enum_info,
12583 .get = alc861vd_mux_enum_get,
12584 .put = alc861vd_mux_enum_put,
12589 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12590 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12592 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12593 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12594 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12596 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12597 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12599 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12601 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12603 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12604 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12606 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12607 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12609 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12611 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12613 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12615 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12616 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12617 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12619 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12620 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12622 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12623 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12625 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12626 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12631 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12632 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12633 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12637 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12641 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12643 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12645 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12646 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12648 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12649 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12651 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12652 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12657 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12658 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12659 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12660 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12662 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12664 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12665 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12666 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12668 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12669 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12670 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12672 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12673 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12678 /* Pin assignment: Speaker=0x14, HP = 0x15,
12679 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12681 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12682 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12683 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12684 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12685 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12686 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12687 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12688 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12689 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12690 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12691 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12692 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12693 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12697 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12698 * Front Mic=0x18, ATAPI Mic = 0x19,
12700 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12701 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12702 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12703 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12704 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12705 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12706 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12707 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12708 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12714 * generic initialization of ADC, input mixers and output mixers
12716 static struct hda_verb alc861vd_volume_init_verbs[] = {
12718 * Unmute ADC0 and set the default input to mic-in
12720 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12721 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12723 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12724 * the analog-loopback mixer widget
12726 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12733 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12734 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12740 * Set up output mixers (0x02 - 0x05)
12742 /* set vol=0 to output mixers */
12743 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12744 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12745 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12746 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12748 /* set up input amps for analog loopback */
12749 /* Amp Indices: DAC = 0, mixer = 1 */
12750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12752 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12754 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12756 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12757 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12763 * 3-stack pin configuration:
12764 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12766 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12768 * Set pin mode and muting
12770 /* set front pin widgets 0x14 for output */
12771 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12773 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12775 /* Mic (rear) pin: input vref at 80% */
12776 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12778 /* Front Mic pin: input vref at 80% */
12779 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12780 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12781 /* Line In pin: input */
12782 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12783 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12784 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12785 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12786 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12787 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12788 /* CD pin widget for input */
12789 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12795 * 6-stack pin configuration:
12797 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12799 * Set pin mode and muting
12801 /* set front pin widgets 0x14 for output */
12802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12803 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12804 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12806 /* Rear Pin: output 1 (0x0d) */
12807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12809 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12810 /* CLFE Pin: output 2 (0x0e) */
12811 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12812 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12813 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12814 /* Side Pin: output 3 (0x0f) */
12815 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12816 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12817 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12819 /* Mic (rear) pin: input vref at 80% */
12820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12822 /* Front Mic pin: input vref at 80% */
12823 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12825 /* Line In pin: input */
12826 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12828 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12830 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12831 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12832 /* CD pin widget for input */
12833 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12838 static struct hda_verb alc861vd_eapd_verbs[] = {
12839 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12843 static struct hda_verb alc660vd_eapd_verbs[] = {
12844 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12845 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12849 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12851 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12853 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12854 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12858 /* toggle speaker-output according to the hp-jack state */
12859 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12861 unsigned int present;
12862 unsigned char bits;
12864 present = snd_hda_codec_read(codec, 0x1b, 0,
12865 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12866 bits = present ? HDA_AMP_MUTE : 0;
12867 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12868 HDA_AMP_MUTE, bits);
12871 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12873 unsigned int present;
12874 unsigned char bits;
12876 present = snd_hda_codec_read(codec, 0x18, 0,
12877 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12878 bits = present ? HDA_AMP_MUTE : 0;
12879 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12880 HDA_AMP_MUTE, bits);
12883 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12885 alc861vd_lenovo_hp_automute(codec);
12886 alc861vd_lenovo_mic_automute(codec);
12889 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12892 switch (res >> 26) {
12893 case ALC880_HP_EVENT:
12894 alc861vd_lenovo_hp_automute(codec);
12896 case ALC880_MIC_EVENT:
12897 alc861vd_lenovo_mic_automute(codec);
12902 static struct hda_verb alc861vd_dallas_verbs[] = {
12903 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12904 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12905 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12906 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12909 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12911 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12913 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12914 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12915 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12918 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12921 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12922 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12923 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12924 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12926 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12927 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12928 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12929 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12930 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12931 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12932 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12933 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12935 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12936 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12937 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12940 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12941 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12947 /* toggle speaker-output according to the hp-jack state */
12948 static void alc861vd_dallas_automute(struct hda_codec *codec)
12950 unsigned int present;
12952 present = snd_hda_codec_read(codec, 0x15, 0,
12953 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12954 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12955 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12958 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12960 if ((res >> 26) == ALC880_HP_EVENT)
12961 alc861vd_dallas_automute(codec);
12964 #ifdef CONFIG_SND_HDA_POWER_SAVE
12965 #define alc861vd_loopbacks alc880_loopbacks
12968 /* pcm configuration: identiacal with ALC880 */
12969 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12970 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12971 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12972 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12975 * configuration and preset
12977 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12978 [ALC660VD_3ST] = "3stack-660",
12979 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12980 [ALC861VD_3ST] = "3stack",
12981 [ALC861VD_3ST_DIG] = "3stack-digout",
12982 [ALC861VD_6ST_DIG] = "6stack-digout",
12983 [ALC861VD_LENOVO] = "lenovo",
12984 [ALC861VD_DALLAS] = "dallas",
12985 [ALC861VD_HP] = "hp",
12986 [ALC861VD_AUTO] = "auto",
12989 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12990 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12991 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12992 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12993 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12994 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12995 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12996 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12997 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12998 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12999 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
13000 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
13001 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
13002 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
13003 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
13004 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
13008 static struct alc_config_preset alc861vd_presets[] = {
13010 .mixers = { alc861vd_3st_mixer },
13011 .init_verbs = { alc861vd_volume_init_verbs,
13012 alc861vd_3stack_init_verbs },
13013 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13014 .dac_nids = alc660vd_dac_nids,
13015 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13016 .channel_mode = alc861vd_3stack_2ch_modes,
13017 .input_mux = &alc861vd_capture_source,
13019 [ALC660VD_3ST_DIG] = {
13020 .mixers = { alc861vd_3st_mixer },
13021 .init_verbs = { alc861vd_volume_init_verbs,
13022 alc861vd_3stack_init_verbs },
13023 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13024 .dac_nids = alc660vd_dac_nids,
13025 .dig_out_nid = ALC861VD_DIGOUT_NID,
13026 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13027 .channel_mode = alc861vd_3stack_2ch_modes,
13028 .input_mux = &alc861vd_capture_source,
13031 .mixers = { alc861vd_3st_mixer },
13032 .init_verbs = { alc861vd_volume_init_verbs,
13033 alc861vd_3stack_init_verbs },
13034 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13035 .dac_nids = alc861vd_dac_nids,
13036 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13037 .channel_mode = alc861vd_3stack_2ch_modes,
13038 .input_mux = &alc861vd_capture_source,
13040 [ALC861VD_3ST_DIG] = {
13041 .mixers = { alc861vd_3st_mixer },
13042 .init_verbs = { alc861vd_volume_init_verbs,
13043 alc861vd_3stack_init_verbs },
13044 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13045 .dac_nids = alc861vd_dac_nids,
13046 .dig_out_nid = ALC861VD_DIGOUT_NID,
13047 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13048 .channel_mode = alc861vd_3stack_2ch_modes,
13049 .input_mux = &alc861vd_capture_source,
13051 [ALC861VD_6ST_DIG] = {
13052 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
13053 .init_verbs = { alc861vd_volume_init_verbs,
13054 alc861vd_6stack_init_verbs },
13055 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13056 .dac_nids = alc861vd_dac_nids,
13057 .dig_out_nid = ALC861VD_DIGOUT_NID,
13058 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
13059 .channel_mode = alc861vd_6stack_modes,
13060 .input_mux = &alc861vd_capture_source,
13062 [ALC861VD_LENOVO] = {
13063 .mixers = { alc861vd_lenovo_mixer },
13064 .init_verbs = { alc861vd_volume_init_verbs,
13065 alc861vd_3stack_init_verbs,
13066 alc861vd_eapd_verbs,
13067 alc861vd_lenovo_unsol_verbs },
13068 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13069 .dac_nids = alc660vd_dac_nids,
13070 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13071 .channel_mode = alc861vd_3stack_2ch_modes,
13072 .input_mux = &alc861vd_capture_source,
13073 .unsol_event = alc861vd_lenovo_unsol_event,
13074 .init_hook = alc861vd_lenovo_automute,
13076 [ALC861VD_DALLAS] = {
13077 .mixers = { alc861vd_dallas_mixer },
13078 .init_verbs = { alc861vd_dallas_verbs },
13079 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13080 .dac_nids = alc861vd_dac_nids,
13081 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13082 .channel_mode = alc861vd_3stack_2ch_modes,
13083 .input_mux = &alc861vd_dallas_capture_source,
13084 .unsol_event = alc861vd_dallas_unsol_event,
13085 .init_hook = alc861vd_dallas_automute,
13088 .mixers = { alc861vd_hp_mixer },
13089 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
13090 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13091 .dac_nids = alc861vd_dac_nids,
13092 .dig_out_nid = ALC861VD_DIGOUT_NID,
13093 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13094 .channel_mode = alc861vd_3stack_2ch_modes,
13095 .input_mux = &alc861vd_hp_capture_source,
13096 .unsol_event = alc861vd_dallas_unsol_event,
13097 .init_hook = alc861vd_dallas_automute,
13102 * BIOS auto configuration
13104 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
13105 hda_nid_t nid, int pin_type, int dac_idx)
13107 alc_set_pin_output(codec, nid, pin_type);
13110 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
13112 struct alc_spec *spec = codec->spec;
13115 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13116 for (i = 0; i <= HDA_SIDE; i++) {
13117 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13118 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13120 alc861vd_auto_set_output_and_unmute(codec, nid,
13126 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
13128 struct alc_spec *spec = codec->spec;
13131 pin = spec->autocfg.hp_pins[0];
13132 if (pin) /* connect to front and use dac 0 */
13133 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13134 pin = spec->autocfg.speaker_pins[0];
13136 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13139 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13140 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13142 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
13144 struct alc_spec *spec = codec->spec;
13147 for (i = 0; i < AUTO_PIN_LAST; i++) {
13148 hda_nid_t nid = spec->autocfg.input_pins[i];
13149 if (alc861vd_is_input_pin(nid)) {
13150 snd_hda_codec_write(codec, nid, 0,
13151 AC_VERB_SET_PIN_WIDGET_CONTROL,
13152 i <= AUTO_PIN_FRONT_MIC ?
13153 PIN_VREF80 : PIN_IN);
13154 if (nid != ALC861VD_PIN_CD_NID)
13155 snd_hda_codec_write(codec, nid, 0,
13156 AC_VERB_SET_AMP_GAIN_MUTE,
13162 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13163 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13165 /* add playback controls from the parsed DAC table */
13166 /* Based on ALC880 version. But ALC861VD has separate,
13167 * different NIDs for mute/unmute switch and volume control */
13168 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
13169 const struct auto_pin_cfg *cfg)
13172 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
13173 hda_nid_t nid_v, nid_s;
13176 for (i = 0; i < cfg->line_outs; i++) {
13177 if (!spec->multiout.dac_nids[i])
13179 nid_v = alc861vd_idx_to_mixer_vol(
13181 spec->multiout.dac_nids[i]));
13182 nid_s = alc861vd_idx_to_mixer_switch(
13184 spec->multiout.dac_nids[i]));
13188 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13189 "Center Playback Volume",
13190 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
13194 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13195 "LFE Playback Volume",
13196 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
13200 err = add_control(spec, ALC_CTL_BIND_MUTE,
13201 "Center Playback Switch",
13202 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
13206 err = add_control(spec, ALC_CTL_BIND_MUTE,
13207 "LFE Playback Switch",
13208 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
13213 sprintf(name, "%s Playback Volume", chname[i]);
13214 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13215 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
13219 sprintf(name, "%s Playback Switch", chname[i]);
13220 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13221 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
13230 /* add playback controls for speaker and HP outputs */
13231 /* Based on ALC880 version. But ALC861VD has separate,
13232 * different NIDs for mute/unmute switch and volume control */
13233 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
13234 hda_nid_t pin, const char *pfx)
13236 hda_nid_t nid_v, nid_s;
13243 if (alc880_is_fixed_pin(pin)) {
13244 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13245 /* specify the DAC as the extra output */
13246 if (!spec->multiout.hp_nid)
13247 spec->multiout.hp_nid = nid_v;
13249 spec->multiout.extra_out_nid[0] = nid_v;
13250 /* control HP volume/switch on the output mixer amp */
13251 nid_v = alc861vd_idx_to_mixer_vol(
13252 alc880_fixed_pin_idx(pin));
13253 nid_s = alc861vd_idx_to_mixer_switch(
13254 alc880_fixed_pin_idx(pin));
13256 sprintf(name, "%s Playback Volume", pfx);
13257 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13258 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
13261 sprintf(name, "%s Playback Switch", pfx);
13262 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13263 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
13266 } else if (alc880_is_multi_pin(pin)) {
13267 /* set manual connection */
13268 /* we have only a switch on HP-out PIN */
13269 sprintf(name, "%s Playback Switch", pfx);
13270 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13271 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13278 /* parse the BIOS configuration and set up the alc_spec
13279 * return 1 if successful, 0 if the proper config is not found,
13280 * or a negative error code
13281 * Based on ALC880 version - had to change it to override
13282 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13283 static int alc861vd_parse_auto_config(struct hda_codec *codec)
13285 struct alc_spec *spec = codec->spec;
13287 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
13289 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13293 if (!spec->autocfg.line_outs)
13294 return 0; /* can't find valid BIOS pin config */
13296 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13299 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
13302 err = alc861vd_auto_create_extra_out(spec,
13303 spec->autocfg.speaker_pins[0],
13307 err = alc861vd_auto_create_extra_out(spec,
13308 spec->autocfg.hp_pins[0],
13312 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
13316 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13318 if (spec->autocfg.dig_out_pin)
13319 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13321 if (spec->kctl_alloc)
13322 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13324 spec->init_verbs[spec->num_init_verbs++]
13325 = alc861vd_volume_init_verbs;
13327 spec->num_mux_defs = 1;
13328 spec->input_mux = &spec->private_imux;
13330 err = alc_auto_add_mic_boost(codec);
13337 /* additional initialization for auto-configuration model */
13338 static void alc861vd_auto_init(struct hda_codec *codec)
13340 struct alc_spec *spec = codec->spec;
13341 alc861vd_auto_init_multi_out(codec);
13342 alc861vd_auto_init_hp_out(codec);
13343 alc861vd_auto_init_analog_input(codec);
13344 if (spec->unsol_event)
13345 alc_sku_automute(codec);
13348 static int patch_alc861vd(struct hda_codec *codec)
13350 struct alc_spec *spec;
13351 int err, board_config;
13353 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13357 codec->spec = spec;
13359 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13363 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13364 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13365 "ALC861VD, trying auto-probe from BIOS...\n");
13366 board_config = ALC861VD_AUTO;
13369 if (board_config == ALC861VD_AUTO) {
13370 /* automatic parse from the BIOS config */
13371 err = alc861vd_parse_auto_config(codec);
13377 "hda_codec: Cannot set up configuration "
13378 "from BIOS. Using base mode...\n");
13379 board_config = ALC861VD_3ST;
13383 if (board_config != ALC861VD_AUTO)
13384 setup_preset(spec, &alc861vd_presets[board_config]);
13386 if (codec->vendor_id == 0x10ec0660) {
13387 spec->stream_name_analog = "ALC660-VD Analog";
13388 spec->stream_name_digital = "ALC660-VD Digital";
13389 /* always turn on EAPD */
13390 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
13392 spec->stream_name_analog = "ALC861VD Analog";
13393 spec->stream_name_digital = "ALC861VD Digital";
13396 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13397 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13399 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13400 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13402 spec->adc_nids = alc861vd_adc_nids;
13403 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13404 spec->capsrc_nids = alc861vd_capsrc_nids;
13406 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13407 spec->num_mixers++;
13409 spec->vmaster_nid = 0x02;
13411 codec->patch_ops = alc_patch_ops;
13413 if (board_config == ALC861VD_AUTO)
13414 spec->init_hook = alc861vd_auto_init;
13415 #ifdef CONFIG_SND_HDA_POWER_SAVE
13416 if (!spec->loopback.amplist)
13417 spec->loopback.amplist = alc861vd_loopbacks;
13426 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13427 * configuration. Each pin widget can choose any input DACs and a mixer.
13428 * Each ADC is connected from a mixer of all inputs. This makes possible
13429 * 6-channel independent captures.
13431 * In addition, an independent DAC for the multi-playback (not used in this
13434 #define ALC662_DIGOUT_NID 0x06
13435 #define ALC662_DIGIN_NID 0x0a
13437 static hda_nid_t alc662_dac_nids[4] = {
13438 /* front, rear, clfe, rear_surr */
13442 static hda_nid_t alc662_adc_nids[1] = {
13447 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13450 /* FIXME: should be a matrix-type input source selection */
13451 static struct hda_input_mux alc662_capture_source = {
13455 { "Front Mic", 0x1 },
13461 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13469 static struct hda_input_mux alc662_eeepc_capture_source = {
13477 static struct hda_input_mux alc663_capture_source = {
13481 { "Front Mic", 0x1 },
13486 static struct hda_input_mux alc663_m51va_capture_source = {
13489 { "Ext-Mic", 0x0 },
13494 #define alc662_mux_enum_info alc_mux_enum_info
13495 #define alc662_mux_enum_get alc_mux_enum_get
13496 #define alc662_mux_enum_put alc882_mux_enum_put
13501 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13508 static struct hda_verb alc662_3ST_ch2_init[] = {
13509 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13510 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13511 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13512 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13519 static struct hda_verb alc662_3ST_ch6_init[] = {
13520 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13521 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13522 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13523 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13524 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13525 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13529 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13530 { 2, alc662_3ST_ch2_init },
13531 { 6, alc662_3ST_ch6_init },
13537 static struct hda_verb alc662_sixstack_ch6_init[] = {
13538 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13539 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13540 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13547 static struct hda_verb alc662_sixstack_ch8_init[] = {
13548 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13549 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13550 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13554 static struct hda_channel_mode alc662_5stack_modes[2] = {
13555 { 2, alc662_sixstack_ch6_init },
13556 { 6, alc662_sixstack_ch8_init },
13559 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13560 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13563 static struct snd_kcontrol_new alc662_base_mixer[] = {
13564 /* output mixer control */
13565 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13566 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13567 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13568 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13569 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13570 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13571 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13572 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13573 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13575 /*Input mixer control */
13576 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13577 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13578 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13579 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13580 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13581 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13582 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13583 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13587 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13588 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13589 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13591 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13592 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13593 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13594 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13596 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13597 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13598 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13599 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13600 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13604 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13605 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13606 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13607 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13608 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13609 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13610 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13611 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13612 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13614 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13615 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13616 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13617 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13619 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13620 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13621 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13622 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13623 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13627 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13628 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13629 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13630 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13631 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13632 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13633 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13634 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13640 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13641 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13643 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13644 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13646 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13647 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13648 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13650 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13651 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13652 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13656 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13657 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13658 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13659 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13660 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13661 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13662 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13663 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13664 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13665 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13666 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13667 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13668 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13674 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
13675 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13676 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13677 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13680 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT),
13684 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
13685 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13686 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13687 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13688 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13689 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13693 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13694 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13698 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
13699 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13700 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13701 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13704 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13705 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13706 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13707 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13708 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13712 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13715 .name = "Channel Mode",
13716 .info = alc_ch_mode_info,
13717 .get = alc_ch_mode_get,
13718 .put = alc_ch_mode_put,
13723 static struct hda_verb alc662_init_verbs[] = {
13724 /* ADC: mute amp left and right */
13725 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13726 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13727 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13737 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13738 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13739 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13740 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13742 /* Front Pin: output 0 (0x0c) */
13743 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13744 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13746 /* Rear Pin: output 1 (0x0d) */
13747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13750 /* CLFE Pin: output 2 (0x0e) */
13751 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13752 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13754 /* Mic (rear) pin: input vref at 80% */
13755 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13756 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13757 /* Front Mic pin: input vref at 80% */
13758 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13759 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13760 /* Line In pin: input */
13761 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13762 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13763 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13764 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13765 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13766 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13767 /* CD pin widget for input */
13768 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13770 /* FIXME: use matrix-type input source selection */
13771 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13778 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13779 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13783 /* always trun on EAPD */
13784 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13785 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13790 static struct hda_verb alc662_sue_init_verbs[] = {
13791 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13792 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13796 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13797 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13798 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13802 /* Set Unsolicited Event*/
13803 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13804 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13805 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13810 * generic initialization of ADC, input mixers and output mixers
13812 static struct hda_verb alc662_auto_init_verbs[] = {
13814 * Unmute ADC and set the default input to mic-in
13816 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13817 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13819 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13821 * Note: PASD motherboards uses the Line In 2 as the input for front
13822 * panel mic (mic 2)
13824 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13825 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13826 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13832 * Set up output mixers (0x0c - 0x0f)
13834 /* set vol=0 to output mixers */
13835 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13836 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13837 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13839 /* set up input amps for analog loopback */
13840 /* Amp Indices: DAC = 0, mixer = 1 */
13841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13849 /* FIXME: use matrix-type input source selection */
13850 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13852 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13853 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13857 static struct hda_verb alc663_m51va_init_verbs[] = {
13858 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13859 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13860 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
13864 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13865 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13869 static struct hda_verb alc663_g71v_init_verbs[] = {
13870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13871 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
13872 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
13874 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13875 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13876 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13878 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13879 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
13880 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13884 static struct hda_verb alc663_g50v_init_verbs[] = {
13885 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13886 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13887 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13889 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13890 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13894 /* capture mixer elements */
13895 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13896 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13897 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13899 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13900 /* The multiple "Capture Source" controls confuse alsamixer
13901 * So call somewhat different..
13903 /* .name = "Capture Source", */
13904 .name = "Input Source",
13906 .info = alc662_mux_enum_info,
13907 .get = alc662_mux_enum_get,
13908 .put = alc662_mux_enum_put,
13913 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13915 unsigned int present;
13916 unsigned char bits;
13918 present = snd_hda_codec_read(codec, 0x14, 0,
13919 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13920 bits = present ? HDA_AMP_MUTE : 0;
13921 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13922 HDA_AMP_MUTE, bits);
13925 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13927 unsigned int present;
13928 unsigned char bits;
13930 present = snd_hda_codec_read(codec, 0x1b, 0,
13931 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13932 bits = present ? HDA_AMP_MUTE : 0;
13933 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13934 HDA_AMP_MUTE, bits);
13935 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13936 HDA_AMP_MUTE, bits);
13939 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13942 if ((res >> 26) == ALC880_HP_EVENT)
13943 alc662_lenovo_101e_all_automute(codec);
13944 if ((res >> 26) == ALC880_FRONT_EVENT)
13945 alc662_lenovo_101e_ispeaker_automute(codec);
13948 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13950 unsigned int present;
13952 present = snd_hda_codec_read(codec, 0x18, 0,
13953 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13954 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13955 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13956 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13957 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13958 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13959 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13960 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13961 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13964 /* unsolicited event for HP jack sensing */
13965 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13968 if ((res >> 26) == ALC880_HP_EVENT)
13969 alc262_hippo1_automute( codec );
13971 if ((res >> 26) == ALC880_MIC_EVENT)
13972 alc662_eeepc_mic_automute(codec);
13975 static void alc662_eeepc_inithook(struct hda_codec *codec)
13977 alc262_hippo1_automute( codec );
13978 alc662_eeepc_mic_automute(codec);
13981 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13984 unsigned int present;
13986 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13987 present = snd_hda_codec_read(codec, 0x14, 0,
13988 AC_VERB_GET_PIN_SENSE, 0);
13989 present = (present & 0x80000000) != 0;
13991 /* mute internal speaker */
13992 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13993 HDA_AMP_MUTE, HDA_AMP_MUTE);
13995 /* unmute internal speaker if necessary */
13996 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13997 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13998 HDA_AMP_MUTE, mute);
14002 /* unsolicited event for HP jack sensing */
14003 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
14006 if ((res >> 26) == ALC880_HP_EVENT)
14007 alc662_eeepc_ep20_automute(codec);
14010 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
14012 alc662_eeepc_ep20_automute(codec);
14015 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
14017 unsigned int present;
14018 unsigned char bits;
14020 present = snd_hda_codec_read(codec, 0x21, 0,
14021 AC_VERB_GET_PIN_SENSE, 0)
14022 & AC_PINSENSE_PRESENCE;
14023 bits = present ? HDA_AMP_MUTE : 0;
14024 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14025 HDA_AMP_MUTE, bits);
14028 static void alc663_m51va_mic_automute(struct hda_codec *codec)
14030 unsigned int present;
14032 present = snd_hda_codec_read(codec, 0x18, 0,
14033 AC_VERB_GET_PIN_SENSE, 0)
14034 & AC_PINSENSE_PRESENCE;
14035 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14036 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14037 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14038 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14039 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14040 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14041 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14042 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14045 static void alc663_m51va_unsol_event(struct hda_codec *codec,
14048 switch (res >> 26) {
14049 case ALC880_HP_EVENT:
14050 alc663_m51va_speaker_automute(codec);
14052 case ALC880_MIC_EVENT:
14053 alc663_m51va_mic_automute(codec);
14058 static void alc663_m51va_inithook(struct hda_codec *codec)
14060 alc663_m51va_speaker_automute(codec);
14061 alc663_m51va_mic_automute(codec);
14064 static void alc663_g71v_hp_automute(struct hda_codec *codec)
14066 unsigned int present;
14067 unsigned char bits;
14069 present = snd_hda_codec_read(codec, 0x21, 0,
14070 AC_VERB_GET_PIN_SENSE, 0)
14071 & AC_PINSENSE_PRESENCE;
14072 bits = present ? HDA_AMP_MUTE : 0;
14073 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14074 HDA_AMP_MUTE, bits);
14075 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14076 HDA_AMP_MUTE, bits);
14079 static void alc663_g71v_front_automute(struct hda_codec *codec)
14081 unsigned int present;
14082 unsigned char bits;
14084 present = snd_hda_codec_read(codec, 0x15, 0,
14085 AC_VERB_GET_PIN_SENSE, 0)
14086 & AC_PINSENSE_PRESENCE;
14087 bits = present ? HDA_AMP_MUTE : 0;
14088 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14089 HDA_AMP_MUTE, bits);
14092 static void alc663_g71v_unsol_event(struct hda_codec *codec,
14095 switch (res >> 26) {
14096 case ALC880_HP_EVENT:
14097 alc663_g71v_hp_automute(codec);
14099 case ALC880_FRONT_EVENT:
14100 alc663_g71v_front_automute(codec);
14102 case ALC880_MIC_EVENT:
14103 alc662_eeepc_mic_automute(codec);
14108 static void alc663_g71v_inithook(struct hda_codec *codec)
14110 alc663_g71v_front_automute(codec);
14111 alc663_g71v_hp_automute(codec);
14112 alc662_eeepc_mic_automute(codec);
14115 static void alc663_g50v_unsol_event(struct hda_codec *codec,
14118 switch (res >> 26) {
14119 case ALC880_HP_EVENT:
14120 alc663_m51va_speaker_automute(codec);
14122 case ALC880_MIC_EVENT:
14123 alc662_eeepc_mic_automute(codec);
14128 static void alc663_g50v_inithook(struct hda_codec *codec)
14130 alc663_m51va_speaker_automute(codec);
14131 alc662_eeepc_mic_automute(codec);
14134 #ifdef CONFIG_SND_HDA_POWER_SAVE
14135 #define alc662_loopbacks alc880_loopbacks
14139 /* pcm configuration: identiacal with ALC880 */
14140 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
14141 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
14142 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
14143 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
14146 * configuration and preset
14148 static const char *alc662_models[ALC662_MODEL_LAST] = {
14149 [ALC662_3ST_2ch_DIG] = "3stack-dig",
14150 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
14151 [ALC662_3ST_6ch] = "3stack-6ch",
14152 [ALC662_5ST_DIG] = "6stack-dig",
14153 [ALC662_LENOVO_101E] = "lenovo-101e",
14154 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
14155 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
14156 [ALC663_ASUS_M51VA] = "m51va",
14157 [ALC663_ASUS_G71V] = "g71v",
14158 [ALC663_ASUS_H13] = "h13",
14159 [ALC663_ASUS_G50V] = "g50v",
14160 [ALC662_AUTO] = "auto",
14163 static struct snd_pci_quirk alc662_cfg_tbl[] = {
14164 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
14165 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
14166 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
14167 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
14168 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
14169 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
14170 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
14171 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
14172 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
14173 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
14177 static struct alc_config_preset alc662_presets[] = {
14178 [ALC662_3ST_2ch_DIG] = {
14179 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
14180 .init_verbs = { alc662_init_verbs },
14181 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14182 .dac_nids = alc662_dac_nids,
14183 .dig_out_nid = ALC662_DIGOUT_NID,
14184 .dig_in_nid = ALC662_DIGIN_NID,
14185 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14186 .channel_mode = alc662_3ST_2ch_modes,
14187 .input_mux = &alc662_capture_source,
14189 [ALC662_3ST_6ch_DIG] = {
14190 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14191 alc662_capture_mixer },
14192 .init_verbs = { alc662_init_verbs },
14193 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14194 .dac_nids = alc662_dac_nids,
14195 .dig_out_nid = ALC662_DIGOUT_NID,
14196 .dig_in_nid = ALC662_DIGIN_NID,
14197 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14198 .channel_mode = alc662_3ST_6ch_modes,
14200 .input_mux = &alc662_capture_source,
14202 [ALC662_3ST_6ch] = {
14203 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14204 alc662_capture_mixer },
14205 .init_verbs = { alc662_init_verbs },
14206 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14207 .dac_nids = alc662_dac_nids,
14208 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14209 .channel_mode = alc662_3ST_6ch_modes,
14211 .input_mux = &alc662_capture_source,
14213 [ALC662_5ST_DIG] = {
14214 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
14215 alc662_capture_mixer },
14216 .init_verbs = { alc662_init_verbs },
14217 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14218 .dac_nids = alc662_dac_nids,
14219 .dig_out_nid = ALC662_DIGOUT_NID,
14220 .dig_in_nid = ALC662_DIGIN_NID,
14221 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
14222 .channel_mode = alc662_5stack_modes,
14223 .input_mux = &alc662_capture_source,
14225 [ALC662_LENOVO_101E] = {
14226 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
14227 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
14228 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14229 .dac_nids = alc662_dac_nids,
14230 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14231 .channel_mode = alc662_3ST_2ch_modes,
14232 .input_mux = &alc662_lenovo_101e_capture_source,
14233 .unsol_event = alc662_lenovo_101e_unsol_event,
14234 .init_hook = alc662_lenovo_101e_all_automute,
14236 [ALC662_ASUS_EEEPC_P701] = {
14237 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
14238 .init_verbs = { alc662_init_verbs,
14239 alc662_eeepc_sue_init_verbs },
14240 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14241 .dac_nids = alc662_dac_nids,
14242 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14243 .channel_mode = alc662_3ST_2ch_modes,
14244 .input_mux = &alc662_eeepc_capture_source,
14245 .unsol_event = alc662_eeepc_unsol_event,
14246 .init_hook = alc662_eeepc_inithook,
14248 [ALC662_ASUS_EEEPC_EP20] = {
14249 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
14250 alc662_chmode_mixer },
14251 .init_verbs = { alc662_init_verbs,
14252 alc662_eeepc_ep20_sue_init_verbs },
14253 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14254 .dac_nids = alc662_dac_nids,
14255 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14256 .channel_mode = alc662_3ST_6ch_modes,
14257 .input_mux = &alc662_lenovo_101e_capture_source,
14258 .unsol_event = alc662_eeepc_ep20_unsol_event,
14259 .init_hook = alc662_eeepc_ep20_inithook,
14261 [ALC663_ASUS_M51VA] = {
14262 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14263 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14264 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14265 .dac_nids = alc662_dac_nids,
14266 .dig_out_nid = ALC662_DIGOUT_NID,
14267 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14268 .channel_mode = alc662_3ST_2ch_modes,
14269 .input_mux = &alc663_m51va_capture_source,
14270 .unsol_event = alc663_m51va_unsol_event,
14271 .init_hook = alc663_m51va_inithook,
14273 [ALC663_ASUS_G71V] = {
14274 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
14275 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
14276 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14277 .dac_nids = alc662_dac_nids,
14278 .dig_out_nid = ALC662_DIGOUT_NID,
14279 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14280 .channel_mode = alc662_3ST_2ch_modes,
14281 .input_mux = &alc662_eeepc_capture_source,
14282 .unsol_event = alc663_g71v_unsol_event,
14283 .init_hook = alc663_g71v_inithook,
14285 [ALC663_ASUS_H13] = {
14286 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14287 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14288 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14289 .dac_nids = alc662_dac_nids,
14290 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14291 .channel_mode = alc662_3ST_2ch_modes,
14292 .input_mux = &alc663_m51va_capture_source,
14293 .unsol_event = alc663_m51va_unsol_event,
14294 .init_hook = alc663_m51va_inithook,
14296 [ALC663_ASUS_G50V] = {
14297 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
14298 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
14299 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14300 .dac_nids = alc662_dac_nids,
14301 .dig_out_nid = ALC662_DIGOUT_NID,
14302 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14303 .channel_mode = alc662_3ST_6ch_modes,
14304 .input_mux = &alc663_capture_source,
14305 .unsol_event = alc663_g50v_unsol_event,
14306 .init_hook = alc663_g50v_inithook,
14312 * BIOS auto configuration
14315 /* add playback controls from the parsed DAC table */
14316 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14317 const struct auto_pin_cfg *cfg)
14320 static const char *chname[4] = {
14321 "Front", "Surround", NULL /*CLFE*/, "Side"
14326 for (i = 0; i < cfg->line_outs; i++) {
14327 if (!spec->multiout.dac_nids[i])
14329 nid = alc880_idx_to_dac(i);
14332 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14333 "Center Playback Volume",
14334 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14338 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14339 "LFE Playback Volume",
14340 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14344 err = add_control(spec, ALC_CTL_BIND_MUTE,
14345 "Center Playback Switch",
14346 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
14350 err = add_control(spec, ALC_CTL_BIND_MUTE,
14351 "LFE Playback Switch",
14352 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
14357 sprintf(name, "%s Playback Volume", chname[i]);
14358 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14359 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14363 sprintf(name, "%s Playback Switch", chname[i]);
14364 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14365 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
14374 /* add playback controls for speaker and HP outputs */
14375 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
14385 if (alc880_is_fixed_pin(pin)) {
14386 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14387 /* printk("DAC nid=%x\n",nid); */
14388 /* specify the DAC as the extra output */
14389 if (!spec->multiout.hp_nid)
14390 spec->multiout.hp_nid = nid;
14392 spec->multiout.extra_out_nid[0] = nid;
14393 /* control HP volume/switch on the output mixer amp */
14394 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14395 sprintf(name, "%s Playback Volume", pfx);
14396 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14397 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14400 sprintf(name, "%s Playback Switch", pfx);
14401 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14402 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
14405 } else if (alc880_is_multi_pin(pin)) {
14406 /* set manual connection */
14407 /* we have only a switch on HP-out PIN */
14408 sprintf(name, "%s Playback Switch", pfx);
14409 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14410 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14417 /* create playback/capture controls for input pins */
14418 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
14419 const struct auto_pin_cfg *cfg)
14421 struct hda_input_mux *imux = &spec->private_imux;
14424 for (i = 0; i < AUTO_PIN_LAST; i++) {
14425 if (alc880_is_input_pin(cfg->input_pins[i])) {
14426 idx = alc880_input_pin_idx(cfg->input_pins[i]);
14427 err = new_analog_input(spec, cfg->input_pins[i],
14428 auto_pin_cfg_labels[i],
14432 imux->items[imux->num_items].label =
14433 auto_pin_cfg_labels[i];
14434 imux->items[imux->num_items].index =
14435 alc880_input_pin_idx(cfg->input_pins[i]);
14442 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
14443 hda_nid_t nid, int pin_type,
14446 alc_set_pin_output(codec, nid, pin_type);
14447 /* need the manual connection? */
14448 if (alc880_is_multi_pin(nid)) {
14449 struct alc_spec *spec = codec->spec;
14450 int idx = alc880_multi_pin_idx(nid);
14451 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
14452 AC_VERB_SET_CONNECT_SEL,
14453 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
14457 static void alc662_auto_init_multi_out(struct hda_codec *codec)
14459 struct alc_spec *spec = codec->spec;
14462 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14463 for (i = 0; i <= HDA_SIDE; i++) {
14464 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14465 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14467 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
14472 static void alc662_auto_init_hp_out(struct hda_codec *codec)
14474 struct alc_spec *spec = codec->spec;
14477 pin = spec->autocfg.hp_pins[0];
14478 if (pin) /* connect to front */
14480 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14481 pin = spec->autocfg.speaker_pins[0];
14483 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14486 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14487 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14489 static void alc662_auto_init_analog_input(struct hda_codec *codec)
14491 struct alc_spec *spec = codec->spec;
14494 for (i = 0; i < AUTO_PIN_LAST; i++) {
14495 hda_nid_t nid = spec->autocfg.input_pins[i];
14496 if (alc662_is_input_pin(nid)) {
14497 snd_hda_codec_write(codec, nid, 0,
14498 AC_VERB_SET_PIN_WIDGET_CONTROL,
14499 (i <= AUTO_PIN_FRONT_MIC ?
14500 PIN_VREF80 : PIN_IN));
14501 if (nid != ALC662_PIN_CD_NID)
14502 snd_hda_codec_write(codec, nid, 0,
14503 AC_VERB_SET_AMP_GAIN_MUTE,
14509 static int alc662_parse_auto_config(struct hda_codec *codec)
14511 struct alc_spec *spec = codec->spec;
14513 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
14515 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14519 if (!spec->autocfg.line_outs)
14520 return 0; /* can't find valid BIOS pin config */
14522 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14525 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
14528 err = alc662_auto_create_extra_out(spec,
14529 spec->autocfg.speaker_pins[0],
14533 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
14537 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
14541 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14543 if (spec->autocfg.dig_out_pin)
14544 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
14546 if (spec->kctl_alloc)
14547 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14549 spec->num_mux_defs = 1;
14550 spec->input_mux = &spec->private_imux;
14552 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14553 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
14554 spec->num_mixers++;
14558 /* additional initialization for auto-configuration model */
14559 static void alc662_auto_init(struct hda_codec *codec)
14561 struct alc_spec *spec = codec->spec;
14562 alc662_auto_init_multi_out(codec);
14563 alc662_auto_init_hp_out(codec);
14564 alc662_auto_init_analog_input(codec);
14565 if (spec->unsol_event)
14566 alc_sku_automute(codec);
14569 static int patch_alc662(struct hda_codec *codec)
14571 struct alc_spec *spec;
14572 int err, board_config;
14574 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14578 codec->spec = spec;
14580 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14582 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
14585 if (board_config < 0) {
14586 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
14587 "trying auto-probe from BIOS...\n");
14588 board_config = ALC662_AUTO;
14591 if (board_config == ALC662_AUTO) {
14592 /* automatic parse from the BIOS config */
14593 err = alc662_parse_auto_config(codec);
14599 "hda_codec: Cannot set up configuration "
14600 "from BIOS. Using base mode...\n");
14601 board_config = ALC662_3ST_2ch_DIG;
14605 if (board_config != ALC662_AUTO)
14606 setup_preset(spec, &alc662_presets[board_config]);
14608 if (codec->vendor_id == 0x10ec0663) {
14609 spec->stream_name_analog = "ALC663 Analog";
14610 spec->stream_name_digital = "ALC663 Digital";
14612 spec->stream_name_analog = "ALC662 Analog";
14613 spec->stream_name_digital = "ALC662 Digital";
14616 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14617 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14619 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14620 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14622 spec->adc_nids = alc662_adc_nids;
14623 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14624 spec->capsrc_nids = alc662_capsrc_nids;
14626 spec->vmaster_nid = 0x02;
14628 codec->patch_ops = alc_patch_ops;
14629 if (board_config == ALC662_AUTO)
14630 spec->init_hook = alc662_auto_init;
14631 #ifdef CONFIG_SND_HDA_POWER_SAVE
14632 if (!spec->loopback.amplist)
14633 spec->loopback.amplist = alc662_loopbacks;
14642 struct hda_codec_preset snd_hda_preset_realtek[] = {
14643 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14644 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14645 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14646 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14647 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14648 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14649 .patch = patch_alc861 },
14650 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14651 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14652 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14653 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14654 .patch = patch_alc883 },
14655 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14656 .patch = patch_alc662 },
14657 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
14658 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14659 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14660 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14661 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14662 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14663 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14664 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14665 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14666 {} /* terminator */