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(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9723 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9724 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9725 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9726 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9727 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9728 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9729 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9733 static struct alc_config_preset alc262_presets[] = {
9735 .mixers = { alc262_base_mixer },
9736 .init_verbs = { alc262_init_verbs },
9737 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9738 .dac_nids = alc262_dac_nids,
9740 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9741 .channel_mode = alc262_modes,
9742 .input_mux = &alc262_capture_source,
9745 .mixers = { alc262_base_mixer },
9746 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9747 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9748 .dac_nids = alc262_dac_nids,
9750 .dig_out_nid = ALC262_DIGOUT_NID,
9751 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9752 .channel_mode = alc262_modes,
9753 .input_mux = &alc262_capture_source,
9754 .unsol_event = alc262_hippo_unsol_event,
9755 .init_hook = alc262_hippo_automute,
9757 [ALC262_HIPPO_1] = {
9758 .mixers = { alc262_hippo1_mixer },
9759 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9760 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9761 .dac_nids = alc262_dac_nids,
9763 .dig_out_nid = ALC262_DIGOUT_NID,
9764 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9765 .channel_mode = alc262_modes,
9766 .input_mux = &alc262_capture_source,
9767 .unsol_event = alc262_hippo1_unsol_event,
9768 .init_hook = alc262_hippo1_automute,
9770 [ALC262_FUJITSU] = {
9771 .mixers = { alc262_fujitsu_mixer },
9772 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9773 alc262_fujitsu_unsol_verbs },
9774 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9775 .dac_nids = alc262_dac_nids,
9777 .dig_out_nid = ALC262_DIGOUT_NID,
9778 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9779 .channel_mode = alc262_modes,
9780 .input_mux = &alc262_fujitsu_capture_source,
9781 .unsol_event = alc262_fujitsu_unsol_event,
9782 .init_hook = alc262_fujitsu_init_hook,
9785 .mixers = { alc262_HP_BPC_mixer },
9786 .init_verbs = { alc262_HP_BPC_init_verbs },
9787 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9788 .dac_nids = alc262_dac_nids,
9790 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9791 .channel_mode = alc262_modes,
9792 .input_mux = &alc262_HP_capture_source,
9793 .unsol_event = alc262_hp_bpc_unsol_event,
9794 .init_hook = alc262_hp_bpc_automute,
9796 [ALC262_HP_BPC_D7000_WF] = {
9797 .mixers = { alc262_HP_BPC_WildWest_mixer },
9798 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9799 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9800 .dac_nids = alc262_dac_nids,
9802 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9803 .channel_mode = alc262_modes,
9804 .input_mux = &alc262_HP_D7000_capture_source,
9805 .unsol_event = alc262_hp_wildwest_unsol_event,
9806 .init_hook = alc262_hp_wildwest_automute,
9808 [ALC262_HP_BPC_D7000_WL] = {
9809 .mixers = { alc262_HP_BPC_WildWest_mixer,
9810 alc262_HP_BPC_WildWest_option_mixer },
9811 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9812 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9813 .dac_nids = alc262_dac_nids,
9815 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9816 .channel_mode = alc262_modes,
9817 .input_mux = &alc262_HP_D7000_capture_source,
9818 .unsol_event = alc262_hp_wildwest_unsol_event,
9819 .init_hook = alc262_hp_wildwest_automute,
9821 [ALC262_HP_TC_T5735] = {
9822 .mixers = { alc262_hp_t5735_mixer },
9823 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9824 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9825 .dac_nids = alc262_dac_nids,
9827 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9828 .channel_mode = alc262_modes,
9829 .input_mux = &alc262_capture_source,
9830 .unsol_event = alc262_hp_t5735_unsol_event,
9831 .init_hook = alc262_hp_t5735_init_hook,
9833 [ALC262_HP_RP5700] = {
9834 .mixers = { alc262_hp_rp5700_mixer },
9835 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9836 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9837 .dac_nids = alc262_dac_nids,
9838 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9839 .channel_mode = alc262_modes,
9840 .input_mux = &alc262_hp_rp5700_capture_source,
9842 [ALC262_BENQ_ED8] = {
9843 .mixers = { alc262_base_mixer },
9844 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9845 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9846 .dac_nids = alc262_dac_nids,
9848 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9849 .channel_mode = alc262_modes,
9850 .input_mux = &alc262_capture_source,
9852 [ALC262_SONY_ASSAMD] = {
9853 .mixers = { alc262_sony_mixer },
9854 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9855 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9856 .dac_nids = alc262_dac_nids,
9858 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9859 .channel_mode = alc262_modes,
9860 .input_mux = &alc262_capture_source,
9861 .unsol_event = alc262_hippo_unsol_event,
9862 .init_hook = alc262_hippo_automute,
9864 [ALC262_BENQ_T31] = {
9865 .mixers = { alc262_benq_t31_mixer },
9866 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9867 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9868 .dac_nids = alc262_dac_nids,
9870 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9871 .channel_mode = alc262_modes,
9872 .input_mux = &alc262_capture_source,
9873 .unsol_event = alc262_hippo_unsol_event,
9874 .init_hook = alc262_hippo_automute,
9877 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9878 .init_verbs = { alc262_ultra_verbs },
9879 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9880 .dac_nids = alc262_dac_nids,
9881 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9882 .channel_mode = alc262_modes,
9883 .input_mux = &alc262_ultra_capture_source,
9884 .adc_nids = alc262_adc_nids, /* ADC0 */
9885 .capsrc_nids = alc262_capsrc_nids,
9886 .num_adc_nids = 1, /* single ADC */
9887 .unsol_event = alc262_ultra_unsol_event,
9888 .init_hook = alc262_ultra_automute,
9890 [ALC262_LENOVO_3000] = {
9891 .mixers = { alc262_lenovo_3000_mixer },
9892 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9893 alc262_lenovo_3000_unsol_verbs },
9894 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9895 .dac_nids = alc262_dac_nids,
9897 .dig_out_nid = ALC262_DIGOUT_NID,
9898 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9899 .channel_mode = alc262_modes,
9900 .input_mux = &alc262_fujitsu_capture_source,
9901 .unsol_event = alc262_lenovo_3000_unsol_event,
9905 static int patch_alc262(struct hda_codec *codec)
9907 struct alc_spec *spec;
9911 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9917 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9922 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9923 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9924 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9925 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9929 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9931 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9935 if (board_config < 0) {
9936 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9937 "trying auto-probe from BIOS...\n");
9938 board_config = ALC262_AUTO;
9941 if (board_config == ALC262_AUTO) {
9942 /* automatic parse from the BIOS config */
9943 err = alc262_parse_auto_config(codec);
9949 "hda_codec: Cannot set up configuration "
9950 "from BIOS. Using base mode...\n");
9951 board_config = ALC262_BASIC;
9955 if (board_config != ALC262_AUTO)
9956 setup_preset(spec, &alc262_presets[board_config]);
9958 spec->stream_name_analog = "ALC262 Analog";
9959 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9960 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9962 spec->stream_name_digital = "ALC262 Digital";
9963 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9964 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9966 if (!spec->adc_nids && spec->input_mux) {
9967 /* check whether NID 0x07 is valid */
9968 unsigned int wcap = get_wcaps(codec, 0x07);
9971 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9972 if (wcap != AC_WID_AUD_IN) {
9973 spec->adc_nids = alc262_adc_nids_alt;
9974 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9975 spec->capsrc_nids = alc262_capsrc_nids_alt;
9976 spec->mixers[spec->num_mixers] =
9977 alc262_capture_alt_mixer;
9980 spec->adc_nids = alc262_adc_nids;
9981 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9982 spec->capsrc_nids = alc262_capsrc_nids;
9983 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9988 spec->vmaster_nid = 0x0c;
9990 codec->patch_ops = alc_patch_ops;
9991 if (board_config == ALC262_AUTO)
9992 spec->init_hook = alc262_auto_init;
9993 #ifdef CONFIG_SND_HDA_POWER_SAVE
9994 if (!spec->loopback.amplist)
9995 spec->loopback.amplist = alc262_loopbacks;
10002 * ALC268 channel source setting (2 channel)
10004 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10005 #define alc268_modes alc260_modes
10007 static hda_nid_t alc268_dac_nids[2] = {
10012 static hda_nid_t alc268_adc_nids[2] = {
10017 static hda_nid_t alc268_adc_nids_alt[1] = {
10022 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10024 static struct snd_kcontrol_new alc268_base_mixer[] = {
10025 /* output mixer control */
10026 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10027 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10028 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10030 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10031 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10032 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10036 /* bind Beep switches of both NID 0x0f and 0x10 */
10037 static struct hda_bind_ctls alc268_bind_beep_sw = {
10038 .ops = &snd_hda_bind_sw,
10040 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10041 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10046 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10047 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10048 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10052 static struct hda_verb alc268_eapd_verbs[] = {
10053 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10054 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10058 /* Toshiba specific */
10059 #define alc268_toshiba_automute alc262_hippo_automute
10061 static struct hda_verb alc268_toshiba_verbs[] = {
10062 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10066 /* Acer specific */
10067 /* bind volumes of both NID 0x02 and 0x03 */
10068 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10069 .ops = &snd_hda_bind_vol,
10071 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10072 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10077 /* mute/unmute internal speaker according to the hp jack and mute state */
10078 static void alc268_acer_automute(struct hda_codec *codec, int force)
10080 struct alc_spec *spec = codec->spec;
10083 if (force || !spec->sense_updated) {
10084 unsigned int present;
10085 present = snd_hda_codec_read(codec, 0x14, 0,
10086 AC_VERB_GET_PIN_SENSE, 0);
10087 spec->jack_present = (present & 0x80000000) != 0;
10088 spec->sense_updated = 1;
10090 if (spec->jack_present)
10091 mute = HDA_AMP_MUTE; /* mute internal speaker */
10092 else /* unmute internal speaker if necessary */
10093 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10094 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10095 HDA_AMP_MUTE, mute);
10099 /* bind hp and internal speaker mute (with plug check) */
10100 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10101 struct snd_ctl_elem_value *ucontrol)
10103 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10104 long *valp = ucontrol->value.integer.value;
10107 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10109 valp[0] ? 0 : HDA_AMP_MUTE);
10110 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10112 valp[1] ? 0 : HDA_AMP_MUTE);
10114 alc268_acer_automute(codec, 0);
10118 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10119 /* output mixer control */
10120 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10122 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10123 .name = "Master Playback Switch",
10124 .info = snd_hda_mixer_amp_switch_info,
10125 .get = snd_hda_mixer_amp_switch_get,
10126 .put = alc268_acer_master_sw_put,
10127 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10129 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10130 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10131 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10135 static struct hda_verb alc268_acer_verbs[] = {
10136 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10137 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10140 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10141 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10143 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10147 /* unsolicited event for HP jack sensing */
10148 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10151 if ((res >> 26) != ALC880_HP_EVENT)
10153 alc268_toshiba_automute(codec);
10156 static void alc268_acer_unsol_event(struct hda_codec *codec,
10159 if ((res >> 26) != ALC880_HP_EVENT)
10161 alc268_acer_automute(codec, 1);
10164 static void alc268_acer_init_hook(struct hda_codec *codec)
10166 alc268_acer_automute(codec, 1);
10169 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10170 /* output mixer control */
10171 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10172 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10173 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10175 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10176 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10180 static struct hda_verb alc268_dell_verbs[] = {
10181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10183 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10187 /* mute/unmute internal speaker according to the hp jack and mute state */
10188 static void alc268_dell_automute(struct hda_codec *codec)
10190 unsigned int present;
10193 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10194 if (present & 0x80000000)
10195 mute = HDA_AMP_MUTE;
10197 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10198 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10199 HDA_AMP_MUTE, mute);
10202 static void alc268_dell_unsol_event(struct hda_codec *codec,
10205 if ((res >> 26) != ALC880_HP_EVENT)
10207 alc268_dell_automute(codec);
10210 #define alc268_dell_init_hook alc268_dell_automute
10212 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10213 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10214 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10216 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10217 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10218 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10219 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10220 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10224 static struct hda_verb alc267_quanta_il1_verbs[] = {
10225 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10226 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10230 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10232 unsigned int present;
10234 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10235 & AC_PINSENSE_PRESENCE;
10236 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10237 present ? 0 : PIN_OUT);
10240 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10242 unsigned int present;
10244 present = snd_hda_codec_read(codec, 0x18, 0,
10245 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10246 snd_hda_codec_write(codec, 0x23, 0,
10247 AC_VERB_SET_CONNECT_SEL,
10248 present ? 0x00 : 0x01);
10251 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10253 alc267_quanta_il1_hp_automute(codec);
10254 alc267_quanta_il1_mic_automute(codec);
10257 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10260 switch (res >> 26) {
10261 case ALC880_HP_EVENT:
10262 alc267_quanta_il1_hp_automute(codec);
10264 case ALC880_MIC_EVENT:
10265 alc267_quanta_il1_mic_automute(codec);
10271 * generic initialization of ADC, input mixers and output mixers
10273 static struct hda_verb alc268_base_init_verbs[] = {
10274 /* Unmute DAC0-1 and set vol = 0 */
10275 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10276 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10277 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10278 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10279 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10280 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10283 * Set up output mixers (0x0c - 0x0e)
10285 /* set vol=0 to output mixers */
10286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10287 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10289 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10291 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10292 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10296 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10298 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10299 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10300 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10301 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10305 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10307 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10308 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10309 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10311 /* set PCBEEP vol = 0, mute connections */
10312 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10313 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10314 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10316 /* Unmute Selector 23h,24h and set the default input to mic-in */
10318 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10320 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10327 * generic initialization of ADC, input mixers and output mixers
10329 static struct hda_verb alc268_volume_init_verbs[] = {
10330 /* set output DAC */
10331 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10332 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10333 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10334 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10336 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10337 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10338 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10339 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10340 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10343 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10345 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10346 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10348 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10349 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10350 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10351 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10353 /* set PCBEEP vol = 0, mute connections */
10354 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10355 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10356 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10361 #define alc268_mux_enum_info alc_mux_enum_info
10362 #define alc268_mux_enum_get alc_mux_enum_get
10363 #define alc268_mux_enum_put alc_mux_enum_put
10365 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10366 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10367 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10369 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10370 /* The multiple "Capture Source" controls confuse alsamixer
10371 * So call somewhat different..
10373 /* .name = "Capture Source", */
10374 .name = "Input Source",
10376 .info = alc268_mux_enum_info,
10377 .get = alc268_mux_enum_get,
10378 .put = alc268_mux_enum_put,
10383 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10384 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10385 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10386 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10387 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10389 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10390 /* The multiple "Capture Source" controls confuse alsamixer
10391 * So call somewhat different..
10393 /* .name = "Capture Source", */
10394 .name = "Input Source",
10396 .info = alc268_mux_enum_info,
10397 .get = alc268_mux_enum_get,
10398 .put = alc268_mux_enum_put,
10403 static struct hda_input_mux alc268_capture_source = {
10407 { "Front Mic", 0x1 },
10413 static struct hda_input_mux alc268_acer_capture_source = {
10417 { "Internal Mic", 0x6 },
10422 #ifdef CONFIG_SND_DEBUG
10423 static struct snd_kcontrol_new alc268_test_mixer[] = {
10424 /* Volume widgets */
10425 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10426 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10427 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10428 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10429 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10430 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10431 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10432 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10433 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10434 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10435 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10436 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10437 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10438 /* The below appears problematic on some hardwares */
10439 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10440 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10441 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10442 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10443 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10445 /* Modes for retasking pin widgets */
10446 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10447 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10448 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10449 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10451 /* Controls for GPIO pins, assuming they are configured as outputs */
10452 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10453 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10454 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10455 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10457 /* Switches to allow the digital SPDIF output pin to be enabled.
10458 * The ALC268 does not have an SPDIF input.
10460 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10462 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10463 * this output to turn on an external amplifier.
10465 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10466 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10472 /* create input playback/capture controls for the given pin */
10473 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10474 const char *ctlname, int idx)
10479 sprintf(name, "%s Playback Volume", ctlname);
10481 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10482 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10486 } else if (nid == 0x15) {
10487 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10488 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10494 sprintf(name, "%s Playback Switch", ctlname);
10495 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10496 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10502 /* add playback controls from the parsed DAC table */
10503 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10504 const struct auto_pin_cfg *cfg)
10509 spec->multiout.num_dacs = 2; /* only use one dac */
10510 spec->multiout.dac_nids = spec->private_dac_nids;
10511 spec->multiout.dac_nids[0] = 2;
10512 spec->multiout.dac_nids[1] = 3;
10514 nid = cfg->line_out_pins[0];
10516 alc268_new_analog_output(spec, nid, "Front", 0);
10518 nid = cfg->speaker_pins[0];
10520 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10521 "Speaker Playback Volume",
10522 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10526 nid = cfg->hp_pins[0];
10528 alc268_new_analog_output(spec, nid, "Headphone", 0);
10530 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10532 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10533 "Mono Playback Switch",
10534 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10541 /* create playback/capture controls for input pins */
10542 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10543 const struct auto_pin_cfg *cfg)
10545 struct hda_input_mux *imux = &spec->private_imux;
10548 for (i = 0; i < AUTO_PIN_LAST; i++) {
10549 switch(cfg->input_pins[i]) {
10551 idx1 = 0; /* Mic 1 */
10554 idx1 = 1; /* Mic 2 */
10557 idx1 = 2; /* Line In */
10564 idx1 = 6; /* digital mics */
10569 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10570 imux->items[imux->num_items].index = idx1;
10576 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10578 struct alc_spec *spec = codec->spec;
10579 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10580 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10581 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10582 unsigned int dac_vol1, dac_vol2;
10585 snd_hda_codec_write(codec, speaker_nid, 0,
10586 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10587 snd_hda_codec_write(codec, 0x0f, 0,
10588 AC_VERB_SET_AMP_GAIN_MUTE,
10590 snd_hda_codec_write(codec, 0x10, 0,
10591 AC_VERB_SET_AMP_GAIN_MUTE,
10594 snd_hda_codec_write(codec, 0x0f, 0,
10595 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10596 snd_hda_codec_write(codec, 0x10, 0,
10597 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10600 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10601 if (line_nid == 0x14)
10602 dac_vol2 = AMP_OUT_ZERO;
10603 else if (line_nid == 0x15)
10604 dac_vol1 = AMP_OUT_ZERO;
10605 if (hp_nid == 0x14)
10606 dac_vol2 = AMP_OUT_ZERO;
10607 else if (hp_nid == 0x15)
10608 dac_vol1 = AMP_OUT_ZERO;
10609 if (line_nid != 0x16 || hp_nid != 0x16 ||
10610 spec->autocfg.line_out_pins[1] != 0x16 ||
10611 spec->autocfg.line_out_pins[2] != 0x16)
10612 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10614 snd_hda_codec_write(codec, 0x02, 0,
10615 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10616 snd_hda_codec_write(codec, 0x03, 0,
10617 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10620 /* pcm configuration: identiacal with ALC880 */
10621 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10622 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10623 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10624 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10627 * BIOS auto configuration
10629 static int alc268_parse_auto_config(struct hda_codec *codec)
10631 struct alc_spec *spec = codec->spec;
10633 static hda_nid_t alc268_ignore[] = { 0 };
10635 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10639 if (!spec->autocfg.line_outs)
10640 return 0; /* can't find valid BIOS pin config */
10642 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10645 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10649 spec->multiout.max_channels = 2;
10651 /* digital only support output */
10652 if (spec->autocfg.dig_out_pin)
10653 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10655 if (spec->kctl_alloc)
10656 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10658 if (spec->autocfg.speaker_pins[0] != 0x1d)
10659 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10661 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10662 spec->num_mux_defs = 1;
10663 spec->input_mux = &spec->private_imux;
10665 err = alc_auto_add_mic_boost(codec);
10672 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10673 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10674 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10676 /* init callback for auto-configuration model -- overriding the default init */
10677 static void alc268_auto_init(struct hda_codec *codec)
10679 struct alc_spec *spec = codec->spec;
10680 alc268_auto_init_multi_out(codec);
10681 alc268_auto_init_hp_out(codec);
10682 alc268_auto_init_mono_speaker_out(codec);
10683 alc268_auto_init_analog_input(codec);
10684 if (spec->unsol_event)
10685 alc_sku_automute(codec);
10689 * configuration and preset
10691 static const char *alc268_models[ALC268_MODEL_LAST] = {
10692 [ALC267_QUANTA_IL1] = "quanta-il1",
10693 [ALC268_3ST] = "3stack",
10694 [ALC268_TOSHIBA] = "toshiba",
10695 [ALC268_ACER] = "acer",
10696 [ALC268_DELL] = "dell",
10697 [ALC268_ZEPTO] = "zepto",
10698 #ifdef CONFIG_SND_DEBUG
10699 [ALC268_TEST] = "test",
10701 [ALC268_AUTO] = "auto",
10704 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10705 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10706 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10707 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10708 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10709 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10710 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10711 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10712 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10713 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10714 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10715 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10716 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10717 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10718 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10722 static struct alc_config_preset alc268_presets[] = {
10723 [ALC267_QUANTA_IL1] = {
10724 .mixers = { alc267_quanta_il1_mixer },
10725 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10726 alc267_quanta_il1_verbs },
10727 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10728 .dac_nids = alc268_dac_nids,
10729 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10730 .adc_nids = alc268_adc_nids_alt,
10732 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10733 .channel_mode = alc268_modes,
10734 .input_mux = &alc268_capture_source,
10735 .unsol_event = alc267_quanta_il1_unsol_event,
10736 .init_hook = alc267_quanta_il1_automute,
10739 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10740 alc268_beep_mixer },
10741 .init_verbs = { alc268_base_init_verbs },
10742 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10743 .dac_nids = alc268_dac_nids,
10744 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10745 .adc_nids = alc268_adc_nids_alt,
10746 .capsrc_nids = alc268_capsrc_nids,
10748 .dig_out_nid = ALC268_DIGOUT_NID,
10749 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10750 .channel_mode = alc268_modes,
10751 .input_mux = &alc268_capture_source,
10753 [ALC268_TOSHIBA] = {
10754 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10755 alc268_beep_mixer },
10756 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10757 alc268_toshiba_verbs },
10758 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10759 .dac_nids = alc268_dac_nids,
10760 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10761 .adc_nids = alc268_adc_nids_alt,
10762 .capsrc_nids = alc268_capsrc_nids,
10764 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10765 .channel_mode = alc268_modes,
10766 .input_mux = &alc268_capture_source,
10767 .unsol_event = alc268_toshiba_unsol_event,
10768 .init_hook = alc268_toshiba_automute,
10771 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10772 alc268_beep_mixer },
10773 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10774 alc268_acer_verbs },
10775 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10776 .dac_nids = alc268_dac_nids,
10777 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10778 .adc_nids = alc268_adc_nids_alt,
10779 .capsrc_nids = alc268_capsrc_nids,
10781 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10782 .channel_mode = alc268_modes,
10783 .input_mux = &alc268_acer_capture_source,
10784 .unsol_event = alc268_acer_unsol_event,
10785 .init_hook = alc268_acer_init_hook,
10788 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10789 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10790 alc268_dell_verbs },
10791 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10792 .dac_nids = alc268_dac_nids,
10794 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10795 .channel_mode = alc268_modes,
10796 .unsol_event = alc268_dell_unsol_event,
10797 .init_hook = alc268_dell_init_hook,
10798 .input_mux = &alc268_capture_source,
10801 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10802 alc268_beep_mixer },
10803 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10804 alc268_toshiba_verbs },
10805 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10806 .dac_nids = alc268_dac_nids,
10807 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10808 .adc_nids = alc268_adc_nids_alt,
10809 .capsrc_nids = alc268_capsrc_nids,
10811 .dig_out_nid = ALC268_DIGOUT_NID,
10812 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10813 .channel_mode = alc268_modes,
10814 .input_mux = &alc268_capture_source,
10815 .unsol_event = alc268_toshiba_unsol_event,
10816 .init_hook = alc268_toshiba_automute
10818 #ifdef CONFIG_SND_DEBUG
10820 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10821 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10822 alc268_volume_init_verbs },
10823 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10824 .dac_nids = alc268_dac_nids,
10825 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10826 .adc_nids = alc268_adc_nids_alt,
10827 .capsrc_nids = alc268_capsrc_nids,
10829 .dig_out_nid = ALC268_DIGOUT_NID,
10830 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10831 .channel_mode = alc268_modes,
10832 .input_mux = &alc268_capture_source,
10837 static int patch_alc268(struct hda_codec *codec)
10839 struct alc_spec *spec;
10843 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10847 codec->spec = spec;
10849 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10853 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10854 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10855 "trying auto-probe from BIOS...\n");
10856 board_config = ALC268_AUTO;
10859 if (board_config == ALC268_AUTO) {
10860 /* automatic parse from the BIOS config */
10861 err = alc268_parse_auto_config(codec);
10867 "hda_codec: Cannot set up configuration "
10868 "from BIOS. Using base mode...\n");
10869 board_config = ALC268_3ST;
10873 if (board_config != ALC268_AUTO)
10874 setup_preset(spec, &alc268_presets[board_config]);
10876 if (codec->vendor_id == 0x10ec0267) {
10877 spec->stream_name_analog = "ALC267 Analog";
10878 spec->stream_name_digital = "ALC267 Digital";
10880 spec->stream_name_analog = "ALC268 Analog";
10881 spec->stream_name_digital = "ALC268 Digital";
10884 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10885 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10886 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10888 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10890 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10891 /* override the amp caps for beep generator */
10892 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10893 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10894 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10895 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10896 (0 << AC_AMPCAP_MUTE_SHIFT));
10898 if (!spec->adc_nids && spec->input_mux) {
10899 /* check whether NID 0x07 is valid */
10900 unsigned int wcap = get_wcaps(codec, 0x07);
10904 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10905 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10906 spec->adc_nids = alc268_adc_nids_alt;
10907 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10908 spec->mixers[spec->num_mixers] =
10909 alc268_capture_alt_mixer;
10910 spec->num_mixers++;
10912 spec->adc_nids = alc268_adc_nids;
10913 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10914 spec->mixers[spec->num_mixers] =
10915 alc268_capture_mixer;
10916 spec->num_mixers++;
10918 spec->capsrc_nids = alc268_capsrc_nids;
10919 /* set default input source */
10920 for (i = 0; i < spec->num_adc_nids; i++)
10921 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10922 0, AC_VERB_SET_CONNECT_SEL,
10923 spec->input_mux->items[0].index);
10926 spec->vmaster_nid = 0x02;
10928 codec->patch_ops = alc_patch_ops;
10929 if (board_config == ALC268_AUTO)
10930 spec->init_hook = alc268_auto_init;
10936 * ALC269 channel source setting (2 channel)
10938 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10940 #define alc269_dac_nids alc260_dac_nids
10942 static hda_nid_t alc269_adc_nids[1] = {
10947 #define alc269_modes alc260_modes
10948 #define alc269_capture_source alc880_lg_lw_capture_source
10950 static struct snd_kcontrol_new alc269_base_mixer[] = {
10951 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10952 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10953 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10954 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10957 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10958 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10959 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10960 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10962 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10966 /* capture mixer elements */
10967 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10968 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10969 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10971 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10972 /* The multiple "Capture Source" controls confuse alsamixer
10973 * So call somewhat different..
10975 /* .name = "Capture Source", */
10976 .name = "Input Source",
10978 .info = alc_mux_enum_info,
10979 .get = alc_mux_enum_get,
10980 .put = alc_mux_enum_put,
10986 * generic initialization of ADC, input mixers and output mixers
10988 static struct hda_verb alc269_init_verbs[] = {
10990 * Unmute ADC0 and set the default input to mic-in
10992 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10994 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10995 * analog-loopback mixer widget
10996 * Note: PASD motherboards uses the Line In 2 as the input for
10997 * front panel mic (mic 2)
10999 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11007 * Set up output mixers (0x0c - 0x0e)
11009 /* set vol=0 to output mixers */
11010 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11011 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11013 /* set up input amps for analog loopback */
11014 /* Amp Indices: DAC = 0, mixer = 1 */
11015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11017 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11020 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11023 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11024 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11025 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11026 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11027 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11028 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11032 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11033 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11034 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11035 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11036 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11038 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11039 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11041 /* FIXME: use matrix-type input source selection */
11042 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11043 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11044 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11050 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11051 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11055 /* add playback controls from the parsed DAC table */
11056 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11057 const struct auto_pin_cfg *cfg)
11062 spec->multiout.num_dacs = 1; /* only use one dac */
11063 spec->multiout.dac_nids = spec->private_dac_nids;
11064 spec->multiout.dac_nids[0] = 2;
11066 nid = cfg->line_out_pins[0];
11068 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11069 "Front Playback Volume",
11070 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
11073 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11074 "Front Playback Switch",
11075 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11080 nid = cfg->speaker_pins[0];
11082 if (!cfg->line_out_pins[0]) {
11083 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11084 "Speaker Playback Volume",
11085 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11091 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11092 "Speaker Playback Switch",
11093 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11098 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11099 "Speaker Playback Switch",
11100 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11106 nid = cfg->hp_pins[0];
11108 /* spec->multiout.hp_nid = 2; */
11109 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
11110 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11111 "Headphone Playback Volume",
11112 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11118 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11119 "Headphone Playback Switch",
11120 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11125 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11126 "Headphone Playback Switch",
11127 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11136 #define alc269_auto_create_analog_input_ctls \
11137 alc880_auto_create_analog_input_ctls
11139 #ifdef CONFIG_SND_HDA_POWER_SAVE
11140 #define alc269_loopbacks alc880_loopbacks
11143 /* pcm configuration: identiacal with ALC880 */
11144 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11145 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11146 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11147 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
11150 * BIOS auto configuration
11152 static int alc269_parse_auto_config(struct hda_codec *codec)
11154 struct alc_spec *spec = codec->spec;
11156 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
11158 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11163 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
11166 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
11170 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11172 if (spec->autocfg.dig_out_pin)
11173 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
11175 if (spec->kctl_alloc)
11176 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11178 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
11179 spec->num_mux_defs = 1;
11180 spec->input_mux = &spec->private_imux;
11182 err = alc_auto_add_mic_boost(codec);
11189 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11190 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11191 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11194 /* init callback for auto-configuration model -- overriding the default init */
11195 static void alc269_auto_init(struct hda_codec *codec)
11197 struct alc_spec *spec = codec->spec;
11198 alc269_auto_init_multi_out(codec);
11199 alc269_auto_init_hp_out(codec);
11200 alc269_auto_init_analog_input(codec);
11201 if (spec->unsol_event)
11202 alc_sku_automute(codec);
11206 * configuration and preset
11208 static const char *alc269_models[ALC269_MODEL_LAST] = {
11209 [ALC269_BASIC] = "basic",
11212 static struct snd_pci_quirk alc269_cfg_tbl[] = {
11216 static struct alc_config_preset alc269_presets[] = {
11218 .mixers = { alc269_base_mixer },
11219 .init_verbs = { alc269_init_verbs },
11220 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11221 .dac_nids = alc269_dac_nids,
11223 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11224 .channel_mode = alc269_modes,
11225 .input_mux = &alc269_capture_source,
11229 static int patch_alc269(struct hda_codec *codec)
11231 struct alc_spec *spec;
11235 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11239 codec->spec = spec;
11241 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11243 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
11247 if (board_config < 0) {
11248 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
11249 "trying auto-probe from BIOS...\n");
11250 board_config = ALC269_AUTO;
11253 if (board_config == ALC269_AUTO) {
11254 /* automatic parse from the BIOS config */
11255 err = alc269_parse_auto_config(codec);
11261 "hda_codec: Cannot set up configuration "
11262 "from BIOS. Using base mode...\n");
11263 board_config = ALC269_BASIC;
11267 if (board_config != ALC269_AUTO)
11268 setup_preset(spec, &alc269_presets[board_config]);
11270 spec->stream_name_analog = "ALC269 Analog";
11271 spec->stream_analog_playback = &alc269_pcm_analog_playback;
11272 spec->stream_analog_capture = &alc269_pcm_analog_capture;
11274 spec->stream_name_digital = "ALC269 Digital";
11275 spec->stream_digital_playback = &alc269_pcm_digital_playback;
11276 spec->stream_digital_capture = &alc269_pcm_digital_capture;
11278 spec->adc_nids = alc269_adc_nids;
11279 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
11280 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
11281 spec->num_mixers++;
11283 codec->patch_ops = alc_patch_ops;
11284 if (board_config == ALC269_AUTO)
11285 spec->init_hook = alc269_auto_init;
11286 #ifdef CONFIG_SND_HDA_POWER_SAVE
11287 if (!spec->loopback.amplist)
11288 spec->loopback.amplist = alc269_loopbacks;
11295 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11299 * set the path ways for 2 channel output
11300 * need to set the codec line out and mic 1 pin widgets to inputs
11302 static struct hda_verb alc861_threestack_ch2_init[] = {
11303 /* set pin widget 1Ah (line in) for input */
11304 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11305 /* set pin widget 18h (mic1/2) for input, for mic also enable
11308 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11310 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11312 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11313 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11319 * need to set the codec line out and mic 1 pin widgets to outputs
11321 static struct hda_verb alc861_threestack_ch6_init[] = {
11322 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11323 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11324 /* set pin widget 18h (mic1) for output (CLFE)*/
11325 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11327 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11328 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11330 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11332 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11333 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11338 static struct hda_channel_mode alc861_threestack_modes[2] = {
11339 { 2, alc861_threestack_ch2_init },
11340 { 6, alc861_threestack_ch6_init },
11342 /* Set mic1 as input and unmute the mixer */
11343 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11344 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11345 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11348 /* Set mic1 as output and mute mixer */
11349 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11350 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11351 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11355 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11356 { 2, alc861_uniwill_m31_ch2_init },
11357 { 4, alc861_uniwill_m31_ch4_init },
11360 /* Set mic1 and line-in as input and unmute the mixer */
11361 static struct hda_verb alc861_asus_ch2_init[] = {
11362 /* set pin widget 1Ah (line in) for input */
11363 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11364 /* set pin widget 18h (mic1/2) for input, for mic also enable
11367 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11369 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11371 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11372 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11376 /* Set mic1 nad line-in as output and mute mixer */
11377 static struct hda_verb alc861_asus_ch6_init[] = {
11378 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11379 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11380 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11381 /* set pin widget 18h (mic1) for output (CLFE)*/
11382 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11383 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11384 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11385 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11387 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11389 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11390 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11395 static struct hda_channel_mode alc861_asus_modes[2] = {
11396 { 2, alc861_asus_ch2_init },
11397 { 6, alc861_asus_ch6_init },
11402 static struct snd_kcontrol_new alc861_base_mixer[] = {
11403 /* output mixer control */
11404 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11405 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11406 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11407 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11408 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11410 /*Input mixer control */
11411 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11412 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11413 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11414 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11415 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11416 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11418 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11419 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11420 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11422 /* Capture mixer control */
11423 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11424 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11427 .name = "Capture Source",
11429 .info = alc_mux_enum_info,
11430 .get = alc_mux_enum_get,
11431 .put = alc_mux_enum_put,
11436 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11437 /* output mixer control */
11438 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11439 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11440 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11441 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11442 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11444 /* Input mixer control */
11445 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11446 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11447 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11448 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11449 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11450 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11451 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11452 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11453 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11454 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11456 /* Capture mixer control */
11457 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11458 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11460 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11461 .name = "Capture Source",
11463 .info = alc_mux_enum_info,
11464 .get = alc_mux_enum_get,
11465 .put = alc_mux_enum_put,
11468 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11469 .name = "Channel Mode",
11470 .info = alc_ch_mode_info,
11471 .get = alc_ch_mode_get,
11472 .put = alc_ch_mode_put,
11473 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11478 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11479 /* output mixer control */
11480 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11481 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11482 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11484 /*Capture mixer control */
11485 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11486 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11489 .name = "Capture Source",
11491 .info = alc_mux_enum_info,
11492 .get = alc_mux_enum_get,
11493 .put = alc_mux_enum_put,
11499 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11500 /* output mixer control */
11501 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11502 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11503 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11504 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11505 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11507 /* Input mixer control */
11508 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11509 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11510 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11511 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11512 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11513 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11515 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11516 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11517 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11519 /* Capture mixer control */
11520 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11521 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11523 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11524 .name = "Capture Source",
11526 .info = alc_mux_enum_info,
11527 .get = alc_mux_enum_get,
11528 .put = alc_mux_enum_put,
11531 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11532 .name = "Channel Mode",
11533 .info = alc_ch_mode_info,
11534 .get = alc_ch_mode_get,
11535 .put = alc_ch_mode_put,
11536 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11541 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11542 /* output mixer control */
11543 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11544 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11545 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11546 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11547 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11549 /* Input mixer control */
11550 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11551 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11552 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11553 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11554 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11555 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11556 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11557 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11558 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11561 /* Capture mixer control */
11562 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11563 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11565 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11566 .name = "Capture Source",
11568 .info = alc_mux_enum_info,
11569 .get = alc_mux_enum_get,
11570 .put = alc_mux_enum_put,
11573 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11574 .name = "Channel Mode",
11575 .info = alc_ch_mode_info,
11576 .get = alc_ch_mode_get,
11577 .put = alc_ch_mode_put,
11578 .private_value = ARRAY_SIZE(alc861_asus_modes),
11583 /* additional mixer */
11584 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11585 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11586 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11587 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11588 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11593 * generic initialization of ADC, input mixers and output mixers
11595 static struct hda_verb alc861_base_init_verbs[] = {
11597 * Unmute ADC0 and set the default input to mic-in
11599 /* port-A for surround (rear panel) */
11600 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11601 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11602 /* port-B for mic-in (rear panel) with vref */
11603 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11604 /* port-C for line-in (rear panel) */
11605 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11606 /* port-D for Front */
11607 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11608 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11609 /* port-E for HP out (front panel) */
11610 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11611 /* route front PCM to HP */
11612 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11613 /* port-F for mic-in (front panel) with vref */
11614 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11615 /* port-G for CLFE (rear panel) */
11616 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11617 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11618 /* port-H for side (rear panel) */
11619 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11620 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11622 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11623 /* route front mic to ADC1*/
11624 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11625 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11627 /* Unmute DAC0~3 & spdif out*/
11628 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11629 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11630 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11631 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11634 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11635 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11636 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11637 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11638 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11640 /* Unmute Stereo Mixer 15 */
11641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11642 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11646 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11647 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11648 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11649 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11650 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11651 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11652 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11654 /* hp used DAC 3 (Front) */
11655 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11656 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11661 static struct hda_verb alc861_threestack_init_verbs[] = {
11663 * Unmute ADC0 and set the default input to mic-in
11665 /* port-A for surround (rear panel) */
11666 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11667 /* port-B for mic-in (rear panel) with vref */
11668 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11669 /* port-C for line-in (rear panel) */
11670 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11671 /* port-D for Front */
11672 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11673 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11674 /* port-E for HP out (front panel) */
11675 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11676 /* route front PCM to HP */
11677 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11678 /* port-F for mic-in (front panel) with vref */
11679 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11680 /* port-G for CLFE (rear panel) */
11681 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11682 /* port-H for side (rear panel) */
11683 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11685 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11686 /* route front mic to ADC1*/
11687 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11688 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11689 /* Unmute DAC0~3 & spdif out*/
11690 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11691 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11692 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11693 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11696 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11697 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11698 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11699 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11700 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11702 /* Unmute Stereo Mixer 15 */
11703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11704 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11708 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11709 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11710 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11711 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11712 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11713 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11714 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11715 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11716 /* hp used DAC 3 (Front) */
11717 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11718 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11722 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11724 * Unmute ADC0 and set the default input to mic-in
11726 /* port-A for surround (rear panel) */
11727 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11728 /* port-B for mic-in (rear panel) with vref */
11729 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11730 /* port-C for line-in (rear panel) */
11731 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11732 /* port-D for Front */
11733 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11734 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11735 /* port-E for HP out (front panel) */
11736 /* this has to be set to VREF80 */
11737 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11738 /* route front PCM to HP */
11739 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11740 /* port-F for mic-in (front panel) with vref */
11741 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11742 /* port-G for CLFE (rear panel) */
11743 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11744 /* port-H for side (rear panel) */
11745 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11747 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11748 /* route front mic to ADC1*/
11749 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11750 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11751 /* Unmute DAC0~3 & spdif out*/
11752 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11753 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11754 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11755 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11758 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11759 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11760 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11761 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11762 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11764 /* Unmute Stereo Mixer 15 */
11765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11766 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11767 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11770 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11772 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11773 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11774 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11778 /* hp used DAC 3 (Front) */
11779 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11780 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11784 static struct hda_verb alc861_asus_init_verbs[] = {
11786 * Unmute ADC0 and set the default input to mic-in
11788 /* port-A for surround (rear panel)
11789 * according to codec#0 this is the HP jack
11791 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11792 /* route front PCM to HP */
11793 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11794 /* port-B for mic-in (rear panel) with vref */
11795 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11796 /* port-C for line-in (rear panel) */
11797 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11798 /* port-D for Front */
11799 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11800 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11801 /* port-E for HP out (front panel) */
11802 /* this has to be set to VREF80 */
11803 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11804 /* route front PCM to HP */
11805 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11806 /* port-F for mic-in (front panel) with vref */
11807 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11808 /* port-G for CLFE (rear panel) */
11809 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11810 /* port-H for side (rear panel) */
11811 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11813 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11814 /* route front mic to ADC1*/
11815 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11816 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11817 /* Unmute DAC0~3 & spdif out*/
11818 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11819 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11820 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11821 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11823 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11824 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11825 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11826 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11827 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11829 /* Unmute Stereo Mixer 15 */
11830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11831 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11835 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11836 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11837 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11838 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11839 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11840 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11841 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11842 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11843 /* hp used DAC 3 (Front) */
11844 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11845 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11849 /* additional init verbs for ASUS laptops */
11850 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11851 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11852 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11857 * generic initialization of ADC, input mixers and output mixers
11859 static struct hda_verb alc861_auto_init_verbs[] = {
11861 * Unmute ADC0 and set the default input to mic-in
11863 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11864 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11866 /* Unmute DAC0~3 & spdif out*/
11867 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11868 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11869 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11870 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11871 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11873 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11874 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11875 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11876 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11877 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11879 /* Unmute Stereo Mixer 15 */
11880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11882 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11883 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11885 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11886 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11887 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11888 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11890 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11891 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11892 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11894 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11895 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11896 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11897 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11898 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11899 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11900 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11901 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11903 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11908 static struct hda_verb alc861_toshiba_init_verbs[] = {
11909 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11914 /* toggle speaker-output according to the hp-jack state */
11915 static void alc861_toshiba_automute(struct hda_codec *codec)
11917 unsigned int present;
11919 present = snd_hda_codec_read(codec, 0x0f, 0,
11920 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11921 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11922 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11923 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11924 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11927 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11930 if ((res >> 26) == ALC880_HP_EVENT)
11931 alc861_toshiba_automute(codec);
11934 /* pcm configuration: identiacal with ALC880 */
11935 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11936 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11937 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11938 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11941 #define ALC861_DIGOUT_NID 0x07
11943 static struct hda_channel_mode alc861_8ch_modes[1] = {
11947 static hda_nid_t alc861_dac_nids[4] = {
11948 /* front, surround, clfe, side */
11949 0x03, 0x06, 0x05, 0x04
11952 static hda_nid_t alc660_dac_nids[3] = {
11953 /* front, clfe, surround */
11957 static hda_nid_t alc861_adc_nids[1] = {
11962 static struct hda_input_mux alc861_capture_source = {
11966 { "Front Mic", 0x3 },
11973 /* fill in the dac_nids table from the parsed pin configuration */
11974 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11975 const struct auto_pin_cfg *cfg)
11980 spec->multiout.dac_nids = spec->private_dac_nids;
11981 for (i = 0; i < cfg->line_outs; i++) {
11982 nid = cfg->line_out_pins[i];
11984 if (i >= ARRAY_SIZE(alc861_dac_nids))
11986 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11989 spec->multiout.num_dacs = cfg->line_outs;
11993 /* add playback controls from the parsed DAC table */
11994 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11995 const struct auto_pin_cfg *cfg)
11998 static const char *chname[4] = {
11999 "Front", "Surround", NULL /*CLFE*/, "Side"
12004 for (i = 0; i < cfg->line_outs; i++) {
12005 nid = spec->multiout.dac_nids[i];
12010 err = add_control(spec, ALC_CTL_BIND_MUTE,
12011 "Center Playback Switch",
12012 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12016 err = add_control(spec, ALC_CTL_BIND_MUTE,
12017 "LFE Playback Switch",
12018 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12023 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
12025 if (nid == alc861_dac_nids[idx])
12027 sprintf(name, "%s Playback Switch", chname[idx]);
12028 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12029 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12038 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
12046 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
12048 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12049 "Headphone Playback Switch",
12050 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12053 spec->multiout.hp_nid = nid;
12058 /* create playback/capture controls for input pins */
12059 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
12060 const struct auto_pin_cfg *cfg)
12062 struct hda_input_mux *imux = &spec->private_imux;
12063 int i, err, idx, idx1;
12065 for (i = 0; i < AUTO_PIN_LAST; i++) {
12066 switch (cfg->input_pins[i]) {
12069 idx = 2; /* Line In */
12073 idx = 2; /* Line In */
12077 idx = 1; /* Mic In */
12081 idx = 1; /* Mic In */
12091 err = new_analog_input(spec, cfg->input_pins[i],
12092 auto_pin_cfg_labels[i], idx, 0x15);
12096 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12097 imux->items[imux->num_items].index = idx1;
12103 static struct snd_kcontrol_new alc861_capture_mixer[] = {
12104 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12105 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12108 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12109 /* The multiple "Capture Source" controls confuse alsamixer
12110 * So call somewhat different..
12112 /* .name = "Capture Source", */
12113 .name = "Input Source",
12115 .info = alc_mux_enum_info,
12116 .get = alc_mux_enum_get,
12117 .put = alc_mux_enum_put,
12122 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
12124 int pin_type, int dac_idx)
12126 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12128 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12132 static void alc861_auto_init_multi_out(struct hda_codec *codec)
12134 struct alc_spec *spec = codec->spec;
12137 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
12138 for (i = 0; i < spec->autocfg.line_outs; i++) {
12139 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12140 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12142 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
12143 spec->multiout.dac_nids[i]);
12147 static void alc861_auto_init_hp_out(struct hda_codec *codec)
12149 struct alc_spec *spec = codec->spec;
12152 pin = spec->autocfg.hp_pins[0];
12153 if (pin) /* connect to front */
12154 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
12155 spec->multiout.dac_nids[0]);
12156 pin = spec->autocfg.speaker_pins[0];
12158 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12161 static void alc861_auto_init_analog_input(struct hda_codec *codec)
12163 struct alc_spec *spec = codec->spec;
12166 for (i = 0; i < AUTO_PIN_LAST; i++) {
12167 hda_nid_t nid = spec->autocfg.input_pins[i];
12168 if (nid >= 0x0c && nid <= 0x11) {
12169 snd_hda_codec_write(codec, nid, 0,
12170 AC_VERB_SET_PIN_WIDGET_CONTROL,
12171 i <= AUTO_PIN_FRONT_MIC ?
12172 PIN_VREF80 : PIN_IN);
12177 /* parse the BIOS configuration and set up the alc_spec */
12178 /* return 1 if successful, 0 if the proper config is not found,
12179 * or a negative error code
12181 static int alc861_parse_auto_config(struct hda_codec *codec)
12183 struct alc_spec *spec = codec->spec;
12185 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12187 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12191 if (!spec->autocfg.line_outs)
12192 return 0; /* can't find valid BIOS pin config */
12194 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
12197 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
12200 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
12203 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
12207 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12209 if (spec->autocfg.dig_out_pin)
12210 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
12212 if (spec->kctl_alloc)
12213 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12215 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
12217 spec->num_mux_defs = 1;
12218 spec->input_mux = &spec->private_imux;
12220 spec->adc_nids = alc861_adc_nids;
12221 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
12222 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
12223 spec->num_mixers++;
12228 /* additional initialization for auto-configuration model */
12229 static void alc861_auto_init(struct hda_codec *codec)
12231 struct alc_spec *spec = codec->spec;
12232 alc861_auto_init_multi_out(codec);
12233 alc861_auto_init_hp_out(codec);
12234 alc861_auto_init_analog_input(codec);
12235 if (spec->unsol_event)
12236 alc_sku_automute(codec);
12239 #ifdef CONFIG_SND_HDA_POWER_SAVE
12240 static struct hda_amp_list alc861_loopbacks[] = {
12241 { 0x15, HDA_INPUT, 0 },
12242 { 0x15, HDA_INPUT, 1 },
12243 { 0x15, HDA_INPUT, 2 },
12244 { 0x15, HDA_INPUT, 3 },
12251 * configuration and preset
12253 static const char *alc861_models[ALC861_MODEL_LAST] = {
12254 [ALC861_3ST] = "3stack",
12255 [ALC660_3ST] = "3stack-660",
12256 [ALC861_3ST_DIG] = "3stack-dig",
12257 [ALC861_6ST_DIG] = "6stack-dig",
12258 [ALC861_UNIWILL_M31] = "uniwill-m31",
12259 [ALC861_TOSHIBA] = "toshiba",
12260 [ALC861_ASUS] = "asus",
12261 [ALC861_ASUS_LAPTOP] = "asus-laptop",
12262 [ALC861_AUTO] = "auto",
12265 static struct snd_pci_quirk alc861_cfg_tbl[] = {
12266 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
12267 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12268 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12269 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
12270 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
12271 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
12272 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
12273 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12274 * Any other models that need this preset?
12276 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12277 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
12278 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
12279 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
12280 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
12281 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
12282 /* FIXME: the below seems conflict */
12283 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12284 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
12285 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
12289 static struct alc_config_preset alc861_presets[] = {
12291 .mixers = { alc861_3ST_mixer },
12292 .init_verbs = { alc861_threestack_init_verbs },
12293 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12294 .dac_nids = alc861_dac_nids,
12295 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12296 .channel_mode = alc861_threestack_modes,
12298 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12299 .adc_nids = alc861_adc_nids,
12300 .input_mux = &alc861_capture_source,
12302 [ALC861_3ST_DIG] = {
12303 .mixers = { alc861_base_mixer },
12304 .init_verbs = { alc861_threestack_init_verbs },
12305 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12306 .dac_nids = alc861_dac_nids,
12307 .dig_out_nid = ALC861_DIGOUT_NID,
12308 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12309 .channel_mode = alc861_threestack_modes,
12311 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12312 .adc_nids = alc861_adc_nids,
12313 .input_mux = &alc861_capture_source,
12315 [ALC861_6ST_DIG] = {
12316 .mixers = { alc861_base_mixer },
12317 .init_verbs = { alc861_base_init_verbs },
12318 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12319 .dac_nids = alc861_dac_nids,
12320 .dig_out_nid = ALC861_DIGOUT_NID,
12321 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12322 .channel_mode = alc861_8ch_modes,
12323 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12324 .adc_nids = alc861_adc_nids,
12325 .input_mux = &alc861_capture_source,
12328 .mixers = { alc861_3ST_mixer },
12329 .init_verbs = { alc861_threestack_init_verbs },
12330 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12331 .dac_nids = alc660_dac_nids,
12332 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12333 .channel_mode = alc861_threestack_modes,
12335 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12336 .adc_nids = alc861_adc_nids,
12337 .input_mux = &alc861_capture_source,
12339 [ALC861_UNIWILL_M31] = {
12340 .mixers = { alc861_uniwill_m31_mixer },
12341 .init_verbs = { alc861_uniwill_m31_init_verbs },
12342 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12343 .dac_nids = alc861_dac_nids,
12344 .dig_out_nid = ALC861_DIGOUT_NID,
12345 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12346 .channel_mode = alc861_uniwill_m31_modes,
12348 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12349 .adc_nids = alc861_adc_nids,
12350 .input_mux = &alc861_capture_source,
12352 [ALC861_TOSHIBA] = {
12353 .mixers = { alc861_toshiba_mixer },
12354 .init_verbs = { alc861_base_init_verbs,
12355 alc861_toshiba_init_verbs },
12356 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12357 .dac_nids = alc861_dac_nids,
12358 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12359 .channel_mode = alc883_3ST_2ch_modes,
12360 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12361 .adc_nids = alc861_adc_nids,
12362 .input_mux = &alc861_capture_source,
12363 .unsol_event = alc861_toshiba_unsol_event,
12364 .init_hook = alc861_toshiba_automute,
12367 .mixers = { alc861_asus_mixer },
12368 .init_verbs = { alc861_asus_init_verbs },
12369 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12370 .dac_nids = alc861_dac_nids,
12371 .dig_out_nid = ALC861_DIGOUT_NID,
12372 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12373 .channel_mode = alc861_asus_modes,
12376 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12377 .adc_nids = alc861_adc_nids,
12378 .input_mux = &alc861_capture_source,
12380 [ALC861_ASUS_LAPTOP] = {
12381 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12382 .init_verbs = { alc861_asus_init_verbs,
12383 alc861_asus_laptop_init_verbs },
12384 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12385 .dac_nids = alc861_dac_nids,
12386 .dig_out_nid = ALC861_DIGOUT_NID,
12387 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12388 .channel_mode = alc883_3ST_2ch_modes,
12390 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12391 .adc_nids = alc861_adc_nids,
12392 .input_mux = &alc861_capture_source,
12397 static int patch_alc861(struct hda_codec *codec)
12399 struct alc_spec *spec;
12403 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12407 codec->spec = spec;
12409 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12413 if (board_config < 0) {
12414 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12415 "trying auto-probe from BIOS...\n");
12416 board_config = ALC861_AUTO;
12419 if (board_config == ALC861_AUTO) {
12420 /* automatic parse from the BIOS config */
12421 err = alc861_parse_auto_config(codec);
12427 "hda_codec: Cannot set up configuration "
12428 "from BIOS. Using base mode...\n");
12429 board_config = ALC861_3ST_DIG;
12433 if (board_config != ALC861_AUTO)
12434 setup_preset(spec, &alc861_presets[board_config]);
12436 spec->stream_name_analog = "ALC861 Analog";
12437 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12438 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12440 spec->stream_name_digital = "ALC861 Digital";
12441 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12442 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12444 spec->vmaster_nid = 0x03;
12446 codec->patch_ops = alc_patch_ops;
12447 if (board_config == ALC861_AUTO)
12448 spec->init_hook = alc861_auto_init;
12449 #ifdef CONFIG_SND_HDA_POWER_SAVE
12450 if (!spec->loopback.amplist)
12451 spec->loopback.amplist = alc861_loopbacks;
12458 * ALC861-VD support
12462 * In addition, an independent DAC
12464 #define ALC861VD_DIGOUT_NID 0x06
12466 static hda_nid_t alc861vd_dac_nids[4] = {
12467 /* front, surr, clfe, side surr */
12468 0x02, 0x03, 0x04, 0x05
12471 /* dac_nids for ALC660vd are in a different order - according to
12472 * Realtek's driver.
12473 * This should probably tesult in a different mixer for 6stack models
12474 * of ALC660vd codecs, but for now there is only 3stack mixer
12475 * - and it is the same as in 861vd.
12476 * adc_nids in ALC660vd are (is) the same as in 861vd
12478 static hda_nid_t alc660vd_dac_nids[3] = {
12479 /* front, rear, clfe, rear_surr */
12483 static hda_nid_t alc861vd_adc_nids[1] = {
12488 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12491 /* FIXME: should be a matrix-type input source selection */
12492 static struct hda_input_mux alc861vd_capture_source = {
12496 { "Front Mic", 0x1 },
12502 static struct hda_input_mux alc861vd_dallas_capture_source = {
12505 { "Ext Mic", 0x0 },
12506 { "Int Mic", 0x1 },
12510 static struct hda_input_mux alc861vd_hp_capture_source = {
12513 { "Front Mic", 0x0 },
12514 { "ATAPI Mic", 0x1 },
12518 #define alc861vd_mux_enum_info alc_mux_enum_info
12519 #define alc861vd_mux_enum_get alc_mux_enum_get
12520 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12521 #define alc861vd_mux_enum_put alc882_mux_enum_put
12526 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12533 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12534 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12535 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12536 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12537 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12544 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12545 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12546 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12547 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12548 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12552 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12553 { 6, alc861vd_6stack_ch6_init },
12554 { 8, alc861vd_6stack_ch8_init },
12557 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12559 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12560 .name = "Channel Mode",
12561 .info = alc_ch_mode_info,
12562 .get = alc_ch_mode_get,
12563 .put = alc_ch_mode_put,
12568 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12569 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12570 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12573 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12574 /* The multiple "Capture Source" controls confuse alsamixer
12575 * So call somewhat different..
12577 /* .name = "Capture Source", */
12578 .name = "Input Source",
12580 .info = alc861vd_mux_enum_info,
12581 .get = alc861vd_mux_enum_get,
12582 .put = alc861vd_mux_enum_put,
12587 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12588 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12590 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12591 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12592 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12594 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12595 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12597 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12599 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12601 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12602 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12604 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12605 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12609 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12611 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12613 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12614 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12615 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12617 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12618 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12620 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12621 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12623 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12624 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12629 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12630 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12631 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12633 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12635 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12637 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12639 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12640 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12641 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12643 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12644 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12646 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12647 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12649 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12650 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12655 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12656 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12657 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12658 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12660 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12662 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12663 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12664 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12666 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12667 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12668 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12670 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12671 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12676 /* Pin assignment: Speaker=0x14, HP = 0x15,
12677 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12679 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12680 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12681 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12682 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12683 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12684 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12685 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12686 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12687 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12688 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12689 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12690 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12691 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12695 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12696 * Front Mic=0x18, ATAPI Mic = 0x19,
12698 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12699 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12700 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12701 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12702 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12703 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12704 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12705 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12706 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12712 * generic initialization of ADC, input mixers and output mixers
12714 static struct hda_verb alc861vd_volume_init_verbs[] = {
12716 * Unmute ADC0 and set the default input to mic-in
12718 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12719 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12721 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12722 * the analog-loopback mixer widget
12724 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12731 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12733 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12734 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12738 * Set up output mixers (0x02 - 0x05)
12740 /* set vol=0 to output mixers */
12741 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12742 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12743 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12744 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12746 /* set up input amps for analog loopback */
12747 /* Amp Indices: DAC = 0, mixer = 1 */
12748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12749 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12750 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12751 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12752 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12754 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12755 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12761 * 3-stack pin configuration:
12762 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12764 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12766 * Set pin mode and muting
12768 /* set front pin widgets 0x14 for output */
12769 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12770 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12771 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12773 /* Mic (rear) pin: input vref at 80% */
12774 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12776 /* Front Mic pin: input vref at 80% */
12777 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12778 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12779 /* Line In pin: input */
12780 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12782 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12783 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12784 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12785 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12786 /* CD pin widget for input */
12787 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12793 * 6-stack pin configuration:
12795 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12797 * Set pin mode and muting
12799 /* set front pin widgets 0x14 for output */
12800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12801 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12802 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12804 /* Rear Pin: output 1 (0x0d) */
12805 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12806 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12807 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12808 /* CLFE Pin: output 2 (0x0e) */
12809 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12810 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12811 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12812 /* Side Pin: output 3 (0x0f) */
12813 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12814 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12815 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12817 /* Mic (rear) pin: input vref at 80% */
12818 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12819 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12820 /* Front Mic pin: input vref at 80% */
12821 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12823 /* Line In pin: input */
12824 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12825 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12826 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12827 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12828 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12829 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12830 /* CD pin widget for input */
12831 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12836 static struct hda_verb alc861vd_eapd_verbs[] = {
12837 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12841 static struct hda_verb alc660vd_eapd_verbs[] = {
12842 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12843 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12847 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12850 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12851 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12852 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12856 /* toggle speaker-output according to the hp-jack state */
12857 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12859 unsigned int present;
12860 unsigned char bits;
12862 present = snd_hda_codec_read(codec, 0x1b, 0,
12863 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12864 bits = present ? HDA_AMP_MUTE : 0;
12865 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12866 HDA_AMP_MUTE, bits);
12869 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12871 unsigned int present;
12872 unsigned char bits;
12874 present = snd_hda_codec_read(codec, 0x18, 0,
12875 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12876 bits = present ? HDA_AMP_MUTE : 0;
12877 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12878 HDA_AMP_MUTE, bits);
12881 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12883 alc861vd_lenovo_hp_automute(codec);
12884 alc861vd_lenovo_mic_automute(codec);
12887 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12890 switch (res >> 26) {
12891 case ALC880_HP_EVENT:
12892 alc861vd_lenovo_hp_automute(codec);
12894 case ALC880_MIC_EVENT:
12895 alc861vd_lenovo_mic_automute(codec);
12900 static struct hda_verb alc861vd_dallas_verbs[] = {
12901 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12902 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12903 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12904 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12906 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12910 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12912 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12913 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12916 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12917 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12919 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12920 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12921 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12922 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12924 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12925 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12926 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12928 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12929 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12930 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12931 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12935 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12936 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12938 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12939 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12940 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12945 /* toggle speaker-output according to the hp-jack state */
12946 static void alc861vd_dallas_automute(struct hda_codec *codec)
12948 unsigned int present;
12950 present = snd_hda_codec_read(codec, 0x15, 0,
12951 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12952 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12953 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12956 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12958 if ((res >> 26) == ALC880_HP_EVENT)
12959 alc861vd_dallas_automute(codec);
12962 #ifdef CONFIG_SND_HDA_POWER_SAVE
12963 #define alc861vd_loopbacks alc880_loopbacks
12966 /* pcm configuration: identiacal with ALC880 */
12967 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12968 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12969 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12970 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12973 * configuration and preset
12975 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12976 [ALC660VD_3ST] = "3stack-660",
12977 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12978 [ALC861VD_3ST] = "3stack",
12979 [ALC861VD_3ST_DIG] = "3stack-digout",
12980 [ALC861VD_6ST_DIG] = "6stack-digout",
12981 [ALC861VD_LENOVO] = "lenovo",
12982 [ALC861VD_DALLAS] = "dallas",
12983 [ALC861VD_HP] = "hp",
12984 [ALC861VD_AUTO] = "auto",
12987 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12988 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12989 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12990 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12991 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12992 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12993 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12994 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12995 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12996 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12997 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12998 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
12999 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
13000 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
13001 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
13002 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
13006 static struct alc_config_preset alc861vd_presets[] = {
13008 .mixers = { alc861vd_3st_mixer },
13009 .init_verbs = { alc861vd_volume_init_verbs,
13010 alc861vd_3stack_init_verbs },
13011 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13012 .dac_nids = alc660vd_dac_nids,
13013 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13014 .channel_mode = alc861vd_3stack_2ch_modes,
13015 .input_mux = &alc861vd_capture_source,
13017 [ALC660VD_3ST_DIG] = {
13018 .mixers = { alc861vd_3st_mixer },
13019 .init_verbs = { alc861vd_volume_init_verbs,
13020 alc861vd_3stack_init_verbs },
13021 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13022 .dac_nids = alc660vd_dac_nids,
13023 .dig_out_nid = ALC861VD_DIGOUT_NID,
13024 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13025 .channel_mode = alc861vd_3stack_2ch_modes,
13026 .input_mux = &alc861vd_capture_source,
13029 .mixers = { alc861vd_3st_mixer },
13030 .init_verbs = { alc861vd_volume_init_verbs,
13031 alc861vd_3stack_init_verbs },
13032 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13033 .dac_nids = alc861vd_dac_nids,
13034 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13035 .channel_mode = alc861vd_3stack_2ch_modes,
13036 .input_mux = &alc861vd_capture_source,
13038 [ALC861VD_3ST_DIG] = {
13039 .mixers = { alc861vd_3st_mixer },
13040 .init_verbs = { alc861vd_volume_init_verbs,
13041 alc861vd_3stack_init_verbs },
13042 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13043 .dac_nids = alc861vd_dac_nids,
13044 .dig_out_nid = ALC861VD_DIGOUT_NID,
13045 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13046 .channel_mode = alc861vd_3stack_2ch_modes,
13047 .input_mux = &alc861vd_capture_source,
13049 [ALC861VD_6ST_DIG] = {
13050 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
13051 .init_verbs = { alc861vd_volume_init_verbs,
13052 alc861vd_6stack_init_verbs },
13053 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13054 .dac_nids = alc861vd_dac_nids,
13055 .dig_out_nid = ALC861VD_DIGOUT_NID,
13056 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
13057 .channel_mode = alc861vd_6stack_modes,
13058 .input_mux = &alc861vd_capture_source,
13060 [ALC861VD_LENOVO] = {
13061 .mixers = { alc861vd_lenovo_mixer },
13062 .init_verbs = { alc861vd_volume_init_verbs,
13063 alc861vd_3stack_init_verbs,
13064 alc861vd_eapd_verbs,
13065 alc861vd_lenovo_unsol_verbs },
13066 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13067 .dac_nids = alc660vd_dac_nids,
13068 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13069 .channel_mode = alc861vd_3stack_2ch_modes,
13070 .input_mux = &alc861vd_capture_source,
13071 .unsol_event = alc861vd_lenovo_unsol_event,
13072 .init_hook = alc861vd_lenovo_automute,
13074 [ALC861VD_DALLAS] = {
13075 .mixers = { alc861vd_dallas_mixer },
13076 .init_verbs = { alc861vd_dallas_verbs },
13077 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13078 .dac_nids = alc861vd_dac_nids,
13079 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13080 .channel_mode = alc861vd_3stack_2ch_modes,
13081 .input_mux = &alc861vd_dallas_capture_source,
13082 .unsol_event = alc861vd_dallas_unsol_event,
13083 .init_hook = alc861vd_dallas_automute,
13086 .mixers = { alc861vd_hp_mixer },
13087 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
13088 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13089 .dac_nids = alc861vd_dac_nids,
13090 .dig_out_nid = ALC861VD_DIGOUT_NID,
13091 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13092 .channel_mode = alc861vd_3stack_2ch_modes,
13093 .input_mux = &alc861vd_hp_capture_source,
13094 .unsol_event = alc861vd_dallas_unsol_event,
13095 .init_hook = alc861vd_dallas_automute,
13100 * BIOS auto configuration
13102 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
13103 hda_nid_t nid, int pin_type, int dac_idx)
13105 alc_set_pin_output(codec, nid, pin_type);
13108 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
13110 struct alc_spec *spec = codec->spec;
13113 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13114 for (i = 0; i <= HDA_SIDE; i++) {
13115 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13116 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13118 alc861vd_auto_set_output_and_unmute(codec, nid,
13124 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
13126 struct alc_spec *spec = codec->spec;
13129 pin = spec->autocfg.hp_pins[0];
13130 if (pin) /* connect to front and use dac 0 */
13131 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13132 pin = spec->autocfg.speaker_pins[0];
13134 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13137 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13138 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13140 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
13142 struct alc_spec *spec = codec->spec;
13145 for (i = 0; i < AUTO_PIN_LAST; i++) {
13146 hda_nid_t nid = spec->autocfg.input_pins[i];
13147 if (alc861vd_is_input_pin(nid)) {
13148 snd_hda_codec_write(codec, nid, 0,
13149 AC_VERB_SET_PIN_WIDGET_CONTROL,
13150 i <= AUTO_PIN_FRONT_MIC ?
13151 PIN_VREF80 : PIN_IN);
13152 if (nid != ALC861VD_PIN_CD_NID)
13153 snd_hda_codec_write(codec, nid, 0,
13154 AC_VERB_SET_AMP_GAIN_MUTE,
13160 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13161 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13163 /* add playback controls from the parsed DAC table */
13164 /* Based on ALC880 version. But ALC861VD has separate,
13165 * different NIDs for mute/unmute switch and volume control */
13166 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
13167 const struct auto_pin_cfg *cfg)
13170 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
13171 hda_nid_t nid_v, nid_s;
13174 for (i = 0; i < cfg->line_outs; i++) {
13175 if (!spec->multiout.dac_nids[i])
13177 nid_v = alc861vd_idx_to_mixer_vol(
13179 spec->multiout.dac_nids[i]));
13180 nid_s = alc861vd_idx_to_mixer_switch(
13182 spec->multiout.dac_nids[i]));
13186 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13187 "Center Playback Volume",
13188 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
13192 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13193 "LFE Playback Volume",
13194 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
13198 err = add_control(spec, ALC_CTL_BIND_MUTE,
13199 "Center Playback Switch",
13200 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
13204 err = add_control(spec, ALC_CTL_BIND_MUTE,
13205 "LFE Playback Switch",
13206 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
13211 sprintf(name, "%s Playback Volume", chname[i]);
13212 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13213 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
13217 sprintf(name, "%s Playback Switch", chname[i]);
13218 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13219 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
13228 /* add playback controls for speaker and HP outputs */
13229 /* Based on ALC880 version. But ALC861VD has separate,
13230 * different NIDs for mute/unmute switch and volume control */
13231 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
13232 hda_nid_t pin, const char *pfx)
13234 hda_nid_t nid_v, nid_s;
13241 if (alc880_is_fixed_pin(pin)) {
13242 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13243 /* specify the DAC as the extra output */
13244 if (!spec->multiout.hp_nid)
13245 spec->multiout.hp_nid = nid_v;
13247 spec->multiout.extra_out_nid[0] = nid_v;
13248 /* control HP volume/switch on the output mixer amp */
13249 nid_v = alc861vd_idx_to_mixer_vol(
13250 alc880_fixed_pin_idx(pin));
13251 nid_s = alc861vd_idx_to_mixer_switch(
13252 alc880_fixed_pin_idx(pin));
13254 sprintf(name, "%s Playback Volume", pfx);
13255 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13256 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
13259 sprintf(name, "%s Playback Switch", pfx);
13260 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13261 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
13264 } else if (alc880_is_multi_pin(pin)) {
13265 /* set manual connection */
13266 /* we have only a switch on HP-out PIN */
13267 sprintf(name, "%s Playback Switch", pfx);
13268 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13269 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13276 /* parse the BIOS configuration and set up the alc_spec
13277 * return 1 if successful, 0 if the proper config is not found,
13278 * or a negative error code
13279 * Based on ALC880 version - had to change it to override
13280 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13281 static int alc861vd_parse_auto_config(struct hda_codec *codec)
13283 struct alc_spec *spec = codec->spec;
13285 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
13287 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13291 if (!spec->autocfg.line_outs)
13292 return 0; /* can't find valid BIOS pin config */
13294 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13297 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
13300 err = alc861vd_auto_create_extra_out(spec,
13301 spec->autocfg.speaker_pins[0],
13305 err = alc861vd_auto_create_extra_out(spec,
13306 spec->autocfg.hp_pins[0],
13310 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
13314 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13316 if (spec->autocfg.dig_out_pin)
13317 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13319 if (spec->kctl_alloc)
13320 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13322 spec->init_verbs[spec->num_init_verbs++]
13323 = alc861vd_volume_init_verbs;
13325 spec->num_mux_defs = 1;
13326 spec->input_mux = &spec->private_imux;
13328 err = alc_auto_add_mic_boost(codec);
13335 /* additional initialization for auto-configuration model */
13336 static void alc861vd_auto_init(struct hda_codec *codec)
13338 struct alc_spec *spec = codec->spec;
13339 alc861vd_auto_init_multi_out(codec);
13340 alc861vd_auto_init_hp_out(codec);
13341 alc861vd_auto_init_analog_input(codec);
13342 if (spec->unsol_event)
13343 alc_sku_automute(codec);
13346 static int patch_alc861vd(struct hda_codec *codec)
13348 struct alc_spec *spec;
13349 int err, board_config;
13351 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13355 codec->spec = spec;
13357 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13361 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13362 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13363 "ALC861VD, trying auto-probe from BIOS...\n");
13364 board_config = ALC861VD_AUTO;
13367 if (board_config == ALC861VD_AUTO) {
13368 /* automatic parse from the BIOS config */
13369 err = alc861vd_parse_auto_config(codec);
13375 "hda_codec: Cannot set up configuration "
13376 "from BIOS. Using base mode...\n");
13377 board_config = ALC861VD_3ST;
13381 if (board_config != ALC861VD_AUTO)
13382 setup_preset(spec, &alc861vd_presets[board_config]);
13384 if (codec->vendor_id == 0x10ec0660) {
13385 spec->stream_name_analog = "ALC660-VD Analog";
13386 spec->stream_name_digital = "ALC660-VD Digital";
13387 /* always turn on EAPD */
13388 spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs;
13390 spec->stream_name_analog = "ALC861VD Analog";
13391 spec->stream_name_digital = "ALC861VD Digital";
13394 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13395 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13397 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13398 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13400 spec->adc_nids = alc861vd_adc_nids;
13401 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13402 spec->capsrc_nids = alc861vd_capsrc_nids;
13404 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13405 spec->num_mixers++;
13407 spec->vmaster_nid = 0x02;
13409 codec->patch_ops = alc_patch_ops;
13411 if (board_config == ALC861VD_AUTO)
13412 spec->init_hook = alc861vd_auto_init;
13413 #ifdef CONFIG_SND_HDA_POWER_SAVE
13414 if (!spec->loopback.amplist)
13415 spec->loopback.amplist = alc861vd_loopbacks;
13424 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13425 * configuration. Each pin widget can choose any input DACs and a mixer.
13426 * Each ADC is connected from a mixer of all inputs. This makes possible
13427 * 6-channel independent captures.
13429 * In addition, an independent DAC for the multi-playback (not used in this
13432 #define ALC662_DIGOUT_NID 0x06
13433 #define ALC662_DIGIN_NID 0x0a
13435 static hda_nid_t alc662_dac_nids[4] = {
13436 /* front, rear, clfe, rear_surr */
13440 static hda_nid_t alc662_adc_nids[1] = {
13445 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13448 /* FIXME: should be a matrix-type input source selection */
13449 static struct hda_input_mux alc662_capture_source = {
13453 { "Front Mic", 0x1 },
13459 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13467 static struct hda_input_mux alc662_eeepc_capture_source = {
13475 static struct hda_input_mux alc663_capture_source = {
13479 { "Front Mic", 0x1 },
13484 static struct hda_input_mux alc663_m51va_capture_source = {
13487 { "Ext-Mic", 0x0 },
13492 #define alc662_mux_enum_info alc_mux_enum_info
13493 #define alc662_mux_enum_get alc_mux_enum_get
13494 #define alc662_mux_enum_put alc882_mux_enum_put
13499 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13506 static struct hda_verb alc662_3ST_ch2_init[] = {
13507 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13508 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13509 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13510 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13517 static struct hda_verb alc662_3ST_ch6_init[] = {
13518 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13519 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13520 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13521 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13522 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13523 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13527 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13528 { 2, alc662_3ST_ch2_init },
13529 { 6, alc662_3ST_ch6_init },
13535 static struct hda_verb alc662_sixstack_ch6_init[] = {
13536 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13537 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13538 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13545 static struct hda_verb alc662_sixstack_ch8_init[] = {
13546 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13547 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13548 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13552 static struct hda_channel_mode alc662_5stack_modes[2] = {
13553 { 2, alc662_sixstack_ch6_init },
13554 { 6, alc662_sixstack_ch8_init },
13557 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13558 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13561 static struct snd_kcontrol_new alc662_base_mixer[] = {
13562 /* output mixer control */
13563 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13564 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13565 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13566 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13567 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13568 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13569 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13570 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13571 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13573 /*Input mixer control */
13574 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13575 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13576 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13577 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13578 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13579 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13580 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13581 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13585 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13586 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13587 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13589 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13590 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13591 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13592 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13595 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13596 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13597 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13598 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13602 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13603 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13604 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13605 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13606 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13607 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13608 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13609 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13610 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13611 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13612 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13613 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13614 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13615 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13618 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13619 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13620 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13621 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13625 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13626 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13627 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13628 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13629 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13630 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13631 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13632 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13633 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13634 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13638 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13639 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13641 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13642 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13644 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13645 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13646 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13648 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13649 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13650 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13654 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13655 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13656 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13658 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13659 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13660 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13661 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13662 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13663 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13664 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13666 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13672 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
13673 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13674 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13675 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13676 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13677 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13678 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT),
13682 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
13683 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13684 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13685 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13686 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13691 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13692 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13696 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
13697 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13698 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13699 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13702 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13703 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13704 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13710 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13712 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13713 .name = "Channel Mode",
13714 .info = alc_ch_mode_info,
13715 .get = alc_ch_mode_get,
13716 .put = alc_ch_mode_put,
13721 static struct hda_verb alc662_init_verbs[] = {
13722 /* ADC: mute amp left and right */
13723 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13724 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13725 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13734 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13738 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13740 /* Front Pin: output 0 (0x0c) */
13741 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13742 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13744 /* Rear Pin: output 1 (0x0d) */
13745 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13746 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13748 /* CLFE Pin: output 2 (0x0e) */
13749 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13750 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13752 /* Mic (rear) pin: input vref at 80% */
13753 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13754 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13755 /* Front Mic pin: input vref at 80% */
13756 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13757 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13758 /* Line In pin: input */
13759 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13760 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13761 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13762 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13763 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13764 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13765 /* CD pin widget for input */
13766 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13768 /* FIXME: use matrix-type input source selection */
13769 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13777 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13778 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13779 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13781 /* always trun on EAPD */
13782 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13783 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13788 static struct hda_verb alc662_sue_init_verbs[] = {
13789 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13790 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13794 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13795 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13796 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13800 /* Set Unsolicited Event*/
13801 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13802 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13803 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13808 * generic initialization of ADC, input mixers and output mixers
13810 static struct hda_verb alc662_auto_init_verbs[] = {
13812 * Unmute ADC and set the default input to mic-in
13814 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13815 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13817 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13819 * Note: PASD motherboards uses the Line In 2 as the input for front
13820 * panel mic (mic 2)
13822 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13823 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13824 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13825 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13826 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13830 * Set up output mixers (0x0c - 0x0f)
13832 /* set vol=0 to output mixers */
13833 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13834 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13835 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13837 /* set up input amps for analog loopback */
13838 /* Amp Indices: DAC = 0, mixer = 1 */
13839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13847 /* FIXME: use matrix-type input source selection */
13848 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13850 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13851 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13855 static struct hda_verb alc663_m51va_init_verbs[] = {
13856 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13857 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13858 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
13862 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13863 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13867 static struct hda_verb alc663_g71v_init_verbs[] = {
13868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13869 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
13870 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
13872 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13873 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13874 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13876 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13877 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
13878 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13882 static struct hda_verb alc663_g50v_init_verbs[] = {
13883 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13884 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13885 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13887 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13888 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13892 /* capture mixer elements */
13893 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13894 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13895 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13897 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13898 /* The multiple "Capture Source" controls confuse alsamixer
13899 * So call somewhat different..
13901 /* .name = "Capture Source", */
13902 .name = "Input Source",
13904 .info = alc662_mux_enum_info,
13905 .get = alc662_mux_enum_get,
13906 .put = alc662_mux_enum_put,
13911 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13913 unsigned int present;
13914 unsigned char bits;
13916 present = snd_hda_codec_read(codec, 0x14, 0,
13917 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13918 bits = present ? HDA_AMP_MUTE : 0;
13919 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13920 HDA_AMP_MUTE, bits);
13923 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13925 unsigned int present;
13926 unsigned char bits;
13928 present = snd_hda_codec_read(codec, 0x1b, 0,
13929 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13930 bits = present ? HDA_AMP_MUTE : 0;
13931 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13932 HDA_AMP_MUTE, bits);
13933 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13934 HDA_AMP_MUTE, bits);
13937 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13940 if ((res >> 26) == ALC880_HP_EVENT)
13941 alc662_lenovo_101e_all_automute(codec);
13942 if ((res >> 26) == ALC880_FRONT_EVENT)
13943 alc662_lenovo_101e_ispeaker_automute(codec);
13946 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13948 unsigned int present;
13950 present = snd_hda_codec_read(codec, 0x18, 0,
13951 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13952 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13953 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13954 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13955 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13956 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13957 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13958 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13959 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13962 /* unsolicited event for HP jack sensing */
13963 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13966 if ((res >> 26) == ALC880_HP_EVENT)
13967 alc262_hippo1_automute( codec );
13969 if ((res >> 26) == ALC880_MIC_EVENT)
13970 alc662_eeepc_mic_automute(codec);
13973 static void alc662_eeepc_inithook(struct hda_codec *codec)
13975 alc262_hippo1_automute( codec );
13976 alc662_eeepc_mic_automute(codec);
13979 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13982 unsigned int present;
13984 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13985 present = snd_hda_codec_read(codec, 0x14, 0,
13986 AC_VERB_GET_PIN_SENSE, 0);
13987 present = (present & 0x80000000) != 0;
13989 /* mute internal speaker */
13990 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13991 HDA_AMP_MUTE, HDA_AMP_MUTE);
13993 /* unmute internal speaker if necessary */
13994 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13995 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13996 HDA_AMP_MUTE, mute);
14000 /* unsolicited event for HP jack sensing */
14001 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
14004 if ((res >> 26) == ALC880_HP_EVENT)
14005 alc662_eeepc_ep20_automute(codec);
14008 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
14010 alc662_eeepc_ep20_automute(codec);
14013 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
14015 unsigned int present;
14016 unsigned char bits;
14018 present = snd_hda_codec_read(codec, 0x21, 0,
14019 AC_VERB_GET_PIN_SENSE, 0)
14020 & AC_PINSENSE_PRESENCE;
14021 bits = present ? HDA_AMP_MUTE : 0;
14022 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14023 HDA_AMP_MUTE, bits);
14026 static void alc663_m51va_mic_automute(struct hda_codec *codec)
14028 unsigned int present;
14030 present = snd_hda_codec_read(codec, 0x18, 0,
14031 AC_VERB_GET_PIN_SENSE, 0)
14032 & AC_PINSENSE_PRESENCE;
14033 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14034 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14035 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14036 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
14037 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14038 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14039 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14040 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
14043 static void alc663_m51va_unsol_event(struct hda_codec *codec,
14046 switch (res >> 26) {
14047 case ALC880_HP_EVENT:
14048 alc663_m51va_speaker_automute(codec);
14050 case ALC880_MIC_EVENT:
14051 alc663_m51va_mic_automute(codec);
14056 static void alc663_m51va_inithook(struct hda_codec *codec)
14058 alc663_m51va_speaker_automute(codec);
14059 alc663_m51va_mic_automute(codec);
14062 static void alc663_g71v_hp_automute(struct hda_codec *codec)
14064 unsigned int present;
14065 unsigned char bits;
14067 present = snd_hda_codec_read(codec, 0x21, 0,
14068 AC_VERB_GET_PIN_SENSE, 0)
14069 & AC_PINSENSE_PRESENCE;
14070 bits = present ? HDA_AMP_MUTE : 0;
14071 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14072 HDA_AMP_MUTE, bits);
14073 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14074 HDA_AMP_MUTE, bits);
14077 static void alc663_g71v_front_automute(struct hda_codec *codec)
14079 unsigned int present;
14080 unsigned char bits;
14082 present = snd_hda_codec_read(codec, 0x15, 0,
14083 AC_VERB_GET_PIN_SENSE, 0)
14084 & AC_PINSENSE_PRESENCE;
14085 bits = present ? HDA_AMP_MUTE : 0;
14086 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14087 HDA_AMP_MUTE, bits);
14090 static void alc663_g71v_unsol_event(struct hda_codec *codec,
14093 switch (res >> 26) {
14094 case ALC880_HP_EVENT:
14095 alc663_g71v_hp_automute(codec);
14097 case ALC880_FRONT_EVENT:
14098 alc663_g71v_front_automute(codec);
14100 case ALC880_MIC_EVENT:
14101 alc662_eeepc_mic_automute(codec);
14106 static void alc663_g71v_inithook(struct hda_codec *codec)
14108 alc663_g71v_front_automute(codec);
14109 alc663_g71v_hp_automute(codec);
14110 alc662_eeepc_mic_automute(codec);
14113 static void alc663_g50v_unsol_event(struct hda_codec *codec,
14116 switch (res >> 26) {
14117 case ALC880_HP_EVENT:
14118 alc663_m51va_speaker_automute(codec);
14120 case ALC880_MIC_EVENT:
14121 alc662_eeepc_mic_automute(codec);
14126 static void alc663_g50v_inithook(struct hda_codec *codec)
14128 alc663_m51va_speaker_automute(codec);
14129 alc662_eeepc_mic_automute(codec);
14132 #ifdef CONFIG_SND_HDA_POWER_SAVE
14133 #define alc662_loopbacks alc880_loopbacks
14137 /* pcm configuration: identiacal with ALC880 */
14138 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
14139 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
14140 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
14141 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
14144 * configuration and preset
14146 static const char *alc662_models[ALC662_MODEL_LAST] = {
14147 [ALC662_3ST_2ch_DIG] = "3stack-dig",
14148 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
14149 [ALC662_3ST_6ch] = "3stack-6ch",
14150 [ALC662_5ST_DIG] = "6stack-dig",
14151 [ALC662_LENOVO_101E] = "lenovo-101e",
14152 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
14153 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
14154 [ALC663_ASUS_M51VA] = "m51va",
14155 [ALC663_ASUS_G71V] = "g71v",
14156 [ALC663_ASUS_H13] = "h13",
14157 [ALC663_ASUS_G50V] = "g50v",
14158 [ALC662_AUTO] = "auto",
14161 static struct snd_pci_quirk alc662_cfg_tbl[] = {
14162 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
14163 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
14164 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
14165 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
14166 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
14167 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
14168 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
14169 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
14170 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
14171 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
14175 static struct alc_config_preset alc662_presets[] = {
14176 [ALC662_3ST_2ch_DIG] = {
14177 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
14178 .init_verbs = { alc662_init_verbs },
14179 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14180 .dac_nids = alc662_dac_nids,
14181 .dig_out_nid = ALC662_DIGOUT_NID,
14182 .dig_in_nid = ALC662_DIGIN_NID,
14183 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14184 .channel_mode = alc662_3ST_2ch_modes,
14185 .input_mux = &alc662_capture_source,
14187 [ALC662_3ST_6ch_DIG] = {
14188 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14189 alc662_capture_mixer },
14190 .init_verbs = { alc662_init_verbs },
14191 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14192 .dac_nids = alc662_dac_nids,
14193 .dig_out_nid = ALC662_DIGOUT_NID,
14194 .dig_in_nid = ALC662_DIGIN_NID,
14195 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14196 .channel_mode = alc662_3ST_6ch_modes,
14198 .input_mux = &alc662_capture_source,
14200 [ALC662_3ST_6ch] = {
14201 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14202 alc662_capture_mixer },
14203 .init_verbs = { alc662_init_verbs },
14204 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14205 .dac_nids = alc662_dac_nids,
14206 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14207 .channel_mode = alc662_3ST_6ch_modes,
14209 .input_mux = &alc662_capture_source,
14211 [ALC662_5ST_DIG] = {
14212 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
14213 alc662_capture_mixer },
14214 .init_verbs = { alc662_init_verbs },
14215 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14216 .dac_nids = alc662_dac_nids,
14217 .dig_out_nid = ALC662_DIGOUT_NID,
14218 .dig_in_nid = ALC662_DIGIN_NID,
14219 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
14220 .channel_mode = alc662_5stack_modes,
14221 .input_mux = &alc662_capture_source,
14223 [ALC662_LENOVO_101E] = {
14224 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
14225 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
14226 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14227 .dac_nids = alc662_dac_nids,
14228 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14229 .channel_mode = alc662_3ST_2ch_modes,
14230 .input_mux = &alc662_lenovo_101e_capture_source,
14231 .unsol_event = alc662_lenovo_101e_unsol_event,
14232 .init_hook = alc662_lenovo_101e_all_automute,
14234 [ALC662_ASUS_EEEPC_P701] = {
14235 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
14236 .init_verbs = { alc662_init_verbs,
14237 alc662_eeepc_sue_init_verbs },
14238 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14239 .dac_nids = alc662_dac_nids,
14240 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14241 .channel_mode = alc662_3ST_2ch_modes,
14242 .input_mux = &alc662_eeepc_capture_source,
14243 .unsol_event = alc662_eeepc_unsol_event,
14244 .init_hook = alc662_eeepc_inithook,
14246 [ALC662_ASUS_EEEPC_EP20] = {
14247 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
14248 alc662_chmode_mixer },
14249 .init_verbs = { alc662_init_verbs,
14250 alc662_eeepc_ep20_sue_init_verbs },
14251 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14252 .dac_nids = alc662_dac_nids,
14253 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14254 .channel_mode = alc662_3ST_6ch_modes,
14255 .input_mux = &alc662_lenovo_101e_capture_source,
14256 .unsol_event = alc662_eeepc_ep20_unsol_event,
14257 .init_hook = alc662_eeepc_ep20_inithook,
14259 [ALC663_ASUS_M51VA] = {
14260 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14261 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14262 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14263 .dac_nids = alc662_dac_nids,
14264 .dig_out_nid = ALC662_DIGOUT_NID,
14265 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14266 .channel_mode = alc662_3ST_2ch_modes,
14267 .input_mux = &alc663_m51va_capture_source,
14268 .unsol_event = alc663_m51va_unsol_event,
14269 .init_hook = alc663_m51va_inithook,
14271 [ALC663_ASUS_G71V] = {
14272 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
14273 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
14274 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14275 .dac_nids = alc662_dac_nids,
14276 .dig_out_nid = ALC662_DIGOUT_NID,
14277 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14278 .channel_mode = alc662_3ST_2ch_modes,
14279 .input_mux = &alc662_eeepc_capture_source,
14280 .unsol_event = alc663_g71v_unsol_event,
14281 .init_hook = alc663_g71v_inithook,
14283 [ALC663_ASUS_H13] = {
14284 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14285 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14286 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14287 .dac_nids = alc662_dac_nids,
14288 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14289 .channel_mode = alc662_3ST_2ch_modes,
14290 .input_mux = &alc663_m51va_capture_source,
14291 .unsol_event = alc663_m51va_unsol_event,
14292 .init_hook = alc663_m51va_inithook,
14294 [ALC663_ASUS_G50V] = {
14295 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
14296 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
14297 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14298 .dac_nids = alc662_dac_nids,
14299 .dig_out_nid = ALC662_DIGOUT_NID,
14300 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14301 .channel_mode = alc662_3ST_6ch_modes,
14302 .input_mux = &alc663_capture_source,
14303 .unsol_event = alc663_g50v_unsol_event,
14304 .init_hook = alc663_g50v_inithook,
14310 * BIOS auto configuration
14313 /* add playback controls from the parsed DAC table */
14314 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14315 const struct auto_pin_cfg *cfg)
14318 static const char *chname[4] = {
14319 "Front", "Surround", NULL /*CLFE*/, "Side"
14324 for (i = 0; i < cfg->line_outs; i++) {
14325 if (!spec->multiout.dac_nids[i])
14327 nid = alc880_idx_to_dac(i);
14330 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14331 "Center Playback Volume",
14332 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14336 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14337 "LFE Playback Volume",
14338 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14342 err = add_control(spec, ALC_CTL_BIND_MUTE,
14343 "Center Playback Switch",
14344 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
14348 err = add_control(spec, ALC_CTL_BIND_MUTE,
14349 "LFE Playback Switch",
14350 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
14355 sprintf(name, "%s Playback Volume", chname[i]);
14356 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14357 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14361 sprintf(name, "%s Playback Switch", chname[i]);
14362 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14363 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
14372 /* add playback controls for speaker and HP outputs */
14373 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
14383 if (alc880_is_fixed_pin(pin)) {
14384 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14385 /* printk("DAC nid=%x\n",nid); */
14386 /* specify the DAC as the extra output */
14387 if (!spec->multiout.hp_nid)
14388 spec->multiout.hp_nid = nid;
14390 spec->multiout.extra_out_nid[0] = nid;
14391 /* control HP volume/switch on the output mixer amp */
14392 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14393 sprintf(name, "%s Playback Volume", pfx);
14394 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14395 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14398 sprintf(name, "%s Playback Switch", pfx);
14399 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14400 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
14403 } else if (alc880_is_multi_pin(pin)) {
14404 /* set manual connection */
14405 /* we have only a switch on HP-out PIN */
14406 sprintf(name, "%s Playback Switch", pfx);
14407 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14408 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14415 /* create playback/capture controls for input pins */
14416 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
14417 const struct auto_pin_cfg *cfg)
14419 struct hda_input_mux *imux = &spec->private_imux;
14422 for (i = 0; i < AUTO_PIN_LAST; i++) {
14423 if (alc880_is_input_pin(cfg->input_pins[i])) {
14424 idx = alc880_input_pin_idx(cfg->input_pins[i]);
14425 err = new_analog_input(spec, cfg->input_pins[i],
14426 auto_pin_cfg_labels[i],
14430 imux->items[imux->num_items].label =
14431 auto_pin_cfg_labels[i];
14432 imux->items[imux->num_items].index =
14433 alc880_input_pin_idx(cfg->input_pins[i]);
14440 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
14441 hda_nid_t nid, int pin_type,
14444 alc_set_pin_output(codec, nid, pin_type);
14445 /* need the manual connection? */
14446 if (alc880_is_multi_pin(nid)) {
14447 struct alc_spec *spec = codec->spec;
14448 int idx = alc880_multi_pin_idx(nid);
14449 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
14450 AC_VERB_SET_CONNECT_SEL,
14451 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
14455 static void alc662_auto_init_multi_out(struct hda_codec *codec)
14457 struct alc_spec *spec = codec->spec;
14460 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14461 for (i = 0; i <= HDA_SIDE; i++) {
14462 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14463 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14465 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
14470 static void alc662_auto_init_hp_out(struct hda_codec *codec)
14472 struct alc_spec *spec = codec->spec;
14475 pin = spec->autocfg.hp_pins[0];
14476 if (pin) /* connect to front */
14478 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14479 pin = spec->autocfg.speaker_pins[0];
14481 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14484 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14485 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14487 static void alc662_auto_init_analog_input(struct hda_codec *codec)
14489 struct alc_spec *spec = codec->spec;
14492 for (i = 0; i < AUTO_PIN_LAST; i++) {
14493 hda_nid_t nid = spec->autocfg.input_pins[i];
14494 if (alc662_is_input_pin(nid)) {
14495 snd_hda_codec_write(codec, nid, 0,
14496 AC_VERB_SET_PIN_WIDGET_CONTROL,
14497 (i <= AUTO_PIN_FRONT_MIC ?
14498 PIN_VREF80 : PIN_IN));
14499 if (nid != ALC662_PIN_CD_NID)
14500 snd_hda_codec_write(codec, nid, 0,
14501 AC_VERB_SET_AMP_GAIN_MUTE,
14507 static int alc662_parse_auto_config(struct hda_codec *codec)
14509 struct alc_spec *spec = codec->spec;
14511 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
14513 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14517 if (!spec->autocfg.line_outs)
14518 return 0; /* can't find valid BIOS pin config */
14520 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14523 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
14526 err = alc662_auto_create_extra_out(spec,
14527 spec->autocfg.speaker_pins[0],
14531 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
14535 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
14539 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14541 if (spec->autocfg.dig_out_pin)
14542 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
14544 if (spec->kctl_alloc)
14545 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14547 spec->num_mux_defs = 1;
14548 spec->input_mux = &spec->private_imux;
14550 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14551 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
14552 spec->num_mixers++;
14556 /* additional initialization for auto-configuration model */
14557 static void alc662_auto_init(struct hda_codec *codec)
14559 struct alc_spec *spec = codec->spec;
14560 alc662_auto_init_multi_out(codec);
14561 alc662_auto_init_hp_out(codec);
14562 alc662_auto_init_analog_input(codec);
14563 if (spec->unsol_event)
14564 alc_sku_automute(codec);
14567 static int patch_alc662(struct hda_codec *codec)
14569 struct alc_spec *spec;
14570 int err, board_config;
14572 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14576 codec->spec = spec;
14578 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14580 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
14583 if (board_config < 0) {
14584 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
14585 "trying auto-probe from BIOS...\n");
14586 board_config = ALC662_AUTO;
14589 if (board_config == ALC662_AUTO) {
14590 /* automatic parse from the BIOS config */
14591 err = alc662_parse_auto_config(codec);
14597 "hda_codec: Cannot set up configuration "
14598 "from BIOS. Using base mode...\n");
14599 board_config = ALC662_3ST_2ch_DIG;
14603 if (board_config != ALC662_AUTO)
14604 setup_preset(spec, &alc662_presets[board_config]);
14606 if (codec->vendor_id == 0x10ec0663) {
14607 spec->stream_name_analog = "ALC663 Analog";
14608 spec->stream_name_digital = "ALC663 Digital";
14610 spec->stream_name_analog = "ALC662 Analog";
14611 spec->stream_name_digital = "ALC662 Digital";
14614 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14615 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14617 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14618 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14620 spec->adc_nids = alc662_adc_nids;
14621 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14622 spec->capsrc_nids = alc662_capsrc_nids;
14624 spec->vmaster_nid = 0x02;
14626 codec->patch_ops = alc_patch_ops;
14627 if (board_config == ALC662_AUTO)
14628 spec->init_hook = alc662_auto_init;
14629 #ifdef CONFIG_SND_HDA_POWER_SAVE
14630 if (!spec->loopback.amplist)
14631 spec->loopback.amplist = alc662_loopbacks;
14640 struct hda_codec_preset snd_hda_preset_realtek[] = {
14641 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14642 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14643 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14644 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14645 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14646 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14647 .patch = patch_alc861 },
14648 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14649 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14650 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14651 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14652 .patch = patch_alc883 },
14653 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14654 .patch = patch_alc662 },
14655 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
14656 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14657 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14658 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14659 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14660 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14661 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14662 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14663 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14664 {} /* terminator */